├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.json ├── .githooks └── post-commit ├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .nvmrc ├── .travis.yml ├── .vscode └── launch.json ├── CONTRIBUTING.md ├── LICENSE ├── Makefile ├── README.md ├── code_of_conduct.md ├── dist ├── BasicParams.d.ts ├── BasicParams.js ├── BasicParams.js.map ├── Bid.d.ts ├── Bid.js ├── Bid.js.map ├── Bid.test.d.ts ├── Bid.test.js ├── Bid.test.js.map ├── BidParams.d.ts ├── BidParams.js ├── BidParams.js.map ├── CommitmentConfirmation.d.ts ├── CommitmentConfirmation.js ├── CommitmentConfirmation.js.map ├── CommitmentConfirmationParams.d.ts ├── CommitmentConfirmationParams.js ├── CommitmentConfirmationParams.js.map ├── CommitmentRequest.d.ts ├── CommitmentRequest.js ├── CommitmentRequest.js.map ├── CommitmentRequestParams.d.ts ├── CommitmentRequestParams.js ├── CommitmentRequestParams.js.map ├── Config.d.ts ├── Config.js ├── Config.js.map ├── Config.test.d.ts ├── Config.test.js ├── Config.test.js.map ├── Contracts.d.ts ├── Contracts.js ├── Contracts.js.map ├── Contracts.test.d.ts ├── Contracts.test.js ├── Contracts.test.js.map ├── ContractsIntegrationSimulator.d.ts ├── ContractsIntegrationSimulator.js ├── ContractsIntegrationSimulator.js.map ├── IBasicParams.d.ts ├── IBasicParams.js ├── IBasicParams.js.map ├── IBidParams.d.ts ├── IBidParams.js ├── IBidParams.js.map ├── IConfig.d.ts ├── IConfig.js ├── IConfig.js.map ├── IMissionParams.d.ts ├── IMissionParams.js ├── IMissionParams.js.map ├── IPrice.d.ts ├── IPrice.js ├── IPrice.js.map ├── Identity.d.ts ├── Identity.js ├── Identity.js.map ├── Identity.test.d.ts ├── Identity.test.js ├── Identity.test.js.map ├── Kafka.d.ts ├── Kafka.js ├── Kafka.js.map ├── Kafka.test.d.ts ├── Kafka.test.js ├── Kafka.test.js.map ├── KafkaApi.d.ts ├── KafkaApi.js ├── KafkaApi.js.map ├── KafkaBase.d.ts ├── KafkaBase.js ├── KafkaBase.js.map ├── KafkaMessageFactory.d.ts ├── KafkaMessageFactory.js ├── KafkaMessageFactory.js.map ├── KafkaMessageStream.d.ts ├── KafkaMessageStream.js ├── KafkaMessageStream.js.map ├── KafkaMessageStream.test.d.ts ├── KafkaMessageStream.test.js ├── KafkaMessageStream.test.js.map ├── KafkaNode.d.ts ├── KafkaNode.js ├── KafkaNode.js.map ├── Message.d.ts ├── Message.js ├── Message.js.map ├── Message.test.d.ts ├── Message.test.js ├── Message.test.js.map ├── MessageParams.d.ts ├── MessageParams.js ├── MessageParams.js.map ├── Mission.d.ts ├── Mission.js ├── Mission.js.map ├── Mission.test.d.ts ├── Mission.test.js ├── Mission.test.js.map ├── MissionParams.d.ts ├── MissionParams.js ├── MissionParams.js.map ├── MissionPeerIdMessageParams.d.ts ├── MissionPeerIdMessageParams.js ├── MissionPeerIdMessageParams.js.map ├── Need.d.ts ├── Need.js ├── Need.js.map ├── Need.test.d.ts ├── Need.test.js ├── Need.test.js.map ├── NeedFilterParams.d.ts ├── NeedFilterParams.js ├── NeedFilterParams.js.map ├── NeedParams.d.ts ├── NeedParams.js ├── NeedParams.js.map ├── Price.d.ts ├── Price.js ├── Price.js.map ├── SDK.d.ts ├── SDK.js ├── SDK.js.map ├── SDK.test.d.ts ├── SDK.test.js ├── SDK.test.js.map ├── SDKFactory.d.ts ├── SDKFactory.js ├── SDKFactory.js.map ├── SDKFactory.test.d.ts ├── SDKFactory.test.js ├── SDKFactory.test.js.map ├── common-enums.d.ts ├── common-enums.js ├── common-enums.js.map ├── common-types.d.ts ├── common-types.js ├── common-types.js.map ├── contracts │ ├── BasicMission.json │ ├── DAVToken.json │ └── Identity.json ├── drone-charging │ ├── BidParams.d.ts │ ├── BidParams.js │ ├── BidParams.js.map │ ├── BidParams.test.d.ts │ ├── BidParams.test.js │ ├── BidParams.test.js.map │ ├── MessageParams.d.ts │ ├── MessageParams.js │ ├── MessageParams.js.map │ ├── MissionParams.d.ts │ ├── MissionParams.js │ ├── MissionParams.js.map │ ├── MissionParams.test.d.ts │ ├── MissionParams.test.js │ ├── MissionParams.test.js.map │ ├── NeedFilterParams.d.ts │ ├── NeedFilterParams.js │ ├── NeedFilterParams.js.map │ ├── NeedFilterParams.test.d.ts │ ├── NeedFilterParams.test.js │ ├── NeedFilterParams.test.js.map │ ├── NeedParams.d.ts │ ├── NeedParams.js │ ├── NeedParams.js.map │ ├── NeedParams.test.d.ts │ ├── NeedParams.test.js │ ├── NeedParams.test.js.map │ ├── ProtocolTypes.d.ts │ ├── ProtocolTypes.js │ ├── ProtocolTypes.js.map │ ├── enums.d.ts │ ├── enums.js │ ├── enums.js.map │ ├── index.d.ts │ ├── index.js │ ├── index.js.map │ └── messages │ │ ├── ChargingArrivalMessageParams.d.ts │ │ ├── ChargingArrivalMessageParams.js │ │ ├── ChargingArrivalMessageParams.js.map │ │ ├── ChargingArrivalMessageParams.test.d.ts │ │ ├── ChargingArrivalMessageParams.test.js │ │ ├── ChargingArrivalMessageParams.test.js.map │ │ ├── ChargingCompleteMessageParams.d.ts │ │ ├── ChargingCompleteMessageParams.js │ │ ├── ChargingCompleteMessageParams.js.map │ │ ├── ChargingCompleteMessageParams.test.d.ts │ │ ├── ChargingCompleteMessageParams.test.js │ │ ├── ChargingCompleteMessageParams.test.js.map │ │ ├── ChargingStartedMessageParams.d.ts │ │ ├── ChargingStartedMessageParams.js │ │ ├── ChargingStartedMessageParams.js.map │ │ ├── DeclineMessageParams.d.ts │ │ ├── DeclineMessageParams.js │ │ ├── DeclineMessageParams.js.map │ │ ├── DeclineMessageParams.test.d.ts │ │ ├── DeclineMessageParams.test.js │ │ ├── DeclineMessageParams.test.js.map │ │ ├── DroneStatusMessageParams.d.ts │ │ ├── DroneStatusMessageParams.js │ │ ├── DroneStatusMessageParams.js.map │ │ ├── DroneStatusMessageParams.test.d.ts │ │ ├── DroneStatusMessageParams.test.js │ │ ├── DroneStatusMessageParams.test.js.map │ │ ├── ProviderStatusMessageParams.d.ts │ │ ├── ProviderStatusMessageParams.js │ │ ├── ProviderStatusMessageParams.js.map │ │ ├── StartingMessageParams.d.ts │ │ ├── StartingMessageParams.js │ │ ├── StartingMessageParams.js.map │ │ ├── StartingMessageParams.test.d.ts │ │ ├── StartingMessageParams.test.js │ │ ├── StartingMessageParams.test.js.map │ │ ├── StatusRequestMessageParams.d.ts │ │ ├── StatusRequestMessageParams.js │ │ ├── StatusRequestMessageParams.js.map │ │ ├── StatusRequestMessageParams.test.d.ts │ │ ├── StatusRequestMessageParams.test.js │ │ └── StatusRequestMessageParams.test.js.map ├── drone-delivery │ ├── BidParams.d.ts │ ├── BidParams.js │ ├── BidParams.js.map │ ├── BidParams.test.d.ts │ ├── BidParams.test.js │ ├── BidParams.test.js.map │ ├── MessageParams.d.ts │ ├── MessageParams.js │ ├── MessageParams.js.map │ ├── MessageParams.test.d.ts │ ├── MessageParams.test.js │ ├── MessageParams.test.js.map │ ├── MissionParams.d.ts │ ├── MissionParams.js │ ├── MissionParams.js.map │ ├── MissionParams.test.d.ts │ ├── MissionParams.test.js │ ├── MissionParams.test.js.map │ ├── NeedFilterParams.d.ts │ ├── NeedFilterParams.js │ ├── NeedFilterParams.js.map │ ├── NeedFilterParams.test.d.ts │ ├── NeedFilterParams.test.js │ ├── NeedFilterParams.test.js.map │ ├── NeedParams.d.ts │ ├── NeedParams.js │ ├── NeedParams.js.map │ ├── NeedParams.test.d.ts │ ├── NeedParams.test.js │ ├── NeedParams.test.js.map │ ├── ProtocolTypes.d.ts │ ├── ProtocolTypes.js │ ├── ProtocolTypes.js.map │ ├── VehicleTypes.d.ts │ ├── VehicleTypes.js │ └── VehicleTypes.js.map ├── index.d.ts ├── index.js ├── index.js.map ├── mocks │ ├── AxiosMock.d.ts │ ├── AxiosMock.js │ ├── AxiosMock.js.map │ ├── Web3Mock.d.ts │ ├── Web3Mock.js │ └── Web3Mock.js.map ├── retryPromise.d.ts ├── retryPromise.js ├── retryPromise.js.map ├── ride-hailing │ ├── BidParams.d.ts │ ├── BidParams.js │ ├── BidParams.js.map │ ├── BidParams.test.d.ts │ ├── BidParams.test.js │ ├── BidParams.test.js.map │ ├── MessageParams.d.ts │ ├── MessageParams.js │ ├── MessageParams.js.map │ ├── MessageParams.test.d.ts │ ├── MessageParams.test.js │ ├── MessageParams.test.js.map │ ├── MissionParams.d.ts │ ├── MissionParams.js │ ├── MissionParams.js.map │ ├── MissionParams.test.d.ts │ ├── MissionParams.test.js │ ├── MissionParams.test.js.map │ ├── NeedFilterParams.d.ts │ ├── NeedFilterParams.js │ ├── NeedFilterParams.js.map │ ├── NeedFilterParams.test.d.ts │ ├── NeedFilterParams.test.js │ ├── NeedFilterParams.test.js.map │ ├── NeedParams.d.ts │ ├── NeedParams.js │ ├── NeedParams.js.map │ ├── NeedParams.test.d.ts │ ├── NeedParams.test.js │ ├── NeedParams.test.js.map │ ├── ProtocolTypes.d.ts │ ├── ProtocolTypes.js │ ├── ProtocolTypes.js.map │ ├── VehicleLocationMessageParams.d.ts │ ├── VehicleLocationMessageParams.js │ ├── VehicleLocationMessageParams.js.map │ ├── VehicleLocationMessageParams.test.d.ts │ ├── VehicleLocationMessageParams.test.js │ ├── VehicleLocationMessageParams.test.js.map │ ├── index.d.ts │ ├── index.js │ └── index.js.map ├── sdkLogger.d.ts ├── sdkLogger.js ├── sdkLogger.js.map ├── tests │ ├── Bid.test.d.ts │ ├── Bid.test.js │ ├── Bid.test.js.map │ ├── Config.test.d.ts │ ├── Config.test.js │ ├── Config.test.js.map │ ├── Contracts.test.d.ts │ ├── Contracts.test.js │ ├── Contracts.test.js.map │ ├── Identity.test.d.ts │ ├── Identity.test.js │ ├── Identity.test.js.map │ ├── Kafka.test.d.ts │ ├── Kafka.test.js │ ├── Kafka.test.js.map │ ├── KafkaMessageStream.test.d.ts │ ├── KafkaMessageStream.test.js │ ├── KafkaMessageStream.test.js.map │ ├── Message.test.d.ts │ ├── Message.test.js │ ├── Message.test.js.map │ ├── Mission.test.d.ts │ ├── Mission.test.js │ ├── Mission.test.js.map │ ├── Need.test.d.ts │ ├── Need.test.js │ ├── Need.test.js.map │ ├── SDK.test.d.ts │ ├── SDK.test.js │ ├── SDK.test.js.map │ ├── SDKFactory.test.d.ts │ ├── SDKFactory.test.js │ └── SDKFactory.test.js.map └── vessel-charging │ ├── BidParams.d.ts │ ├── BidParams.js │ ├── BidParams.js.map │ ├── BidParams.test.d.ts │ ├── BidParams.test.js │ ├── BidParams.test.js.map │ ├── MessageParams.d.ts │ ├── MessageParams.js │ ├── MessageParams.js.map │ ├── MissionParams.d.ts │ ├── MissionParams.js │ ├── MissionParams.js.map │ ├── MissionParams.test.d.ts │ ├── MissionParams.test.js │ ├── MissionParams.test.js.map │ ├── NeedFilterParams.d.ts │ ├── NeedFilterParams.js │ ├── NeedFilterParams.js.map │ ├── NeedFilterParams.test.d.ts │ ├── NeedFilterParams.test.js │ ├── NeedFilterParams.test.js.map │ ├── NeedParams.d.ts │ ├── NeedParams.js │ ├── NeedParams.js.map │ ├── NeedParams.test.d.ts │ ├── NeedParams.test.js │ ├── NeedParams.test.js.map │ ├── enums.d.ts │ ├── enums.js │ ├── enums.js.map │ ├── index.d.ts │ ├── index.js │ ├── index.js.map │ └── messages │ ├── ChargingArrivalMessageParams.d.ts │ ├── ChargingArrivalMessageParams.js │ ├── ChargingArrivalMessageParams.js.map │ ├── ChargingArrivalMessageParams.test.d.ts │ ├── ChargingArrivalMessageParams.test.js │ ├── ChargingArrivalMessageParams.test.js.map │ ├── ChargingCompleteMessageParams.d.ts │ ├── ChargingCompleteMessageParams.js │ ├── ChargingCompleteMessageParams.js.map │ ├── ChargingCompleteMessageParams.test.d.ts │ ├── ChargingCompleteMessageParams.test.js │ ├── ChargingCompleteMessageParams.test.js.map │ ├── ChargingStartedMessageParams.d.ts │ ├── ChargingStartedMessageParams.js │ ├── ChargingStartedMessageParams.js.map │ ├── DeclineMessageParams.d.ts │ ├── DeclineMessageParams.js │ ├── DeclineMessageParams.js.map │ ├── DeclineMessageParams.test.d.ts │ ├── DeclineMessageParams.test.js │ ├── DeclineMessageParams.test.js.map │ ├── ProviderStatusMessageParams.d.ts │ ├── ProviderStatusMessageParams.js │ ├── ProviderStatusMessageParams.js.map │ ├── StartingMessageParams.d.ts │ ├── StartingMessageParams.js │ ├── StartingMessageParams.js.map │ ├── StartingMessageParams.test.d.ts │ ├── StartingMessageParams.test.js │ ├── StartingMessageParams.test.js.map │ ├── StatusRequestMessageParams.d.ts │ ├── StatusRequestMessageParams.js │ ├── StatusRequestMessageParams.js.map │ ├── StatusRequestMessageParams.test.d.ts │ ├── StatusRequestMessageParams.test.js │ ├── StatusRequestMessageParams.test.js.map │ ├── VesselStatusMessageParams.d.ts │ ├── VesselStatusMessageParams.js │ ├── VesselStatusMessageParams.js.map │ ├── VesselStatusMessageParams.test.d.ts │ ├── VesselStatusMessageParams.test.js │ └── VesselStatusMessageParams.test.js.map ├── gulpfile.js ├── jest.config.js ├── package.json ├── samples ├── dav-sdk-bidder.js ├── dav-sdk-needer.js ├── drone_delivery │ ├── provider_sample.js │ └── requester_sample.js ├── ride-hailing │ ├── config.ts │ ├── driver.ts │ └── passenger.ts └── vessel_charging │ ├── Consumer.ts │ ├── Provider.ts │ └── index.ts ├── speller-dictionary.js ├── src ├── BasicParams.ts ├── Bid.ts ├── BidParams.ts ├── CommitmentConfirmation.ts ├── CommitmentConfirmationParams.ts ├── CommitmentRequest.ts ├── CommitmentRequestParams.ts ├── Config.ts ├── Contracts.ts ├── ContractsIntegrationSimulator.ts ├── IBasicParams.ts ├── IBidParams.ts ├── IConfig.ts ├── IMissionParams.ts ├── IPrice.ts ├── Identity.ts ├── Kafka.ts ├── KafkaApi.ts ├── KafkaBase.ts ├── KafkaMessageFactory.ts ├── KafkaMessageStream.ts ├── KafkaNode.ts ├── Message.ts ├── MessageParams.ts ├── Mission.ts ├── MissionParams.ts ├── MissionPeerIdMessageParams.ts ├── Need.ts ├── NeedFilterParams.ts ├── NeedParams.ts ├── Price.ts ├── SDK.ts ├── SDKFactory.ts ├── common-enums.ts ├── common-types.ts ├── contracts │ ├── BasicMission.json │ ├── DAVToken.json │ └── Identity.json ├── drone-charging │ ├── BidParams.test.ts │ ├── BidParams.ts │ ├── MessageParams.ts │ ├── MissionParams.test.ts │ ├── MissionParams.ts │ ├── NeedFilterParams.test.ts │ ├── NeedFilterParams.ts │ ├── NeedParams.test.ts │ ├── NeedParams.ts │ ├── enums.ts │ ├── index.ts │ └── messages │ │ ├── ChargingArrivalMessageParams.test.ts │ │ ├── ChargingArrivalMessageParams.ts │ │ ├── ChargingCompleteMessageParams.test.ts │ │ ├── ChargingCompleteMessageParams.ts │ │ ├── ChargingStartedMessageParams.ts │ │ ├── DeclineMessageParams.test.ts │ │ ├── DeclineMessageParams.ts │ │ ├── DroneStatusMessageParams.test.ts │ │ ├── DroneStatusMessageParams.ts │ │ ├── ProviderStatusMessageParams.ts │ │ ├── StartingMessageParams.test.ts │ │ ├── StartingMessageParams.ts │ │ ├── StatusRequestMessageParams.test.ts │ │ └── StatusRequestMessageParams.ts ├── drone-delivery │ ├── BidParams.test.ts │ ├── BidParams.ts │ ├── MessageParams.test.ts │ ├── MessageParams.ts │ ├── MissionParams.test.ts │ ├── MissionParams.ts │ ├── NeedFilterParams.test.ts │ ├── NeedFilterParams.ts │ ├── NeedParams.test.ts │ ├── NeedParams.ts │ ├── ProtocolTypes.ts │ └── VehicleTypes.ts ├── gulpfile.js ├── index.ts ├── mocks │ ├── AxiosMock.ts │ └── Web3Mock.ts ├── retryPromise.ts ├── ride-hailing │ ├── BidParams.test.ts │ ├── BidParams.ts │ ├── MessageParams.test.ts │ ├── MessageParams.ts │ ├── MissionParams.test.ts │ ├── MissionParams.ts │ ├── NeedFilterParams.test.ts │ ├── NeedFilterParams.ts │ ├── NeedParams.test.ts │ ├── NeedParams.ts │ ├── ProtocolTypes.ts │ ├── VehicleLocationMessageParams.test.ts │ ├── VehicleLocationMessageParams.ts │ └── index.ts ├── sdkLogger.ts ├── tests │ ├── Bid.test.ts │ ├── Config.test.ts │ ├── Contracts.test.ts │ ├── Identity.test.ts │ ├── Kafka.test.ts │ ├── KafkaMessageStream.test.ts │ ├── Message.test.ts │ ├── Mission.test.ts │ ├── Need.test.ts │ ├── SDK.test.ts │ └── SDKFactory.test.ts ├── tests~HEAD └── vessel-charging │ ├── BidParams.test.ts │ ├── BidParams.ts │ ├── MessageParams.ts │ ├── MissionParams.test.ts │ ├── MissionParams.ts │ ├── NeedFilterParams.test.ts │ ├── NeedFilterParams.ts │ ├── NeedParams.test.ts │ ├── NeedParams.ts │ ├── enums.ts │ ├── index.ts │ └── messages │ ├── ChargingArrivalMessageParams.test.ts │ ├── ChargingArrivalMessageParams.ts │ ├── ChargingCompleteMessageParams.test.ts │ ├── ChargingCompleteMessageParams.ts │ ├── ChargingStartedMessageParams.ts │ ├── DeclineMessageParams.test.ts │ ├── DeclineMessageParams.ts │ ├── ProviderStatusMessageParams.ts │ ├── StartingMessageParams.test.ts │ ├── StartingMessageParams.ts │ ├── StatusRequestMessageParams.test.ts │ ├── StatusRequestMessageParams.ts │ ├── VesselStatusMessageParams.test.ts │ └── VesselStatusMessageParams.ts ├── truffle.js ├── tsconfig.json ├── tslint.json ├── typedoc.js └── webpack.config.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "env" 4 | ], 5 | "plugins": ["transform-regenerator"] 6 | } 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # http://editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | indent_style = space 9 | indent_size = 2 10 | end_of_line = lf 11 | charset = utf-8 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | [Makefile] 15 | indent_style = tab 16 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true, 5 | "es6": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended" 9 | ], 10 | "parserOptions": { 11 | "ecmaVersion": 8, 12 | "sourceType": "module" 13 | }, 14 | "rules": { 15 | "no-console": 0, 16 | "indent": [ 17 | "error", 18 | 2, 19 | { "SwitchCase": 1 } 20 | ], 21 | "linebreak-style": [ 22 | "error", 23 | "unix" 24 | ], 25 | "quotes": [ 26 | "error", 27 | "single", 28 | { "allowTemplateLiterals": true } 29 | ], 30 | "semi": [ 31 | "error", 32 | "always" 33 | ] 34 | }, 35 | "globals": { 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.githooks/post-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | npm run pre-publish 4 | if [ "$?" != "0" ]; then 5 | exit 1 6 | fi 7 | git add dist/. 8 | git commit -m "chore: update dist files" 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | .DS_Store 4 | .idea 5 | build 6 | docs 7 | coverage 8 | package-lock.json 9 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Test", 11 | "program": "${workspaceFolder}/node_modules/.bin/jest", 12 | "args": [ 13 | "--runInBand", 14 | "src/" 15 | ], 16 | "console": "internalConsole", 17 | "internalConsoleOptions": "neverOpen", 18 | "windows": { 19 | "program": "${workspaceFolder}/node_modules/jest/bin/jest", 20 | }, 21 | "disableOptimisticBPs": true 22 | }, 23 | { 24 | "type": "node", 25 | "request": "launch", 26 | "name": "Launch Program", 27 | "program": "${workspaceFolder}/samples/drone_delivery/provider_sample.js", 28 | "env": { 29 | "NODE_ENV": "development", 30 | "BLOCKCHAIN_TYPE": "ETH_LOCAL_TESTNET" 31 | } 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 DAV Foundation 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 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | FORCE: 2 | 3 | tslint: FORCE 4 | npm run tslint 5 | 6 | jest: FORCE 7 | npm run jest 8 | 9 | create-dist: FORCE 10 | npm run create-dist 11 | 12 | tsc: FORCE 13 | npm run tsc 14 | 15 | spellcheck: FORCE 16 | npm run spellcheck 17 | 18 | pre-push: FORCE 19 | npm run tslint 20 | npm run jest 21 | npm run spellcheck 22 | npm run tsc 23 | npm run typedoc 24 | npm run create-dist 25 | 26 | pre-publish: FORCE 27 | npm run pre-publish 28 | 29 | publish: pre-push 30 | npm publish --access public 31 | -------------------------------------------------------------------------------- /dist/BasicParams.d.ts: -------------------------------------------------------------------------------- 1 | import IBasicParams from './IBasicParams'; 2 | /** 3 | * @class The abstract Class BasicParams represent common parameters to all the SDK's Params classes. 4 | */ 5 | export default abstract class BasicParams { 6 | private _protocol; 7 | private _messageType; 8 | /** 9 | * Hop limit, in seconds, for the inherited class. 10 | */ 11 | ttl?: number; 12 | constructor(_protocol: string, _messageType: string, values?: Partial); 13 | serialize(): { 14 | ttl: number; 15 | protocol: string; 16 | type: string; 17 | }; 18 | readonly protocol: string; 19 | readonly messageType: string; 20 | deserialize(json: any): void; 21 | } 22 | -------------------------------------------------------------------------------- /dist/BasicParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * @class The abstract Class BasicParams represent common parameters to all the SDK's Params classes. 5 | */ 6 | class BasicParams { 7 | constructor(_protocol, _messageType, values) { 8 | this._protocol = _protocol; 9 | this._messageType = _messageType; 10 | if (!!values) { 11 | this.ttl = values.ttl; 12 | } 13 | } 14 | serialize() { 15 | return { 16 | ttl: this.ttl, 17 | protocol: this._protocol, 18 | type: this._messageType, 19 | }; 20 | } 21 | get protocol() { 22 | return this._protocol; 23 | } 24 | get messageType() { 25 | return this._messageType; 26 | } 27 | deserialize(json) { 28 | this.ttl = json.ttl; 29 | } 30 | } 31 | exports.default = BasicParams; 32 | 33 | //# sourceMappingURL=BasicParams.js.map 34 | -------------------------------------------------------------------------------- /dist/Bid.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/BidParams.d.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | import IPrice from './IPrice'; 3 | import { ID, DavID } from './common-types'; 4 | import IBidParams from './IBidParams'; 5 | /** 6 | * @class The abstract Class BidParams represent common parameters of BidParams classes. 7 | */ 8 | export default abstract class BidParams extends BasicParams { 9 | id: ID; 10 | price: IPrice[]; 11 | vehicleId: DavID; 12 | neederDavId: DavID; 13 | isCommitted: boolean; 14 | constructor(protocol: string, type: string, values?: Partial); 15 | serialize(): { 16 | ttl: number; 17 | protocol: string; 18 | type: string; 19 | }; 20 | deserialize(json: any): void; 21 | equals(other: BidParams): boolean; 22 | } 23 | -------------------------------------------------------------------------------- /dist/CommitmentConfirmation.d.ts: -------------------------------------------------------------------------------- 1 | import CommitmentConfirmationParams from './CommitmentConfirmationParams'; 2 | export default class CommitmentConfirmation { 3 | private _commitmentParams; 4 | readonly BidId: string; 5 | constructor(_commitmentParams: CommitmentConfirmationParams); 6 | } 7 | -------------------------------------------------------------------------------- /dist/CommitmentConfirmation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | class CommitmentConfirmation { 4 | constructor(_commitmentParams) { 5 | this._commitmentParams = _commitmentParams; 6 | } 7 | get BidId() { 8 | return this._commitmentParams.bidId; 9 | } 10 | } 11 | exports.default = CommitmentConfirmation; 12 | 13 | //# sourceMappingURL=CommitmentConfirmation.js.map 14 | -------------------------------------------------------------------------------- /dist/CommitmentConfirmation.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/CommitmentConfirmation.ts"],"names":[],"mappings":";;AAEA;IAKE,YAAoB,iBAA+C;QAA/C,sBAAiB,GAAjB,iBAAiB,CAA8B;IAAG,CAAC;IAJvE,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;IACtC,CAAC;CAGF;AAND,yCAMC","file":"CommitmentConfirmation.js","sourcesContent":["import CommitmentConfirmationParams from './CommitmentConfirmationParams';\n\nexport default class CommitmentConfirmation {\n public get BidId() {\n return this._commitmentParams.bidId;\n }\n\n constructor(private _commitmentParams: CommitmentConfirmationParams) {}\n}\n"]} -------------------------------------------------------------------------------- /dist/CommitmentConfirmationParams.d.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | import IBasicParams from './IBasicParams'; 3 | export interface ICommitmentConfirmationParams extends IBasicParams { 4 | bidId: string; 5 | } 6 | export default class CommitmentConfirmationParams extends BasicParams { 7 | static _protocol: string; 8 | static _messageType: string; 9 | bidId: string; 10 | static getMessageType(): string; 11 | static getMessageProtocol(): string; 12 | constructor(values?: Partial); 13 | serialize(): { 14 | ttl: number; 15 | protocol: string; 16 | type: string; 17 | }; 18 | getProtocolTypes(): any; 19 | deserialize(json: any): void; 20 | } 21 | -------------------------------------------------------------------------------- /dist/CommitmentRequest.d.ts: -------------------------------------------------------------------------------- 1 | import IConfig from './IConfig'; 2 | import CommitmentRequestParams from './CommitmentRequestParams'; 3 | export default class CommitmentRequest { 4 | private _bidId; 5 | private _commitmentRequestParams; 6 | private _config; 7 | constructor(_bidId: string, _commitmentRequestParams: CommitmentRequestParams, _config: IConfig); 8 | confirm(): Promise; 9 | } 10 | -------------------------------------------------------------------------------- /dist/CommitmentRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const Kafka_1 = require("./Kafka"); 4 | const CommitmentConfirmationParams_1 = require("./CommitmentConfirmationParams"); 5 | class CommitmentRequest { 6 | constructor(_bidId, _commitmentRequestParams, _config) { 7 | this._bidId = _bidId; 8 | this._commitmentRequestParams = _commitmentRequestParams; 9 | this._config = _config; 10 | /** */ 11 | } 12 | async confirm() { 13 | const commitmentConfirmationParams = new CommitmentConfirmationParams_1.default({ bidId: this._bidId }); 14 | await Kafka_1.default.sendParams(this._commitmentRequestParams.neederId, commitmentConfirmationParams, this._config); 15 | } 16 | } 17 | exports.default = CommitmentRequest; 18 | 19 | //# sourceMappingURL=CommitmentRequest.js.map 20 | -------------------------------------------------------------------------------- /dist/CommitmentRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/CommitmentRequest.ts"],"names":[],"mappings":";;AAAA,mCAA4B;AAG5B,iFAA0E;AAE1E;IACE,YACU,MAAc,EACd,wBAAiD,EACjD,OAAgB;QAFhB,WAAM,GAAN,MAAM,CAAQ;QACd,6BAAwB,GAAxB,wBAAwB,CAAyB;QACjD,YAAO,GAAP,OAAO,CAAS;QAExB,MAAM;IACR,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,MAAM,4BAA4B,GAAiC,IAAI,sCAA4B,CACjG,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CACvB,CAAC;QACF,MAAM,eAAK,CAAC,UAAU,CACpB,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EACtC,4BAA4B,EAC5B,IAAI,CAAC,OAAO,CACb,CAAC;IACJ,CAAC;CACF;AAnBD,oCAmBC","file":"CommitmentRequest.js","sourcesContent":["import Kafka from './Kafka';\nimport IConfig from './IConfig';\nimport CommitmentRequestParams from './CommitmentRequestParams';\nimport CommitmentConfirmationParams from './CommitmentConfirmationParams';\n\nexport default class CommitmentRequest {\n constructor(\n private _bidId: string,\n private _commitmentRequestParams: CommitmentRequestParams,\n private _config: IConfig,\n ) {\n /** */\n }\n\n public async confirm() {\n const commitmentConfirmationParams: CommitmentConfirmationParams = new CommitmentConfirmationParams(\n { bidId: this._bidId },\n );\n await Kafka.sendParams(\n this._commitmentRequestParams.neederId,\n commitmentConfirmationParams,\n this._config,\n );\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/CommitmentRequestParams.d.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | export interface ICommitmentRequestParams extends BasicParams { 3 | neederId: string; 4 | } 5 | export default class CommitmentRequestParams extends BasicParams { 6 | static _protocol: string; 7 | static _messageType: string; 8 | neederId: string; 9 | constructor(values?: Partial); 10 | serialize(): { 11 | ttl: number; 12 | protocol: string; 13 | type: string; 14 | }; 15 | deserialize(json: any): void; 16 | } 17 | -------------------------------------------------------------------------------- /dist/CommitmentRequestParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const BasicParams_1 = require("./BasicParams"); 4 | class CommitmentRequestParams extends BasicParams_1.default { 5 | constructor(values) { 6 | super(CommitmentRequestParams._protocol, CommitmentRequestParams._messageType, values); 7 | if (!!values) { 8 | this.neederId = values.neederId; 9 | } 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | Object.assign(formattedParams, { 14 | neederId: this.neederId, 15 | }); 16 | return formattedParams; 17 | } 18 | deserialize(json) { 19 | super.deserialize(json); 20 | this.neederId = json.neederId; 21 | } 22 | } 23 | CommitmentRequestParams._protocol = ''; 24 | CommitmentRequestParams._messageType = 'commitment_request'; 25 | exports.default = CommitmentRequestParams; 26 | 27 | //# sourceMappingURL=CommitmentRequestParams.js.map 28 | -------------------------------------------------------------------------------- /dist/Config.d.ts: -------------------------------------------------------------------------------- 1 | import IConfig from './IConfig'; 2 | import { BlockchainType } from './common-enums'; 3 | /** 4 | * @class The DavSDK Config Class is used to create configuration object to the SDK. 5 | */ 6 | export default class Config implements IConfig { 7 | /** 8 | * @param props Partial configuration object 9 | * @returns DavSDK configuration object. 10 | */ 11 | constructor(props: Partial); 12 | } 13 | export declare const defaultConfiguration: { 14 | ethNodeUrl: string; 15 | apiSeedUrls: string[]; 16 | kafkaSeedUrls: string[]; 17 | identityTtl: number; 18 | needTypeTtl: number; 19 | needTtl: number; 20 | missionConsumerTtl: number; 21 | missionProviderTtl: number; 22 | kafkaBrowserPollingInterval: number; 23 | kafkaBrowserRequestTimeout: number; 24 | blockchainType: BlockchainType; 25 | }; 26 | -------------------------------------------------------------------------------- /dist/Config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const common_enums_1 = require("./common-enums"); 4 | const defaultValues = { 5 | ethNodeUrl: '', 6 | apiSeedUrls: [''], 7 | kafkaSeedUrls: [''], 8 | identityTtl: 10000, 9 | needTypeTtl: 10000, 10 | needTtl: 10000, 11 | missionConsumerTtl: 10000, 12 | missionProviderTtl: 10000, 13 | kafkaBrowserPollingInterval: 1000, 14 | kafkaBrowserRequestTimeout: 500, 15 | blockchainType: common_enums_1.BlockchainType.test, 16 | }; 17 | /** 18 | * @class The DavSDK Config Class is used to create configuration object to the SDK. 19 | */ 20 | class Config { 21 | /** 22 | * @param props Partial configuration object 23 | * @returns DavSDK configuration object. 24 | */ 25 | constructor(props) { 26 | Object.assign(this, defaultValues, props); 27 | } 28 | } 29 | exports.default = Config; 30 | exports.defaultConfiguration = defaultValues; 31 | 32 | //# sourceMappingURL=Config.js.map 33 | -------------------------------------------------------------------------------- /dist/Config.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/Contracts.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/ContractsIntegrationSimulator.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/IBasicParams.d.ts: -------------------------------------------------------------------------------- 1 | export default interface IBasicParams { 2 | /** 3 | * Hop limit, in seconds, for the inherited class. 4 | */ 5 | ttl: number; 6 | } 7 | -------------------------------------------------------------------------------- /dist/IBasicParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | 4 | //# sourceMappingURL=IBasicParams.js.map 5 | -------------------------------------------------------------------------------- /dist/IBasicParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/IBasicParams.ts"],"names":[],"mappings":"","file":"IBasicParams.js","sourcesContent":["export default interface IBasicParams {\n /**\n * Hop limit, in seconds, for the inherited class.\n */\n ttl: number; // TTL in seconds\n}\n"]} -------------------------------------------------------------------------------- /dist/IBidParams.d.ts: -------------------------------------------------------------------------------- 1 | import IPrice from './IPrice'; 2 | import { ID, BigInteger, DavID } from './common-types'; 3 | import IBasicParams from './IBasicParams'; 4 | /** 5 | * @interface IBidParams extends The interface IBidParams represents valid arguments of BidParams constructor. 6 | */ 7 | export default interface IBidParams extends IBasicParams { 8 | /** 9 | * @property The bid's topic id (used to send messages). 10 | */ 11 | id: ID; 12 | /** 13 | * @property The bid's price. 14 | */ 15 | price: IPrice | BigInteger | Array; 16 | /** 17 | * @property The bid's vehicle DAV Id. 18 | */ 19 | vehicleId: DavID; 20 | /** 21 | * @property The consumer DAV Id. 22 | */ 23 | neederDavId: DavID; 24 | /** 25 | * @property Represents if the bidder is committed to provide this bid. 26 | */ 27 | isCommitted: boolean; 28 | } 29 | -------------------------------------------------------------------------------- /dist/IBidParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | 4 | //# sourceMappingURL=IBidParams.js.map 5 | -------------------------------------------------------------------------------- /dist/IBidParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/IBidParams.ts"],"names":[],"mappings":"","file":"IBidParams.js","sourcesContent":["import IPrice from './IPrice';\nimport { ID, BigInteger, DavID } from './common-types';\nimport IBasicParams from './IBasicParams';\n\n/**\n * @interface IBidParams extends The interface IBidParams represents valid arguments of BidParams constructor.\n */\nexport default interface IBidParams extends IBasicParams {\n /**\n * @property The bid's topic id (used to send messages).\n */\n id: ID;\n /**\n * @property The bid's price.\n */\n price: IPrice | BigInteger | Array;\n /**\n * @property The bid's vehicle DAV Id.\n */\n vehicleId: DavID;\n /**\n * @property The consumer DAV Id.\n */\n neederDavId: DavID;\n /**\n * @property Represents if the bidder is committed to provide this bid.\n */\n isCommitted: boolean;\n}\n"]} -------------------------------------------------------------------------------- /dist/IConfig.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | 4 | //# sourceMappingURL=IConfig.js.map 5 | -------------------------------------------------------------------------------- /dist/IMissionParams.d.ts: -------------------------------------------------------------------------------- 1 | import IPrice from './IPrice'; 2 | import { ID, DavID, BigInteger } from './common-types'; 3 | import IBasicParams from './IBasicParams'; 4 | /** 5 | * @interface IMissionParams The interface IMissionParams represents valid arguments of MissionParams constructor. 6 | */ 7 | export default interface IMissionParams extends IBasicParams { 8 | /** 9 | * @property The mission's topic id (used to send messages to consumer). 10 | */ 11 | id: ID; 12 | /** 13 | * @property The mission's price. 14 | */ 15 | price: IPrice | BigInteger | Array; 16 | /** 17 | * @property The mission's vehicle (provider) DAV Id. 18 | */ 19 | vehicleId: DavID; 20 | /** 21 | * @property The consumer DavID. 22 | */ 23 | neederDavId: DavID; 24 | } 25 | -------------------------------------------------------------------------------- /dist/IMissionParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | 4 | //# sourceMappingURL=IMissionParams.js.map 5 | -------------------------------------------------------------------------------- /dist/IMissionParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/IMissionParams.ts"],"names":[],"mappings":"","file":"IMissionParams.js","sourcesContent":["import IPrice from './IPrice';\nimport { ID, DavID, BigInteger } from './common-types';\nimport IBasicParams from './IBasicParams';\n\n/**\n * @interface IMissionParams The interface IMissionParams represents valid arguments of MissionParams constructor.\n */\nexport default interface IMissionParams extends IBasicParams {\n /**\n * @property The mission's topic id (used to send messages to consumer).\n */\n id: ID;\n /**\n * @property The mission's price.\n */\n price: IPrice | BigInteger | Array;\n /**\n * @property The mission's vehicle (provider) DAV Id.\n */\n vehicleId: DavID;\n /**\n * @property The consumer DavID.\n */\n neederDavId: DavID;\n}\n"]} -------------------------------------------------------------------------------- /dist/IPrice.d.ts: -------------------------------------------------------------------------------- 1 | import { BigInteger } from './common-types'; 2 | import { PriceType } from './common-enums'; 3 | /** 4 | * @interface IPrice Represent a mission price. 5 | */ 6 | export default interface IPrice { 7 | /** 8 | * @property The price value in Vinci. 9 | */ 10 | value: BigInteger; 11 | /** 12 | * @property The price type. 13 | */ 14 | type: PriceType; 15 | /** 16 | * @property general description of the price. 17 | */ 18 | description?: string; 19 | /** 20 | * @method equals Used to compare between two price objects. 21 | */ 22 | equals(other: IPrice): boolean; 23 | } 24 | -------------------------------------------------------------------------------- /dist/IPrice.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | 4 | //# sourceMappingURL=IPrice.js.map 5 | -------------------------------------------------------------------------------- /dist/IPrice.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/IPrice.ts"],"names":[],"mappings":"","file":"IPrice.js","sourcesContent":["import { BigInteger } from './common-types';\nimport { PriceType } from './common-enums';\n/**\n * @interface IPrice Represent a mission price.\n */\nexport default interface IPrice {\n /**\n * @property The price value in Vinci.\n */\n value: BigInteger;\n /**\n * @property The price type.\n */\n type: PriceType;\n /**\n * @property general description of the price.\n */\n description?: string;\n /**\n * @method equals Used to compare between two price objects.\n */\n equals(other: IPrice): boolean;\n}\n"]} -------------------------------------------------------------------------------- /dist/Identity.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/Kafka.d.ts: -------------------------------------------------------------------------------- 1 | import { IKafka } from './common-types'; 2 | declare let Kafka: IKafka; 3 | export default Kafka; 4 | -------------------------------------------------------------------------------- /dist/Kafka.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const runningOnBrowser = process.env.BROWSER || false; 4 | // tslint:disable-next-line:variable-name 5 | let Kafka; 6 | const loadKafka = () => { 7 | if (runningOnBrowser) { 8 | Kafka = new (require('./KafkaApi')).default(); 9 | } 10 | else { 11 | Kafka = new (require('./KafkaNode')).default(); 12 | } 13 | }; 14 | loadKafka(); 15 | exports.default = Kafka; 16 | 17 | //# sourceMappingURL=Kafka.js.map 18 | -------------------------------------------------------------------------------- /dist/Kafka.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/Kafka.ts"],"names":[],"mappings":";;AAEA,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,KAAK,CAAC;AAEtD,yCAAyC;AACzC,IAAI,KAAa,CAAC;AAElB,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,IAAI,gBAAgB,EAAE;QACpB,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;KAC/C;SAAM;QACL,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;KAChD;AACH,CAAC,CAAC;AACF,SAAS,EAAE,CAAC;AACZ,kBAAe,KAAK,CAAC","file":"Kafka.js","sourcesContent":["import { IKafka } from './common-types';\n\nconst runningOnBrowser = process.env.BROWSER || false;\n\n// tslint:disable-next-line:variable-name\nlet Kafka: IKafka;\n\nconst loadKafka = () => {\n if (runningOnBrowser) {\n Kafka = new (require('./KafkaApi')).default();\n } else {\n Kafka = new (require('./KafkaNode')).default();\n }\n};\nloadKafka();\nexport default Kafka;\n"]} -------------------------------------------------------------------------------- /dist/Kafka.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/KafkaApi.d.ts: -------------------------------------------------------------------------------- 1 | import KafkaBase from './KafkaBase'; 2 | import IConfig from './IConfig'; 3 | import BasicParams from './BasicParams'; 4 | import { IKafka } from './common-types'; 5 | import KafkaMessageStream from './KafkaMessageStream'; 6 | export default class Kafka extends KafkaBase implements IKafka { 7 | createTopic(topicId: string, config: IConfig): Promise; 8 | sendParams(topicId: string, basicParams: BasicParams, config: IConfig): Promise; 9 | messages(topicId: string, config: IConfig): Promise; 10 | } 11 | -------------------------------------------------------------------------------- /dist/KafkaBase.d.ts: -------------------------------------------------------------------------------- 1 | export default abstract class KafkaBase { 2 | generateTopicId(): string; 3 | } 4 | -------------------------------------------------------------------------------- /dist/KafkaBase.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const uuid_1 = require("uuid"); 4 | class KafkaBase { 5 | generateTopicId() { 6 | return uuid_1.v4(); 7 | } 8 | } 9 | exports.default = KafkaBase; 10 | 11 | //# sourceMappingURL=KafkaBase.js.map 12 | -------------------------------------------------------------------------------- /dist/KafkaBase.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/KafkaBase.ts"],"names":[],"mappings":";;AAAA,+BAAoC;AAEpC;IACS,eAAe;QACpB,OAAO,SAAM,EAAE,CAAC;IAClB,CAAC;CACF;AAJD,4BAIC","file":"KafkaBase.js","sourcesContent":["import { v4 as uuidV4 } from 'uuid';\n\nexport default abstract class KafkaBase {\n public generateTopicId(): string {\n return uuidV4();\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/KafkaMessageFactory.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum MessageCategories { 2 | NeedFilter = "NeedFilter", 3 | Need = "Need", 4 | Bid = "Bid", 5 | Mission = "Mission", 6 | Message = "Message" 7 | } 8 | export default class KafkaMessageFactory { 9 | private static _instance; 10 | private protocolMap; 11 | static readonly instance: KafkaMessageFactory; 12 | private constructor(); 13 | private getProtocol; 14 | private registerClassType; 15 | private registerMessageCategory; 16 | getClassType(protocol: string, messageType: string): new (...all: any[]) => T; 17 | getMessageTypes(protocol: string, category: MessageCategories): string[]; 18 | registerMessageClassAndCategory(protocol: string, messageType: string, messageCategory: MessageCategories, classType: new (...all: any[]) => T): void; 19 | registerMessageClasses(messageClasses: Array<{ 20 | protocol: string; 21 | messageType: string; 22 | messageCategory: MessageCategories; 23 | classType: new (...all: any[]) => any; 24 | }>): void; 25 | } 26 | -------------------------------------------------------------------------------- /dist/KafkaMessageStream.d.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from './common-types'; 2 | import BasicParams from './BasicParams'; 3 | export interface IKafkaMessage { 4 | protocol: string; 5 | type: string; 6 | contents: string; 7 | } 8 | export default class KafkaMessageStream { 9 | private kafkaStream; 10 | private static fromJson; 11 | constructor(kafkaStream: Observable); 12 | filterType(typesFilter: string[]): Observable; 13 | } 14 | -------------------------------------------------------------------------------- /dist/KafkaMessageStream.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const common_types_1 = require("./common-types"); 4 | const KafkaMessageFactory_1 = require("./KafkaMessageFactory"); 5 | const sdkLogger_1 = require("./sdkLogger"); 6 | class KafkaMessageStream { 7 | constructor(kafkaStream) { 8 | this.kafkaStream = kafkaStream; 9 | } 10 | static fromJson(classType, json) { 11 | const objectInstance = new classType.prototype.constructor(); 12 | objectInstance.deserialize(JSON.parse(json)); 13 | return objectInstance; 14 | } 15 | filterType(typesFilter) { 16 | return common_types_1.Observable.fromObservable(this.kafkaStream 17 | .filter(message => typesFilter.includes(message.type)) 18 | .map(message => { 19 | const classType = KafkaMessageFactory_1.default.instance.getClassType(message.protocol, message.type); 20 | sdkLogger_1.default(`KafkaMessageStream message on ${this.kafkaStream.topic} with class type ${classType.name}`); 21 | return KafkaMessageStream.fromJson(classType, message.contents); 22 | }), this.kafkaStream.topic); 23 | } 24 | } 25 | exports.default = KafkaMessageStream; 26 | 27 | //# sourceMappingURL=KafkaMessageStream.js.map 28 | -------------------------------------------------------------------------------- /dist/KafkaMessageStream.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/KafkaNode.d.ts: -------------------------------------------------------------------------------- 1 | import { Message } from 'kafka-node'; 2 | import IConfig from './IConfig'; 3 | import { IKafka } from './common-types'; 4 | import BasicParams from './BasicParams'; 5 | import { Observable as RxObservable } from 'rxjs'; 6 | import KafkaMessageStream from './KafkaMessageStream'; 7 | import KafkaBase from './KafkaBase'; 8 | import { ProduceRequest } from 'kafka-node'; 9 | export default class Kafka extends KafkaBase implements IKafka { 10 | private getKafkaClient; 11 | private getProducer; 12 | private getConsumer; 13 | createTopic(topicId: string, config: IConfig): Promise; 14 | sendMessage(topicId: string, message: string, config: IConfig): Promise; 15 | sendPayloads(payloads: ProduceRequest[], config: IConfig): Promise; 16 | sendParams(topicId: string, basicParams: BasicParams, config: IConfig): Promise; 17 | rawMessages(topicId: string, config: IConfig): Promise>; 18 | messages(topicId: string, config: IConfig): Promise; 19 | isConnected(config: IConfig): Promise; 20 | } 21 | -------------------------------------------------------------------------------- /dist/Message.d.ts: -------------------------------------------------------------------------------- 1 | import IConfig from './IConfig'; 2 | import { ID } from './common-types'; 3 | import MessageParams from './MessageParams'; 4 | /** 5 | * @class The Message Class represent a single message between consumer and service provider. 6 | */ 7 | export default class Message { 8 | selfId: ID; 9 | private _params; 10 | private config; 11 | readonly params: T; 12 | constructor(selfId: ID, _params: T, config: IConfig); 13 | /** 14 | * @method respond Used to reply for the current message. 15 | * @param params the message parameters. 16 | */ 17 | respond(params: MessageParams): Promise; 18 | /** 19 | * @method getMessageType Used to check the message type and protocol. 20 | */ 21 | getMessageType(): string; 22 | } 23 | -------------------------------------------------------------------------------- /dist/Message.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const Kafka_1 = require("./Kafka"); 4 | /** 5 | * @class The Message Class represent a single message between consumer and service provider. 6 | */ 7 | class Message { 8 | constructor(selfId, _params, config) { 9 | this.selfId = selfId; 10 | this._params = _params; 11 | this.config = config; 12 | /* */ 13 | } 14 | get params() { 15 | return this._params; 16 | } 17 | /** 18 | * @method respond Used to reply for the current message. 19 | * @param params the message parameters. 20 | */ 21 | respond(params) { 22 | params.senderId = this.selfId; 23 | return Kafka_1.default.sendParams(this._params.senderId, params, this.config); 24 | } 25 | /** 26 | * @method getMessageType Used to check the message type and protocol. 27 | */ 28 | getMessageType() { 29 | const formattedParams = this._params.serialize(); 30 | return `${formattedParams.protocol}:${formattedParams.type}`; 31 | } 32 | } 33 | exports.default = Message; 34 | 35 | //# sourceMappingURL=Message.js.map 36 | -------------------------------------------------------------------------------- /dist/Message.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/MessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | import { ID, BigInteger } from './common-types'; 3 | export interface IMessageParams { 4 | /** 5 | * @property The message sender id. 6 | */ 7 | senderId: ID | BigInteger; 8 | } 9 | /** 10 | * @class The abstract Class MessageParams represent common parameters of MessageParams classes. 11 | */ 12 | export default abstract class MessageParams extends BasicParams { 13 | /** 14 | * @property The message sender id. 15 | */ 16 | senderId: ID | BigInteger; 17 | constructor(protocol: string, type: string, values?: Partial); 18 | serialize(): { 19 | ttl: number; 20 | protocol: string; 21 | type: string; 22 | }; 23 | deserialize(json: any): void; 24 | } 25 | -------------------------------------------------------------------------------- /dist/MessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const BasicParams_1 = require("./BasicParams"); 4 | /** 5 | * @class The abstract Class MessageParams represent common parameters of MessageParams classes. 6 | */ 7 | class MessageParams extends BasicParams_1.default { 8 | constructor(protocol, type, values) { 9 | super(protocol, type, values); 10 | if (!!values) { 11 | this.senderId = values.senderId; 12 | } 13 | } 14 | serialize() { 15 | const formattedParams = super.serialize(); 16 | Object.assign(formattedParams, { senderId: this.senderId }); 17 | return formattedParams; 18 | } 19 | deserialize(json) { 20 | super.deserialize(json); 21 | this.senderId = json.senderId; 22 | } 23 | } 24 | exports.default = MessageParams; 25 | 26 | //# sourceMappingURL=MessageParams.js.map 27 | -------------------------------------------------------------------------------- /dist/Mission.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/MissionParams.d.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | import IPrice from './IPrice'; 3 | import { ID, DavID } from './common-types'; 4 | import IMissionParams from './IMissionParams'; 5 | /** 6 | * @class The abstract Class MissionParams represent common parameters of MissionParams classes. 7 | */ 8 | export default abstract class MissionParams extends BasicParams { 9 | price: IPrice[]; 10 | id: ID; 11 | neederDavId: DavID; 12 | vehicleId: DavID; 13 | constructor(protocol: string, type: string, values?: Partial); 14 | serialize(): { 15 | ttl: number; 16 | protocol: string; 17 | type: string; 18 | }; 19 | deserialize(json: any): void; 20 | } 21 | -------------------------------------------------------------------------------- /dist/MissionPeerIdMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from './MessageParams'; 2 | /** 3 | * @class The Class MissionPeerIdMessageParams represent internal message from provider to consumer to announce his mission selfId. 4 | */ 5 | export default class MissionPeerIdMessageParams extends BaseMessageParams { 6 | static _protocol: string; 7 | static _messageType: string; 8 | constructor(values?: Partial); 9 | serialize(): { 10 | ttl: number; 11 | protocol: string; 12 | type: string; 13 | }; 14 | deserialize(json: any): void; 15 | } 16 | -------------------------------------------------------------------------------- /dist/MissionPeerIdMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("./MessageParams"); 4 | /** 5 | * @class The Class MissionPeerIdMessageParams represent internal message from provider to consumer to announce his mission selfId. 6 | */ 7 | class MissionPeerIdMessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MissionPeerIdMessageParams._protocol, MissionPeerIdMessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MissionPeerIdMessageParams._protocol = ''; 20 | MissionPeerIdMessageParams._messageType = 'mission_peer_id_message'; 21 | exports.default = MissionPeerIdMessageParams; 22 | 23 | //# sourceMappingURL=MissionPeerIdMessageParams.js.map 24 | -------------------------------------------------------------------------------- /dist/MissionPeerIdMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/MissionPeerIdMessageParams.ts"],"names":[],"mappings":";;AAAA,mDAAgD;AAEhD;;GAEG;AACH,gCAAgD,SAAQ,uBAAiB;IAIvE,YAAY,MAA4C;QACtD,KAAK,CACH,0BAA0B,CAAC,SAAS,EACpC,0BAA0B,CAAC,YAAY,EACvC,MAAM,CACP,CAAC;IACJ,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAlBa,oCAAS,GAAG,EAAE,CAAC;AACf,uCAAY,GAAG,yBAAyB,CAAC;AAFzD,6CAoBC","file":"MissionPeerIdMessageParams.js","sourcesContent":["import BaseMessageParams from './MessageParams';\n\n/**\n * @class The Class MissionPeerIdMessageParams represent internal message from provider to consumer to announce his mission selfId.\n */\nexport default class MissionPeerIdMessageParams extends BaseMessageParams {\n public static _protocol = '';\n public static _messageType = 'mission_peer_id_message';\n\n constructor(values?: Partial) {\n super(\n MissionPeerIdMessageParams._protocol,\n MissionPeerIdMessageParams._messageType,\n values,\n );\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/Need.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/NeedFilterParams.d.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | import { DavID, ILocation } from './common-types'; 3 | /** 4 | * @class The abstract Class NeedFilterParams represent common parameters of NeedFilterParams classes. 5 | */ 6 | export default abstract class NeedFilterParams extends BasicParams { 7 | /** 8 | * @property The service provider location. 9 | */ 10 | location: ILocation; 11 | /** 12 | * @property The service provider max supported distance. if null then it is a global service (not limited to a geographic area) 13 | */ 14 | radius: number; 15 | /** 16 | * @property Provider Dav ID. 17 | */ 18 | davId: DavID; 19 | constructor(protocol: string, type: string, values?: Partial); 20 | serialize(): { 21 | ttl: number; 22 | protocol: string; 23 | type: string; 24 | }; 25 | deserialize(json: any): void; 26 | } 27 | -------------------------------------------------------------------------------- /dist/NeedParams.d.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | import { ID, DavID, ILocation } from './common-types'; 3 | /** 4 | * @class The abstract Class NeedParams represent common parameters of NeedParams classes. 5 | */ 6 | export default abstract class NeedParams extends BasicParams { 7 | /** 8 | * @property The need's topic id (used to send messages and bids to consumer). 9 | */ 10 | id: ID; 11 | /** 12 | * @property The need's topic id (used to send messages and bids to consumer). 13 | */ 14 | davId: DavID; 15 | /** 16 | * @property The consumer current location. 17 | */ 18 | location: ILocation; 19 | constructor(protocol: string, type: string, values?: Partial); 20 | serialize(): { 21 | ttl: number; 22 | protocol: string; 23 | type: string; 24 | }; 25 | deserialize(json: any): void; 26 | } 27 | -------------------------------------------------------------------------------- /dist/Price.d.ts: -------------------------------------------------------------------------------- 1 | import { BigInteger } from './common-types'; 2 | import { PriceType } from './common-enums'; 3 | import IPrice from './IPrice'; 4 | /** 5 | * @class The Price class is an implementation of the IPrice interface. 6 | */ 7 | export default class Price implements IPrice { 8 | value: BigInteger; 9 | type: PriceType; 10 | description?: string; 11 | constructor(value: BigInteger, type: PriceType, description?: string); 12 | /** 13 | * @method equals used to compare between two prices object. 14 | * @param other another price object to compare to current. 15 | */ 16 | equals(other: Price): boolean; 17 | } 18 | -------------------------------------------------------------------------------- /dist/Price.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * @class The Price class is an implementation of the IPrice interface. 5 | */ 6 | class Price { 7 | constructor(value, type, description) { 8 | this.value = value; 9 | this.type = type; 10 | this.description = description; 11 | /**/ 12 | } 13 | /** 14 | * @method equals used to compare between two prices object. 15 | * @param other another price object to compare to current. 16 | */ 17 | equals(other) { 18 | return (this.value === other.value && 19 | this.type === other.type && 20 | this.description === other.description); 21 | } 22 | } 23 | exports.default = Price; 24 | 25 | //# sourceMappingURL=Price.js.map 26 | -------------------------------------------------------------------------------- /dist/Price.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/Price.ts"],"names":[],"mappings":";;AAGA;;GAEG;AACH;IACE,YACS,KAAiB,EACjB,IAAe,EACf,WAAoB;QAFpB,UAAK,GAAL,KAAK,CAAY;QACjB,SAAI,GAAJ,IAAI,CAAW;QACf,gBAAW,GAAX,WAAW,CAAS;QAE3B,IAAI;IACN,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,KAAY;QACxB,OAAO,CACL,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK;YAC1B,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;YACxB,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,CACvC,CAAC;IACJ,CAAC;CACF;AAnBD,wBAmBC","file":"Price.js","sourcesContent":["import { BigInteger } from './common-types';\nimport { PriceType } from './common-enums';\nimport IPrice from './IPrice';\n/**\n * @class The Price class is an implementation of the IPrice interface.\n */\nexport default class Price implements IPrice {\n public constructor(\n public value: BigInteger,\n public type: PriceType,\n public description?: string,\n ) {\n /**/\n }\n /**\n * @method equals used to compare between two prices object.\n * @param other another price object to compare to current.\n */\n public equals(other: Price) {\n return (\n this.value === other.value &&\n this.type === other.type &&\n this.description === other.description\n );\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/SDK.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/SDKFactory.d.ts: -------------------------------------------------------------------------------- 1 | import IConfig from './IConfig'; 2 | import SDK from './SDK'; 3 | /** 4 | * @function SDKFactory create an instance of DAV SDK. 5 | * @param config DAV configuration object. 6 | * @returns DavSDK instance with the specified configuration object. 7 | */ 8 | export default function SDKFactory(config: IConfig): SDK; 9 | -------------------------------------------------------------------------------- /dist/SDKFactory.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const Config_1 = require("./Config"); 4 | const SDK_1 = require("./SDK"); 5 | /** 6 | * @function SDKFactory create an instance of DAV SDK. 7 | * @param config DAV configuration object. 8 | * @returns DavSDK instance with the specified configuration object. 9 | */ 10 | function SDKFactory(config) { 11 | const configuration = new Config_1.default(config); 12 | return new SDK_1.default(configuration); 13 | } 14 | exports.default = SDKFactory; 15 | 16 | //# sourceMappingURL=SDKFactory.js.map 17 | -------------------------------------------------------------------------------- /dist/SDKFactory.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/SDKFactory.ts"],"names":[],"mappings":";;AACA,qCAA8B;AAC9B,+BAAwB;AACxB;;;;GAIG;AACH,oBAAmC,MAAe;IAChD,MAAM,aAAa,GAAG,IAAI,gBAAM,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,IAAI,aAAG,CAAC,aAAa,CAAC,CAAC;AAChC,CAAC;AAHD,6BAGC","file":"SDKFactory.js","sourcesContent":["import IConfig from './IConfig';\nimport Config from './Config';\nimport SDK from './SDK';\n/**\n * @function SDKFactory create an instance of DAV SDK.\n * @param config DAV configuration object.\n * @returns DavSDK instance with the specified configuration object.\n */\nexport default function SDKFactory(config: IConfig): SDK {\n const configuration = new Config(config);\n return new SDK(configuration);\n}\n"]} -------------------------------------------------------------------------------- /dist/SDKFactory.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/SDKFactory.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const SDKFactory_1 = require("./SDKFactory"); 4 | const Config_1 = require("./Config"); 5 | describe('SDKFactory method', () => { 6 | it('should create SDK instance', () => { 7 | // Arrange 8 | const config = new Config_1.default({ 9 | apiSeedUrls: ['apiUrl'], 10 | ethNodeUrl: 'ethUrl', 11 | kafkaSeedUrls: ['kafkaUrl'], 12 | }); 13 | // Act 14 | const sdk = SDKFactory_1.default(config); 15 | // Assert 16 | expect(sdk.getIdentity).toBeDefined(); 17 | expect(sdk.isRegistered).toBeDefined(); 18 | expect(sdk.registerIdentity).toBeDefined(); 19 | }); 20 | }); 21 | 22 | //# sourceMappingURL=SDKFactory.test.js.map 23 | -------------------------------------------------------------------------------- /dist/SDKFactory.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/SDKFactory.test.ts"],"names":[],"mappings":";;AAAA,6CAAsC;AACtC,qCAAqC;AAErC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,UAAU;QACV,MAAM,MAAM,GAAG,IAAI,gBAAa,CAAC;YAC/B,WAAW,EAAE,CAAC,QAAQ,CAAC;YACvB,UAAU,EAAE,QAAQ;YACpB,aAAa,EAAE,CAAC,UAAU,CAAC;SAC5B,CAAC,CAAC;QAEH,MAAM;QACN,MAAM,GAAG,GAAG,oBAAU,CAAC,MAAM,CAAC,CAAC;QAE/B,SAAS;QACT,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"SDKFactory.test.js","sourcesContent":["import SDKFactory from './SDKFactory';\nimport Configuration from './Config';\n\ndescribe('SDKFactory method', () => {\n it('should create SDK instance', () => {\n // Arrange\n const config = new Configuration({\n apiSeedUrls: ['apiUrl'],\n ethNodeUrl: 'ethUrl',\n kafkaSeedUrls: ['kafkaUrl'],\n });\n\n // Act\n const sdk = SDKFactory(config);\n\n // Assert\n expect(sdk.getIdentity).toBeDefined();\n expect(sdk.isRegistered).toBeDefined();\n expect(sdk.registerIdentity).toBeDefined();\n });\n});\n"]} -------------------------------------------------------------------------------- /dist/common-enums.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @enum The enum PriceType represent the type of the price of the service. 3 | */ 4 | export declare enum PriceType { 5 | flat = "flat" 6 | } 7 | /** 8 | * @enum The enum BlockchainType represent the type of the blockchain network. 9 | */ 10 | export declare enum BlockchainType { 11 | local = "local", 12 | test = "ropsten", 13 | main = "main" 14 | } 15 | /** 16 | * @enum The enum ContractTypes represent the dav contracts names. 17 | */ 18 | export declare enum ContractTypes { 19 | identity = "Identity", 20 | davToken = "DAVToken", 21 | basicMission = "BasicMission" 22 | } 23 | -------------------------------------------------------------------------------- /dist/common-enums.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * @enum The enum PriceType represent the type of the price of the service. 5 | */ 6 | var PriceType; 7 | (function (PriceType) { 8 | PriceType["flat"] = "flat"; 9 | })(PriceType = exports.PriceType || (exports.PriceType = {})); 10 | /** 11 | * @enum The enum BlockchainType represent the type of the blockchain network. 12 | */ 13 | var BlockchainType; 14 | (function (BlockchainType) { 15 | BlockchainType["local"] = "local"; 16 | BlockchainType["test"] = "ropsten"; 17 | BlockchainType["main"] = "main"; 18 | })(BlockchainType = exports.BlockchainType || (exports.BlockchainType = {})); 19 | /** 20 | * @enum The enum ContractTypes represent the dav contracts names. 21 | */ 22 | var ContractTypes; 23 | (function (ContractTypes) { 24 | ContractTypes["identity"] = "Identity"; 25 | ContractTypes["davToken"] = "DAVToken"; 26 | ContractTypes["basicMission"] = "BasicMission"; 27 | })(ContractTypes = exports.ContractTypes || (exports.ContractTypes = {})); 28 | 29 | //# sourceMappingURL=common-enums.js.map 30 | -------------------------------------------------------------------------------- /dist/common-enums.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/common-enums.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,0BAAa,CAAA;AACf,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB;AACD;;GAEG;AACH,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,iCAAe,CAAA;IACf,kCAAgB,CAAA;IAChB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB;AACD;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,sCAAqB,CAAA;IACrB,8CAA6B,CAAA;AAC/B,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB","file":"common-enums.js","sourcesContent":["/**\n * @enum The enum PriceType represent the type of the price of the service.\n */\nexport enum PriceType {\n flat = 'flat',\n}\n/**\n * @enum The enum BlockchainType represent the type of the blockchain network.\n */\nexport enum BlockchainType {\n local = 'local',\n test = 'ropsten',\n main = 'main',\n}\n/**\n * @enum The enum ContractTypes represent the dav contracts names.\n */\nexport enum ContractTypes {\n identity = 'Identity',\n davToken = 'DAVToken',\n basicMission = 'BasicMission',\n}\n"]} -------------------------------------------------------------------------------- /dist/common-types.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const rxjs_1 = require("rxjs"); 4 | /** 5 | * @type The type Observable represent the SDK observable object that used to subscribe to Needs/Bids/Messages/etc... 6 | */ 7 | class Observable extends rxjs_1.Observable { 8 | constructor() { 9 | super(); 10 | } 11 | static fromObservable(observableRx, topic) { 12 | const observable = observableRx; 13 | observable.topic = topic; 14 | return observable; 15 | } 16 | } 17 | exports.Observable = Observable; 18 | 19 | //# sourceMappingURL=common-types.js.map 20 | -------------------------------------------------------------------------------- /dist/drone-charging/BidParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/MessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging message. 4 | */ 5 | export default abstract class MessageParams extends BaseMessageParams { 6 | static _protocol: string; 7 | constructor(messageType: string, values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/drone-charging/MessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(messageType, values) { 9 | super(MessageParams._protocol, messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._protocol = 'drone_charging'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=MessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/drone-charging/MessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/MessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AAEjD;;GAEG;AACH,mBAA4C,SAAQ,uBAAiB;IAGnE,YAAY,WAAmB,EAAE,MAA+B;QAC9D,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,uBAAS,GAAG,gBAAgB,CAAC;AAD7C,gCAeC","file":"MessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n\n/**\n * @class The Class drone-charging/MessageParams represent the parameters of drone-charging message.\n */\nexport default abstract class MessageParams extends BaseMessageParams {\n public static _protocol = 'drone_charging';\n\n constructor(messageType: string, values?: Partial) {\n super(MessageParams._protocol, messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/MissionParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMissionParams from '../MissionParams'; 2 | import BaseIMissionParams from '../IMissionParams'; 3 | import { ID } from '../common-types'; 4 | /** 5 | * @interface IMissionParams The interface drone-charging/IMissionParams represent a valid argument of drone-charging/MissionParams constructor. 6 | */ 7 | interface IMissionParams extends BaseIMissionParams { 8 | /** 9 | * @property The mission's topic id (used to send messages to consumer). 10 | */ 11 | id: ID; 12 | } 13 | /** 14 | * @class The Class drone-charging/MissionParams represent the parameters of drone-charging mission. 15 | */ 16 | export default class MissionParams extends BaseMissionParams { 17 | static _protocol: string; 18 | static _messageType: string; 19 | static getMessageType(): string; 20 | static getMessageProtocol(): string; 21 | constructor(values?: Partial); 22 | serialize(): { 23 | ttl: number; 24 | protocol: string; 25 | type: string; 26 | }; 27 | deserialize(json: any): void; 28 | } 29 | export {}; 30 | -------------------------------------------------------------------------------- /dist/drone-charging/MissionParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MissionParams_1 = require("../MissionParams"); 4 | /** 5 | * @class The Class drone-charging/MissionParams represent the parameters of drone-charging mission. 6 | */ 7 | class MissionParams extends MissionParams_1.default { 8 | constructor(values) { 9 | super(MissionParams._protocol, MissionParams._messageType, values); 10 | } 11 | static getMessageType() { 12 | return MissionParams._messageType; 13 | } 14 | static getMessageProtocol() { 15 | return MissionParams._protocol; 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | return formattedParams; 20 | } 21 | deserialize(json) { 22 | super.deserialize(json); 23 | } 24 | } 25 | MissionParams._protocol = 'drone_charging'; 26 | MissionParams._messageType = 'mission'; 27 | exports.default = MissionParams; 28 | 29 | //# sourceMappingURL=MissionParams.js.map 30 | -------------------------------------------------------------------------------- /dist/drone-charging/MissionParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/NeedFilterParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | import { IDimensions } from '../common-types'; 3 | /** 4 | * @class The Class drone-charging/NeedFilterParams represent the parameters that used to filter drone-charging needs. 5 | */ 6 | export default class NeedFilterParams extends BaseNeedFilterParams { 7 | static _protocol: string; 8 | static _messageType: string; 9 | maxDimensions: IDimensions; 10 | constructor(values?: Partial); 11 | serialize(): { 12 | ttl: number; 13 | protocol: string; 14 | type: string; 15 | }; 16 | deserialize(json: any): void; 17 | } 18 | -------------------------------------------------------------------------------- /dist/drone-charging/NeedFilterParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const NeedFilterParams_1 = require("../NeedFilterParams"); 4 | /** 5 | * @class The Class drone-charging/NeedFilterParams represent the parameters that used to filter drone-charging needs. 6 | */ 7 | class NeedFilterParams extends NeedFilterParams_1.default { 8 | constructor(values) { 9 | super(NeedFilterParams._protocol, NeedFilterParams._messageType, values); 10 | if (!!values) { 11 | this.maxDimensions = values.maxDimensions; 12 | } 13 | } 14 | serialize() { 15 | const formattedParams = super.serialize(); 16 | Object.assign(formattedParams, { dimensions: this.maxDimensions }); 17 | return formattedParams; 18 | } 19 | deserialize(json) { 20 | super.deserialize(json); 21 | this.maxDimensions = json.dimensions; 22 | } 23 | } 24 | NeedFilterParams._protocol = 'drone_charging'; 25 | NeedFilterParams._messageType = 'need_filter'; 26 | exports.default = NeedFilterParams; 27 | 28 | //# sourceMappingURL=NeedFilterParams.js.map 29 | -------------------------------------------------------------------------------- /dist/drone-charging/NeedFilterParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/NeedParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedParams from '../NeedParams'; 2 | import { IDimensions } from '../common-types'; 3 | import { EnergySources, Amenities } from './enums'; 4 | /** 5 | * @class The Class drone-charging/NeedParams represent the parameters of drone-charging need. 6 | */ 7 | export default class NeedParams extends BaseNeedParams { 8 | static _protocol: string; 9 | static _messageType: string; 10 | radius: number; 11 | startAt: number; 12 | dimensions: IDimensions; 13 | batteryCapacity: number; 14 | currentBatteryCharge: number; 15 | energySource: EnergySources; 16 | amenities: Amenities[]; 17 | constructor(values?: Partial); 18 | serialize(): { 19 | ttl: number; 20 | protocol: string; 21 | type: string; 22 | }; 23 | deserialize(json: any): void; 24 | } 25 | -------------------------------------------------------------------------------- /dist/drone-charging/NeedParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/ProtocolTypes.d.ts: -------------------------------------------------------------------------------- 1 | import BidParams from './BidParams'; 2 | import MissionParams from './MissionParams'; 3 | import MessageParams from './MessageParams'; 4 | import NeedFilterParams from './NeedFilterParams'; 5 | import NeedParams from './NeedParams'; 6 | declare const _default: { 7 | need_filter: typeof NeedFilterParams; 8 | need: typeof NeedParams; 9 | bid: typeof BidParams; 10 | mission: typeof MissionParams; 11 | message: typeof MessageParams; 12 | needFilters: string[]; 13 | needs: string[]; 14 | bids: string[]; 15 | missions: string[]; 16 | messages: string[]; 17 | }; 18 | export default _default; 19 | //# sourceMappingURL=ProtocolTypes.d.ts.map -------------------------------------------------------------------------------- /dist/drone-charging/ProtocolTypes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const BidParams_1 = require("./BidParams"); 4 | const MissionParams_1 = require("./MissionParams"); 5 | const MessageParams_1 = require("./MessageParams"); 6 | const NeedFilterParams_1 = require("./NeedFilterParams"); 7 | const NeedParams_1 = require("./NeedParams"); 8 | exports.default = { 9 | need_filter: NeedFilterParams_1.default, 10 | need: NeedParams_1.default, 11 | bid: BidParams_1.default, 12 | mission: MissionParams_1.default, 13 | message: MessageParams_1.default, 14 | needFilters: ['need_filter'], 15 | needs: ['need'], 16 | bids: ['bid'], 17 | missions: ['mission'], 18 | messages: ['message'], 19 | }; 20 | 21 | //# sourceMappingURL=ProtocolTypes.js.map 22 | -------------------------------------------------------------------------------- /dist/drone-charging/ProtocolTypes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/ProtocolTypes.ts"],"names":[],"mappings":";;AAAA,2CAAoC;AACpC,mDAA4C;AAC5C,mDAA4C;AAC5C,yDAAkD;AAClD,6CAAsC;AAEtC,kBAAe;IACb,WAAW,EAAE,0BAAgB;IAC7B,IAAI,EAAE,oBAAU;IAChB,GAAG,EAAE,mBAAS;IACd,OAAO,EAAE,uBAAa;IACtB,OAAO,EAAE,uBAAa;IACtB,WAAW,EAAE,CAAC,aAAa,CAAC;IAC5B,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,KAAK,CAAC;IACb,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,QAAQ,EAAE,CAAC,SAAS,CAAC;CACtB,CAAC","file":"ProtocolTypes.js","sourcesContent":["import BidParams from './BidParams';\nimport MissionParams from './MissionParams';\nimport MessageParams from './MessageParams';\nimport NeedFilterParams from './NeedFilterParams';\nimport NeedParams from './NeedParams';\n\nexport default {\n need_filter: NeedFilterParams,\n need: NeedParams,\n bid: BidParams,\n mission: MissionParams,\n message: MessageParams,\n needFilters: ['need_filter'],\n needs: ['need'],\n bids: ['bid'],\n missions: ['mission'],\n messages: ['message'],\n};\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/enums.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum EnergySources { 2 | Grid = "grid", 3 | Renewable = "renewable", 4 | Solar = "solar", 5 | Wind = "wind", 6 | Hydro = "hydro", 7 | Geothermal = "geothermal" 8 | } 9 | export declare enum Amenities { 10 | Park = 1 11 | } 12 | export declare enum PriceTypes { 13 | kwh = "kwh", 14 | second = "second", 15 | minute = "minute", 16 | hour = "hour", 17 | day = "day", 18 | week = "week", 19 | flat = "flat" 20 | } 21 | -------------------------------------------------------------------------------- /dist/drone-charging/enums.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | var EnergySources; 4 | (function (EnergySources) { 5 | EnergySources["Grid"] = "grid"; 6 | EnergySources["Renewable"] = "renewable"; 7 | EnergySources["Solar"] = "solar"; 8 | EnergySources["Wind"] = "wind"; 9 | EnergySources["Hydro"] = "hydro"; 10 | EnergySources["Geothermal"] = "geothermal"; 11 | })(EnergySources = exports.EnergySources || (exports.EnergySources = {})); 12 | var Amenities; 13 | (function (Amenities) { 14 | Amenities[Amenities["Park"] = 1] = "Park"; 15 | })(Amenities = exports.Amenities || (exports.Amenities = {})); 16 | var PriceTypes; 17 | (function (PriceTypes) { 18 | PriceTypes["kwh"] = "kwh"; 19 | PriceTypes["second"] = "second"; 20 | PriceTypes["minute"] = "minute"; 21 | PriceTypes["hour"] = "hour"; 22 | PriceTypes["day"] = "day"; 23 | PriceTypes["week"] = "week"; 24 | PriceTypes["flat"] = "flat"; 25 | })(PriceTypes = exports.PriceTypes || (exports.PriceTypes = {})); 26 | 27 | //# sourceMappingURL=enums.js.map 28 | -------------------------------------------------------------------------------- /dist/drone-charging/enums.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/enums.ts"],"names":[],"mappings":";;AAAA,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,wCAAuB,CAAA;IACvB,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,gCAAe,CAAA;IACf,0CAAyB,CAAA;AAC3B,CAAC,EAPW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAOxB;AAED,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,yCAAQ,CAAA;AACV,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB;AAED,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,2BAAa,CAAA;AACf,CAAC,EARW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAQrB","file":"enums.js","sourcesContent":["export enum EnergySources {\n Grid = 'grid',\n Renewable = 'renewable',\n Solar = 'solar',\n Wind = 'wind',\n Hydro = 'hydro',\n Geothermal = 'geothermal',\n}\n\nexport enum Amenities {\n Park = 1,\n}\n\nexport enum PriceTypes {\n kwh = 'kwh',\n second = 'second',\n minute = 'minute',\n hour = 'hour',\n day = 'day',\n week = 'week',\n flat = 'flat',\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/index.d.ts: -------------------------------------------------------------------------------- 1 | import * as enums from './enums'; 2 | import NeedParams from './NeedParams'; 3 | import NeedFilterParams from './NeedFilterParams'; 4 | import BidParams from './BidParams'; 5 | import MissionParams from './MissionParams'; 6 | import ChargingArrivalMessageParams from './messages/ChargingArrivalMessageParams'; 7 | import ChargingCompleteMessageParams from './messages/ChargingCompleteMessageParams'; 8 | import ChargingStartedMessageParams from './messages/ChargingStartedMessageParams'; 9 | import DeclineMessageParams from './messages/DeclineMessageParams'; 10 | import ProviderStatusMessageParams from './messages/ProviderStatusMessageParams'; 11 | import StartingMessageParams from './messages/StartingMessageParams'; 12 | import StatusRequestMessageParams from './messages/StatusRequestMessageParams'; 13 | import DroneStatusMessageParams from './messages/DroneStatusMessageParams'; 14 | export { enums, NeedParams, NeedFilterParams, BidParams, MissionParams, ChargingArrivalMessageParams, ChargingCompleteMessageParams, ChargingStartedMessageParams, DeclineMessageParams, ProviderStatusMessageParams, StartingMessageParams, StatusRequestMessageParams, DroneStatusMessageParams, }; 15 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingArrivalMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/ChargingArrivalMessageParams represent the parameters of drone-charging arrival message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingArrivalMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/ChargingArrivalMessageParams represent the parameters of drone-charging arrival message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'charging_arrival_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=ChargingArrivalMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingArrivalMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/messages/ChargingArrivalMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,0BAA0B,CAAC;AAD1D,gCAeC","file":"ChargingArrivalMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class drone-charging/ChargingArrivalMessageParams represent the parameters of drone-charging arrival message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'charging_arrival_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingArrivalMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingCompleteMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/ChargingCompleteMessageParams represent the parameters of drone-charging complete charging message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingCompleteMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/ChargingCompleteMessageParams represent the parameters of drone-charging complete charging message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'charging_complete_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=ChargingCompleteMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingCompleteMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/messages/ChargingCompleteMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,2BAA2B,CAAC;AAD3D,gCAeC","file":"ChargingCompleteMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class drone-charging/ChargingCompleteMessageParams represent the parameters of drone-charging complete charging message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'charging_complete_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingCompleteMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingStartedMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingStartedMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | const messageParams = super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'charging_started_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=ChargingStartedMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ChargingStartedMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/messages/ChargingStartedMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;;AAba,0BAAY,GAAG,0BAA0B,CAAC;AAD1D,gCAeC","file":"ChargingStartedMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class drone-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'charging_started_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n const messageParams = super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/messages/DeclineMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging decline mission message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/DeclineMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging decline mission message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'decline_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=DeclineMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/DeclineMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/messages/DeclineMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,iBAAiB,CAAC;AADjD,gCAeC","file":"DeclineMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class drone-charging/MessageParams represent the parameters of drone-charging decline mission message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'decline_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/messages/DeclineMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/DroneStatusMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | import { ILocation } from '../../common-types'; 3 | /** 4 | * @class The Class drone-charging/DroneStatusMessageParams represent the parameters of drone-charging consumer status message. 5 | */ 6 | export default class MessageParams extends BaseMessageParams { 7 | static _messageType: string; 8 | location: ILocation; 9 | constructor(values?: Partial); 10 | serialize(): { 11 | ttl: number; 12 | protocol: string; 13 | type: string; 14 | }; 15 | deserialize(json: any): void; 16 | } 17 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/DroneStatusMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/DroneStatusMessageParams represent the parameters of drone-charging consumer status message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | if (!!values) { 11 | if (!values.location) { 12 | throw new Error('location is a required field'); 13 | } 14 | this.location = values.location; 15 | } 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | Object.assign(formattedParams, { 20 | location: this.location, 21 | }); 22 | return formattedParams; 23 | } 24 | deserialize(json) { 25 | super.deserialize(json); 26 | this.location = json.location; 27 | } 28 | } 29 | MessageParams._messageType = 'drone_status_message'; 30 | exports.default = MessageParams; 31 | 32 | //# sourceMappingURL=DroneStatusMessageParams.js.map 33 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/DroneStatusMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ProviderStatusMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging provider status message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | finishEta: number; 8 | constructor(values?: Partial); 9 | serialize(): { 10 | ttl: number; 11 | protocol: string; 12 | type: string; 13 | }; 14 | deserialize(json: any): void; 15 | } 16 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/ProviderStatusMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging provider status message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | if (!!values) { 11 | if (!values.finishEta) { 12 | throw new Error('finishEta is a required field'); 13 | } 14 | this.finishEta = values.finishEta; 15 | } 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | Object.assign(formattedParams, { 20 | finishEta: this.finishEta, 21 | }); 22 | return formattedParams; 23 | } 24 | deserialize(json) { 25 | super.deserialize(json); 26 | this.finishEta = json.finishEta; 27 | } 28 | } 29 | MessageParams._messageType = 'provider_status_message'; 30 | exports.default = MessageParams; 31 | 32 | //# sourceMappingURL=ProviderStatusMessageParams.js.map 33 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/StartingMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/StartingMessageParams represent the parameters of drone-charging approve mission by the service provider message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/StartingMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/StartingMessageParams represent the parameters of drone-charging approve mission by the service provider message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'starting_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=StartingMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/StartingMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/messages/StartingMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,kBAAkB,CAAC;AADlD,gCAeC","file":"StartingMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class drone-charging/StartingMessageParams represent the parameters of drone-charging approve mission by the service provider message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'starting_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/messages/StartingMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/StatusRequestMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/StatusRequestMessageParams represent the parameters of drone-charging status request message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/StatusRequestMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-charging/StatusRequestMessageParams represent the parameters of drone-charging status request message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'status_request_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=StatusRequestMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/StatusRequestMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-charging/messages/StatusRequestMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,wBAAwB,CAAC;AADxD,gCAeC","file":"StatusRequestMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class drone-charging/StatusRequestMessageParams represent the parameters of drone-charging status request message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'status_request_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/drone-charging/messages/StatusRequestMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-charging/messages/StatusRequestMessageParams.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const StatusRequestMessageParams_1 = require("./StatusRequestMessageParams"); 4 | describe('MessageParams class', () => { 5 | const messageParams = new StatusRequestMessageParams_1.default({ senderId: 'senderId' }); // <-- Causing TypeError 6 | const serializedMessageParams = { 7 | protocol: 'drone_charging', 8 | ttl: undefined, 9 | type: 'status_request_message', 10 | senderId: 'senderId', 11 | }; 12 | describe('serialize method', () => { 13 | it('should return serialized message params object with the current values', () => { 14 | expect(messageParams.serialize()).toEqual(serializedMessageParams); 15 | }); 16 | }); 17 | describe('deserialize method', () => { 18 | it('should return MessageParams instance with the current parameters', () => { 19 | const messageParamsObject = new StatusRequestMessageParams_1.default(); 20 | messageParamsObject.deserialize(serializedMessageParams); 21 | expect(messageParamsObject).toEqual(messageParams); 22 | }); 23 | }); 24 | }); 25 | 26 | //# sourceMappingURL=StatusRequestMessageParams.test.js.map 27 | -------------------------------------------------------------------------------- /dist/drone-delivery/BidParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseBidParams from '../BidParams'; 2 | import IBaseBidParams from '../IBidParams'; 3 | /** 4 | * @interface IBidParams The interface drone-delivery/IBidParams represent a valid argument of drone-delivery/BidParams constructor. 5 | */ 6 | interface IBidParams extends IBaseBidParams { 7 | /** 8 | * @property Estimated time from contract signing to delivery in seconds. 9 | */ 10 | eta: number; 11 | } 12 | /** 13 | * @class The Class drone-delivery/BidParams represent the parameters of drone-delivery bid. 14 | */ 15 | export default class BidParams extends BaseBidParams { 16 | private static _protocol; 17 | private static _type; 18 | /** 19 | * @property Estimated time from contract signing to delivery in seconds. 20 | */ 21 | eta?: number; 22 | static getMessageType(): string; 23 | static getMessageProtocol(): string; 24 | constructor(values: Partial); 25 | serialize(): { 26 | ttl: number; 27 | protocol: string; 28 | type: string; 29 | }; 30 | deserialize(json: any): void; 31 | equals(other: BidParams): boolean; 32 | } 33 | export {}; 34 | -------------------------------------------------------------------------------- /dist/drone-delivery/BidParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const BidParams_1 = require("../BidParams"); 4 | /** 5 | * @class The Class drone-delivery/BidParams represent the parameters of drone-delivery bid. 6 | */ 7 | class BidParams extends BidParams_1.default { 8 | constructor(values) { 9 | super(BidParams._protocol, BidParams._type, values); 10 | if (!!values) { 11 | this.eta = values.eta; 12 | } 13 | } 14 | static getMessageType() { 15 | return BidParams._type; 16 | } 17 | static getMessageProtocol() { 18 | return BidParams._protocol; 19 | } 20 | serialize() { 21 | const formattedParams = super.serialize(); 22 | Object.assign(formattedParams, { 23 | eta: this.eta, 24 | }); 25 | return formattedParams; 26 | } 27 | deserialize(json) { 28 | super.deserialize(json); 29 | this.eta = json.eta; 30 | } 31 | equals(other) { 32 | return super.equals(other) && this.eta === other.eta; 33 | } 34 | } 35 | BidParams._protocol = 'drone_delivery'; 36 | BidParams._type = 'bid'; 37 | exports.default = BidParams; 38 | 39 | //# sourceMappingURL=BidParams.js.map 40 | -------------------------------------------------------------------------------- /dist/drone-delivery/BidParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-delivery/MessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-delivery/MessageParams represent the parameters of drone-delivery message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | private static _protocol; 7 | private static _type; 8 | static getMessageType(): string; 9 | static getMessageProtocol(): string; 10 | constructor(values?: Partial); 11 | serialize(): { 12 | ttl: number; 13 | protocol: string; 14 | type: string; 15 | }; 16 | deserialize(json: any): void; 17 | } 18 | -------------------------------------------------------------------------------- /dist/drone-delivery/MessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class drone-delivery/MessageParams represent the parameters of drone-delivery message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._protocol, MessageParams._type, values); 10 | } 11 | static getMessageType() { 12 | return MessageParams._type; 13 | } 14 | static getMessageProtocol() { 15 | return MessageParams._protocol; 16 | } 17 | serialize() { 18 | return super.serialize(); 19 | } 20 | deserialize(json) { 21 | super.deserialize(json); 22 | } 23 | } 24 | MessageParams._protocol = 'drone_delivery'; 25 | MessageParams._type = 'message'; 26 | exports.default = MessageParams; 27 | 28 | //# sourceMappingURL=MessageParams.js.map 29 | -------------------------------------------------------------------------------- /dist/drone-delivery/MessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-delivery/MissionParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMissionParams from '../MissionParams'; 2 | import IMissionParams from '../IMissionParams'; 3 | /** 4 | * @class The Class drone-delivery/MissionParams represent the parameters of drone-delivery mission. 5 | */ 6 | export default class MissionParams extends BaseMissionParams { 7 | private static _protocol; 8 | private static _type; 9 | static getMessageType(): string; 10 | static getMessageProtocol(): string; 11 | constructor(values?: Partial); 12 | serialize(): { 13 | ttl: number; 14 | protocol: string; 15 | type: string; 16 | }; 17 | deserialize(json: any): void; 18 | } 19 | -------------------------------------------------------------------------------- /dist/drone-delivery/MissionParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MissionParams_1 = require("../MissionParams"); 4 | /** 5 | * @class The Class drone-delivery/MissionParams represent the parameters of drone-delivery mission. 6 | */ 7 | class MissionParams extends MissionParams_1.default { 8 | constructor(values) { 9 | super(MissionParams._protocol, MissionParams._type, values); 10 | } 11 | static getMessageType() { 12 | return MissionParams._type; 13 | } 14 | static getMessageProtocol() { 15 | return MissionParams._protocol; 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | return formattedParams; 20 | } 21 | deserialize(json) { 22 | super.deserialize(json); 23 | } 24 | } 25 | MissionParams._protocol = 'drone_delivery'; 26 | MissionParams._type = 'mission'; 27 | exports.default = MissionParams; 28 | 29 | //# sourceMappingURL=MissionParams.js.map 30 | -------------------------------------------------------------------------------- /dist/drone-delivery/MissionParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-delivery/NeedFilterParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | import { IDimensions } from '../common-types'; 3 | /** 4 | * @class The Class drone-delivery/NeedFilterParams represent the parameters that used to filter drone-delivery needs. 5 | */ 6 | export default class NeedFilterParams extends BaseNeedFilterParams { 7 | private static _protocol; 8 | private static _type; 9 | maxDimensions: IDimensions; 10 | static getMessageType(): string; 11 | static getMessageProtocol(): string; 12 | constructor(values?: Partial); 13 | serialize(): { 14 | ttl: number; 15 | protocol: string; 16 | type: string; 17 | }; 18 | deserialize(json: any): void; 19 | } 20 | -------------------------------------------------------------------------------- /dist/drone-delivery/NeedFilterParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const NeedFilterParams_1 = require("../NeedFilterParams"); 4 | /** 5 | * @class The Class drone-delivery/NeedFilterParams represent the parameters that used to filter drone-delivery needs. 6 | */ 7 | class NeedFilterParams extends NeedFilterParams_1.default { 8 | constructor(values) { 9 | super(NeedFilterParams._protocol, NeedFilterParams._type, values); 10 | } 11 | static getMessageType() { 12 | return NeedFilterParams._type; 13 | } 14 | static getMessageProtocol() { 15 | return NeedFilterParams._protocol; 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | Object.assign(formattedParams, { dimensions: this.maxDimensions }); 20 | return formattedParams; 21 | } 22 | deserialize(json) { 23 | super.deserialize(json); 24 | this.maxDimensions = json.dimensions; 25 | } 26 | } 27 | NeedFilterParams._protocol = 'drone_delivery'; 28 | NeedFilterParams._type = 'need_filter'; 29 | exports.default = NeedFilterParams; 30 | 31 | //# sourceMappingURL=NeedFilterParams.js.map 32 | -------------------------------------------------------------------------------- /dist/drone-delivery/NeedFilterParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-delivery/NeedParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/drone-delivery/ProtocolTypes.d.ts: -------------------------------------------------------------------------------- 1 | import NeedParams from './NeedParams'; 2 | import BidParams from './BidParams'; 3 | import MissionParams from './MissionParams'; 4 | import MessageParams from './MessageParams'; 5 | import NeedFilterParams from './NeedFilterParams'; 6 | declare const _default: { 7 | need_filter: typeof NeedFilterParams; 8 | need: typeof NeedParams; 9 | bid: typeof BidParams; 10 | mission: typeof MissionParams; 11 | message: typeof MessageParams; 12 | needFilters: string[]; 13 | needs: string[]; 14 | bids: string[]; 15 | missions: string[]; 16 | messages: string[]; 17 | }; 18 | export default _default; 19 | -------------------------------------------------------------------------------- /dist/drone-delivery/ProtocolTypes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const NeedParams_1 = require("./NeedParams"); 4 | const BidParams_1 = require("./BidParams"); 5 | const MissionParams_1 = require("./MissionParams"); 6 | const MessageParams_1 = require("./MessageParams"); 7 | const NeedFilterParams_1 = require("./NeedFilterParams"); 8 | exports.default = { 9 | need_filter: NeedFilterParams_1.default, 10 | need: NeedParams_1.default, 11 | bid: BidParams_1.default, 12 | mission: MissionParams_1.default, 13 | message: MessageParams_1.default, 14 | needFilters: ['need_filter'], 15 | needs: ['need'], 16 | bids: ['bid'], 17 | missions: ['mission'], 18 | messages: ['message'], 19 | }; 20 | 21 | //# sourceMappingURL=ProtocolTypes.js.map 22 | -------------------------------------------------------------------------------- /dist/drone-delivery/ProtocolTypes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-delivery/ProtocolTypes.ts"],"names":[],"mappings":";;AAAA,6CAAsC;AACtC,2CAAoC;AACpC,mDAA4C;AAC5C,mDAA4C;AAC5C,yDAAkD;AAElD,kBAAe;IACb,WAAW,EAAE,0BAAgB;IAC7B,IAAI,EAAE,oBAAU;IAChB,GAAG,EAAE,mBAAS;IACd,OAAO,EAAE,uBAAa;IACtB,OAAO,EAAE,uBAAa;IACtB,WAAW,EAAE,CAAC,aAAa,CAAC;IAC5B,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,KAAK,CAAC;IACb,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,QAAQ,EAAE,CAAC,SAAS,CAAC;CACtB,CAAC","file":"ProtocolTypes.js","sourcesContent":["import NeedParams from './NeedParams';\nimport BidParams from './BidParams';\nimport MissionParams from './MissionParams';\nimport MessageParams from './MessageParams';\nimport NeedFilterParams from './NeedFilterParams';\n\nexport default {\n need_filter: NeedFilterParams,\n need: NeedParams,\n bid: BidParams,\n mission: MissionParams,\n message: MessageParams,\n needFilters: ['need_filter'],\n needs: ['need'],\n bids: ['bid'],\n missions: ['mission'],\n messages: ['message'],\n};\n"]} -------------------------------------------------------------------------------- /dist/drone-delivery/VehicleTypes.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @enum The enum drone-delivery/VehicleTypes represent which type of vehicle will make the delivery. 3 | */ 4 | declare enum VehicleTypes { 5 | drone = "drone" 6 | } 7 | export default VehicleTypes; 8 | -------------------------------------------------------------------------------- /dist/drone-delivery/VehicleTypes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /** 4 | * @enum The enum drone-delivery/VehicleTypes represent which type of vehicle will make the delivery. 5 | */ 6 | var VehicleTypes; 7 | (function (VehicleTypes) { 8 | VehicleTypes["drone"] = "drone"; 9 | })(VehicleTypes || (VehicleTypes = {})); 10 | exports.default = VehicleTypes; 11 | 12 | //# sourceMappingURL=VehicleTypes.js.map 13 | -------------------------------------------------------------------------------- /dist/drone-delivery/VehicleTypes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/drone-delivery/VehicleTypes.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,IAAK,YAEJ;AAFD,WAAK,YAAY;IACf,+BAAe,CAAA;AACjB,CAAC,EAFI,YAAY,KAAZ,YAAY,QAEhB;AACD,kBAAe,YAAY,CAAC","file":"VehicleTypes.js","sourcesContent":["/**\n * @enum The enum drone-delivery/VehicleTypes represent which type of vehicle will make the delivery.\n */\nenum VehicleTypes {\n drone = 'drone',\n}\nexport default VehicleTypes;\n"]} -------------------------------------------------------------------------------- /dist/index.d.ts: -------------------------------------------------------------------------------- 1 | import SDKFactory from './SDKFactory'; 2 | import Mission from './Mission'; 3 | import Bid from './Bid'; 4 | import IConfig from './IConfig'; 5 | import Config from './Config'; 6 | import Message from './Message'; 7 | import Need from './Need'; 8 | import KafkaNode from './KafkaNode'; 9 | import { retryPromise } from './retryPromise'; 10 | export { SDKFactory, Mission, Bid, IConfig, Config, Message, Need, KafkaNode, retryPromise, }; 11 | -------------------------------------------------------------------------------- /dist/mocks/AxiosMock.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | declare const _default: { 3 | post: jest.Mock, any[]>; 4 | }; 5 | export default _default; 6 | -------------------------------------------------------------------------------- /dist/mocks/AxiosMock.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.default = { 4 | post: jest.fn(() => Promise.resolve()), 5 | }; 6 | 7 | //# sourceMappingURL=AxiosMock.js.map 8 | -------------------------------------------------------------------------------- /dist/mocks/AxiosMock.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/mocks/AxiosMock.ts"],"names":[],"mappings":";;AAAA,kBAAe;IACb,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;CACvC,CAAC","file":"AxiosMock.js","sourcesContent":["export default {\n post: jest.fn(() => Promise.resolve()),\n};\n"]} -------------------------------------------------------------------------------- /dist/mocks/Web3Mock.d.ts: -------------------------------------------------------------------------------- 1 | declare class Contract { 2 | static methods: any; 3 | readonly methods: any; 4 | static getPastEvents: any; 5 | readonly getPastEvents: any; 6 | } 7 | declare class Accounts { 8 | static privateKeyToAccount: any; 9 | readonly privateKeyToAccount: any; 10 | static signTransaction: any; 11 | readonly signTransaction: any; 12 | } 13 | declare class HttpProvider { 14 | } 15 | export default class Web3Mock { 16 | static providers: { 17 | HttpProvider: typeof HttpProvider; 18 | }; 19 | static eth: { 20 | Contract: typeof Contract; 21 | accounts: typeof Accounts; 22 | getGasPrice: () => number; 23 | }; 24 | readonly eth: any; 25 | utils: { 26 | sha3: (x: any) => any; 27 | toHex: (x: any) => any; 28 | }; 29 | } 30 | export {}; 31 | -------------------------------------------------------------------------------- /dist/mocks/Web3Mock.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | // tslint:disable:max-classes-per-file 4 | class Contract { 5 | get methods() { 6 | return Contract.methods; 7 | } 8 | get getPastEvents() { 9 | return Contract.getPastEvents; 10 | } 11 | } 12 | class Accounts { 13 | get privateKeyToAccount() { 14 | return Accounts.privateKeyToAccount; 15 | } 16 | get signTransaction() { 17 | return Accounts.signTransaction; 18 | } 19 | } 20 | class HttpProvider { 21 | } 22 | class Web3Mock { 23 | constructor() { 24 | this.utils = { 25 | sha3: (x) => x, 26 | toHex: (x) => x, 27 | }; 28 | } 29 | get eth() { 30 | return Web3Mock.eth; 31 | } 32 | } 33 | Web3Mock.providers = { HttpProvider }; 34 | Web3Mock.eth = { Contract, accounts: Accounts, getGasPrice: () => 1 }; 35 | exports.default = Web3Mock; 36 | 37 | //# sourceMappingURL=Web3Mock.js.map 38 | -------------------------------------------------------------------------------- /dist/retryPromise.d.ts: -------------------------------------------------------------------------------- 1 | import * as retry from 'retry'; 2 | export declare function retryPromise(promiseFactory: (currentAttempt: number) => Promise, options?: retry.OperationOptions): Promise; 3 | -------------------------------------------------------------------------------- /dist/retryPromise.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const retry = require("retry"); 4 | function retryPromise(promiseFactory, options) { 5 | return new Promise(async (resolve, reject) => { 6 | options = Object.assign({ retries: 10, minTimeout: 1000, maxTimeout: 20000, forever: false, factor: 2.0, randomize: true }, options); 7 | const operation = retry.operation(options); 8 | operation.attempt(currentAttempt => { 9 | promiseFactory(currentAttempt).then(t => resolve(t), err => { 10 | if (!operation.retry(err)) { 11 | reject(operation.mainError()); 12 | } 13 | }); 14 | }); 15 | }); 16 | } 17 | exports.retryPromise = retryPromise; 18 | 19 | //# sourceMappingURL=retryPromise.js.map 20 | -------------------------------------------------------------------------------- /dist/ride-hailing/BidParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/ride-hailing/MessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/ride-hailing/MissionParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMissionParams from '../MissionParams'; 2 | import IBaseMissionParams from '../IMissionParams'; 3 | /** 4 | * @class The Class ride-hailing/MissionParams represent the parameters of ride-hailing mission. 5 | */ 6 | export default class MissionParams extends BaseMissionParams { 7 | static _protocol: string; 8 | static _messageType: string; 9 | constructor(values?: Partial); 10 | serialize(): { 11 | ttl: number; 12 | protocol: string; 13 | type: string; 14 | }; 15 | deserialize(json: any): void; 16 | } 17 | -------------------------------------------------------------------------------- /dist/ride-hailing/MissionParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MissionParams_1 = require("../MissionParams"); 4 | /** 5 | * @class The Class ride-hailing/MissionParams represent the parameters of ride-hailing mission. 6 | */ 7 | class MissionParams extends MissionParams_1.default { 8 | constructor(values) { 9 | super(MissionParams._protocol, MissionParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MissionParams._protocol = 'ride_hailing'; 20 | MissionParams._messageType = 'mission'; 21 | exports.default = MissionParams; 22 | 23 | //# sourceMappingURL=MissionParams.js.map 24 | -------------------------------------------------------------------------------- /dist/ride-hailing/MissionParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/ride-hailing/MissionParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AAGjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAI1D,YAAY,MAAoC;QAC9C,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAda,uBAAS,GAAG,cAAc,CAAC;AAC3B,0BAAY,GAAG,SAAS,CAAC;AAFzC,gCAgBC","file":"MissionParams.js","sourcesContent":["import BaseMissionParams from '../MissionParams';\nimport IBaseMissionParams from '../IMissionParams';\n\n/**\n * @class The Class ride-hailing/MissionParams represent the parameters of ride-hailing mission.\n */\nexport default class MissionParams extends BaseMissionParams {\n public static _protocol = 'ride_hailing';\n public static _messageType = 'mission';\n\n constructor(values?: Partial) {\n super(MissionParams._protocol, MissionParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/ride-hailing/MissionParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/ride-hailing/NeedFilterParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | /** 3 | * @class The Class ride-hailing/NeedFilterParams represent the parameters that used to filter ride-hailing needs. 4 | */ 5 | export default class NeedFilterParams extends BaseNeedFilterParams { 6 | static _protocol: string; 7 | static _messageType: string; 8 | constructor(values?: Partial); 9 | serialize(): { 10 | ttl: number; 11 | protocol: string; 12 | type: string; 13 | }; 14 | deserialize(json: any): void; 15 | } 16 | -------------------------------------------------------------------------------- /dist/ride-hailing/NeedFilterParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const NeedFilterParams_1 = require("../NeedFilterParams"); 4 | /** 5 | * @class The Class ride-hailing/NeedFilterParams represent the parameters that used to filter ride-hailing needs. 6 | */ 7 | class NeedFilterParams extends NeedFilterParams_1.default { 8 | constructor(values) { 9 | super(NeedFilterParams._protocol, NeedFilterParams._messageType, values); 10 | if (!!values) { 11 | if (!values.location || 12 | !values.location.lat || 13 | !values.location.long || 14 | !values.radius) { 15 | throw new Error('NeedFilter lack of essential parameters'); 16 | } 17 | } 18 | } 19 | serialize() { 20 | const formattedParams = super.serialize(); 21 | return formattedParams; 22 | } 23 | deserialize(json) { 24 | super.deserialize(json); 25 | } 26 | } 27 | NeedFilterParams._protocol = 'ride_hailing'; 28 | NeedFilterParams._messageType = 'need_filter'; 29 | exports.default = NeedFilterParams; 30 | 31 | //# sourceMappingURL=NeedFilterParams.js.map 32 | -------------------------------------------------------------------------------- /dist/ride-hailing/NeedFilterParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/ride-hailing/NeedParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedParams from '../NeedParams'; 2 | import { ILocation } from '../common-types'; 3 | /** 4 | * @class The Class ride-hailing/NeedParams represent the parameters of ride-hailing need. 5 | */ 6 | export default class NeedParams extends BaseNeedParams { 7 | static _protocol: string; 8 | static _messageType: string; 9 | /** 10 | * @property The passenger's pickup location (required). 11 | */ 12 | pickupLocation: ILocation; 13 | /** 14 | * @property The passenger's dropoff location (required). 15 | */ 16 | destinationLocation: ILocation; 17 | constructor(values?: Partial); 18 | serialize(): { 19 | ttl: number; 20 | protocol: string; 21 | type: string; 22 | }; 23 | deserialize(json: any): void; 24 | } 25 | -------------------------------------------------------------------------------- /dist/ride-hailing/NeedParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/ride-hailing/ProtocolTypes.d.ts: -------------------------------------------------------------------------------- 1 | import NeedParams from './NeedParams'; 2 | import NeedFilterParams from './NeedFilterParams'; 3 | import BidParams from './BidParams'; 4 | import MissionParams from './MissionParams'; 5 | import MessageParams from './MessageParams'; 6 | import VehicleLocationMessageParams from './VehicleLocationMessageParams'; 7 | declare const _default: { 8 | need_filter: typeof NeedFilterParams; 9 | need: typeof NeedParams; 10 | bid: typeof BidParams; 11 | mission: typeof MissionParams; 12 | message: typeof MessageParams; 13 | vehicle_location_message: typeof VehicleLocationMessageParams; 14 | needFilters: string[]; 15 | needs: string[]; 16 | bids: string[]; 17 | missions: string[]; 18 | messages: string[]; 19 | }; 20 | export default _default; 21 | -------------------------------------------------------------------------------- /dist/ride-hailing/ProtocolTypes.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const NeedParams_1 = require("./NeedParams"); 4 | const NeedFilterParams_1 = require("./NeedFilterParams"); 5 | const BidParams_1 = require("./BidParams"); 6 | const MissionParams_1 = require("./MissionParams"); 7 | const MessageParams_1 = require("./MessageParams"); 8 | const VehicleLocationMessageParams_1 = require("./VehicleLocationMessageParams"); 9 | exports.default = { 10 | need_filter: NeedFilterParams_1.default, 11 | need: NeedParams_1.default, 12 | bid: BidParams_1.default, 13 | mission: MissionParams_1.default, 14 | message: MessageParams_1.default, 15 | vehicle_location_message: VehicleLocationMessageParams_1.default, 16 | needFilters: ['need_filter'], 17 | needs: ['need'], 18 | bids: ['bid'], 19 | missions: ['mission'], 20 | messages: ['vehicle_location_message', 'message'], 21 | }; 22 | 23 | //# sourceMappingURL=ProtocolTypes.js.map 24 | -------------------------------------------------------------------------------- /dist/ride-hailing/ProtocolTypes.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/ride-hailing/ProtocolTypes.ts"],"names":[],"mappings":";;AAAA,6CAAsC;AACtC,yDAAkD;AAClD,2CAAoC;AACpC,mDAA4C;AAC5C,mDAA4C;AAC5C,iFAA0E;AAE1E,kBAAe;IACb,WAAW,EAAE,0BAAgB;IAC7B,IAAI,EAAE,oBAAU;IAChB,GAAG,EAAE,mBAAS;IACd,OAAO,EAAE,uBAAa;IACtB,OAAO,EAAE,uBAAa;IACtB,wBAAwB,EAAE,sCAA4B;IACtD,WAAW,EAAE,CAAC,aAAa,CAAC;IAC5B,KAAK,EAAE,CAAC,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,KAAK,CAAC;IACb,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,QAAQ,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC;CAClD,CAAC","file":"ProtocolTypes.js","sourcesContent":["import NeedParams from './NeedParams';\nimport NeedFilterParams from './NeedFilterParams';\nimport BidParams from './BidParams';\nimport MissionParams from './MissionParams';\nimport MessageParams from './MessageParams';\nimport VehicleLocationMessageParams from './VehicleLocationMessageParams';\n\nexport default {\n need_filter: NeedFilterParams,\n need: NeedParams,\n bid: BidParams,\n mission: MissionParams,\n message: MessageParams,\n vehicle_location_message: VehicleLocationMessageParams,\n needFilters: ['need_filter'],\n needs: ['need'],\n bids: ['bid'],\n missions: ['mission'],\n messages: ['vehicle_location_message', 'message'],\n};\n"]} -------------------------------------------------------------------------------- /dist/ride-hailing/VehicleLocationMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams, { IMessageParams as IBaseMessageParams } from '../MessageParams'; 2 | import { ILocation } from '../common-types'; 3 | import { MissionStatus } from './MessageParams'; 4 | /** 5 | * @interface IMessageParams extends The base interface IMessageParams for ride hailing protocol for OnTheWay message only. 6 | */ 7 | interface IMessageParams extends IBaseMessageParams { 8 | /** 9 | * @property Last vehicle location. 10 | */ 11 | vehicleLocation: ILocation; 12 | } 13 | /** 14 | * @class The Class ride-hailing/MessageParams represent the parameters of ride-hailing message for OnTheWay message only. 15 | */ 16 | export default class MessageParams extends BaseMessageParams { 17 | static _protocol: string; 18 | static _messageType: string; 19 | missionStatus: MissionStatus; 20 | vehicleLocation: ILocation; 21 | constructor(values?: Partial); 22 | serialize(): { 23 | ttl: number; 24 | protocol: string; 25 | type: string; 26 | }; 27 | deserialize(json: any): void; 28 | } 29 | export {}; 30 | -------------------------------------------------------------------------------- /dist/ride-hailing/VehicleLocationMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/ride-hailing/index.d.ts: -------------------------------------------------------------------------------- 1 | import NeedParams from './NeedParams'; 2 | import NeedFilterParams from './NeedFilterParams'; 3 | import BidParams from './BidParams'; 4 | import MissionParams from './MissionParams'; 5 | import MessageParams, { MissionStatus } from './MessageParams'; 6 | import VehicleLocationMessageParams from './VehicleLocationMessageParams'; 7 | /** 8 | * @enum The enum RideHailingMissionStatus represent the mission statuses after the contract has been signed 9 | * - all statuses are sent by the driver except PassengerIsComing. 10 | */ 11 | export { NeedFilterParams, NeedParams, BidParams, MissionParams, MessageParams, VehicleLocationMessageParams, MissionStatus, }; 12 | -------------------------------------------------------------------------------- /dist/sdkLogger.d.ts: -------------------------------------------------------------------------------- 1 | declare function sdkLogger(message?: any, ...optionalParams: any[]): void; 2 | export default sdkLogger; 3 | -------------------------------------------------------------------------------- /dist/sdkLogger.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | function sdkLogger(message, ...optionalParams) { 4 | const sdkDebugLog = process.env.SDK_DEBUG_LOG === 'true'; 5 | if (sdkDebugLog) { 6 | // tslint:disable-next-line:no-console 7 | console.log(message, ...optionalParams); 8 | } 9 | } 10 | exports.default = sdkLogger; 11 | 12 | //# sourceMappingURL=sdkLogger.js.map 13 | -------------------------------------------------------------------------------- /dist/sdkLogger.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/sdkLogger.ts"],"names":[],"mappings":";;AAAA,mBAAmB,OAAa,EAAE,GAAG,cAAqB;IACxD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC;IACzD,IAAI,WAAW,EAAE;QACf,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;KACzC;AACH,CAAC;AAED,kBAAe,SAAS,CAAC","file":"sdkLogger.js","sourcesContent":["function sdkLogger(message?: any, ...optionalParams: any[]) {\n const sdkDebugLog = process.env.SDK_DEBUG_LOG === 'true';\n if (sdkDebugLog) {\n // tslint:disable-next-line:no-console\n console.log(message, ...optionalParams);\n }\n}\n\nexport default sdkLogger;\n"]} -------------------------------------------------------------------------------- /dist/tests/Bid.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/Config.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/Contracts.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/Identity.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/Kafka.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/KafkaMessageStream.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/Message.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/Mission.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/Need.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/SDK.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/SDKFactory.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/tests/SDKFactory.test.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const SDKFactory_1 = require("../SDKFactory"); 4 | const Config_1 = require("../Config"); 5 | describe('SDKFactory method', () => { 6 | it('should create SDK instance', () => { 7 | // Arrange 8 | const config = new Config_1.default({ 9 | apiSeedUrls: ['apiUrl'], 10 | ethNodeUrl: 'ethUrl', 11 | kafkaSeedUrls: ['kafkaUrl'], 12 | }); 13 | // Act 14 | const sdk = SDKFactory_1.default(config); 15 | // Assert 16 | expect(sdk.getIdentity).toBeDefined(); 17 | expect(sdk.isRegistered).toBeDefined(); 18 | expect(sdk.registerIdentity).toBeDefined(); 19 | }); 20 | }); 21 | 22 | //# sourceMappingURL=SDKFactory.test.js.map 23 | -------------------------------------------------------------------------------- /dist/tests/SDKFactory.test.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/tests/SDKFactory.test.ts"],"names":[],"mappings":";;AAAA,8CAAuC;AACvC,sCAAsC;AAEtC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,UAAU;QACV,MAAM,MAAM,GAAG,IAAI,gBAAa,CAAC;YAC/B,WAAW,EAAE,CAAC,QAAQ,CAAC;YACvB,UAAU,EAAE,QAAQ;YACpB,aAAa,EAAE,CAAC,UAAU,CAAC;SAC5B,CAAC,CAAC;QAEH,MAAM;QACN,MAAM,GAAG,GAAG,oBAAU,CAAC,MAAM,CAAC,CAAC;QAE/B,SAAS;QACT,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;QACvC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","file":"SDKFactory.test.js","sourcesContent":["import SDKFactory from '../SDKFactory';\nimport Configuration from '../Config';\n\ndescribe('SDKFactory method', () => {\n it('should create SDK instance', () => {\n // Arrange\n const config = new Configuration({\n apiSeedUrls: ['apiUrl'],\n ethNodeUrl: 'ethUrl',\n kafkaSeedUrls: ['kafkaUrl'],\n });\n\n // Act\n const sdk = SDKFactory(config);\n\n // Assert\n expect(sdk.getIdentity).toBeDefined();\n expect(sdk.isRegistered).toBeDefined();\n expect(sdk.registerIdentity).toBeDefined();\n });\n});\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/BidParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/MessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging message. 4 | */ 5 | export default abstract class MessageParams extends BaseMessageParams { 6 | static _protocol: string; 7 | constructor(messageType: string, values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/MessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(messageType, values) { 9 | super(MessageParams._protocol, messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._protocol = 'vessel_charging'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=MessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/vessel-charging/MessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/MessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AAEjD;;GAEG;AACH,mBAA4C,SAAQ,uBAAiB;IAGnE,YAAY,WAAmB,EAAE,MAA+B;QAC9D,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,uBAAS,GAAG,iBAAiB,CAAC;AAD9C,gCAeC","file":"MessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n\n/**\n * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging message.\n */\nexport default abstract class MessageParams extends BaseMessageParams {\n public static _protocol = 'vessel_charging';\n\n constructor(messageType: string, values?: Partial) {\n super(MessageParams._protocol, messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/MissionParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMissionParams from '../MissionParams'; 2 | import BaseIMissionParams from '../IMissionParams'; 3 | import { ID } from '../common-types'; 4 | /** 5 | * @interface IMissionParams The interface vessel-charging/IMissionParams represent a valid argument of vessel-charging/MissionParams constructor. 6 | */ 7 | interface IMissionParams extends BaseIMissionParams { 8 | /** 9 | * @property The mission's topic id (used to send messages to consumer). 10 | */ 11 | id: ID; 12 | } 13 | /** 14 | * @class The Class vessel-charging/MissionParams represent the parameters of vessel-charging mission. 15 | */ 16 | export default class MissionParams extends BaseMissionParams { 17 | static _protocol: string; 18 | static _messageType: string; 19 | static getMessageType(): string; 20 | static getMessageProtocol(): string; 21 | constructor(values?: Partial); 22 | serialize(): { 23 | ttl: number; 24 | protocol: string; 25 | type: string; 26 | }; 27 | deserialize(json: any): void; 28 | } 29 | export {}; 30 | -------------------------------------------------------------------------------- /dist/vessel-charging/MissionParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MissionParams_1 = require("../MissionParams"); 4 | /** 5 | * @class The Class vessel-charging/MissionParams represent the parameters of vessel-charging mission. 6 | */ 7 | class MissionParams extends MissionParams_1.default { 8 | constructor(values) { 9 | super(MissionParams._protocol, MissionParams._messageType, values); 10 | } 11 | static getMessageType() { 12 | return MissionParams._messageType; 13 | } 14 | static getMessageProtocol() { 15 | return MissionParams._protocol; 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | return formattedParams; 20 | } 21 | deserialize(json) { 22 | super.deserialize(json); 23 | } 24 | } 25 | MissionParams._protocol = 'vessel_charging'; 26 | MissionParams._messageType = 'mission'; 27 | exports.default = MissionParams; 28 | 29 | //# sourceMappingURL=MissionParams.js.map 30 | -------------------------------------------------------------------------------- /dist/vessel-charging/MissionParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/NeedFilterParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | import { IDimensions } from '../common-types'; 3 | /** 4 | * @class The Class vessel-charging/NeedFilterParams represent the parameters that used to filter vessel-charging needs. 5 | */ 6 | export default class NeedFilterParams extends BaseNeedFilterParams { 7 | static _protocol: string; 8 | static _messageType: string; 9 | maxDimensions: IDimensions; 10 | constructor(values?: Partial); 11 | serialize(): { 12 | ttl: number; 13 | protocol: string; 14 | type: string; 15 | }; 16 | deserialize(json: any): void; 17 | } 18 | -------------------------------------------------------------------------------- /dist/vessel-charging/NeedFilterParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const NeedFilterParams_1 = require("../NeedFilterParams"); 4 | /** 5 | * @class The Class vessel-charging/NeedFilterParams represent the parameters that used to filter vessel-charging needs. 6 | */ 7 | class NeedFilterParams extends NeedFilterParams_1.default { 8 | constructor(values) { 9 | super(NeedFilterParams._protocol, NeedFilterParams._messageType, values); 10 | if (!!values) { 11 | this.maxDimensions = values.maxDimensions; 12 | } 13 | } 14 | serialize() { 15 | const formattedParams = super.serialize(); 16 | Object.assign(formattedParams, { dimensions: this.maxDimensions }); 17 | return formattedParams; 18 | } 19 | deserialize(json) { 20 | super.deserialize(json); 21 | this.maxDimensions = json.dimensions; 22 | } 23 | } 24 | NeedFilterParams._protocol = 'vessel_charging'; 25 | NeedFilterParams._messageType = 'need_filter'; 26 | exports.default = NeedFilterParams; 27 | 28 | //# sourceMappingURL=NeedFilterParams.js.map 29 | -------------------------------------------------------------------------------- /dist/vessel-charging/NeedFilterParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/NeedParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedParams from '../NeedParams'; 2 | import { IDimensions } from '../common-types'; 3 | import { EnergySources, Amenities } from './enums'; 4 | /** 5 | * @class The Class vessel-charging/NeedParams represent the parameters of vessel-charging need. 6 | */ 7 | export default class NeedParams extends BaseNeedParams { 8 | static _protocol: string; 9 | static _messageType: string; 10 | radius: number; 11 | startAt: number; 12 | dimensions: IDimensions; 13 | batteryCapacity: number; 14 | currentBatteryCharge: number; 15 | energySource: EnergySources; 16 | amenities: Amenities[]; 17 | constructor(values?: Partial); 18 | serialize(): { 19 | ttl: number; 20 | protocol: string; 21 | type: string; 22 | }; 23 | deserialize(json: any): void; 24 | } 25 | -------------------------------------------------------------------------------- /dist/vessel-charging/NeedParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/enums.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum EnergySources { 2 | Grid = "grid", 3 | Renewable = "renewable", 4 | Solar = "solar", 5 | Wind = "wind", 6 | Hydro = "hydro", 7 | Geothermal = "geothermal" 8 | } 9 | export declare enum Amenities { 10 | Lodging = 1, 11 | Dining = 2, 12 | Restrooms = 3, 13 | Docking = 4, 14 | Park = 5, 15 | WiFi = 6, 16 | Shopping = 7, 17 | Grocery = 8 18 | } 19 | export declare enum PriceTypes { 20 | kwh = "kwh", 21 | second = "second", 22 | minute = "minute", 23 | hour = "hour", 24 | day = "day", 25 | week = "week", 26 | flat = "flat" 27 | } 28 | -------------------------------------------------------------------------------- /dist/vessel-charging/enums.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/enums.ts"],"names":[],"mappings":";;AAAA,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,wCAAuB,CAAA;IACvB,gCAAe,CAAA;IACf,8BAAa,CAAA;IACb,gCAAe,CAAA;IACf,0CAAyB,CAAA;AAC3B,CAAC,EAPW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAOxB;AAED,IAAY,SASX;AATD,WAAY,SAAS;IACnB,+CAAW,CAAA;IACX,6CAAU,CAAA;IACV,mDAAa,CAAA;IACb,+CAAW,CAAA;IACX,yCAAQ,CAAA;IACR,yCAAQ,CAAA;IACR,iDAAY,CAAA;IACZ,+CAAW,CAAA;AACb,CAAC,EATW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QASpB;AAED,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,2BAAa,CAAA;AACf,CAAC,EARW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAQrB","file":"enums.js","sourcesContent":["export enum EnergySources {\n Grid = 'grid',\n Renewable = 'renewable',\n Solar = 'solar',\n Wind = 'wind',\n Hydro = 'hydro',\n Geothermal = 'geothermal',\n}\n\nexport enum Amenities {\n Lodging = 1,\n Dining = 2,\n Restrooms = 3,\n Docking = 4,\n Park = 5,\n WiFi = 6,\n Shopping = 7,\n Grocery = 8,\n}\n\nexport enum PriceTypes {\n kwh = 'kwh',\n second = 'second',\n minute = 'minute',\n hour = 'hour',\n day = 'day',\n week = 'week',\n flat = 'flat',\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/index.d.ts: -------------------------------------------------------------------------------- 1 | import * as enums from './enums'; 2 | import NeedParams from './NeedParams'; 3 | import NeedFilterParams from './NeedFilterParams'; 4 | import BidParams from './BidParams'; 5 | import MissionParams from './MissionParams'; 6 | import ChargingArrivalMessageParams from './messages/ChargingArrivalMessageParams'; 7 | import ChargingCompleteMessageParams from './messages/ChargingCompleteMessageParams'; 8 | import ChargingStartedMessageParams from './messages/ChargingStartedMessageParams'; 9 | import DeclineMessageParams from './messages/DeclineMessageParams'; 10 | import ProviderStatusMessageParams from './messages/ProviderStatusMessageParams'; 11 | import StartingMessageParams from './messages/StartingMessageParams'; 12 | import StatusRequestMessageParams from './messages/StatusRequestMessageParams'; 13 | import VesselStatusMessageParams from './messages/VesselStatusMessageParams'; 14 | export { enums, NeedParams, NeedFilterParams, BidParams, MissionParams, ChargingArrivalMessageParams, ChargingCompleteMessageParams, ChargingStartedMessageParams, DeclineMessageParams, ProviderStatusMessageParams, StartingMessageParams, StatusRequestMessageParams, VesselStatusMessageParams, }; 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingArrivalMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/ChargingArrivalMessageParams represent the parameters of vessel-charging arrival message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingArrivalMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/ChargingArrivalMessageParams represent the parameters of vessel-charging arrival message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'charging_arrival_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=ChargingArrivalMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingArrivalMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/messages/ChargingArrivalMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,0BAA0B,CAAC;AAD1D,gCAeC","file":"ChargingArrivalMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class vessel-charging/ChargingArrivalMessageParams represent the parameters of vessel-charging arrival message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'charging_arrival_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingArrivalMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingCompleteMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/ChargingCompleteMessageParams represent the parameters of vessel-charging complete charging message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingCompleteMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/ChargingCompleteMessageParams represent the parameters of vessel-charging complete charging message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'charging_complete_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=ChargingCompleteMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingCompleteMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/messages/ChargingCompleteMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,2BAA2B,CAAC;AAD3D,gCAeC","file":"ChargingCompleteMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class vessel-charging/ChargingCompleteMessageParams represent the parameters of vessel-charging complete charging message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'charging_complete_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingCompleteMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingStartedMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingStartedMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | const messageParams = super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'charging_started_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=ChargingStartedMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ChargingStartedMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/messages/ChargingStartedMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;;AAba,0BAAY,GAAG,0BAA0B,CAAC;AAD1D,gCAeC","file":"ChargingStartedMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class vessel-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'charging_started_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n const messageParams = super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/messages/DeclineMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging decline mission message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/DeclineMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging decline mission message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'decline_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=DeclineMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/DeclineMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/messages/DeclineMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,iBAAiB,CAAC;AADjD,gCAeC","file":"DeclineMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging decline mission message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'decline_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/messages/DeclineMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ProviderStatusMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging provider status message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | finishEta: number; 8 | constructor(values?: Partial); 9 | serialize(): { 10 | ttl: number; 11 | protocol: string; 12 | type: string; 13 | }; 14 | deserialize(json: any): void; 15 | } 16 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/ProviderStatusMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging provider status message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | if (!!values) { 11 | if (!values.finishEta) { 12 | throw new Error('finishEta is a required field'); 13 | } 14 | this.finishEta = values.finishEta; 15 | } 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | Object.assign(formattedParams, { 20 | finishEta: this.finishEta, 21 | }); 22 | return formattedParams; 23 | } 24 | deserialize(json) { 25 | super.deserialize(json); 26 | this.finishEta = json.finishEta; 27 | } 28 | } 29 | MessageParams._messageType = 'provider_status_message'; 30 | exports.default = MessageParams; 31 | 32 | //# sourceMappingURL=ProviderStatusMessageParams.js.map 33 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StartingMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/StartingMessageParams represent the parameters of vessel-charging approve mission by the service provider message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StartingMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/StartingMessageParams represent the parameters of vessel-charging approve mission by the service provider message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'starting_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=StartingMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StartingMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/messages/StartingMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,kBAAkB,CAAC;AADlD,gCAeC","file":"StartingMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class vessel-charging/StartingMessageParams represent the parameters of vessel-charging approve mission by the service provider message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'starting_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StartingMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StatusRequestMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/StatusRequestMessageParams represent the parameters of vessel-charging status request message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | static _messageType: string; 7 | constructor(values?: Partial); 8 | serialize(): { 9 | ttl: number; 10 | protocol: string; 11 | type: string; 12 | }; 13 | deserialize(json: any): void; 14 | } 15 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StatusRequestMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/StatusRequestMessageParams represent the parameters of vessel-charging status request message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | } 11 | serialize() { 12 | const formattedParams = super.serialize(); 13 | return formattedParams; 14 | } 15 | deserialize(json) { 16 | super.deserialize(json); 17 | } 18 | } 19 | MessageParams._messageType = 'status_request_message'; 20 | exports.default = MessageParams; 21 | 22 | //# sourceMappingURL=StatusRequestMessageParams.js.map 23 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StatusRequestMessageParams.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["../src/vessel-charging/messages/StatusRequestMessageParams.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD;;GAEG;AACH,mBAAmC,SAAQ,uBAAiB;IAG1D,YAAY,MAA+B;QACzC,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEM,SAAS;QACd,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC1C,OAAO,eAAe,CAAC;IACzB,CAAC;IAEM,WAAW,CAAC,IAAS;QAC1B,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;;AAba,0BAAY,GAAG,wBAAwB,CAAC;AADxD,gCAeC","file":"StatusRequestMessageParams.js","sourcesContent":["import BaseMessageParams from '../MessageParams';\n/**\n * @class The Class vessel-charging/StatusRequestMessageParams represent the parameters of vessel-charging status request message.\n */\nexport default class MessageParams extends BaseMessageParams {\n public static _messageType = 'status_request_message';\n\n constructor(values?: Partial) {\n super(MessageParams._messageType, values);\n }\n\n public serialize() {\n const formattedParams = super.serialize();\n return formattedParams;\n }\n\n public deserialize(json: any): void {\n super.deserialize(json);\n }\n}\n"]} -------------------------------------------------------------------------------- /dist/vessel-charging/messages/StatusRequestMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/VesselStatusMessageParams.d.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | import { ILocation } from '../../common-types'; 3 | /** 4 | * @class The Class vessel-charging/VesselStatusMessageParams represent the parameters of vessel-charging consumer status message. 5 | */ 6 | export default class MessageParams extends BaseMessageParams { 7 | static _messageType: string; 8 | location: ILocation; 9 | constructor(values?: Partial); 10 | serialize(): { 11 | ttl: number; 12 | protocol: string; 13 | type: string; 14 | }; 15 | deserialize(json: any): void; 16 | } 17 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/VesselStatusMessageParams.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const MessageParams_1 = require("../MessageParams"); 4 | /** 5 | * @class The Class vessel-charging/VesselStatusMessageParams represent the parameters of vessel-charging consumer status message. 6 | */ 7 | class MessageParams extends MessageParams_1.default { 8 | constructor(values) { 9 | super(MessageParams._messageType, values); 10 | if (!!values) { 11 | if (!values.location) { 12 | throw new Error('location is a required field'); 13 | } 14 | this.location = values.location; 15 | } 16 | } 17 | serialize() { 18 | const formattedParams = super.serialize(); 19 | Object.assign(formattedParams, { 20 | location: this.location, 21 | }); 22 | return formattedParams; 23 | } 24 | deserialize(json) { 25 | super.deserialize(json); 26 | this.location = json.location; 27 | } 28 | } 29 | MessageParams._messageType = 'vessel_status_message'; 30 | exports.default = MessageParams; 31 | 32 | //# sourceMappingURL=VesselStatusMessageParams.js.map 33 | -------------------------------------------------------------------------------- /dist/vessel-charging/messages/VesselStatusMessageParams.test.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | testEnvironment: 'node', 4 | roots: ['/src'], 5 | transform: { 6 | '\\.tsx?$': 'ts-jest', 7 | "^.+\\.jsx?$": "babel-jest", 8 | }, 9 | testRegex: '(\\.(test|spec))\\.(jsx?|tsx?)$', 10 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 11 | }; 12 | -------------------------------------------------------------------------------- /samples/ride-hailing/config.ts: -------------------------------------------------------------------------------- 1 | import Config from '../../src/Config'; 2 | 3 | process.env.SDK_DEBUG_LOG = 'true'; 4 | 5 | export default new Config({ 6 | apiSeedUrls: ['http://localhost:8080'], 7 | kafkaSeedUrls: ['localhost:9092'], 8 | }); 9 | -------------------------------------------------------------------------------- /samples/vessel_charging/index.ts: -------------------------------------------------------------------------------- 1 | import Provider from './Provider'; 2 | import Consumer from './Consumer'; 3 | 4 | async function main() { 5 | const provider = new Provider(); 6 | const consumer = new Consumer(); 7 | await provider.init( 8 | '0x48a699a79fB7d2a7E9096df09f426837369d1F85', 9 | '0x8a6e061de1d2417c276277af3cc3e24ffdbbe3c662c6264c2e46cde3496df8e3', 10 | ); 11 | await consumer.init( 12 | '0xFEDdDcBf94cB620d6D92D049b75fc7062a3E2Fc6', '0xFEDdDcBf94cB620d6D92D049b75fc7062a3E2Fc6', 13 | 'PRIVATE_KEY_FOR_0xFEDdDcBf94cB620d6D92D049b75fc7062a3E2Fc6', 14 | ); 15 | await provider.start(); 16 | await new Promise(res => setTimeout(res, 1000)); 17 | await consumer.start(); 18 | } 19 | 20 | main(); 21 | -------------------------------------------------------------------------------- /speller-dictionary.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | 'params', 3 | 'ttl', 4 | 'json', 5 | 'config', 6 | 'kafka', 7 | 'dav', 8 | 'http', 9 | 'eth', 10 | 'utils', 11 | 'abi', 12 | 'init', 13 | 'tx', 14 | 'url', 15 | 'api', 16 | 'urls', 17 | 'blockchain', 18 | 'enum', 19 | 'rx', 20 | 'sdk', 21 | 'axios', 22 | 'ethereum', 23 | 'lon', 24 | 'deserialize', 25 | 'lang', 26 | 'dropoff', 27 | ]; 28 | -------------------------------------------------------------------------------- /src/BasicParams.ts: -------------------------------------------------------------------------------- 1 | import IBasicParams from './IBasicParams'; 2 | 3 | /** 4 | * @class The abstract Class BasicParams represent common parameters to all the SDK's Params classes. 5 | */ 6 | export default abstract class BasicParams { 7 | /** 8 | * Hop limit, in seconds, for the inherited class. 9 | */ 10 | public ttl?: number; // TTL in seconds 11 | 12 | public constructor( 13 | private _protocol: string, 14 | private _messageType: string, 15 | values?: Partial, 16 | ) { 17 | if (!!values) { 18 | this.ttl = values.ttl; 19 | } 20 | } 21 | 22 | public serialize() { 23 | return { 24 | ttl: this.ttl, 25 | protocol: this._protocol, 26 | type: this._messageType, 27 | }; 28 | } 29 | 30 | public get protocol(): string { 31 | return this._protocol; 32 | } 33 | 34 | public get messageType(): string { 35 | return this._messageType; 36 | } 37 | 38 | public deserialize(json: any): void { 39 | this.ttl = json.ttl; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/CommitmentConfirmation.ts: -------------------------------------------------------------------------------- 1 | import CommitmentConfirmationParams from './CommitmentConfirmationParams'; 2 | 3 | export default class CommitmentConfirmation { 4 | public get BidId() { 5 | return this._commitmentParams.bidId; 6 | } 7 | 8 | constructor(private _commitmentParams: CommitmentConfirmationParams) {} 9 | } 10 | -------------------------------------------------------------------------------- /src/CommitmentRequest.ts: -------------------------------------------------------------------------------- 1 | import Kafka from './Kafka'; 2 | import IConfig from './IConfig'; 3 | import CommitmentRequestParams from './CommitmentRequestParams'; 4 | import CommitmentConfirmationParams from './CommitmentConfirmationParams'; 5 | 6 | export default class CommitmentRequest { 7 | constructor( 8 | private _bidId: string, 9 | private _commitmentRequestParams: CommitmentRequestParams, 10 | private _config: IConfig, 11 | ) { 12 | /** */ 13 | } 14 | 15 | public async confirm() { 16 | const commitmentConfirmationParams: CommitmentConfirmationParams = new CommitmentConfirmationParams( 17 | { bidId: this._bidId }, 18 | ); 19 | await Kafka.sendParams( 20 | this._commitmentRequestParams.neederId, 21 | commitmentConfirmationParams, 22 | this._config, 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/CommitmentRequestParams.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | 3 | export interface ICommitmentRequestParams extends BasicParams { 4 | neederId: string; 5 | } 6 | 7 | export default class CommitmentRequestParams extends BasicParams { 8 | public static _protocol = ''; 9 | public static _messageType = 'commitment_request'; 10 | 11 | public neederId: string; 12 | 13 | constructor(values?: Partial) { 14 | super( 15 | CommitmentRequestParams._protocol, 16 | CommitmentRequestParams._messageType, 17 | values, 18 | ); 19 | 20 | if (!!values) { 21 | this.neederId = values.neederId; 22 | } 23 | } 24 | 25 | public serialize() { 26 | const formattedParams = super.serialize(); 27 | Object.assign(formattedParams, { 28 | neederId: this.neederId, 29 | }); 30 | return formattedParams; 31 | } 32 | 33 | public deserialize(json: any): void { 34 | super.deserialize(json); 35 | this.neederId = json.neederId; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Config.ts: -------------------------------------------------------------------------------- 1 | import IConfig from './IConfig'; 2 | import { BlockchainType } from './common-enums'; 3 | 4 | const defaultValues = { 5 | ethNodeUrl: '', 6 | apiSeedUrls: [''], 7 | kafkaSeedUrls: [''], 8 | identityTtl: 10000, 9 | needTypeTtl: 10000, 10 | needTtl: 10000, 11 | missionConsumerTtl: 10000, 12 | missionProviderTtl: 10000, 13 | kafkaBrowserPollingInterval: 1000, 14 | kafkaBrowserRequestTimeout: 500, 15 | blockchainType: BlockchainType.test, 16 | }; 17 | /** 18 | * @class The DavSDK Config Class is used to create configuration object to the SDK. 19 | */ 20 | export default class Config implements IConfig { 21 | /** 22 | * @param props Partial configuration object 23 | * @returns DavSDK configuration object. 24 | */ 25 | constructor(props: Partial) { 26 | Object.assign(this, defaultValues, props); 27 | } 28 | } 29 | 30 | export const defaultConfiguration = defaultValues; 31 | -------------------------------------------------------------------------------- /src/IBasicParams.ts: -------------------------------------------------------------------------------- 1 | export default interface IBasicParams { 2 | /** 3 | * Hop limit, in seconds, for the inherited class. 4 | */ 5 | ttl: number; // TTL in seconds 6 | } 7 | -------------------------------------------------------------------------------- /src/IBidParams.ts: -------------------------------------------------------------------------------- 1 | import IPrice from './IPrice'; 2 | import { ID, BigInteger, DavID } from './common-types'; 3 | import IBasicParams from './IBasicParams'; 4 | 5 | /** 6 | * @interface IBidParams extends The interface IBidParams represents valid arguments of BidParams constructor. 7 | */ 8 | export default interface IBidParams extends IBasicParams { 9 | /** 10 | * @property The bid's topic id (used to send messages). 11 | */ 12 | id: ID; 13 | /** 14 | * @property The bid's price. 15 | */ 16 | price: IPrice | BigInteger | Array; 17 | /** 18 | * @property The bid's vehicle DAV Id. 19 | */ 20 | vehicleId: DavID; 21 | /** 22 | * @property The consumer DAV Id. 23 | */ 24 | neederDavId: DavID; 25 | /** 26 | * @property Represents if the bidder is committed to provide this bid. 27 | */ 28 | isCommitted: boolean; 29 | } 30 | -------------------------------------------------------------------------------- /src/IMissionParams.ts: -------------------------------------------------------------------------------- 1 | import IPrice from './IPrice'; 2 | import { ID, DavID, BigInteger } from './common-types'; 3 | import IBasicParams from './IBasicParams'; 4 | 5 | /** 6 | * @interface IMissionParams The interface IMissionParams represents valid arguments of MissionParams constructor. 7 | */ 8 | export default interface IMissionParams extends IBasicParams { 9 | /** 10 | * @property The mission's topic id (used to send messages to consumer). 11 | */ 12 | id: ID; 13 | /** 14 | * @property The mission's price. 15 | */ 16 | price: IPrice | BigInteger | Array; 17 | /** 18 | * @property The mission's vehicle (provider) DAV Id. 19 | */ 20 | vehicleId: DavID; 21 | /** 22 | * @property The consumer DavID. 23 | */ 24 | neederDavId: DavID; 25 | } 26 | -------------------------------------------------------------------------------- /src/IPrice.ts: -------------------------------------------------------------------------------- 1 | import { BigInteger } from './common-types'; 2 | import { PriceType } from './common-enums'; 3 | /** 4 | * @interface IPrice Represent a mission price. 5 | */ 6 | export default interface IPrice { 7 | /** 8 | * @property The price value in Vinci. 9 | */ 10 | value: BigInteger; 11 | /** 12 | * @property The price type. 13 | */ 14 | type: PriceType; 15 | /** 16 | * @property general description of the price. 17 | */ 18 | description?: string; 19 | /** 20 | * @method equals Used to compare between two price objects. 21 | */ 22 | equals(other: IPrice): boolean; 23 | } 24 | -------------------------------------------------------------------------------- /src/Kafka.ts: -------------------------------------------------------------------------------- 1 | import { IKafka } from './common-types'; 2 | 3 | const runningOnBrowser = process.env.BROWSER || false; 4 | 5 | // tslint:disable-next-line:variable-name 6 | let Kafka: IKafka; 7 | 8 | const loadKafka = () => { 9 | if (runningOnBrowser) { 10 | Kafka = new (require('./KafkaApi')).default(); 11 | } else { 12 | Kafka = new (require('./KafkaNode')).default(); 13 | } 14 | }; 15 | loadKafka(); 16 | export default Kafka; 17 | -------------------------------------------------------------------------------- /src/KafkaBase.ts: -------------------------------------------------------------------------------- 1 | import { v4 as uuidV4 } from 'uuid'; 2 | 3 | export default abstract class KafkaBase { 4 | public generateTopicId(): string { 5 | return uuidV4(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Message.ts: -------------------------------------------------------------------------------- 1 | import IConfig from './IConfig'; 2 | import { ID } from './common-types'; 3 | import MessageParams from './MessageParams'; 4 | import Kafka from './Kafka'; 5 | /** 6 | * @class The Message Class represent a single message between consumer and service provider. 7 | */ 8 | export default class Message { 9 | public get params(): T { 10 | return this._params; 11 | } 12 | 13 | constructor(public selfId: ID, private _params: T, private config: IConfig) { 14 | /* */ 15 | } 16 | /** 17 | * @method respond Used to reply for the current message. 18 | * @param params the message parameters. 19 | */ 20 | public respond(params: MessageParams): Promise { 21 | params.senderId = this.selfId; 22 | return Kafka.sendParams(this._params.senderId, params, this.config); 23 | } 24 | /** 25 | * @method getMessageType Used to check the message type and protocol. 26 | */ 27 | public getMessageType(): string { 28 | const formattedParams = this._params.serialize(); 29 | return `${formattedParams.protocol}:${formattedParams.type}`; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/MessageParams.ts: -------------------------------------------------------------------------------- 1 | import BasicParams from './BasicParams'; 2 | import { ID, BigInteger } from './common-types'; 3 | 4 | export interface IMessageParams { 5 | /** 6 | * @property The message sender id. 7 | */ 8 | senderId: ID | BigInteger; 9 | } 10 | 11 | /** 12 | * @class The abstract Class MessageParams represent common parameters of MessageParams classes. 13 | */ 14 | export default abstract class MessageParams extends BasicParams { 15 | /** 16 | * @property The message sender id. 17 | */ 18 | public senderId: ID | BigInteger; 19 | 20 | constructor(protocol: string, type: string, values?: Partial) { 21 | super(protocol, type, values); 22 | if (!!values) { 23 | this.senderId = values.senderId; 24 | } 25 | } 26 | 27 | public serialize() { 28 | const formattedParams = super.serialize(); 29 | Object.assign(formattedParams, { senderId: this.senderId }); 30 | return formattedParams; 31 | } 32 | 33 | public deserialize(json: any): void { 34 | super.deserialize(json); 35 | this.senderId = json.senderId; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/MissionPeerIdMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from './MessageParams'; 2 | 3 | /** 4 | * @class The Class MissionPeerIdMessageParams represent internal message from provider to consumer to announce his mission selfId. 5 | */ 6 | export default class MissionPeerIdMessageParams extends BaseMessageParams { 7 | public static _protocol = ''; 8 | public static _messageType = 'mission_peer_id_message'; 9 | 10 | constructor(values?: Partial) { 11 | super( 12 | MissionPeerIdMessageParams._protocol, 13 | MissionPeerIdMessageParams._messageType, 14 | values, 15 | ); 16 | } 17 | 18 | public serialize() { 19 | const formattedParams = super.serialize(); 20 | return formattedParams; 21 | } 22 | 23 | public deserialize(json: any): void { 24 | super.deserialize(json); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Price.ts: -------------------------------------------------------------------------------- 1 | import { BigInteger } from './common-types'; 2 | import { PriceType } from './common-enums'; 3 | import IPrice from './IPrice'; 4 | /** 5 | * @class The Price class is an implementation of the IPrice interface. 6 | */ 7 | export default class Price implements IPrice { 8 | public constructor( 9 | public value: BigInteger, 10 | public type: PriceType, 11 | public description?: string, 12 | ) { 13 | /**/ 14 | } 15 | /** 16 | * @method equals used to compare between two prices object. 17 | * @param other another price object to compare to current. 18 | */ 19 | public equals(other: Price) { 20 | return ( 21 | this.value === other.value && 22 | this.type === other.type && 23 | this.description === other.description 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/SDKFactory.ts: -------------------------------------------------------------------------------- 1 | import IConfig from './IConfig'; 2 | import Config from './Config'; 3 | import SDK from './SDK'; 4 | /** 5 | * @function SDKFactory create an instance of DAV SDK. 6 | * @param config DAV configuration object. 7 | * @returns DavSDK instance with the specified configuration object. 8 | */ 9 | export default function SDKFactory(config: IConfig): SDK { 10 | const configuration = new Config(config); 11 | return new SDK(configuration); 12 | } 13 | -------------------------------------------------------------------------------- /src/common-enums.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @enum The enum PriceType represent the type of the price of the service. 3 | */ 4 | export enum PriceType { 5 | flat = 'flat', 6 | } 7 | /** 8 | * @enum The enum BlockchainType represent the type of the blockchain network. 9 | */ 10 | export enum BlockchainType { 11 | local = 'local', 12 | test = 'ropsten', 13 | main = 'main', 14 | } 15 | /** 16 | * @enum The enum ContractTypes represent the dav contracts names. 17 | */ 18 | export enum ContractTypes { 19 | identity = 'Identity', 20 | davToken = 'DAVToken', 21 | basicMission = 'BasicMission', 22 | } 23 | -------------------------------------------------------------------------------- /src/drone-charging/MessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | 3 | /** 4 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging message. 5 | */ 6 | export default abstract class MessageParams extends BaseMessageParams { 7 | public static _protocol = 'drone_charging'; 8 | 9 | constructor(messageType: string, values?: Partial) { 10 | super(MessageParams._protocol, messageType, values); 11 | } 12 | 13 | public serialize() { 14 | const formattedParams = super.serialize(); 15 | return formattedParams; 16 | } 17 | 18 | public deserialize(json: any): void { 19 | super.deserialize(json); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/drone-charging/NeedFilterParams.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | import { IDimensions } from '../common-types'; 3 | 4 | /** 5 | * @class The Class drone-charging/NeedFilterParams represent the parameters that used to filter drone-charging needs. 6 | */ 7 | export default class NeedFilterParams extends BaseNeedFilterParams { 8 | public static _protocol = 'drone_charging'; 9 | public static _messageType = 'need_filter'; 10 | 11 | public maxDimensions: IDimensions; 12 | 13 | constructor(values?: Partial) { 14 | super(NeedFilterParams._protocol, NeedFilterParams._messageType, values); 15 | if (!!values) { 16 | this.maxDimensions = values.maxDimensions; 17 | } 18 | } 19 | 20 | public serialize() { 21 | const formattedParams = super.serialize(); 22 | Object.assign(formattedParams, { dimensions: this.maxDimensions }); 23 | return formattedParams; 24 | } 25 | 26 | public deserialize(json: any): void { 27 | super.deserialize(json); 28 | this.maxDimensions = json.dimensions; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/drone-charging/enums.ts: -------------------------------------------------------------------------------- 1 | export enum EnergySources { 2 | Grid = 'grid', 3 | Renewable = 'renewable', 4 | Solar = 'solar', 5 | Wind = 'wind', 6 | Hydro = 'hydro', 7 | Geothermal = 'geothermal', 8 | } 9 | 10 | export enum Amenities { 11 | Park = 1, 12 | } 13 | 14 | export enum PriceTypes { 15 | kwh = 'kwh', 16 | second = 'second', 17 | minute = 'minute', 18 | hour = 'hour', 19 | day = 'day', 20 | week = 'week', 21 | flat = 'flat', 22 | } 23 | -------------------------------------------------------------------------------- /src/drone-charging/messages/ChargingArrivalMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/ChargingArrivalMessageParams represent the parameters of drone-charging arrival message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'charging_arrival_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/drone-charging/messages/ChargingCompleteMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/ChargingCompleteMessageParams represent the parameters of drone-charging complete charging message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'charging_complete_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/drone-charging/messages/ChargingStartedMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'charging_started_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | const messageParams = super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/drone-charging/messages/DeclineMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging decline mission message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'decline_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/drone-charging/messages/DroneStatusMessageParams.test.ts: -------------------------------------------------------------------------------- 1 | import MessageParams from './DroneStatusMessageParams'; 2 | 3 | describe('MessageParams class', () => { 4 | const messageParams = new MessageParams({ 5 | location: { 6 | lat: 32.050382, 7 | long: 34.766149, 8 | }, 9 | }); 10 | 11 | const serializedMessageParams: any = { 12 | senderId: undefined, 13 | protocol: 'drone_charging', 14 | ttl: undefined, 15 | type: 'drone_status_message', 16 | location: { lat: 32.050382, long: 34.766149 }, 17 | }; 18 | 19 | describe('serialize method', () => { 20 | it('should return serialized need params object with the current values', () => { 21 | expect(messageParams.serialize()).toEqual(serializedMessageParams); 22 | }); 23 | }); 24 | 25 | describe('deserialize method', () => { 26 | it('should return NeedParams instance with the current parameters', () => { 27 | const messageParamsObject = new MessageParams(); 28 | messageParamsObject.deserialize(serializedMessageParams); 29 | expect(messageParamsObject).toEqual(messageParams); 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /src/drone-charging/messages/DroneStatusMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | import { ILocation } from '../../common-types'; 3 | /** 4 | * @class The Class drone-charging/DroneStatusMessageParams represent the parameters of drone-charging consumer status message. 5 | */ 6 | export default class MessageParams extends BaseMessageParams { 7 | public static _messageType = 'drone_status_message'; 8 | public location: ILocation; 9 | 10 | constructor(values?: Partial) { 11 | super(MessageParams._messageType, values); 12 | if (!!values) { 13 | if (!values.location) { 14 | throw new Error('location is a required field'); 15 | } 16 | this.location = values.location; 17 | } 18 | } 19 | 20 | public serialize() { 21 | const formattedParams = super.serialize(); 22 | Object.assign(formattedParams, { 23 | location: this.location, 24 | }); 25 | return formattedParams; 26 | } 27 | 28 | public deserialize(json: any): void { 29 | super.deserialize(json); 30 | this.location = json.location; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/drone-charging/messages/ProviderStatusMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/MessageParams represent the parameters of drone-charging provider status message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'provider_status_message'; 7 | public finishEta: number; 8 | 9 | constructor(values?: Partial) { 10 | super(MessageParams._messageType, values); 11 | if (!!values) { 12 | if (!values.finishEta) { 13 | throw new Error('finishEta is a required field'); 14 | } 15 | this.finishEta = values.finishEta; 16 | } 17 | } 18 | 19 | public serialize() { 20 | const formattedParams = super.serialize(); 21 | Object.assign(formattedParams, { 22 | finishEta: this.finishEta, 23 | }); 24 | return formattedParams; 25 | } 26 | 27 | public deserialize(json: any): void { 28 | super.deserialize(json); 29 | this.finishEta = json.finishEta; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/drone-charging/messages/StartingMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/StartingMessageParams represent the parameters of drone-charging approve mission by the service provider message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'starting_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/drone-charging/messages/StatusRequestMessageParams.test.ts: -------------------------------------------------------------------------------- 1 | import MessageParams from './StatusRequestMessageParams'; 2 | 3 | describe('MessageParams class', () => { 4 | const messageParams = new MessageParams({ senderId: 'senderId' }); // <-- Causing TypeError 5 | const serializedMessageParams: any = { 6 | protocol: 'drone_charging', 7 | ttl: undefined, 8 | type: 'status_request_message', 9 | senderId: 'senderId', 10 | }; 11 | 12 | describe('serialize method', () => { 13 | it('should return serialized message params object with the current values', () => { 14 | expect(messageParams.serialize()).toEqual(serializedMessageParams); 15 | }); 16 | }); 17 | 18 | describe('deserialize method', () => { 19 | it('should return MessageParams instance with the current parameters', () => { 20 | const messageParamsObject = new MessageParams(); 21 | messageParamsObject.deserialize(serializedMessageParams); 22 | expect(messageParamsObject).toEqual(messageParams); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/drone-charging/messages/StatusRequestMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class drone-charging/StatusRequestMessageParams represent the parameters of drone-charging status request message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'status_request_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/drone-delivery/MessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | 3 | /** 4 | * @class The Class drone-delivery/MessageParams represent the parameters of drone-delivery message. 5 | */ 6 | export default class MessageParams extends BaseMessageParams { 7 | private static _protocol = 'drone_delivery'; 8 | private static _type = 'message'; 9 | 10 | public static getMessageType(): string { 11 | return MessageParams._type; 12 | } 13 | 14 | public static getMessageProtocol(): string { 15 | return MessageParams._protocol; 16 | } 17 | 18 | constructor(values?: Partial) { 19 | super(MessageParams._protocol, MessageParams._type, values); 20 | } 21 | 22 | public serialize() { 23 | return super.serialize(); 24 | } 25 | 26 | public deserialize(json: any): void { 27 | super.deserialize(json); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/drone-delivery/MissionParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMissionParams from '../MissionParams'; 2 | import { ID, DavID, BigInteger } from '../common-types'; 3 | import IPrice from '../IPrice'; 4 | import IMissionParams from '../IMissionParams'; 5 | 6 | /** 7 | * @class The Class drone-delivery/MissionParams represent the parameters of drone-delivery mission. 8 | */ 9 | export default class MissionParams extends BaseMissionParams { 10 | private static _protocol = 'drone_delivery'; 11 | private static _type = 'mission'; 12 | 13 | public static getMessageType(): string { 14 | return MissionParams._type; 15 | } 16 | 17 | public static getMessageProtocol(): string { 18 | return MissionParams._protocol; 19 | } 20 | 21 | constructor(values?: Partial) { 22 | super(MissionParams._protocol, MissionParams._type, values); 23 | } 24 | 25 | public serialize() { 26 | const formattedParams = super.serialize(); 27 | return formattedParams; 28 | } 29 | 30 | public deserialize(json: any): void { 31 | super.deserialize(json); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/drone-delivery/NeedFilterParams.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | import { IDimensions } from '../common-types'; 3 | 4 | /** 5 | * @class The Class drone-delivery/NeedFilterParams represent the parameters that used to filter drone-delivery needs. 6 | */ 7 | export default class NeedFilterParams extends BaseNeedFilterParams { 8 | private static _protocol = 'drone_delivery'; 9 | private static _type = 'need_filter'; 10 | public maxDimensions: IDimensions; 11 | 12 | public static getMessageType(): string { 13 | return NeedFilterParams._type; 14 | } 15 | 16 | public static getMessageProtocol(): string { 17 | return NeedFilterParams._protocol; 18 | } 19 | 20 | constructor(values?: Partial) { 21 | super(NeedFilterParams._protocol, NeedFilterParams._type, values); 22 | } 23 | 24 | public serialize() { 25 | const formattedParams = super.serialize(); 26 | Object.assign(formattedParams, { dimensions: this.maxDimensions }); 27 | return formattedParams; 28 | } 29 | 30 | public deserialize(json: any): void { 31 | super.deserialize(json); 32 | this.maxDimensions = json.dimensions; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/drone-delivery/ProtocolTypes.ts: -------------------------------------------------------------------------------- 1 | import NeedParams from './NeedParams'; 2 | import BidParams from './BidParams'; 3 | import MissionParams from './MissionParams'; 4 | import MessageParams from './MessageParams'; 5 | import NeedFilterParams from './NeedFilterParams'; 6 | 7 | export default { 8 | need_filter: NeedFilterParams, 9 | need: NeedParams, 10 | bid: BidParams, 11 | mission: MissionParams, 12 | message: MessageParams, 13 | needFilters: ['need_filter'], 14 | needs: ['need'], 15 | bids: ['bid'], 16 | missions: ['mission'], 17 | messages: ['message'], 18 | }; 19 | -------------------------------------------------------------------------------- /src/drone-delivery/VehicleTypes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @enum The enum drone-delivery/VehicleTypes represent which type of vehicle will make the delivery. 3 | */ 4 | enum VehicleTypes { 5 | drone = 'drone', 6 | } 7 | export default VehicleTypes; 8 | -------------------------------------------------------------------------------- /src/gulpfile.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAVFoundation/dav-js/a5c0cc1708bc77eb28b78e05f1ca802b7f840ae5/src/gulpfile.js -------------------------------------------------------------------------------- /src/mocks/AxiosMock.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | post: jest.fn(() => Promise.resolve()), 3 | }; 4 | -------------------------------------------------------------------------------- /src/mocks/Web3Mock.ts: -------------------------------------------------------------------------------- 1 | // tslint:disable:max-classes-per-file 2 | class Contract { 3 | public static methods: any; 4 | public get methods(): any { 5 | return Contract.methods; 6 | } 7 | public static getPastEvents: any; 8 | public get getPastEvents(): any { 9 | return Contract.getPastEvents; 10 | } 11 | } 12 | 13 | class Accounts { 14 | public static privateKeyToAccount: any; 15 | public get privateKeyToAccount(): any { 16 | return Accounts.privateKeyToAccount; 17 | } 18 | public static signTransaction: any; 19 | public get signTransaction(): any { 20 | return Accounts.signTransaction; 21 | } 22 | } 23 | 24 | class HttpProvider { } 25 | 26 | export default class Web3Mock { 27 | public static providers = { HttpProvider }; 28 | public static eth = { Contract, accounts: Accounts, getGasPrice: () => 1 }; 29 | public get eth(): any { 30 | return Web3Mock.eth; 31 | } 32 | public utils = { 33 | sha3: (x: any) => x, 34 | toHex: (x: any) => x, 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /src/retryPromise.ts: -------------------------------------------------------------------------------- 1 | import * as retry from 'retry'; 2 | 3 | export function retryPromise( 4 | promiseFactory: (currentAttempt: number) => Promise, 5 | options?: retry.OperationOptions, 6 | ): Promise { 7 | return new Promise(async (resolve, reject) => { 8 | options = { 9 | retries: 10, 10 | minTimeout: 1000, 11 | maxTimeout: 20000, 12 | forever: false, 13 | factor: 2.0, 14 | randomize: true, 15 | ...options, 16 | }; 17 | const operation = retry.operation(options); 18 | operation.attempt(currentAttempt => { 19 | promiseFactory(currentAttempt).then( 20 | t => resolve(t), 21 | err => { 22 | if (!operation.retry(err)) { 23 | reject(operation.mainError()); 24 | } 25 | }, 26 | ); 27 | }); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /src/ride-hailing/MissionParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMissionParams from '../MissionParams'; 2 | import IBaseMissionParams from '../IMissionParams'; 3 | 4 | /** 5 | * @class The Class ride-hailing/MissionParams represent the parameters of ride-hailing mission. 6 | */ 7 | export default class MissionParams extends BaseMissionParams { 8 | public static _protocol = 'ride_hailing'; 9 | public static _messageType = 'mission'; 10 | 11 | constructor(values?: Partial) { 12 | super(MissionParams._protocol, MissionParams._messageType, values); 13 | } 14 | 15 | public serialize() { 16 | const formattedParams = super.serialize(); 17 | return formattedParams; 18 | } 19 | 20 | public deserialize(json: any): void { 21 | super.deserialize(json); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/ride-hailing/NeedFilterParams.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | 3 | /** 4 | * @class The Class ride-hailing/NeedFilterParams represent the parameters that used to filter ride-hailing needs. 5 | */ 6 | export default class NeedFilterParams extends BaseNeedFilterParams { 7 | public static _protocol = 'ride_hailing'; 8 | public static _messageType = 'need_filter'; 9 | 10 | constructor(values?: Partial) { 11 | super(NeedFilterParams._protocol, NeedFilterParams._messageType, values); 12 | if (!!values) { 13 | if ( 14 | !values.location || 15 | !values.location.lat || 16 | !values.location.long || 17 | !values.radius 18 | ) { 19 | throw new Error('NeedFilter lack of essential parameters'); 20 | } 21 | } 22 | } 23 | 24 | public serialize() { 25 | const formattedParams = super.serialize(); 26 | return formattedParams; 27 | } 28 | 29 | public deserialize(json: any): void { 30 | super.deserialize(json); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/ride-hailing/ProtocolTypes.ts: -------------------------------------------------------------------------------- 1 | import NeedParams from './NeedParams'; 2 | import NeedFilterParams from './NeedFilterParams'; 3 | import BidParams from './BidParams'; 4 | import MissionParams from './MissionParams'; 5 | import MessageParams from './MessageParams'; 6 | import VehicleLocationMessageParams from './VehicleLocationMessageParams'; 7 | 8 | export default { 9 | need_filter: NeedFilterParams, 10 | need: NeedParams, 11 | bid: BidParams, 12 | mission: MissionParams, 13 | message: MessageParams, 14 | vehicle_location_message: VehicleLocationMessageParams, 15 | needFilters: ['need_filter'], 16 | needs: ['need'], 17 | bids: ['bid'], 18 | missions: ['mission'], 19 | messages: ['vehicle_location_message', 'message'], 20 | }; 21 | -------------------------------------------------------------------------------- /src/ride-hailing/VehicleLocationMessageParams.test.ts: -------------------------------------------------------------------------------- 1 | import MessageParams from './VehicleLocationMessageParams'; 2 | 3 | describe('MessageParams class', () => { 4 | const messageParams = new MessageParams({ 5 | vehicleLocation: { 6 | lat: 32.050382, 7 | long: 34.766149, 8 | }, 9 | }); 10 | 11 | const serializedMessageParams: any = { 12 | missionStatus: 'on_the_way', 13 | protocol: 'ride_hailing', 14 | ttl: undefined, 15 | type: 'vehicle_location_message', 16 | vehicleLocation: { lat: 32.050382, long: 34.766149 }, 17 | }; 18 | 19 | describe('serialize method', () => { 20 | it('should return serialized need params object with the current values', () => { 21 | expect(messageParams.serialize()).toEqual(serializedMessageParams); 22 | }); 23 | }); 24 | 25 | describe('deserialize method', () => { 26 | it('should return NeedParams instance with the current parameters', () => { 27 | const messageParamsObject = new MessageParams(); 28 | messageParamsObject.deserialize(serializedMessageParams); 29 | expect(messageParamsObject).toEqual(messageParams); 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /src/sdkLogger.ts: -------------------------------------------------------------------------------- 1 | function sdkLogger(message?: any, ...optionalParams: any[]) { 2 | const sdkDebugLog = process.env.SDK_DEBUG_LOG === 'true'; 3 | if (sdkDebugLog) { 4 | // tslint:disable-next-line:no-console 5 | console.log(message, ...optionalParams); 6 | } 7 | } 8 | 9 | export default sdkLogger; 10 | -------------------------------------------------------------------------------- /src/tests/SDKFactory.test.ts: -------------------------------------------------------------------------------- 1 | import SDKFactory from '../SDKFactory'; 2 | import Configuration from '../Config'; 3 | 4 | describe('SDKFactory method', () => { 5 | it('should create SDK instance', () => { 6 | // Arrange 7 | const config = new Configuration({ 8 | apiSeedUrls: ['apiUrl'], 9 | ethNodeUrl: 'ethUrl', 10 | kafkaSeedUrls: ['kafkaUrl'], 11 | }); 12 | 13 | // Act 14 | const sdk = SDKFactory(config); 15 | 16 | // Assert 17 | expect(sdk.getIdentity).toBeDefined(); 18 | expect(sdk.isRegistered).toBeDefined(); 19 | expect(sdk.registerIdentity).toBeDefined(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /src/tests~HEAD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAVFoundation/dav-js/a5c0cc1708bc77eb28b78e05f1ca802b7f840ae5/src/tests~HEAD -------------------------------------------------------------------------------- /src/vessel-charging/MessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | 3 | /** 4 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging message. 5 | */ 6 | export default abstract class MessageParams extends BaseMessageParams { 7 | public static _protocol = 'vessel_charging'; 8 | 9 | constructor(messageType: string, values?: Partial) { 10 | super(MessageParams._protocol, messageType, values); 11 | } 12 | 13 | public serialize() { 14 | const formattedParams = super.serialize(); 15 | return formattedParams; 16 | } 17 | 18 | public deserialize(json: any): void { 19 | super.deserialize(json); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/vessel-charging/NeedFilterParams.ts: -------------------------------------------------------------------------------- 1 | import BaseNeedFilterParams from '../NeedFilterParams'; 2 | import { IDimensions } from '../common-types'; 3 | 4 | /** 5 | * @class The Class vessel-charging/NeedFilterParams represent the parameters that used to filter vessel-charging needs. 6 | */ 7 | export default class NeedFilterParams extends BaseNeedFilterParams { 8 | public static _protocol = 'vessel_charging'; 9 | public static _messageType = 'need_filter'; 10 | 11 | public maxDimensions: IDimensions; 12 | 13 | constructor(values?: Partial) { 14 | super(NeedFilterParams._protocol, NeedFilterParams._messageType, values); 15 | if (!!values) { 16 | this.maxDimensions = values.maxDimensions; 17 | } 18 | } 19 | 20 | public serialize() { 21 | const formattedParams = super.serialize(); 22 | Object.assign(formattedParams, { dimensions: this.maxDimensions }); 23 | return formattedParams; 24 | } 25 | 26 | public deserialize(json: any): void { 27 | super.deserialize(json); 28 | this.maxDimensions = json.dimensions; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/vessel-charging/enums.ts: -------------------------------------------------------------------------------- 1 | export enum EnergySources { 2 | Grid = 'grid', 3 | Renewable = 'renewable', 4 | Solar = 'solar', 5 | Wind = 'wind', 6 | Hydro = 'hydro', 7 | Geothermal = 'geothermal', 8 | } 9 | 10 | export enum Amenities { 11 | Lodging = 1, 12 | Dining = 2, 13 | Restrooms = 3, 14 | Docking = 4, 15 | Park = 5, 16 | WiFi = 6, 17 | Shopping = 7, 18 | Grocery = 8, 19 | } 20 | 21 | export enum PriceTypes { 22 | kwh = 'kwh', 23 | second = 'second', 24 | minute = 'minute', 25 | hour = 'hour', 26 | day = 'day', 27 | week = 'week', 28 | flat = 'flat', 29 | } 30 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/ChargingArrivalMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/ChargingArrivalMessageParams represent the parameters of vessel-charging arrival message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'charging_arrival_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/ChargingCompleteMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/ChargingCompleteMessageParams represent the parameters of vessel-charging complete charging message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'charging_complete_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/ChargingStartedMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/ChargingStartedMessageParams represent the parameters of provider notifying that charging has begun. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'charging_started_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | const messageParams = super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/DeclineMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging decline mission message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'decline_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/ProviderStatusMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/MessageParams represent the parameters of vessel-charging provider status message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'provider_status_message'; 7 | public finishEta: number; 8 | 9 | constructor(values?: Partial) { 10 | super(MessageParams._messageType, values); 11 | if (!!values) { 12 | if (!values.finishEta) { 13 | throw new Error('finishEta is a required field'); 14 | } 15 | this.finishEta = values.finishEta; 16 | } 17 | } 18 | 19 | public serialize() { 20 | const formattedParams = super.serialize(); 21 | Object.assign(formattedParams, { 22 | finishEta: this.finishEta, 23 | }); 24 | return formattedParams; 25 | } 26 | 27 | public deserialize(json: any): void { 28 | super.deserialize(json); 29 | this.finishEta = json.finishEta; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/StartingMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/StartingMessageParams represent the parameters of vessel-charging approve mission by the service provider message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'starting_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/StatusRequestMessageParams.test.ts: -------------------------------------------------------------------------------- 1 | import MessageParams from './StatusRequestMessageParams'; 2 | 3 | describe('MessageParams class', () => { 4 | const messageParams = new MessageParams({ senderId: 'senderId' }); // <-- Causing TypeError 5 | const serializedMessageParams: any = { 6 | protocol: 'vessel_charging', 7 | ttl: undefined, 8 | type: 'status_request_message', 9 | senderId: 'senderId', 10 | }; 11 | 12 | describe('serialize method', () => { 13 | it('should return serialized message params object with the current values', () => { 14 | expect(messageParams.serialize()).toEqual(serializedMessageParams); 15 | }); 16 | }); 17 | 18 | describe('deserialize method', () => { 19 | it('should return MessageParams instance with the current parameters', () => { 20 | const messageParamsObject = new MessageParams(); 21 | messageParamsObject.deserialize(serializedMessageParams); 22 | expect(messageParamsObject).toEqual(messageParams); 23 | }); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/StatusRequestMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | /** 3 | * @class The Class vessel-charging/StatusRequestMessageParams represent the parameters of vessel-charging status request message. 4 | */ 5 | export default class MessageParams extends BaseMessageParams { 6 | public static _messageType = 'status_request_message'; 7 | 8 | constructor(values?: Partial) { 9 | super(MessageParams._messageType, values); 10 | } 11 | 12 | public serialize() { 13 | const formattedParams = super.serialize(); 14 | return formattedParams; 15 | } 16 | 17 | public deserialize(json: any): void { 18 | super.deserialize(json); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/VesselStatusMessageParams.test.ts: -------------------------------------------------------------------------------- 1 | import MessageParams from './VesselStatusMessageParams'; 2 | 3 | describe('MessageParams class', () => { 4 | const messageParams = new MessageParams({ 5 | location: { 6 | lat: 32.050382, 7 | long: 34.766149, 8 | }, 9 | }); 10 | 11 | const serializedMessageParams: any = { 12 | senderId: undefined, 13 | protocol: 'vessel_charging', 14 | ttl: undefined, 15 | type: 'vessel_status_message', 16 | location: { lat: 32.050382, long: 34.766149 }, 17 | }; 18 | 19 | describe('serialize method', () => { 20 | it('should return serialized need params object with the current values', () => { 21 | expect(messageParams.serialize()).toEqual(serializedMessageParams); 22 | }); 23 | }); 24 | 25 | describe('deserialize method', () => { 26 | it('should return NeedParams instance with the current parameters', () => { 27 | const messageParamsObject = new MessageParams(); 28 | messageParamsObject.deserialize(serializedMessageParams); 29 | expect(messageParamsObject).toEqual(messageParams); 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /src/vessel-charging/messages/VesselStatusMessageParams.ts: -------------------------------------------------------------------------------- 1 | import BaseMessageParams from '../MessageParams'; 2 | import { ILocation } from '../../common-types'; 3 | /** 4 | * @class The Class vessel-charging/VesselStatusMessageParams represent the parameters of vessel-charging consumer status message. 5 | */ 6 | export default class MessageParams extends BaseMessageParams { 7 | public static _messageType = 'vessel_status_message'; 8 | public location: ILocation; 9 | 10 | constructor(values?: Partial) { 11 | super(MessageParams._messageType, values); 12 | if (!!values) { 13 | if (!values.location) { 14 | throw new Error('location is a required field'); 15 | } 16 | this.location = values.location; 17 | } 18 | } 19 | 20 | public serialize() { 21 | const formattedParams = super.serialize(); 22 | Object.assign(formattedParams, { 23 | location: this.location, 24 | }); 25 | return formattedParams; 26 | } 27 | 28 | public deserialize(json: any): void { 29 | super.deserialize(json); 30 | this.location = json.location; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /truffle.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | contracts_directory: './node_modules/dav-contracts/contracts', 3 | migrations_directory: './node_modules/dav-contracts/migrations', 4 | networks: { 5 | development: { 6 | host: 'localhost', 7 | port: 8545, 8 | network_id: '*', // Match any network id 9 | }, 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "target": "es2018", 5 | "module": "commonjs", 6 | "noImplicitAny": true, 7 | "removeComments": false, 8 | "preserveConstEnums": true, 9 | "sourceMap": true, 10 | "skipLibCheck": true, 11 | "lib": [ 12 | "es2017", 13 | "dom" 14 | ], 15 | "outDir": "build" 16 | }, 17 | "include": [ 18 | "src/**/*", 19 | "samples/**/*" 20 | ], 21 | "exclude": [ 22 | "node_modules" 23 | ], 24 | } 25 | -------------------------------------------------------------------------------- /typedoc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | out: 'docs/api', 3 | module: 'commonjs', 4 | target: 'es2017', 5 | name: 'DAV Network Javascript SDK', 6 | exclude: 7 | '**/*+(test|ContractsIntegrationSimulator|Kafka|Contracts|KafkaMessageStream|KafkaApi|KafkaBase|KafkaNode).ts', 8 | excludeExternals: true, 9 | ignoreCompilerErrors: true 10 | }; 11 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | output: { 5 | path: path.resolve(__dirname, 'dist'), 6 | publicPath: '/', 7 | filename: 'dav.js', 8 | sourceMapFilename: '[file].map', 9 | }, 10 | module: { 11 | rules: [ 12 | { 13 | test: /\.js$/, 14 | exclude: /node_modules/, 15 | use: { 16 | loader: 'babel-loader', 17 | }, 18 | }, 19 | ], 20 | }, 21 | }; 22 | --------------------------------------------------------------------------------