├── .dockerignore ├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE │ └── default.md ├── pull_request_template.md └── workflows │ ├── _main_sth-build-test-node-18.yml │ ├── analyze-code.yml │ ├── build-docker-prerunner.yml │ ├── build-docker-runner-node.yml │ ├── build-docker-runner-python.yml │ ├── build-docker-sth.yml │ ├── build-refapps.yml │ ├── build-sth.yml │ ├── preinstall-deps.yml │ ├── publish-release.yml │ ├── release-test.yml │ ├── security-check.yml │ ├── test-bdd-docker.yml │ ├── test-bdd-process.yml │ └── test-unit.yml ├── .gitignore ├── .husky └── .gitignore ├── .markdownlint.json ├── .prettierrc ├── .vscode ├── launch.json └── settings.json ├── .work └── .keep ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── ENV_VARS.md ├── FUNDING.yml ├── LICENSE ├── README.md ├── bdd ├── .eslintrc ├── README.md ├── cucumber.js ├── data │ ├── cities.json │ ├── data.json │ ├── python-weather-startup-config.json │ ├── runner-messages.ts │ ├── sample-config-exit.json │ ├── sample-config-output.txt │ ├── sample-config.json │ ├── sample-log.log.ansi │ ├── sample-log.log.plain │ ├── sample-log.log.source │ ├── seq-startup-config.json │ ├── sequences │ │ ├── args-config-test │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── args-to-output │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── bin-out-seq │ │ │ ├── dist │ │ │ │ ├── index.js │ │ │ │ ├── node_modules │ │ │ │ │ └── .package-lock.json │ │ │ │ ├── package-lock.json │ │ │ │ ├── package.json │ │ │ │ └── random.bin │ │ │ ├── index.ts │ │ │ ├── package.json │ │ │ ├── random.bin │ │ │ └── tsconfig.json │ │ ├── deploy-app │ │ │ ├── dist │ │ │ │ ├── index.js │ │ │ │ ├── package-lock.json │ │ │ │ └── package.json │ │ │ ├── index.ts │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ └── tsconfig.json │ │ ├── event-sequence │ │ │ ├── index.js │ │ │ └── package.json │ │ └── simple-stdio │ │ │ ├── index.js │ │ │ └── package.json │ ├── test-data │ │ ├── checksum.json │ │ ├── sample_unicode_1.txt │ │ ├── sth-config.json │ │ └── sth-config.yml │ └── tsconfig.json ├── features │ ├── RM-001-runner-mock.feature │ ├── e2e │ │ ├── E2E-001-samples.feature │ │ ├── E2E-002-stop.feature │ │ ├── E2E-003-kill.feature │ │ ├── E2E-007-host-client.feature │ │ ├── E2E-008-host-api.feature │ │ ├── E2E-010-cli.feature │ │ ├── E2E-011-cli-topic.feature │ │ ├── E2E-012-cli-config.feature │ │ ├── E2E-012-stream-flooding-test.feature │ │ ├── E2E-013-topic.feature │ │ ├── E2E-014-python.feature │ │ ├── E2E-015-unified.feature │ │ └── E2E-016-errors.feature │ ├── hub │ │ ├── HUB-001-host-config.feature │ │ └── HUB-002-host-iac.feature │ ├── performance-tests │ │ ├── PT-001-durability.feature │ │ ├── PT-002-function-call-delay.feature │ │ ├── PT-003-process-large-file.feature │ │ ├── PT-004-checksum.feature │ │ ├── PT-005-ports.feature │ │ └── PT-006-durability-ports.feature │ └── reference-apps │ │ ├── RA-001-inert-apps.feature │ │ ├── RA-002-read-apps.feature │ │ ├── RA-003-transform-apps.feature │ │ ├── RA-004-write-apps.feature │ │ └── RA-005-transform-apps.feature ├── iac-test-data │ ├── sequences │ │ ├── hello-1 │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── hello-2 │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── hub-client │ │ │ ├── index.js │ │ │ └── package.json │ │ └── infinite │ │ │ ├── index.js │ │ │ └── package.json │ ├── start-config-hubclient.json │ └── start-config.json ├── lib │ ├── host-utils.ts │ ├── json.parser.ts │ └── utils.ts ├── package.json ├── reports │ ├── .keep │ └── .work │ │ └── .keep ├── step-definitions │ ├── e2e │ │ ├── cli.ts │ │ ├── expectedResponses.ts │ │ └── host-steps.ts │ ├── hub │ │ └── config.ts │ ├── performance-tests │ │ └── delay-test-steps.ts │ └── world.ts ├── tsconfig.json └── yarn.lock ├── conf ├── .eslintrc ├── config.json ├── launch.json └── readme-parts │ ├── contrib.md │ ├── license-agpl.md │ ├── license-mit.md │ ├── links.md │ ├── logo-header.md │ ├── shields.md │ ├── sth.md │ └── use-cases.md ├── configs-examples ├── sequence-config.json ├── sequence-config.yaml ├── sequence-startup.json ├── session-config.json ├── si-default-config.json ├── si-production-config.json ├── sth-config.json └── sth-config.yaml ├── docs ├── adapters │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── DockerInstanceAdapter.md │ │ ├── DockerSequenceAdapter.md │ │ ├── DockerodeDockerHelper.md │ │ ├── KubernetesInstanceAdapter.md │ │ ├── KubernetesSequenceAdapter.md │ │ ├── ProcessInstanceAdapter.md │ │ └── ProcessSequenceAdapter.md │ ├── interfaces │ │ └── IDockerHelper.md │ └── modules.md ├── api-client │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── HostClient.md │ │ ├── InstanceClient.md │ │ ├── ManagerClient.md │ │ └── SequenceClient.md │ └── modules.md ├── api-server │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── CeroError.md │ │ ├── DuplexStream.md │ │ └── ServerConfiguration.md │ ├── interfaces │ │ ├── CeroRouter.md │ │ └── SequentialCeroRouter.md │ └── modules.md ├── cli │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── ProfileConfig.md │ │ └── ReadOnlyProfileConfig.md │ ├── commands-description.md │ ├── interfaces │ │ ├── ProfileConfigEntity.md │ │ ├── SessionConfigEntity.md │ │ └── SiConfigEntity.md │ └── modules.md ├── client-utils │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── ClientError.md │ │ ├── ClientUtils.md │ │ └── ClientUtilsCustomAgent.md │ ├── interfaces │ │ ├── ClientProvider.md │ │ └── HttpClient.md │ └── modules.md ├── guides │ ├── kubernetes │ │ ├── charts │ │ │ ├── Chart.yaml │ │ │ ├── README.md │ │ │ ├── templates │ │ │ │ ├── NOTES.txt │ │ │ │ ├── _helpers.tpl │ │ │ │ ├── allow-kube-apiserver.yaml │ │ │ │ ├── runner-networkpolicy.yaml │ │ │ │ ├── sth-api-service.yaml │ │ │ │ ├── sth-config.yaml │ │ │ │ ├── sth-networkpolicy.yaml │ │ │ │ ├── sth-role.yaml │ │ │ │ ├── sth-rolebinding.yaml │ │ │ │ ├── sth-secret.yaml │ │ │ │ ├── sth-server-service.yaml │ │ │ │ ├── sth-serviceaccount.yaml │ │ │ │ └── sth-statefulset.yaml │ │ │ └── values.yaml │ │ └── manifests │ │ │ ├── README.md │ │ │ ├── sth-deployment.yaml │ │ │ ├── sth-networkpolicy.yaml │ │ │ ├── sth-rbac.yaml │ │ │ ├── sth-secret.yaml │ │ │ ├── sth-service.yaml │ │ │ └── sth-serviceaccount.yaml │ └── nomad │ │ ├── README.md │ │ ├── config.hcl │ │ └── transformhub.nomad ├── host │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── CPMConnector.md │ │ ├── CSIController.md │ │ ├── CommonLogsPipe.md │ │ ├── Host.md │ │ ├── ServiceDiscovery.md │ │ └── SocketServer.md │ └── modules.md ├── load-check │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── LoadCheck.md │ │ └── LoadCheckConfig.md │ └── modules.md ├── logger │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ └── Logger.md │ └── modules.md ├── middleware-api-client │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ └── MiddlewareClient.md │ └── modules.md ├── model │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── AppError.md │ │ ├── CSIControllerError.md │ │ ├── CommunicationHandler.md │ │ ├── DelayedStream.md │ │ ├── HostError.md │ │ ├── IDProvider.md │ │ ├── InstanceAdapterError.md │ │ ├── RunnerError.md │ │ └── SequenceAdapterError.md │ └── modules.md ├── module-loader │ ├── README.md │ └── modules.md ├── monitoring-server │ ├── README.md │ ├── classes │ │ ├── MonitoringServer.md │ │ └── MonitoringServerConf.md │ └── modules.md ├── multi-manager-api-client │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ └── MultiManagerClient.md │ └── modules.md ├── obj-logger │ ├── .nojekyll │ ├── README.md │ └── classes │ │ └── ObjLogger.md ├── read-more │ ├── how-to-write-a-sequence.md │ ├── sth-config.md │ └── stream-and-api.md ├── runner │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── MessageUtils.md │ │ └── Runner.md │ └── modules.md ├── sth-config │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ └── ConfigService.md │ └── modules.md ├── sth-constants │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ └── MyCustomErrorExample.md │ └── modules.md ├── sth │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ └── STH.md │ └── modules.md ├── symbols │ ├── .nojekyll │ ├── README.md │ ├── enums │ │ ├── APIErrorCode.md │ │ ├── CPMMessageCode.md │ │ ├── CommunicationChannel.md │ │ ├── DisconnectHubErrors.md │ │ ├── HostHeaders.md │ │ ├── InstanceMessageCode.md │ │ ├── InstanceStatus.md │ │ ├── OpRecordCode.md │ │ ├── ReadableState.md │ │ ├── RunnerExitCode.md │ │ ├── RunnerMessageCode.md │ │ ├── SequenceMessageCode.md │ │ ├── StreamType.md │ │ ├── WorkState.md │ │ └── WritableState.md │ └── modules.md ├── telemetry │ ├── .nojekyll │ ├── README.md │ ├── interfaces │ │ └── ITelemetryAdapter.md │ └── modules.md ├── types │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── ClientProvider.md │ │ ├── HostClient.md │ │ ├── InstanceClient.md │ │ └── SequenceClient.md │ ├── interfaces │ │ ├── APIBase.md │ │ ├── APIError.md │ │ ├── APIExpose.md │ │ ├── APIRoute.md │ │ ├── AppContext.md │ │ ├── ICommunicationHandler.md │ │ ├── IComponent.md │ │ ├── IHostClient.md │ │ ├── ILifeCycleAdapter.md │ │ ├── ILifeCycleAdapterMain.md │ │ ├── ILifeCycleAdapterRun.md │ │ ├── IMonitoringServer.md │ │ ├── IMonitoringServerConf.md │ │ ├── IMonitoringServerConfConstructor.md │ │ ├── IMonitoringServerConstructor.md │ │ ├── IObjectLogger.md │ │ ├── ISequenceAdapter.md │ │ ├── ReadableStream.md │ │ ├── StreamHandler.md │ │ ├── TopicHandler.md │ │ └── WritableStream.md │ ├── modules.md │ └── modules │ │ ├── MHRestAPI.md │ │ ├── MMRestAPI.md │ │ ├── MRestAPI.md │ │ ├── MWRestAPI.md │ │ ├── MessageCodes.md │ │ └── STHRestAPI.md ├── utility │ ├── .nojekyll │ ├── README.md │ ├── classes │ │ ├── Config.md │ │ ├── ConfigFile.md │ │ ├── ConfigFileDefault.md │ │ ├── FreePortsFinder.md │ │ ├── JsonFile.md │ │ ├── ReadOnlyConfig.md │ │ ├── ReadOnlyConfigFile.md │ │ ├── ReadOnlyConfigFileDefault.md │ │ ├── SchemaValidator.md │ │ ├── TextFile.md │ │ ├── TypedEmitter.md │ │ └── YamlFile.md │ ├── interfaces │ │ └── File.md │ └── modules.md └── verser │ ├── .nojekyll │ ├── README.md │ ├── classes │ ├── Verser.md │ ├── VerserClient.md │ └── VerserConnection.md │ └── modules.md ├── images ├── ava.png ├── ava1.png ├── clean_install.png ├── cli_npm.png ├── discord.png ├── docker.png ├── gh_logo.png ├── hello_alice.png ├── hub_start.png ├── installations.png ├── node_install.png ├── npm_logo.png ├── npm_package.png ├── nvm_installation_output.png ├── slack.png ├── tags.png ├── test1.png ├── test2.png ├── test3.png └── test_ci.png ├── nyc.config.js ├── package-lock.json ├── package.json ├── packages ├── adapters │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── package.json │ ├── src │ │ ├── docker-instance-adapter.ts │ │ ├── docker-networking.ts │ │ ├── docker-sequence-adapter.ts │ │ ├── dockerode-docker-helper.ts │ │ ├── get-instance-adapter.ts │ │ ├── get-runner-env.ts │ │ ├── get-sequence-adapter.ts │ │ ├── index.ts │ │ ├── initialize-runtime-adapters.ts │ │ ├── kubernetes-client-adapter.ts │ │ ├── kubernetes-config-decoder.ts │ │ ├── kubernetes-instance-adapter.ts │ │ ├── kubernetes-sequence-adapter.ts │ │ ├── process-instance-adapter.ts │ │ ├── process-sequence-adapter.ts │ │ ├── readme.mtpl │ │ ├── types.ts │ │ ├── utils.ts │ │ └── validate-sequence-package-json.ts │ ├── test │ │ └── pass.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── api-client │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── package.json │ ├── src │ │ ├── definitions.d.ts │ │ ├── host-client.ts │ │ ├── index.ts │ │ ├── instance-client.ts │ │ ├── manager-client.ts │ │ ├── readme.mtpl │ │ └── sequence-client.ts │ ├── test │ │ └── pass.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── api-server │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── src │ │ ├── config │ │ │ └── ServerConfiguration.ts │ │ ├── handlers │ │ │ ├── get.ts │ │ │ ├── op.ts │ │ │ └── stream.ts │ │ ├── index.ts │ │ ├── lib │ │ │ ├── 0http.ts │ │ │ ├── data-extractors.ts │ │ │ ├── definitions.ts │ │ │ ├── duplex-stream.ts │ │ │ └── mime.ts │ │ ├── readme.mtpl │ │ └── types │ │ │ ├── ServerConfig.ts │ │ │ └── index.ts │ ├── test │ │ ├── 0http.spec.ts │ │ ├── lib │ │ │ ├── get-communcation-handler.ts │ │ │ ├── server-mock.ts │ │ │ └── trouter-mock.ts │ │ ├── pause-resume.ts │ │ ├── rest-methods.spec.ts │ │ ├── server.spec.ts │ │ └── stream-methods.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── cli │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── scripts │ │ └── completion │ │ │ ├── install.sh │ │ │ ├── si │ │ │ └── uninstall.sh │ ├── src │ │ ├── bin │ │ │ └── index.ts │ │ ├── errors │ │ │ └── bashScriptError.ts │ │ ├── events │ │ │ └── completerDetails.ts │ │ ├── handlers │ │ │ └── completion │ │ │ │ ├── commanderCompleter.ts │ │ │ │ ├── compWordsIterator.ts │ │ │ │ └── index.ts │ │ ├── helpers │ │ │ ├── commandIterator.ts │ │ │ └── runScript.ts │ │ ├── index.ts │ │ ├── lib │ │ │ ├── commands │ │ │ │ ├── completion.ts │ │ │ │ ├── config.ts │ │ │ │ ├── developerTools.ts │ │ │ │ ├── hub.ts │ │ │ │ ├── index.ts │ │ │ │ ├── init.ts │ │ │ │ ├── instance.ts │ │ │ │ ├── scope.ts │ │ │ │ ├── sequence.ts │ │ │ │ ├── si.ts │ │ │ │ ├── space.ts │ │ │ │ ├── store.ts │ │ │ │ ├── topic.ts │ │ │ │ └── util.ts │ │ │ ├── common.ts │ │ │ ├── config │ │ │ │ ├── commonProfileConfig.ts │ │ │ │ ├── index.ts │ │ │ │ ├── profileConfig.ts │ │ │ │ ├── profileManager.ts │ │ │ │ ├── readOnlyProfileConfig.ts │ │ │ │ ├── sessionConfig.ts │ │ │ │ └── siConfig.ts │ │ │ ├── errorHandler.ts │ │ │ ├── helpers │ │ │ │ ├── developerTools.ts │ │ │ │ ├── instance.ts │ │ │ │ ├── isLinux.ts │ │ │ │ ├── messages.ts │ │ │ │ ├── scope.ts │ │ │ │ ├── sequence.ts │ │ │ │ └── various.ts │ │ │ ├── output.ts │ │ │ ├── paths.ts │ │ │ └── platform │ │ │ │ ├── common.ts │ │ │ │ └── index.ts │ │ ├── readme.mtpl │ │ ├── types │ │ │ ├── index.ts │ │ │ └── params │ │ │ │ ├── index.ts │ │ │ │ └── sequence.ts │ │ └── utils │ │ │ ├── envs.ts │ │ │ ├── sessionId.ts │ │ │ └── stringToBoolean.ts │ ├── test │ │ ├── .keep │ │ ├── cliProcess.ts │ │ └── config.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── client-utils │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── package.json │ ├── src │ │ ├── client-error.ts │ │ ├── client-utils.ts │ │ ├── index.browser.ts │ │ ├── index.ts │ │ ├── readme.mtpl │ │ └── types │ │ │ └── index.ts │ ├── test │ │ └── pass.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── host │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── .keep │ │ │ ├── auditor.ts │ │ │ ├── common-logs-pipe.ts │ │ │ ├── cpm-connector.ts │ │ │ ├── csi-controller.ts │ │ │ ├── csi-dispatcher.ts │ │ │ ├── host.ts │ │ │ ├── instance-store.ts │ │ │ ├── middlewares │ │ │ │ ├── audit.ts │ │ │ │ ├── cors.ts │ │ │ │ └── options.ts │ │ │ ├── s3-client.ts │ │ │ ├── sequenceStore.ts │ │ │ ├── serviceDiscovery │ │ │ │ ├── contentType.ts │ │ │ │ ├── sd-adapter.ts │ │ │ │ ├── topic.ts │ │ │ │ ├── topicId.ts │ │ │ │ ├── topicRouter.ts │ │ │ │ └── topicsController.ts │ │ │ ├── socket-server.ts │ │ │ ├── start-host.ts │ │ │ └── utils.ts │ │ └── readme.mtpl │ ├── test │ │ ├── common-logs-pipe.spec.ts │ │ └── serviceDiscovery │ │ │ ├── sd-discovery.spec.ts │ │ │ └── topic.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── load-check │ ├── .eslintrc │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── package.json │ ├── src │ │ ├── config │ │ │ ├── instance-requirements-config.ts │ │ │ └── load-check-config.ts │ │ ├── index.ts │ │ ├── load-check.ts │ │ └── readme.mtpl │ ├── test │ │ └── pass.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── logger │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── lib │ │ │ ├── colors.ts │ │ │ └── get-name.ts │ │ └── readme.mtpl │ ├── test │ │ └── methods.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── middleware-api-client │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── middleware-client.ts │ ├── test │ │ └── pass.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── model │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── package.json │ ├── src │ │ ├── errors │ │ │ ├── app-error.ts │ │ │ ├── csi-controller-error.ts │ │ │ ├── host-error.ts │ │ │ ├── index.ts │ │ │ ├── instance-adapter-error.ts │ │ │ ├── runner-error.ts │ │ │ └── sequence-adapter-error.ts │ │ ├── get-message.ts │ │ ├── index.ts │ │ ├── messages-utils.ts │ │ ├── readme.mtpl │ │ ├── stream-handler.ts │ │ └── utils │ │ │ ├── delayed-stream.ts │ │ │ └── id-provider.ts │ ├── test │ │ └── model.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── module-loader │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── package.json │ ├── src │ │ └── index.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── monitoring-server │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── package.json │ ├── src │ │ ├── config │ │ │ └── monitoringConfig.ts │ │ ├── index.ts │ │ └── monitoring-server.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── multi-manager-api-client │ ├── .eslintrc.js │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── multi-cpm-client.ts │ ├── test │ │ └── pass.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── obj-logger │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── obj-logger.ts │ │ ├── readme.mtpl │ │ └── utils │ │ │ ├── colors.ts │ │ │ ├── get-name.ts │ │ │ ├── pretty-print.ts │ │ │ └── streams.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── pre-runner │ ├── Dockerfile │ ├── README.md │ ├── env.sh │ ├── identify.sh │ ├── package.json │ ├── permissions.sh │ ├── src │ │ └── readme.mtpl │ ├── unpack-identify.sh │ └── unpack.sh ├── python-runner │ ├── Dockerfile │ ├── Dockerfile-tf-gpu │ ├── README.md │ ├── docker-entrypoint.sh │ ├── hardcoded_magic_values.py │ ├── logging_setup.py │ ├── package.json │ ├── requirements.txt │ ├── runner.py │ ├── unpack.sh │ └── wait-for-sequence-and-start.sh ├── runner │ ├── .dockerignore │ ├── .eslintrc.js │ ├── .nycrc.json │ ├── Dockerfile │ ├── README.md │ ├── docker-entrypoint.sh │ ├── package.json │ ├── src │ │ ├── bin │ │ │ ├── start-runner-local.ts │ │ │ ├── start-runner.ts │ │ │ └── start.sh │ │ ├── host-client.ts │ │ ├── index.ts │ │ ├── input-stream.ts │ │ ├── message-utils.ts │ │ ├── mock │ │ │ └── runner.ts │ │ ├── readme.mtpl │ │ ├── runner-app-context.ts │ │ └── runner.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ ├── unpack.sh │ └── wait-for-sequence-and-start.sh ├── sth-config │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── src │ │ ├── config-service.ts │ │ ├── image-config.json │ │ ├── index.ts │ │ └── readme.mtpl │ ├── test │ │ └── index.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── sth │ ├── .eslintrc.js │ ├── Dockerfile │ ├── README.md │ ├── docker-compose.yaml │ ├── docker-entrypoint.sh │ ├── package.json │ ├── postinstall.js │ ├── src │ │ ├── bin │ │ │ └── hub.ts │ │ ├── index.ts │ │ ├── lib │ │ │ └── index.ts │ │ └── readme.mtpl │ ├── sth-logo.svg │ ├── test │ │ └── .keep │ ├── tsconfig.build.json │ └── tsconfig.json ├── symbols │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── src │ │ ├── api-error-codes.ts │ │ ├── communication-channel.ts │ │ ├── cpm-message-code.ts │ │ ├── disconnect-error-codes.ts │ │ ├── headers │ │ │ ├── host.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── instance-status-code.ts │ │ ├── instance-status.ts │ │ ├── op-record-code.ts │ │ ├── op-state.ts │ │ ├── readme.mtpl │ │ ├── runner-exit-code.ts │ │ ├── runner-message-code.ts │ │ ├── sd-stream-handler-state.ts │ │ ├── sequence-status-code.ts │ │ └── symbols.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── telemetry │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── src │ │ ├── adapters │ │ │ └── loki.ts │ │ ├── index.ts │ │ ├── readme.mtpl │ │ └── types.ts │ ├── tsconfig.build.json │ └── tsconfig.json ├── types │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── scripts │ │ └── generate.js │ ├── src │ │ ├── api-client │ │ │ ├── host-client.ts │ │ │ └── manager-client.ts │ │ ├── api-expose.ts │ │ ├── app-config.ts │ │ ├── app-context.ts │ │ ├── application.ts │ │ ├── client-utils │ │ │ ├── client-utils.ts │ │ │ └── index.ts │ │ ├── communication-handler.ts │ │ ├── component.ts │ │ ├── cpm-connector.ts │ │ ├── csh-connector.ts │ │ ├── dto │ │ │ ├── index.ts │ │ │ └── start-sequence.ts │ │ ├── error-codes │ │ │ ├── app-error.ts │ │ │ ├── csi-controller-error.ts │ │ │ ├── host-error.ts │ │ │ ├── index.ts │ │ │ ├── instance-adapter-error.ts │ │ │ ├── runner-error.ts │ │ │ └── sequence-adapter-error.ts │ │ ├── functions.ts │ │ ├── host-proxy.ts │ │ ├── index.ts │ │ ├── instance-limits.ts │ │ ├── instance-stats.ts │ │ ├── instance-store.ts │ │ ├── instance.ts │ │ ├── lifecycle-adapters.ts │ │ ├── lifecycle.ts │ │ ├── load-check-stat.ts │ │ ├── logger.ts │ │ ├── manager-configuration.ts │ │ ├── message-streams.ts │ │ ├── messages │ │ │ ├── acknowledge.ts │ │ │ ├── describe-sequence.ts │ │ │ ├── error.ts │ │ │ ├── event.ts │ │ │ ├── handshake-acknowledge.ts │ │ │ ├── handshake.ts │ │ │ ├── index.ts │ │ │ ├── instance.ts │ │ │ ├── keep-alive.ts │ │ │ ├── kill-sequence.ts │ │ │ ├── load.ts │ │ │ ├── message.ts │ │ │ ├── monitor-rate.ts │ │ │ ├── monitor-reply.ts │ │ │ ├── monitoring.ts │ │ │ ├── network-info.ts │ │ │ ├── op-record.ts │ │ │ ├── sequence-complete.ts │ │ │ ├── sequence-end.ts │ │ │ ├── sequence-stopped.ts │ │ │ ├── sequence.ts │ │ │ ├── status.ts │ │ │ ├── sth-id.ts │ │ │ ├── sth-topic.ts │ │ │ └── stop-sequence.ts │ │ ├── model.ts │ │ ├── module-loader.ts │ │ ├── monitoring-server.ts │ │ ├── network-info.ts │ │ ├── object-logger.ts │ │ ├── op-response.ts │ │ ├── readme.mtpl │ │ ├── rest-api-commons │ │ │ ├── index.ts │ │ │ ├── load-check.ts │ │ │ └── version.ts │ │ ├── rest-api-error │ │ │ └── rest-api-error.ts │ │ ├── rest-api-manager │ │ │ ├── clear-store.ts │ │ │ ├── common.ts │ │ │ ├── delete-hub.ts │ │ │ ├── get-config.ts │ │ │ ├── get-entities.ts │ │ │ ├── get-health.ts │ │ │ ├── get-host-info.ts │ │ │ ├── get-instance.ts │ │ │ ├── get-instances.ts │ │ │ ├── get-list.ts │ │ │ ├── get-load.ts │ │ │ ├── get-sequence-ids.ts │ │ │ ├── get-sequence.ts │ │ │ ├── get-sequences.ts │ │ │ ├── get-store-items.ts │ │ │ ├── get-topics.ts │ │ │ ├── get-version.ts │ │ │ ├── index.ts │ │ │ ├── post-disconnect.ts │ │ │ └── put-store-item.ts │ │ ├── rest-api-middleware │ │ │ ├── get-multi-manager.ts │ │ │ ├── get-multi-managers.ts │ │ │ ├── get-version.ts │ │ │ └── index.ts │ │ ├── rest-api-multi-host │ │ │ ├── get-version.ts │ │ │ └── index.ts │ │ ├── rest-api-multi-manager │ │ │ ├── access-key.ts │ │ │ ├── common.ts │ │ │ ├── get-info.ts │ │ │ ├── get-load-check.ts │ │ │ ├── get-manager.ts │ │ │ ├── get-managers.ts │ │ │ ├── get-version.ts │ │ │ ├── index.ts │ │ │ ├── start-manager.ts │ │ │ └── stop-manager.ts │ │ ├── rest-api-sth │ │ │ ├── common.ts │ │ │ ├── get-config.ts │ │ │ ├── get-entities.ts │ │ │ ├── get-event.ts │ │ │ ├── get-health.ts │ │ │ ├── get-instance.ts │ │ │ ├── get-instances.ts │ │ │ ├── get-load-check.ts │ │ │ ├── get-sequence-instances.ts │ │ │ ├── get-sequence.ts │ │ │ ├── get-sequences.ts │ │ │ ├── get-status.ts │ │ │ ├── get-topics.ts │ │ │ ├── get-version.ts │ │ │ ├── index.ts │ │ │ ├── send-delete-sequence.ts │ │ │ ├── send-event.ts │ │ │ ├── send-kill-instance.ts │ │ │ ├── send-sequence.ts │ │ │ ├── send-stop-instance.ts │ │ │ └── start-sequence.ts │ │ ├── runner-config.ts │ │ ├── runner-connect.ts │ │ ├── runner.ts │ │ ├── sd-content-type.ts │ │ ├── sd-stream-handler.ts │ │ ├── sd-topic-handler.ts │ │ ├── sequence-adapter.ts │ │ ├── sequence-package-json.ts │ │ ├── sequence.ts │ │ ├── sth-command-options.ts │ │ ├── sth-configuration.ts │ │ ├── telemetry-config.ts │ │ ├── topic-router.ts │ │ └── utils.ts │ ├── test │ │ ├── .work │ │ │ └── .keep │ │ ├── composite_read.spec.ts │ │ ├── composite_write.spec.ts │ │ ├── lib │ │ │ ├── transform.d.ts │ │ │ └── transform.js │ │ ├── scramjet_read.spec.ts │ │ ├── simple_read.spec.ts │ │ ├── simple_transform.spec.ts │ │ └── simple_write.spec.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── tsconfig.test.json ├── utility │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── src │ │ ├── config │ │ │ ├── config.ts │ │ │ ├── configFile.ts │ │ │ ├── configFileDefault.ts │ │ │ ├── configuration.ts │ │ │ ├── configurationBase.ts │ │ │ ├── index.ts │ │ │ ├── readOnlyConfig.ts │ │ │ ├── readOnlyConfigFile.ts │ │ │ ├── readOnlyConfigFileDefault.ts │ │ │ └── readOnlyConfiguration.ts │ │ ├── constants │ │ │ ├── index.ts │ │ │ └── object-logger.ts │ │ ├── defer.ts │ │ ├── file │ │ │ ├── file.ts │ │ │ ├── index.ts │ │ │ ├── jsonFile.ts │ │ │ ├── textFile.ts │ │ │ └── yamlFile.ts │ │ ├── free-ports-finder.ts │ │ ├── index.ts │ │ ├── keygen.ts │ │ ├── merge.ts │ │ ├── normalize-url.ts │ │ ├── process-env.ts │ │ ├── promise-timeout.ts │ │ ├── read-json-file.ts │ │ ├── read-streamed-json.ts │ │ ├── readme.mtpl │ │ ├── stream-to-string.ts │ │ ├── typed-emitter.ts │ │ ├── typeguards │ │ │ ├── dto │ │ │ │ └── sequence-start.ts │ │ │ ├── index.ts │ │ │ ├── is-api-version.ts │ │ │ ├── is-boolean.ts │ │ │ ├── is-defined.ts │ │ │ ├── is-empty-string.ts │ │ │ ├── is-http-url.ts │ │ │ ├── is-id-string.ts │ │ │ ├── is-log-level.ts │ │ │ ├── is-port.ts │ │ │ └── is-url-path.ts │ │ └── validators │ │ │ ├── api-version.ts │ │ │ ├── boolean.ts │ │ │ ├── defined.ts │ │ │ ├── fileExists.ts │ │ │ ├── http-url.ts │ │ │ ├── id-string.ts │ │ │ ├── index.ts │ │ │ ├── log-level.ts │ │ │ ├── optional.ts │ │ │ ├── port.ts │ │ │ ├── schema-validator.ts │ │ │ ├── string.ts │ │ │ └── url-path.ts │ ├── test │ │ ├── configFileDefault.spec.ts │ │ └── host.spec.ts │ ├── tsconfig.build.json │ └── tsconfig.json └── verser │ ├── .eslintrc.js │ ├── README.md │ ├── package.json │ ├── src │ ├── index.ts │ ├── lib │ │ ├── verser-client-default-config.ts │ │ ├── verser-client.ts │ │ ├── verser-connection.ts │ │ └── verser.ts │ ├── readme.mtpl │ └── types │ │ └── index.ts │ ├── test │ ├── .keep │ ├── cert │ │ ├── cleanup-localhost-cert.sh │ │ └── gen-localhost-cert.sh │ └── http-connection.spec.ts │ ├── tsconfig.build.json │ ├── tsconfig.json │ └── types.ts ├── scripts ├── .eslintrc ├── _ │ ├── pack-sequence │ └── upload-sequence ├── add-to-packages-json.js ├── build-all.js ├── bump-dependencies-versions.sh ├── bump_docker_images.sh ├── deps-update.js ├── dev │ ├── names.json │ ├── sd.ts │ └── start-seq.ts ├── editorconfig.js ├── hash-to-file.js ├── lib │ ├── build-utils.js │ ├── get-deep-deps.js │ ├── opts.js │ ├── pack.js │ ├── pre-pack.js │ └── readme-helpers.js ├── mk-readme.js ├── package.json ├── packsequence.js ├── publish-order-dist-packages.js ├── publish.js ├── run-script.js ├── systemd │ ├── README.md │ └── scramjet-transform-hub.service ├── test-all.sh ├── utils.js └── yarn.lock ├── sth-config-example.json ├── template ├── .eslintrc ├── package.json ├── src │ ├── index.ts │ └── lib │ │ └── .keep ├── test │ └── .keep ├── tsconfig.build.json └── tsconfig.json ├── tsconfig.base.json └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | # The following lines are toggled at compilation time 2 | **/node_modules/ 3 | **/.bic_cache 4 | **/.git/ 5 | **/.github/ 6 | **/Dockerfile* 7 | **/Jenkinsfile* 8 | **/docs/ 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | max_line_length = 180 9 | end_of_line = lf 10 | charset = utf-8 11 | 12 | [*{.json,.yml}] 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [Jenkinsfile*] 17 | indent_style = space 18 | indent_size = 2 19 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # don't ever lint node_modules 2 | node_modules 3 | conf/launch.json 4 | jest.config.js -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | text eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: "Scramjet's Discord" 3 | url: https://discord.gg/7ABeYbKDMb 4 | about: "Get support directly from the community and Scramjet's development team on our Discord server" 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Feature description** 11 | A clear and concise description of the feature 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/default.md: -------------------------------------------------------------------------------- 1 | ../pull_request_template.md -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "MD001": false, 3 | "MD003": false, 4 | "MD004": false, 5 | "MD013": false, 6 | "MD024": false, 7 | "MD025": false, 8 | "MD026": false, 9 | "MD028": false, 10 | "MD033": false, 11 | "MD037": false, 12 | "MD041": false, 13 | "MD046": false 14 | } 15 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "none" 3 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cucumberautocomplete.steps": [ 3 | "./bdd/step-definitions/**/*.ts" 4 | ], 5 | "cucumberautocomplete.strictGherkinCompletion": true, 6 | "python.analysis.extraPaths": [ 7 | "./packages/python-runner/__pypackages__" 8 | ], 9 | "spellright.language": [ 10 | "en" 11 | ], 12 | "spellright.documentTypes": [ 13 | "markdown", 14 | "latex", 15 | "plaintext" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /.work/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/.work/.keep -------------------------------------------------------------------------------- /FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: scramjetorg -------------------------------------------------------------------------------- /bdd/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "new-cap": 0 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /bdd/cucumber.js: -------------------------------------------------------------------------------- 1 | const common = [ 2 | "--require step-definitions/**/*.ts", 3 | "--require-module ts-node/register", 4 | "--publish-quiet", 5 | "--exit", 6 | "--tags \"not @ignore\"", 7 | "--format @cucumber/pretty-formatter", 8 | "--format html:reports/" + new Date().toISOString().replace(new RegExp(/[:\\.]/g), "_") + "_report.html" 9 | ].join(" "); 10 | 11 | module.exports = { 12 | default: common 13 | }; 14 | -------------------------------------------------------------------------------- /bdd/data/cities.json: -------------------------------------------------------------------------------- 1 | { "city": "New York" } 2 | -------------------------------------------------------------------------------- /bdd/data/data.json: -------------------------------------------------------------------------------- 1 | { "name": "Ant-Man" } 2 | { "name": "Iron Man" } 3 | { "name": "Hulk" } 4 | { "name": "Hawkeye" } 5 | { "name": "Black Widow" } 6 | { "name": "Thor" } 7 | { "name": "Captain America" } 8 | { "name": "Spider-Man" } 9 | 10 | -------------------------------------------------------------------------------- /bdd/data/python-weather-startup-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appConfig": { 3 | "current": [ 4 | "temperature_2m", 5 | "is_day", 6 | "rain", 7 | "snowfall", 8 | "wind_speed_10m" 9 | ] 10 | }, 11 | "args": [{ "cities": ["Warszawa", "Berlin", "Moskwa"] }] 12 | } 13 | -------------------------------------------------------------------------------- /bdd/data/runner-messages.ts: -------------------------------------------------------------------------------- 1 | export const runnerMessages = new Map([ 2 | ["KILL", "[4002,{}]"], 3 | ["PING", "[4000,{}]"], 4 | ["PONG", "[3000,{}]"], 5 | ["ALIVE", "[3010,{}]"], 6 | ["ALIVE_RESPONSE", "[3004,{\"received\":3010}]"], 7 | ["HEALTHY", "[3010,{\"healthy\":true}]"], 8 | ["INCORRECT", "INCORRECT"], 9 | ["INCORRECT_MESSAGE_RESPONSE", "[3004,{\"received\":\"unknown message\"}]"], 10 | ]); 11 | -------------------------------------------------------------------------------- /bdd/data/sample-config-exit.json: -------------------------------------------------------------------------------- 1 | { 2 | "sequences": [ 3 | { "id": "args-config-test", "args": ["123", "false", "abc", "{\"a\": 1}"], "appConfig": {"x": 1, "exit": true} } 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /bdd/data/sample-config-output.txt: -------------------------------------------------------------------------------- 1 | config: {"x":1} 2 | string, "123" 3 | string, "false" 4 | string, "abc" 5 | string, "{\"a\": 1}" 6 | -------------------------------------------------------------------------------- /bdd/data/sample-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "sequences": [ 3 | { "id": "args-config-test", "args": ["123", "false", "abc", "{\"a\": 1}"], "appConfig": {"x": 1} } 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /bdd/data/sample-log.log.ansi: -------------------------------------------------------------------------------- 1 | 2022-03-24T18:26:34.823Z TRACE ProcessInstanceAdapter Runner process is running [ 484 ] 2 | 2022-03-24T18:26:34.923Z TRACE ProcessInstanceAdapter Runner process exited [ 484 ] 3 | 2022-03-24T18:26:34.924Z DEBUG ProcessInstanceAdapter Process returned non-zero status code [ 1 ] 4 | 2022-03-24T18:26:34.924Z TRACE CSIController Sequence finished with status [ 1 ] 5 | 2022-03-24T18:26:34.924Z ERROR CSIController Sequence finished with error [ 1 ] 6 | -------------------------------------------------------------------------------- /bdd/data/sample-log.log.plain: -------------------------------------------------------------------------------- 1 | 1648146394823 TRACE ProcessInstanceAdapter Runner process is running [ 484 ] 2 | 1648146394923 TRACE ProcessInstanceAdapter Runner process exited [ 484 ] 3 | 1648146394924 DEBUG ProcessInstanceAdapter Process returned non-zero status code [ 1 ] 4 | 1648146394924 TRACE CSIController Sequence finished with status [ 1 ] 5 | 1648146394924 ERROR CSIController Sequence finished with error [ 1 ] 6 | -------------------------------------------------------------------------------- /bdd/data/sample-log.log.source: -------------------------------------------------------------------------------- 1 | {"level":"TRACE","msg":"Runner process is running","ts":1648146394823,"from":"ProcessInstanceAdapter","Host":{},"data":[484]} 2 | {"level":"TRACE","msg":"Runner process exited","ts":1648146394923,"from":"ProcessInstanceAdapter","Host":{},"data":[484]} 3 | {"level":"DEBUG","msg":"Process returned non-zero status code","ts":1648146394924,"from":"ProcessInstanceAdapter","Host":{},"data":[1]} 4 | {"level":"TRACE","msg":"Sequence finished with status","ts":1648146394924,"from":"CSIController","Host":{},"data":[1]} 5 | {"level":"ERROR","msg":"Sequence finished with error","ts":1648146394924,"from":"CSIController","Host":{},"data":[1]} 6 | -------------------------------------------------------------------------------- /bdd/data/seq-startup-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appConfig": { 3 | "testAppConfig": { 4 | "key1": "value1", 5 | "key2": 2, 6 | "key3": true 7 | } 8 | }, 9 | "args": [1000] 10 | } 11 | -------------------------------------------------------------------------------- /bdd/data/sequences/args-config-test/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const { PassThrough } = require("stream"); 4 | 5 | module.exports = function(_stream, ...args) { 6 | const out = new PassThrough(); 7 | 8 | out.write("config: "); 9 | out.write(JSON.stringify(this.config)); 10 | out.write("\n"); 11 | for (const arg of args) { 12 | out.write(`${typeof arg}, ${JSON.stringify(arg)}\n`); 13 | } 14 | out.end(); 15 | 16 | if (this.config.exit) { 17 | this.exitTimeout = 500; 18 | } 19 | return out; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /bdd/data/sequences/args-config-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scramjet/args-config-test", 3 | "version": "0.20.0", 4 | "description": "", 5 | "license": "ISC", 6 | "author": "Scramjet ", 7 | "main": "index.js", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/scramjetorg/transform-hub.git" 11 | }, 12 | "devDependencies": { 13 | "@scramjet/types": "1.0.1" 14 | }, 15 | "private": true 16 | } 17 | -------------------------------------------------------------------------------- /bdd/data/sequences/args-to-output/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const { PassThrough } = require("stream"); 4 | 5 | const exp = function(_stream, arg1, arg2, arg3, arg4) { 6 | const out = new PassThrough(); 7 | 8 | out.write(arg1 + "\n"); 9 | out.write(arg2.toString() + "\n"); 10 | out.write(arg3.abc + "\n"); 11 | out.write(arg4[0] + "\n"); 12 | 13 | return out; 14 | }; 15 | 16 | module.exports = exp; 17 | exports.default = exp; 18 | -------------------------------------------------------------------------------- /bdd/data/sequences/args-to-output/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scramjet/test-args-to-output", 3 | "version": "0.22.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build:refapps": "node ../../../scripts/build-all.js --copy-dist", 8 | "postbuild:refapps": "yarn packseq", 9 | "packseq": "node ../../../scripts/packsequence.js", 10 | "clean": "rm -rf ./dist .bic_cache" 11 | }, 12 | "author": "Scramjet ", 13 | "license": "ISC", 14 | "devDependencies": { 15 | "@scramjet/types": "^1.0.1", 16 | "@types/node": "15.12.5" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/scramjetorg/transform-hub.git" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /bdd/data/sequences/bin-out-seq/dist/node_modules/.package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scramjet/bin-out-seq", 3 | "version": "0.23.2", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": {} 7 | } 8 | -------------------------------------------------------------------------------- /bdd/data/sequences/bin-out-seq/dist/random.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/data/sequences/bin-out-seq/dist/random.bin -------------------------------------------------------------------------------- /bdd/data/sequences/bin-out-seq/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scramjet/bin-out-seq", 3 | "version": "0.23.2", 4 | "description": "A Sequence that reads binary file and writes data to output.", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "tsc -p tsconfig.json", 8 | "postbuild": "cp -r package.json random.bin dist/ && (cd dist && npm i --only=production)" 9 | }, 10 | "author": "Scramjet ", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@scramjet/types": "^1.0.1", 14 | "@types/node": "15.12.5" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/scramjetorg/transform-hub.git" 19 | }, 20 | "assets": [ 21 | "random.bin" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /bdd/data/sequences/bin-out-seq/random.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/data/sequences/bin-out-seq/random.bin -------------------------------------------------------------------------------- /bdd/data/sequences/bin-out-seq/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "include": [ 6 | "./index.ts" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /bdd/data/sequences/deploy-app/dist/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | var stream_1 = require("stream"); 4 | var exp = function (_stream, arg1, arg2, arg3, arg4) { 5 | var out = new stream_1.PassThrough(); 6 | out.write(arg1 + "\n"); 7 | out.write(arg2.toString() + "\n"); 8 | out.write(arg3.abc + "\n"); 9 | out.write(arg4[0] + "\n"); 10 | return out; 11 | }; 12 | exports["default"] = exp; 13 | -------------------------------------------------------------------------------- /bdd/data/sequences/deploy-app/dist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scramjet/deploy-app", 3 | "version": "0.23.2", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "tsc -p tsconfig.json", 8 | "postbuild": "cp -r package.json dist/ && (cd dist && npm i --only=production)" 9 | }, 10 | "author": "Scramjet ", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@scramjet/types": "^1.0.1", 14 | "@types/node": "15.12.5" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/scramjetorg/transform-hub.git" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /bdd/data/sequences/deploy-app/index.ts: -------------------------------------------------------------------------------- 1 | import { ReadableApp } from "@scramjet/types"; 2 | import { PassThrough } from "stream"; 3 | 4 | type Arguments = [string, number, { abc: string }, [string]] 5 | 6 | const exp: ReadableApp = function(_stream, arg1, arg2, arg3, arg4) { 7 | const out = new PassThrough(); 8 | 9 | out.write(arg1 + "\n"); 10 | out.write(arg2.toString() + "\n"); 11 | out.write(arg3.abc + "\n"); 12 | out.write(arg4[0] + "\n"); 13 | 14 | return out; 15 | }; 16 | 17 | export default exp; 18 | -------------------------------------------------------------------------------- /bdd/data/sequences/deploy-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scramjet/deploy-app", 3 | "version": "0.23.2", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "tsc -p tsconfig.json", 8 | "postbuild": "cp -r package.json dist/ && (cd dist && npm i --only=production)" 9 | }, 10 | "author": "Scramjet ", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "@scramjet/types": "^1.0.1", 14 | "@types/node": "15.12.5" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/scramjetorg/transform-hub.git" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /bdd/data/sequences/deploy-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "include": [ 6 | "./index.ts" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /bdd/data/sequences/simple-stdio/index.js: -------------------------------------------------------------------------------- 1 | const { createInterface } = require("node:readline"); 2 | 3 | module.exports = async function(_input, nowait) { 4 | /** 5 | * @this {import("@scramjet/types").AppContext} 6 | */ 7 | const lines = createInterface({ input: process.stdin }); 8 | 9 | this.logger.info("Working..."); 10 | for await (const line of lines) { 11 | this.logger.info("line", line); 12 | process.stdout.write(">>> "); 13 | process.stdout.write(line); 14 | } 15 | 16 | this.exitTimeout = 0; 17 | if (!nowait) await new Promise(res => setTimeout(res, 5e3)); 18 | }; 19 | -------------------------------------------------------------------------------- /bdd/data/sequences/simple-stdio/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@scramjet/reference-simple-stdio", 3 | "version": "0.19.2", 4 | "description": "", 5 | "main": "index.js", 6 | "author": "Scramjet ", 7 | "license": "ISC", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/scramjetorg/transform-hub.git" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /bdd/data/test-data/sample_unicode_1.txt: -------------------------------------------------------------------------------- 1 | foo 2 | bar baz 3 | żółw 4 | -------------------------------------------------------------------------------- /bdd/data/test-data/sth-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeAdapter": "process", 3 | "host": { "port": 9079 } 4 | } 5 | -------------------------------------------------------------------------------- /bdd/data/test-data/sth-config.yml: -------------------------------------------------------------------------------- 1 | runtimeAdapter: process 2 | host: 3 | port: 9078 4 | -------------------------------------------------------------------------------- /bdd/data/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "allowJs": true 5 | }, 6 | "include": [ 7 | "./sequences" 8 | ], 9 | "exclude": [ 10 | "node_modules" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /bdd/features/RM-001-runner-mock.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/RM-001-runner-mock.feature -------------------------------------------------------------------------------- /bdd/features/e2e/E2E-001-samples.feature: -------------------------------------------------------------------------------- 1 | Feature: Sample e2e tests 2 | 3 | @ci-instance-node 4 | Scenario: E2E-001 TC-002 Test stdio available after the sequence is completed 5 | Given host is running 6 | When I execute CLI with "seq pack data/sequences/simple-stdio -o data/simple-stdio-2.tar.gz" 7 | And sequence "data/simple-stdio-2.tar.gz" loaded 8 | And instance started with arguments "1" 9 | And wait for "500" ms 10 | Then send "Hello Alice!" to stdin 11 | And wait for "3000" ms 12 | And get instance info 13 | Then "stdout" is ">>> Hello Alice!" 14 | And host is still running 15 | -------------------------------------------------------------------------------- /bdd/features/e2e/E2E-003-kill.feature: -------------------------------------------------------------------------------- 1 | Feature: Kill e2e tests 2 | 3 | @ci-instance-node 4 | Scenario: E2E-003 TC-003 API test - Kill instance when it's not responding 5 | Given host is running 6 | When sequence "../packages/process-not-responding.tar.gz" loaded 7 | And instance started 8 | And wait for instance healthy is "true" 9 | And get runner PID 10 | And send kill message to instance 11 | And wait for "10000" ms 12 | And runner has ended execution 13 | Then host is still running 14 | -------------------------------------------------------------------------------- /bdd/features/e2e/E2E-008-host-api.feature: -------------------------------------------------------------------------------- 1 | Feature: Ports e2e tests 2 | 3 | @ci-api 4 | Scenario: E2E-008 TC-001 API test for basic Host endpoints 5 | Given host is running 6 | When I get version 7 | Then it returns the root package version 8 | When I get load-check 9 | Then it returns a correct load check with required properties 10 | And host is running 11 | -------------------------------------------------------------------------------- /bdd/features/e2e/E2E-016-errors.feature: -------------------------------------------------------------------------------- 1 | Feature: Test error handling while sequence is uploaded 2 | 3 | @ci-instance-node 4 | Scenario: E2E-016 TC-001 Run errored sequence 5 | Given I set config for local Hub 6 | When I deploy sequence "js-bad-sequence.tar.gz" 7 | Then I should see error message: "Sequence entrypoint path app.js is invalid. Check `main` field in Sequence package.json" 8 | Then I should see exitCode: "1" 9 | -------------------------------------------------------------------------------- /bdd/features/performance-tests/PT-001-durability.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/performance-tests/PT-001-durability.feature -------------------------------------------------------------------------------- /bdd/features/performance-tests/PT-005-ports.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/performance-tests/PT-005-ports.feature -------------------------------------------------------------------------------- /bdd/features/performance-tests/PT-006-durability-ports.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/performance-tests/PT-006-durability-ports.feature -------------------------------------------------------------------------------- /bdd/features/reference-apps/RA-001-inert-apps.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/reference-apps/RA-001-inert-apps.feature -------------------------------------------------------------------------------- /bdd/features/reference-apps/RA-002-read-apps.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/reference-apps/RA-002-read-apps.feature -------------------------------------------------------------------------------- /bdd/features/reference-apps/RA-003-transform-apps.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/reference-apps/RA-003-transform-apps.feature -------------------------------------------------------------------------------- /bdd/features/reference-apps/RA-004-write-apps.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/reference-apps/RA-004-write-apps.feature -------------------------------------------------------------------------------- /bdd/features/reference-apps/RA-005-transform-apps.feature: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/features/reference-apps/RA-005-transform-apps.feature -------------------------------------------------------------------------------- /bdd/iac-test-data/sequences/hello-1/index.js: -------------------------------------------------------------------------------- 1 | module.exports = async function*(/** @type {import("stream").Readable} */ stream) { 2 | const prefix = this.config?.greet ? "Hello" : "Goodbye"; 3 | 4 | for await (const data of stream) { 5 | yield `${prefix} ${data}?`; 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /bdd/iac-test-data/sequences/hello-1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-1", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "engines": { 6 | "node": ">=16" 7 | }, 8 | "scripts": { 9 | "build": "si pack -o ../hello-1.tar.gz ." 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /bdd/iac-test-data/sequences/hello-2/index.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = async function*(/** @type {import("stream").Readable} */ stream, prefix = "Hello") { 3 | for await (const data of stream) { 4 | yield `${prefix} ${data}?`; 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /bdd/iac-test-data/sequences/hello-2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-2", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "engines": { 6 | "node": ">=16" 7 | }, 8 | "scripts": { 9 | "build": "si pack -o ../hello-2.tar.gz ." 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /bdd/iac-test-data/sequences/hub-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "infinite-seq", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "engines": { 6 | "node": ">=16" 7 | }, 8 | "scripts": { 9 | "build": "si pack -o ../hello-2.tar.gz ." 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /bdd/iac-test-data/sequences/infinite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "infinite-seq", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "engines": { 6 | "node": ">=16" 7 | }, 8 | "scripts": { 9 | "build": "si pack -o ../hello-2.tar.gz ." 10 | }, 11 | "devDependencies": { 12 | "@scramjet/types": "^1.0.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bdd/iac-test-data/start-config-hubclient.json: -------------------------------------------------------------------------------- 1 | { 2 | "sequences": [ 3 | {"id": "hub-client"} 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /bdd/iac-test-data/start-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "sequences": [ 3 | {"id": "hello-1", "args": ["Hi"]}, 4 | {"id": "hello-1"}, 5 | {"id": "hello-2", "config": {"greet": true}}, 6 | {"id": "hello-3"} 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /bdd/reports/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/reports/.keep -------------------------------------------------------------------------------- /bdd/reports/.work/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/bdd/reports/.work/.keep -------------------------------------------------------------------------------- /bdd/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist", 4 | "skipLibCheck": true 5 | }, 6 | "extends": "../tsconfig.base.json", 7 | "include": [ 8 | "./step-definitions", 9 | "./lib" 10 | ], 11 | "exclude": [ 12 | "../node_modules" 13 | ], 14 | "typedocOptions": { 15 | "gitRevision": "HEAD" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /conf/.eslintrc: -------------------------------------------------------------------------------- 1 | {"parserOptions":{"project": "./tsconfig.json", "tsconfigRootDir":"./conf"}} 2 | -------------------------------------------------------------------------------- /conf/config.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /conf/readme-parts/license-agpl.md: -------------------------------------------------------------------------------- 1 | ## License and contributions 2 | 3 | This module is licensed under AGPL-3.0 license. 4 | 5 | The Scramjet Transform Hub project is dual-licensed under the AGPL-3.0 and MIT licenses. Parts of the project that are linked with your programs are MIT licensed, the rest is AGPL. 6 | -------------------------------------------------------------------------------- /conf/readme-parts/license-mit.md: -------------------------------------------------------------------------------- 1 | ## License and contributions 2 | 3 | This module is licensed under MIT license. 4 | 5 | The Scramjet Transform Hub project is dual-licensed under the AGPL-3.0 and MIT licenses. Parts of the project that are linked with your programs are MIT licensed, the rest is AGPL. 6 | -------------------------------------------------------------------------------- /conf/readme-parts/sth.md: -------------------------------------------------------------------------------- 1 | ## Scramjet Transform Hub 2 | 3 | This package is part of [Scramjet Transform Hub](https://www.npmjs.org/package/@scramjet/sth). 4 | 5 | Scramjet Transform Hub is a deployment and execution platform. Once installed on a server, it will allow you to start your programs and keep them running on a remote machine. You will be able to start programs in the background or connect to them and see their output directly on your terminal. You will be able to pipe your local data to the program, as if it was running from your terminal. You can start your server in AWS, Google Cloud or Azure, start it on your local machine, install it on a Raspberry Pi or wherever else you'd like. 6 | -------------------------------------------------------------------------------- /conf/readme-parts/use-cases.md: -------------------------------------------------------------------------------- 1 | ## Use cases 2 | 3 | There's no limit what you can use it for. You want a stock checker? A chat bot? Maybe you'd like to automate your home? Retrieve sensor data? Maybe you have a lot of data and want to transfer and wrangle it? You have a database of cities and you'd like to enrich your data? You do machine learning and you want to train your set while the data is fetched in real time? Hey, you want to use it for something else and ask us if that's a good use? Ask us [via email](mailto:get@scramjet.org) or hop on our [Scramjet Discord](https://scr.je/join-community-mg1)! 4 | -------------------------------------------------------------------------------- /configs-examples/sequence-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appConfig": { 3 | "key1": "value", 4 | "key2": 2 5 | }, 6 | "args": [1, 2, 3, "someArg"], 7 | "outputTopic": "", 8 | "inputTopic": "", 9 | "limits": { 10 | "memory": 128 11 | }, 12 | "instanceId": "Instance-id-must-consist-of-36-signs" 13 | } 14 | -------------------------------------------------------------------------------- /configs-examples/sequence-config.yaml: -------------------------------------------------------------------------------- 1 | appConfig: 2 | key1: 'value' 3 | key2: 2 4 | args: 5 | - 1 6 | - 2 7 | - 3 8 | - 'someArg' 9 | outputTopic: '' 10 | inputTopic: '' 11 | limits: 12 | memory: 100 13 | instanceId: 'Instance-id-must-consist-of-36-signs' 14 | -------------------------------------------------------------------------------- /configs-examples/sequence-startup.json: -------------------------------------------------------------------------------- 1 | { 2 | "sequences": [ 3 | { 4 | "id": "supervisor-sequence", 5 | "args": [], 6 | "instanceId": "Supervisor-Instance-0000-11111111111" 7 | }, 8 | { 9 | "id": "producer-sequence", 10 | "args": [], 11 | "instanceId": "Produce-Inst-must-c0nsist-0f-36signs" 12 | }, 13 | { 14 | "id": "consumer-sequence", 15 | "args": [], 16 | "instanceId": "Consume-Inst-must-c0nsist-0f-36signs" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /configs-examples/session-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "lastPackagePath": "", 3 | "lastInstanceId": "", 4 | "lastSequenceId": "", 5 | "lastSpaceId": "", 6 | "lastHubId": "", 7 | "sessionId": "2192654" 8 | } 9 | -------------------------------------------------------------------------------- /configs-examples/si-default-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "configVersion": 1, 3 | "apiUrl": "http://127.0.0.1:8000/api/v1", 4 | "middlewareApiUrl": "", 5 | "env": "development", 6 | "scope": "", 7 | "token": "", 8 | "log": { "debug": false, "format": "pretty" } 9 | } 10 | -------------------------------------------------------------------------------- /configs-examples/si-production-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "configVersion": 1, 3 | "apiUrl": "http://127.0.0.1:8000/api/v1", 4 | "middlewareApiUrl": "https://api.scramjet.cloud/api/v1", 5 | "env": "production", 6 | "scope": "", 7 | "token": "", 8 | "log": { 9 | "debug": false, 10 | "format": "pretty" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /configs-examples/sth-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": { 3 | "hostname": "0.0.0.0", 4 | "port": 8000, 5 | "instancesServerPort": 8001, 6 | "id": "sth-1" 7 | }, 8 | "timings": { 9 | "instanceLifetimeExtensionDelay": 10000 10 | }, 11 | "platform": { 12 | "apiKey": "", 13 | "api": "https://api-shh.scramjet.cloud", 14 | "space": "org-abcd88bd-1111-2222-3333-042ffedd0e25:org-abcd88bd-1111-2222-3333-042ffedd0e25-manager", 15 | "hostType": "hub" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /configs-examples/sth-config.yaml: -------------------------------------------------------------------------------- 1 | host: 2 | hostname: '0.0.0.0' 3 | port: 8000 4 | instancesServerPort: 8001 5 | id: 'sth-1' 6 | timings: 7 | instanceLifetimeExtensionDelay: 10000 8 | platform: 9 | apiKey: '' 10 | api: 'https://api-shh.scramjet.cloud' 11 | space: 'org-abcd88bd-1111-2222-3333-042ffedd0e25:org-abcd88bd-1111-2222-3333-042ffedd0e25-manager' 12 | hostType: 'hub' 13 | -------------------------------------------------------------------------------- /docs/adapters/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/api-client/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/api-server/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/cli/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/cli/interfaces/SiConfigEntity.md: -------------------------------------------------------------------------------- 1 | [@scramjet/cli](../README.md) / [Exports](../modules.md) / SiConfigEntity 2 | 3 | # Interface: SiConfigEntity 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [profile](SiConfigEntity.md#profile) 10 | 11 | ## Properties 12 | 13 | ### profile 14 | 15 | • **profile**: `string` 16 | 17 | #### Defined in 18 | 19 | [cli/src/types/index.ts:26](https://github.com/scramjetorg/transform-hub/blob/HEAD/packages/cli/src/types/index.ts#L26) 20 | -------------------------------------------------------------------------------- /docs/client-utils/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/client-utils/interfaces/ClientProvider.md: -------------------------------------------------------------------------------- 1 | [@scramjet/client-utils](../README.md) / [Exports](../modules.md) / ClientProvider 2 | 3 | # Interface: ClientProvider 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [client](ClientProvider.md#client) 10 | 11 | ## Properties 12 | 13 | ### client 14 | 15 | • **client**: [`HttpClient`](HttpClient.md) 16 | 17 | #### Defined in 18 | 19 | [packages/client-utils/src/index.ts:62](https://github.com/scramjetorg/transform-hub/blob/HEAD/packages/client-utils/src/index.ts#L62) 20 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | description: A Helm chart to deploy STH 3 | name: sth 4 | version: 0.0.5 5 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/README.md: -------------------------------------------------------------------------------- 1 | ## Example of deployment: 2 | 3 | `helm upgrade --install sth charts/ --namespace ` 4 | 5 | ```bash 6 | helm upgrade --install sth charts/ --namespace default 7 | ``` 8 | 9 | ## Delete deployment 10 | 11 | ```bash 12 | helm delete charts/ --namespace= 13 | ``` 14 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/templates/NOTES.txt: -------------------------------------------------------------------------------- 1 | In order to access the Transform-Hub API you have the following options: 2 | 3 | kubectl get pods,svc,deployment.apps,pvc -n {{ .Release.Namespace }} 4 | 5 | Check STH version 6 | curl -s :{{ .Values.sthApi.service.port }}/api/v1/version |jq 7 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/templates/allow-kube-apiserver.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: NetworkPolicy 3 | metadata: 4 | name: allow-kube-apiserver 5 | labels: 6 | app.kubernetes.io/name: {{ include "sth.name" . }} 7 | helm.sh/chart: {{ include "sth.chart" . }} 8 | app.kubernetes.io/instance: {{ .Release.Name }} 9 | app.kubernetes.io/managed-by: {{ .Release.Service }} 10 | spec: 11 | egress: 12 | - to: 13 | - podSelector: 14 | matchLabels: 15 | component: kube-apiserver 16 | ports: 17 | - port: 6443 18 | protocol: TCP 19 | podSelector: 20 | matchLabels: 21 | app: sth 22 | policyTypes: 23 | - Egress 24 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/templates/sth-config.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.config }} 2 | --- 3 | apiVersion: v1 4 | kind: ConfigMap 5 | metadata: 6 | name: sth-cm 7 | labels: 8 | app.kubernetes.io/name: {{ include "sth.name" . }} 9 | helm.sh/chart: {{ include "sth.chart" . }} 10 | app.kubernetes.io/instance: {{ .Release.Name }} 11 | app.kubernetes.io/managed-by: {{ .Release.Service }} 12 | data: 13 | {{- range $path, $config := .Values.config }} 14 | {{ $path }}: | 15 | {{ tpl $config $ | indent 4 -}} 16 | {{- end -}} 17 | {{- end -}} 18 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/templates/sth-rolebinding.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccountToken.enabled }} 2 | kind: RoleBinding 3 | apiVersion: rbac.authorization.k8s.io/v1 4 | metadata: 5 | name: sth-rolebinding 6 | labels: 7 | app.kubernetes.io/name: {{ include "sth.name" . }} 8 | helm.sh/chart: {{ include "sth.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | subjects: 12 | - kind: ServiceAccount 13 | name: sth-sa 14 | roleRef: 15 | kind: Role 16 | name: sth-role 17 | apiGroup: rbac.authorization.k8s.io 18 | {{- end }} 19 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/templates/sth-secret.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccountToken.enabled }} 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: sth-secret 6 | labels: 7 | app.kubernetes.io/name: {{ include "sth.name" . }} 8 | helm.sh/chart: {{ include "sth.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | annotations: 12 | kubernetes.io/service-account.name: sth-sa 13 | type: kubernetes.io/service-account-token 14 | {{- end }} 15 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/charts/templates/sth-serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | {{- if .Values.serviceAccountToken.enabled }} 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: sth-sa 6 | labels: 7 | app.kubernetes.io/name: {{ include "sth.name" . }} 8 | helm.sh/chart: {{ include "sth.chart" . }} 9 | app.kubernetes.io/instance: {{ .Release.Name }} 10 | app.kubernetes.io/managed-by: {{ .Release.Service }} 11 | secrets: 12 | - name: sth-secret 13 | {{- end }} 14 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/manifests/sth-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | namespace: default 5 | name: sth-secret 6 | labels: 7 | app.kubernetes.io/name: sth 8 | annotations: 9 | kubernetes.io/service-account.name: sth-sa 10 | type: kubernetes.io/service-account-token 11 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/manifests/sth-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | namespace: default 5 | name: sth-api 6 | labels: 7 | app: sth 8 | app.kubernetes.io/name: sth 9 | service: sth-external 10 | spec: 11 | type: NodePort 12 | ports: 13 | - port: 8000 14 | name: sth 15 | targetPort: sth-api 16 | externalTrafficPolicy: Local 17 | selector: 18 | app: sth 19 | --- 20 | apiVersion: v1 21 | kind: Service 22 | metadata: 23 | name: sth-runner 24 | labels: 25 | app: sth 26 | app.kubernetes.io/name: sth 27 | service: sth-runner 28 | spec: 29 | type: ClusterIP 30 | ports: 31 | - port: 8001 32 | name: sth 33 | targetPort: sth-runner 34 | selector: 35 | app: sth 36 | -------------------------------------------------------------------------------- /docs/guides/kubernetes/manifests/sth-serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | namespace: default 5 | name: sth-sa 6 | labels: 7 | app.kubernetes.io/name: sth 8 | secrets: 9 | - name: sth-secret 10 | -------------------------------------------------------------------------------- /docs/guides/nomad/config.hcl: -------------------------------------------------------------------------------- 1 | plugin "docker" { 2 | config { 3 | volumes { 4 | enabled = true 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /docs/host/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/load-check/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/load-check/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/load-check](README.md) / Exports 2 | 3 | # @scramjet/load-check 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [LoadCheck](classes/LoadCheck.md) 10 | - [LoadCheckConfig](classes/LoadCheckConfig.md) 11 | -------------------------------------------------------------------------------- /docs/logger/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/middleware-api-client/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/middleware-api-client/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/middleware-api-client](README.md) / Exports 2 | 3 | # @scramjet/middleware-api-client 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [MiddlewareClient](classes/MiddlewareClient.md) 10 | -------------------------------------------------------------------------------- /docs/model/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/monitoring-server/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/monitoring-server](README.md) / Exports 2 | 3 | # @scramjet/monitoring-server 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [MonitoringServer](classes/MonitoringServer.md) 10 | - [MonitoringServerConf](classes/MonitoringServerConf.md) 11 | -------------------------------------------------------------------------------- /docs/multi-manager-api-client/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/multi-manager-api-client/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/multi-manager-api-client](README.md) / Exports 2 | 3 | # @scramjet/multi-manager-api-client 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [MultiManagerClient](classes/MultiManagerClient.md) 10 | -------------------------------------------------------------------------------- /docs/obj-logger/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/runner/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/runner/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/runner](README.md) / Exports 2 | 3 | # @scramjet/runner 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [MessageUtils](classes/MessageUtils.md) 10 | - [Runner](classes/Runner.md) 11 | -------------------------------------------------------------------------------- /docs/sth-config/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/sth-constants/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/sth-constants/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/constants](README.md) / Exports 2 | 3 | # @scramjet/constants 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [MyCustomErrorExample](classes/MyCustomErrorExample.md) 10 | 11 | ### Variables 12 | 13 | - [exampleResponse](modules.md#exampleresponse) 14 | 15 | ## Variables 16 | 17 | ### exampleResponse 18 | 19 | • `Const` **exampleResponse**: `Object` 20 | 21 | #### Type declaration 22 | 23 | | Name | Type | 24 | | :------ | :------ | 25 | | `message` | `string` | 26 | | `status` | `number` | 27 | 28 | #### Defined in 29 | 30 | [packages/constants/src/lib/responses.ts:1](https://github.com/scramjetorg/transform-hub/blob/HEAD/packages/constants/src/lib/responses.ts#L1) 31 | -------------------------------------------------------------------------------- /docs/sth/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/sth/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/sth](README.md) / Exports 2 | 3 | # @scramjet/sth 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [STH](classes/STH.md) 10 | -------------------------------------------------------------------------------- /docs/symbols/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/symbols/enums/HostHeaders.md: -------------------------------------------------------------------------------- 1 | [@scramjet/symbols](../README.md) / [Exports](../modules.md) / HostHeaders 2 | 3 | # Enumeration: HostHeaders 4 | 5 | ## Table of contents 6 | 7 | ### Enumeration Members 8 | 9 | - [SEQUENCE\_FORCE\_REMOVE](HostHeaders.md#sequence_force_remove) 10 | 11 | ## Enumeration Members 12 | 13 | ### SEQUENCE\_FORCE\_REMOVE 14 | 15 | • **SEQUENCE\_FORCE\_REMOVE** = ``"x-seq-kill-inst"`` 16 | 17 | #### Defined in 18 | 19 | [headers/host.ts:2](https://github.com/scramjetorg/transform-hub/blob/HEAD/packages/symbols/src/headers/host.ts#L2) 20 | -------------------------------------------------------------------------------- /docs/telemetry/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/types/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/types/classes/ClientProvider.md: -------------------------------------------------------------------------------- 1 | [@scramjet/types](../README.md) / [Exports](../modules.md) / ClientProvider 2 | 3 | # Class: ClientProvider 4 | 5 | ## Table of contents 6 | 7 | ### Properties 8 | 9 | - [client](ClientProvider.md#client) 10 | 11 | ### Constructors 12 | 13 | - [constructor](ClientProvider.md#constructor) 14 | 15 | ## Properties 16 | 17 | ### client 18 | 19 | • **client**: `HttpClient` 20 | 21 | #### Defined in 22 | 23 | [packages/types/src/api-client/host-client.ts:14](https://github.com/scramjetorg/transform-hub/blob/HEAD/packages/types/src/api-client/host-client.ts#L14) 24 | 25 | ## Constructors 26 | 27 | ### constructor 28 | 29 | • **new ClientProvider**() 30 | -------------------------------------------------------------------------------- /docs/types/interfaces/IMonitoringServer.md: -------------------------------------------------------------------------------- 1 | [@scramjet/types](../README.md) / [Exports](../modules.md) / IMonitoringServer 2 | 3 | # Interface: IMonitoringServer 4 | 5 | ## Table of contents 6 | 7 | ### Methods 8 | 9 | - [start](IMonitoringServer.md#start) 10 | 11 | ## Methods 12 | 13 | ### start 14 | 15 | ▸ **start**(): `Promise`<[`MonitoringServerConfig`](../modules.md#monitoringserverconfig)\> 16 | 17 | #### Returns 18 | 19 | `Promise`<[`MonitoringServerConfig`](../modules.md#monitoringserverconfig)\> 20 | 21 | #### Defined in 22 | 23 | [packages/types/src/monitoring-server.ts:12](https://github.com/scramjetorg/transform-hub/blob/HEAD/packages/types/src/monitoring-server.ts#L12) 24 | -------------------------------------------------------------------------------- /docs/types/modules/MHRestAPI.md: -------------------------------------------------------------------------------- 1 | [@scramjet/types](../README.md) / [Exports](../modules.md) / MHRestAPI 2 | 3 | # Namespace: MHRestAPI 4 | 5 | ## Table of contents 6 | 7 | ### References 8 | 9 | - [GetVersionResponse](MHRestAPI.md#getversionresponse) 10 | 11 | ## References 12 | 13 | ### GetVersionResponse 14 | 15 | Re-exports [GetVersionResponse](MRestAPI.md#getversionresponse) 16 | -------------------------------------------------------------------------------- /docs/utility/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/verser/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/verser/modules.md: -------------------------------------------------------------------------------- 1 | [@scramjet/verser](README.md) / Exports 2 | 3 | # @scramjet/verser 4 | 5 | ## Table of contents 6 | 7 | ### Classes 8 | 9 | - [Verser](classes/Verser.md) 10 | - [VerserClient](classes/VerserClient.md) 11 | - [VerserConnection](classes/VerserConnection.md) 12 | -------------------------------------------------------------------------------- /images/ava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/ava.png -------------------------------------------------------------------------------- /images/ava1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/ava1.png -------------------------------------------------------------------------------- /images/clean_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/clean_install.png -------------------------------------------------------------------------------- /images/cli_npm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/cli_npm.png -------------------------------------------------------------------------------- /images/discord.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/discord.png -------------------------------------------------------------------------------- /images/docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/docker.png -------------------------------------------------------------------------------- /images/gh_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/gh_logo.png -------------------------------------------------------------------------------- /images/hello_alice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/hello_alice.png -------------------------------------------------------------------------------- /images/hub_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/hub_start.png -------------------------------------------------------------------------------- /images/installations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/installations.png -------------------------------------------------------------------------------- /images/node_install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/node_install.png -------------------------------------------------------------------------------- /images/npm_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/npm_logo.png -------------------------------------------------------------------------------- /images/npm_package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/npm_package.png -------------------------------------------------------------------------------- /images/nvm_installation_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/nvm_installation_output.png -------------------------------------------------------------------------------- /images/slack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/slack.png -------------------------------------------------------------------------------- /images/tags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/tags.png -------------------------------------------------------------------------------- /images/test1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/test1.png -------------------------------------------------------------------------------- /images/test2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/test2.png -------------------------------------------------------------------------------- /images/test3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/test3.png -------------------------------------------------------------------------------- /images/test_ci.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/images/test_ci.png -------------------------------------------------------------------------------- /nyc.config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | exclude: ["**/types/**", "**/types.ts"], 5 | extends: "@istanbuljs/nyc-config-typescript", 6 | all: true, // Whether or not to instrument all files (not just the ones touched by your test suite) 7 | "report-dir": "./coverage", // Where to put the coverage report files 8 | include: "packages/**", 9 | reporter: [ 10 | "html", 11 | // "text", 12 | "text-summary" 13 | ] 14 | }; 15 | -------------------------------------------------------------------------------- /packages/adapters/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/adapters/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "exclude": [ 7 | "**/*.spec.ts" 8 | ], 9 | "reporter": [ 10 | "lcovonly", 11 | "text" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/adapters/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./dockerode-docker-helper"; 2 | export * from "./docker-instance-adapter"; 3 | export * from "./docker-sequence-adapter"; 4 | export * from "./initialize-runtime-adapters"; 5 | export * from "./types"; 6 | 7 | export * from "./get-instance-adapter"; 8 | export * from "./get-sequence-adapter"; 9 | 10 | export * from "./docker-networking"; 11 | 12 | export * from "./kubernetes-sequence-adapter"; 13 | export * from "./kubernetes-instance-adapter"; 14 | 15 | export * from "./process-sequence-adapter"; 16 | export * from "./process-instance-adapter"; 17 | -------------------------------------------------------------------------------- /packages/adapters/src/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Determines Sequence language by checking file extension in `main` field. 3 | * When failed, checks `engines` field for `node`. 4 | * Returns "unknown" when language can't be determined with this methods. 5 | * 6 | * @param {any} packageJson package.json contents 7 | * @returns {string} Detected language or "unknown" 8 | */ 9 | export const detectLanguage = (packageJson: {[key: string]: any}) => { 10 | if (packageJson.engines) { 11 | if ("python3" in packageJson.engines) return "py"; 12 | if ("node" in packageJson.engines) return "js"; 13 | } 14 | 15 | return (packageJson.main?.match(/(?:\.)([^.\\/:*?"<>|\r\n]+$)/) || { 1: undefined })[1] || "unknown"; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/adapters/test/pass.spec.ts: -------------------------------------------------------------------------------- 1 | import test from "ava"; 2 | 3 | test("Passing test", (t) => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/adapters/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/adapters/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/adapters", 18 | "plugin": "typedoc-plugin-markdown", 19 | "gitRevision": "HEAD", 20 | "sort": "alphabetical" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/api-client/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | }, 7 | rules: { 8 | "no-console": 2 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /packages/api-client/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "exclude": [ 7 | "**/*.spec.ts" 8 | ], 9 | "reporter": [ 10 | "lcovonly", 11 | "text" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/api-client/src/definitions.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /packages/api-client/src/index.ts: -------------------------------------------------------------------------------- 1 | export { HostClient } from "./host-client"; 2 | export { InstanceClient, InstanceInputStream, InstanceOutputStream } from "./instance-client"; 3 | export { SequenceClient } from "./sequence-client"; 4 | export * from "./manager-client"; 5 | -------------------------------------------------------------------------------- /packages/api-client/test/pass.spec.ts: -------------------------------------------------------------------------------- 1 | import test from "ava"; 2 | 3 | test("Passing test", (t) => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/api-client/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/api-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/api-client", 18 | "plugin": "typedoc-plugin-markdown", 19 | "gitRevision": "HEAD", 20 | "sort": "alphabetical" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/api-server/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/api-server/src/lib/0http.ts: -------------------------------------------------------------------------------- 1 | import { Server } from "http"; 2 | import { CeroConfig, CeroRouter, CeroRouterConfig, SequentialCeroRouter } from "./definitions"; 3 | 4 | const _cero = require("0http"); 5 | 6 | export const sequentialRouter: (config: CeroRouterConfig) => SequentialCeroRouter = require("0http/lib/router/sequential"); 7 | export const cero = < 8 | T extends Server = Server, 9 | S extends CeroRouter = CeroRouter 10 | >(config?: CeroConfig) => { 11 | return _cero(config) as { 12 | router: S; 13 | server: T; 14 | }; 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /packages/api-server/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # Scramjet Transform Hub API Server 2 | 3 | This package is part of [Scramjet Transform Hub](https://www.npmjs.org/package/@scramjet/sth). The package provides the API Server used by STH to expose the interface. 4 | 5 | ## Docs 6 | 7 | >!docs api-server/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/api-server/src/types/ServerConfig.ts: -------------------------------------------------------------------------------- 1 | import { Server as HttpServer } from "http"; 2 | import { Server as HttpsServer } from "https"; 3 | import { CeroRouter } from "../lib/definitions"; 4 | 5 | export type ServerConfig = { 6 | verbose?: boolean; 7 | server?: HttpsServer | HttpServer; 8 | sslKeyPath?: string; 9 | sslCertPath?: string; 10 | router?: CeroRouter; 11 | }; 12 | -------------------------------------------------------------------------------- /packages/api-server/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export { ServerConfig } from "./ServerConfig"; 2 | -------------------------------------------------------------------------------- /packages/api-server/test/pause-resume.ts: -------------------------------------------------------------------------------- 1 | import { PassThrough } from "stream"; 2 | import { createServer } from ".."; 3 | 4 | const srv = createServer({ 5 | verbose: true 6 | }); 7 | const pipe = new PassThrough(); 8 | 9 | srv.downstream("/in", pipe, { text: true }); 10 | srv.upstream("/out", pipe, { text: true }); 11 | 12 | srv.server.listen(7000); 13 | -------------------------------------------------------------------------------- /packages/api-server/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/api-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts", 16 | "src/handlers", 17 | "src/lib" 18 | ], 19 | "out": "../../docs/api-server", 20 | "plugin": "typedoc-plugin-markdown", 21 | "excludePrivate": "true", 22 | "gitRevision": "HEAD", 23 | "sort": "alphabetical" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/cli/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/cli/scripts/completion/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo rm /etc/bash_completion.d/si 4 | complete -W "" si 5 | -------------------------------------------------------------------------------- /packages/cli/src/errors/bashScriptError.ts: -------------------------------------------------------------------------------- 1 | export class BashScriptError extends Error { 2 | exitCode: number; 3 | 4 | constructor(message: string, exitCode?: number) { 5 | const errorStart = "[Error] "; 6 | 7 | if (message.startsWith(errorStart)) message = message.substring(errorStart.length); 8 | super(message); 9 | this.exitCode = exitCode || -1; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/cli/src/events/completerDetails.ts: -------------------------------------------------------------------------------- 1 | export type CompleterParams = string[] | "filenames" | "dirnames"; 2 | export type ArgumentOrOptionName = string; 3 | export type CommandCompleterDetails = Record; 4 | 5 | export const CompleterDetailsEvent = "CompleterDetails"; 6 | export type CompleterDetailsCallback = ({}: CommandCompleterDetails) => void; 7 | -------------------------------------------------------------------------------- /packages/cli/src/index.ts: -------------------------------------------------------------------------------- 1 | // this index.ts file is used to generate Typedoc documentation, please do not remove it. 2 | export * from "./lib/common"; 3 | export * from "./lib/config"; 4 | export * from "./lib/output"; 5 | export * from "./lib/commands/scope"; 6 | export * from "./lib/commands/config"; 7 | export * from "./lib/commands/instance"; 8 | export * from "./lib/commands/sequence"; 9 | export * from "./lib/commands/space"; 10 | export * from "./lib/commands/topic"; 11 | export * from "./lib/commands/completion"; 12 | export * from "./lib/commands/init"; 13 | export * from "./lib/commands/util"; 14 | export * from "./types/index"; 15 | -------------------------------------------------------------------------------- /packages/cli/src/lib/commands/completion.ts: -------------------------------------------------------------------------------- 1 | import { CommandDefinition } from "../../types"; 2 | import { Completion } from "../../handlers/completion"; 3 | import { isCompletionScript } from "../../utils/envs"; 4 | 5 | export const completion: CommandDefinition = (program) => { 6 | const completionCmd = program.command("completion").addHelpCommand(false).description("Completion operations"); 7 | 8 | if (isCompletionScript()) completionCmd.action(() => Completion.complete(program)); 9 | 10 | completionCmd.command("install").description("Installs bash completion script").action(Completion.install); 11 | completionCmd.command("uninstall").description("Uninstalls bash completion script").action(Completion.uninstall); 12 | }; 13 | -------------------------------------------------------------------------------- /packages/cli/src/lib/helpers/isLinux.ts: -------------------------------------------------------------------------------- 1 | export const isLinuxOS = () => { 2 | return process.platform === "linux"; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/cli/src/lib/helpers/messages.ts: -------------------------------------------------------------------------------- 1 | import { displayError } from "../output"; 2 | 3 | export const displayProdOnlyMsg = (command: string) => { 4 | displayError(`'${command}' command is only available in production environment 5 | to change environment please use following command: 'si config set env production' 6 | or check out our documentation for more details: 'https://docs.scramjet.org/platform/get-started/'`); 7 | }; 8 | 9 | -------------------------------------------------------------------------------- /packages/cli/src/lib/platform/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./common"; 2 | -------------------------------------------------------------------------------- /packages/cli/src/types/params/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Arguments types 3 | */ 4 | 5 | export * from "./sequence"; 6 | -------------------------------------------------------------------------------- /packages/cli/src/types/params/sequence.ts: -------------------------------------------------------------------------------- 1 | import { DeepPartial, STHRestAPI } from "@scramjet/types"; 2 | 3 | export type SequenceDeployArgs = STHRestAPI.StartSequencePayload & { 4 | output?: string; 5 | }; 6 | 7 | export type SequenceStartCLIArgs = { 8 | args?: string; 9 | configFile?: string; 10 | configString?: string; 11 | instId?: string; 12 | inputTopic?: string; 13 | limits?: string; 14 | output?: string; 15 | outputTopic?: string; 16 | startupConfig: DeepPartial; 17 | }; 18 | -------------------------------------------------------------------------------- /packages/cli/src/utils/envs.ts: -------------------------------------------------------------------------------- 1 | export const envs = { 2 | nodeEnv: process.env.NODE_ENV, 3 | siConfigEnv: process.env.SI_CONFIG, 4 | siConfigPathEnv: process.env.SI_CONFIG_PATH, 5 | }; 6 | 7 | export const isDevelopment = () => envs.nodeEnv === "development"; 8 | export const isCompletionScript = () => envs.nodeEnv === "completion"; 9 | export const isTSNode = !!(process as any)[Symbol.for("ts-node.register.instance")]; 10 | 11 | -------------------------------------------------------------------------------- /packages/cli/src/utils/sessionId.ts: -------------------------------------------------------------------------------- 1 | import { readFileSync } from "fs"; 2 | import * as os from "os"; 3 | 4 | export const sessionId = () => { 5 | if (os.platform() !== "linux") return ""; 6 | 7 | return readFileSync("/proc/self/stat", { encoding: "utf-8" }).split(" ")[5]; 8 | }; 9 | -------------------------------------------------------------------------------- /packages/cli/src/utils/stringToBoolean.ts: -------------------------------------------------------------------------------- 1 | export const stringToBoolean = (string:string) => { 2 | switch (string.toLowerCase().trim()) { 3 | case "true": 4 | case "yes": 5 | case "1": 6 | return true; 7 | 8 | case "false": 9 | case "no": 10 | case "0": 11 | case null: 12 | return false; 13 | 14 | default: 15 | return undefined; 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /packages/cli/test/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/packages/cli/test/.keep -------------------------------------------------------------------------------- /packages/cli/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "ts-node": { 3 | "files": true 4 | }, 5 | "compilerOptions": { 6 | "outDir": "./dist" 7 | }, 8 | "extends": "../../tsconfig.base.json", 9 | "include": [ 10 | "./src/**/*.ts", 11 | "./test/**/*.ts" 12 | ], 13 | "exclude": [ 14 | "node_modules" 15 | ], 16 | "typedocOptions": { 17 | "entryPoints": [ 18 | "src/index.ts" 19 | ], 20 | "out": "../../docs/cli", 21 | "plugin": "typedoc-plugin-markdown", 22 | "excludePrivate": "true", 23 | "gitRevision": "HEAD", 24 | "sort": "alphabetical" 25 | } 26 | } -------------------------------------------------------------------------------- /packages/client-utils/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | }, 7 | rules: { 8 | "no-console": 2 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /packages/client-utils/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "exclude": [ 7 | "**/*.spec.ts" 8 | ], 9 | "reporter": [ 10 | "lcovonly", 11 | "text" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/client-utils/src/readme.mtpl: -------------------------------------------------------------------------------- 1 |

Scramjet Transform Hub API Client

2 | 3 | >@shields 4 | 5 | This package is part of Scramjet Transform Hub. The package provides the API Client Utils for use with Scramjet Transform Hub. 6 | 7 | ## Docs 8 | 9 | >!docs client-utils/modules.md & 10 | 11 | ## More reading 12 | 13 | In the link below you will find more information about our stream protocol and API usage. 14 | 15 | >!docs read-more/stream-and-api.md & 16 | 17 | >@sth 18 | >@use-cases 19 | >@links 20 | >@license-agpl 21 | >@contrib 22 | -------------------------------------------------------------------------------- /packages/client-utils/test/pass.spec.ts: -------------------------------------------------------------------------------- 1 | import test from "ava"; 2 | 3 | test("Passing test", (t) => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/client-utils/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/client-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/client-utils", 18 | "plugin": "typedoc-plugin-markdown", 19 | "gitRevision": "HEAD", 20 | "sort": "alphabetical" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/host/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js", "jest.config.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/host/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "reporter": ["lcovonly", "text"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/host/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | coverageDirectory: "coverage", 3 | coveragePathIgnorePatterns: [ 4 | "/node_modules/", 5 | "/dist/" 6 | ], 7 | coverageProvider: "v8", 8 | coverageReporters: [ 9 | // "json", 10 | "text", 11 | // "lcov", 12 | ], 13 | errorOnDeprecated: true, 14 | preset: 'ts-jest', 15 | slowTestThreshold: 5, 16 | testEnvironment: 'node', 17 | testMatch: [ 18 | "**/__tests__/**/*.[jt]s?(x)", 19 | "**/test/**/*.[jt]s?(x)", 20 | "**/?(*.)+(spec|test).[tj]s?(x)" 21 | ], 22 | testPathIgnorePatterns: [ 23 | "/node_modules/", 24 | "/dist/", 25 | ], 26 | }; -------------------------------------------------------------------------------- /packages/host/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./lib/common-logs-pipe"; 2 | export * from "./lib/cpm-connector"; 3 | export * from "./lib/csi-controller"; 4 | export * from "./lib/host"; 5 | export * from "./lib/instance-store"; 6 | export * from "./lib/serviceDiscovery/sd-adapter"; 7 | export * from "./lib/socket-server"; 8 | export * from "./lib/start-host"; 9 | -------------------------------------------------------------------------------- /packages/host/src/lib/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/packages/host/src/lib/.keep -------------------------------------------------------------------------------- /packages/host/src/lib/instance-store.ts: -------------------------------------------------------------------------------- 1 | import { CSIController } from "./csi-controller"; 2 | 3 | /** 4 | * Object storing Instance controllers. 5 | */ 6 | export const InstanceStore: { [key: string]: CSIController } = {}; 7 | -------------------------------------------------------------------------------- /packages/host/src/lib/middlewares/cors.ts: -------------------------------------------------------------------------------- 1 | import { NextCallback, ParsedMessage } from "@scramjet/types"; 2 | import { ServerResponse } from "http"; 3 | 4 | export const corsMiddleware = (req: ParsedMessage, res: ServerResponse, next: NextCallback) => { 5 | res.setHeader("Access-Control-Allow-Origin", "*"); 6 | 7 | return next(); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/host/src/lib/middlewares/options.ts: -------------------------------------------------------------------------------- 1 | import { NextCallback, ParsedMessage } from "@scramjet/types"; 2 | import { ServerResponse } from "http"; 3 | 4 | export const optionsMiddleware = (req: ParsedMessage, res: ServerResponse, next: NextCallback) => { 5 | if (req.method === "OPTIONS") { 6 | res.setHeader("Access-Control-Allow-Headers", "*"); 7 | res.setHeader("Access-Control-Allow-Methods", "DELETE, POST, GET, OPTIONS"); 8 | return res.end(); 9 | } 10 | 11 | return next(); 12 | }; 13 | -------------------------------------------------------------------------------- /packages/host/src/lib/serviceDiscovery/contentType.ts: -------------------------------------------------------------------------------- 1 | import { ContentType } from "@scramjet/types"; 2 | 3 | export const isContentType = (contentType: string): contentType is ContentType => { 4 | return [ 5 | "text/x-ndjson", 6 | "application/x-ndjson", 7 | "text/plain", 8 | "application/octet-stream" 9 | ].includes(contentType); 10 | }; 11 | -------------------------------------------------------------------------------- /packages/host/src/lib/serviceDiscovery/topicId.ts: -------------------------------------------------------------------------------- 1 | class TopicId { 2 | private topicName: string; 3 | 4 | constructor(name: string) { 5 | this.topicName = name; 6 | } 7 | toString() { 8 | return this.topicName; 9 | } 10 | isValid() { 11 | return TopicId.validate(this.topicName); 12 | } 13 | static validate(topicName: string) { 14 | if (topicName.match(/^[\\a-zA-Z0-9_+-]+$/)) return true; 15 | return false; 16 | } 17 | } 18 | 19 | export default TopicId; 20 | -------------------------------------------------------------------------------- /packages/host/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/host` 2 | 3 | This package provides the main host subsystem of STH - starts API Servers, creates adapters etc. 4 | 5 | ## Docs 6 | 7 | >!docs host/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/host/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*", 8 | "src/build.info.json" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/host/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/host", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/load-check/.eslintrc: -------------------------------------------------------------------------------- 1 | {"parserOptions":{"project": "./tsconfig.json", "tsconfigRootDir":"./packages/load-check"}} 2 | -------------------------------------------------------------------------------- /packages/load-check/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/load-check/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "src/**/*" 5 | ], 6 | "reporter": ["lcovonly", "text"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/load-check/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./load-check"; 2 | export { LoadCheckConfig } from "./config/load-check-config"; 3 | -------------------------------------------------------------------------------- /packages/load-check/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/load-check` 2 | 3 | This package provides info about STH health and also some metrics such as CPU, memory and disk usage. 4 | 5 | ## Docs 6 | 7 | >!docs load-check/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/load-check/test/pass.spec.ts: -------------------------------------------------------------------------------- 1 | import test from "ava"; 2 | 3 | test("Passing test", (t) => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/load-check/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/load-check/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/load-check", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/logger/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/logger/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "reporter": ["lcovonly", "text"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/logger/src/lib/colors.ts: -------------------------------------------------------------------------------- 1 | export enum COLORS { 2 | Reset = "\x1b[0m", 3 | Bright = "\x1b[1m", 4 | Dim = "\x1b[2m", 5 | Underscore = "\x1b[4m", 6 | Blink = "\x1b[5m", 7 | Reverse = "\x1b[7m", 8 | Hidden = "\x1b[8m", 9 | 10 | FgBlack = "\x1b[30m", 11 | FgRed = "\x1b[31m", 12 | FgGreen = "\x1b[32m", 13 | FgYellow = "\x1b[33m", 14 | FgBlue = "\x1b[34m", 15 | FgMagenta = "\x1b[35m", 16 | FgCyan = "\x1b[36m", 17 | FgWhite = "\x1b[37m", 18 | 19 | BgBlack = "\x1b[40m", 20 | BgRed = "\x1b[41m", 21 | BgGreen = "\x1b[42m", 22 | BgYellow = "\x1b[43m", 23 | BgBlue = "\x1b[44m", 24 | BgMagenta = "\x1b[45m", 25 | BgCyan = "\x1b[46m", 26 | BgWhite = "\x1b[47m" 27 | } 28 | -------------------------------------------------------------------------------- /packages/logger/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/logger` 2 | 3 | The package provides Scramjet Transform Hub with a simple logger with 100% Console Web API compatible signatures and a streaming output of any choice. 4 | 5 | ## Docs 6 | 7 | >!docs logger/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/logger/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/logger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/logger", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/middleware-api-client/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js", "bundle"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/middleware-api-client/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./middleware-client"; 2 | -------------------------------------------------------------------------------- /packages/middleware-api-client/test/pass.spec.ts: -------------------------------------------------------------------------------- 1 | import test from "ava"; 2 | 3 | test("Passing test", (t) => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/middleware-api-client/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/middleware-api-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/middleware-api-client", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/model/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/model/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "src/**/*" 5 | ], 6 | "reporter": ["lcovonly", "text"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/model/src/errors/app-error.ts: -------------------------------------------------------------------------------- 1 | import { AppError as IAppError, AppErrorCode } from "@scramjet/types"; 2 | 3 | type IAppErrorData = { 4 | data?: any; 5 | } 6 | 7 | export class AppError extends Error implements IAppError, IAppErrorData { 8 | code: AppErrorCode; 9 | data?: any; 10 | 11 | constructor(code: AppErrorCode) { 12 | super("Application Error Occurred"); 13 | 14 | this.code = code; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /packages/model/src/errors/csi-controller-error.ts: -------------------------------------------------------------------------------- 1 | import { CSIControllerErrorCode } from "@scramjet/types"; 2 | import { AppError } from "./app-error"; 3 | 4 | export type ICSIControllerErrorData = any; 5 | 6 | export class CSIControllerError extends AppError implements ICSIControllerErrorData { 7 | constructor(code: CSIControllerErrorCode, data?: ICSIControllerErrorData) { 8 | super(code); 9 | 10 | this.data = data; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/model/src/errors/host-error.ts: -------------------------------------------------------------------------------- 1 | import { HostErrorCode } from "@scramjet/types"; 2 | import { AppError } from "./app-error"; 3 | 4 | export type IHostErrorData = any; 5 | 6 | export class HostError extends AppError implements IHostErrorData { 7 | constructor(code: HostErrorCode, data?: IHostErrorData) { 8 | super(code); 9 | 10 | this.data = data; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/model/src/errors/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./app-error"; 2 | export * from "./host-error"; 3 | export * from "./runner-error"; 4 | export * from "./instance-adapter-error"; 5 | export * from "./csi-controller-error"; 6 | export * from "./sequence-adapter-error"; 7 | -------------------------------------------------------------------------------- /packages/model/src/errors/instance-adapter-error.ts: -------------------------------------------------------------------------------- 1 | import { InstanceAdapterErrorCode } from "@scramjet/types"; 2 | import { AppError } from "./app-error"; 3 | 4 | export class InstanceAdapterError extends AppError { 5 | constructor(code: InstanceAdapterErrorCode, data?: any) { 6 | super(code); 7 | 8 | this.data = data; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/model/src/errors/runner-error.ts: -------------------------------------------------------------------------------- 1 | import { RunnerErrorCode } from "@scramjet/types"; 2 | import { AppError } from "./app-error"; 3 | 4 | export type IRunnerErrorData = any; 5 | 6 | export class RunnerError extends AppError implements IRunnerErrorData { 7 | constructor(code: RunnerErrorCode, data?: IRunnerErrorData) { 8 | super(code); 9 | 10 | this.data = data; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/model/src/errors/sequence-adapter-error.ts: -------------------------------------------------------------------------------- 1 | import { SequenceAdapterErrorCode } from "@scramjet/types"; 2 | import { AppError } from "./app-error"; 3 | 4 | export class SequenceAdapterError extends AppError { 5 | constructor(code: SequenceAdapterErrorCode, data?: any) { 6 | super(code); 7 | 8 | this.data = data; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/model/src/index.ts: -------------------------------------------------------------------------------- 1 | import { deserializeMessage, serializeMessage } from "./messages-utils"; 2 | 3 | export * from "./errors"; 4 | export * from "./get-message"; 5 | export * from "./messages-utils"; 6 | export * from "./stream-handler"; 7 | 8 | export { DelayedStream } from "./utils/delayed-stream"; 9 | 10 | export { IDProvider } from "./utils/id-provider"; 11 | export const MessageUtilities = { serializeMessage, deserializeMessage }; 12 | -------------------------------------------------------------------------------- /packages/model/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/model` 2 | 3 | The package provides the domain model for Scramjet Transform Hub, the API Client and CLI. 4 | 5 | ## Docs 6 | 7 | >!docs model/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/model/src/utils/id-provider.ts: -------------------------------------------------------------------------------- 1 | import { v4 as uuidv4, validate } from "uuid"; 2 | 3 | export class IDProvider { 4 | static generate() { 5 | return uuidv4(); 6 | } 7 | 8 | public static isValid(id: string) { 9 | return validate(id); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/model/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/model/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/model", 18 | "plugin": "typedoc-plugin-markdown", 19 | "gitRevision": "HEAD", 20 | "sort": "alphabetical" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/module-loader/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/module-loader/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "reporter": ["lcovonly", "text"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/module-loader/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/module-loader/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules", 12 | "dist" 13 | ], 14 | "typedocOptions": { 15 | "entryPoints": [ 16 | "src/index.ts" 17 | ], 18 | "out": "../../docs/module-loader", 19 | "plugin": "typedoc-plugin-markdown", 20 | "excludePrivate": "true", 21 | "gitRevision": "HEAD", 22 | "sort": "alphabetical" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/monitoring-server/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/monitoring-server/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "reporter": ["lcovonly", "text"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/monitoring-server/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./monitoring-server"; 2 | export * from "./config/monitoringConfig"; 3 | -------------------------------------------------------------------------------- /packages/monitoring-server/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/monitoring-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/monitoring-server", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/multi-manager-api-client/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/multi-manager-api-client/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./multi-cpm-client"; 2 | -------------------------------------------------------------------------------- /packages/multi-manager-api-client/test/pass.spec.ts: -------------------------------------------------------------------------------- 1 | import test from "ava"; 2 | 3 | test("Passing test", (t) => { 4 | t.pass(); 5 | }); 6 | -------------------------------------------------------------------------------- /packages/multi-manager-api-client/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/multi-manager-api-client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/multi-manager-api-client", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/obj-logger/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/obj-logger/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "include": [ 4 | "dist/**/*" 5 | ], 6 | "reporter": ["lcovonly", "text"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/obj-logger/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./obj-logger"; 2 | export * from "./utils/pretty-print"; 3 | -------------------------------------------------------------------------------- /packages/obj-logger/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/obj-logger` 2 | 3 | The package provides Scramjet Transform Hub with an object logger. 4 | 5 | ## Docs 6 | 7 | >!docs logger/README.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/obj-logger/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/obj-logger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/obj-logger", 18 | "plugin": "typedoc-plugin-markdown", 19 | "readme": "none", 20 | "excludePrivate": "true", 21 | "gitRevision": "HEAD" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/pre-runner/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-bullseye-slim 2 | 3 | ENV PACKAGE_DIR=/package \ 4 | HUB_DIR=/opt/transform-hub 5 | 6 | RUN groupadd -g 1200 prerunner \ 7 | && useradd -g 1200 -u 1200 -m -d ${HUB_DIR} -s /bin/false prerunner \ 8 | && mkdir -p ${PACKAGE_DIR} \ 9 | && chown prerunner:prerunner ${PACKAGE_DIR} 10 | 11 | RUN apt-get update \ 12 | && apt-get install -y jq --no-install-recommends \ 13 | && rm -rf /var/lib/apt/lists/* 14 | 15 | WORKDIR ${HUB_DIR} 16 | 17 | COPY ./env.sh . 18 | COPY ./unpack.sh . 19 | COPY ./permissions.sh . 20 | COPY ./identify.sh . 21 | COPY ./unpack-identify.sh . 22 | 23 | 24 | USER prerunner 25 | CMD [ "./unpack-identify.sh" ] 26 | -------------------------------------------------------------------------------- /packages/pre-runner/env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | pkg_dir="${PACKAGE_DIR:-/package}" 4 | pkg_file="package.json" 5 | 6 | die() { 7 | local msg=$1 8 | local code=${2-1} 9 | echo >&1 -e "{\"error\":\"${msg}\"}" 10 | exit ${code} 11 | } 12 | -------------------------------------------------------------------------------- /packages/pre-runner/identify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ./env.sh 4 | 5 | if [ ! -r "${pkg_dir}/${pkg_file}" ]; then 6 | die "No ${pkg_file} in pkg archive." 7 | fi 8 | 9 | cat ${pkg_dir}/${pkg_file} \ 10 | | jq -c '{ name, author, version, keywords, description, main, engines, scramjet, repository, args }' 11 | -------------------------------------------------------------------------------- /packages/pre-runner/permissions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | RUNNER_USER="${RUNNER_USER:-runner}" 4 | 5 | chown -R ${RUNNER_USER}:${RUNNER_USER} ${HUB_DIR} ${PACKAGE_DIR} 6 | -------------------------------------------------------------------------------- /packages/pre-runner/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/pre-runner` 2 | 3 | The package builds a docker container that identifies the Sequences and returns the information back to STH. 4 | 5 | >@sth 6 | >@use-cases 7 | >@links 8 | >@license-agpl 9 | >@contrib 10 | -------------------------------------------------------------------------------- /packages/pre-runner/unpack-identify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ./env.sh 4 | . ./unpack.sh 5 | . ./identify.sh 6 | . ./permissions.sh 7 | -------------------------------------------------------------------------------- /packages/pre-runner/unpack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . ./env.sh 4 | 5 | if [ ! -w "${pkg_dir}" ]; then 6 | die "${pkg_dir} doesnt exist or is not writable." 7 | fi 8 | 9 | tar zxf - -C ${pkg_dir} || die "Invalid pkg tar.gz archive" 10 | -------------------------------------------------------------------------------- /packages/python-runner/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | RUNNER_USER="${RUNNER_USER:-runner}" 6 | 7 | if [ "$1" == "start-runner" ]; then 8 | shift 9 | set -- python runner.py "$@" 10 | fi 11 | 12 | exec gosu ${RUNNER_USER} "$@" 13 | -------------------------------------------------------------------------------- /packages/python-runner/requirements.txt: -------------------------------------------------------------------------------- 1 | pyee==9.0.4 2 | scramjet-framework-py -------------------------------------------------------------------------------- /packages/python-runner/unpack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | tar zxf - -C /package && chown -R 1200:1200 $PACKAGE_DIR && touch /package/.ready || touch $PACKAGE_DIR/.fail 6 | -------------------------------------------------------------------------------- /packages/python-runner/wait-for-sequence-and-start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | while true; do 6 | sleep 1; 7 | 8 | if test -f /package/.ready; then 9 | docker-entrypoint.sh start-runner; 10 | exit $?; 11 | elif test -f /package/.fail; then 12 | >&2 echo "$(cat /package/.fail)" 13 | exit 10 14 | fi 15 | done; 16 | -------------------------------------------------------------------------------- /packages/runner/.dockerignore: -------------------------------------------------------------------------------- 1 | **/.git/ 2 | **/.github/ 3 | **/Dockerfile* 4 | **/Jenkinsfile* 5 | **/docs/ 6 | -------------------------------------------------------------------------------- /packages/runner/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | }, 7 | rules: { 8 | "no-console": ["error", { allow: ["warn", "error"] }] 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /packages/runner/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": true, 3 | "exclude": [ 4 | "**/*.spec.ts" 5 | ], 6 | "reporter": [ 7 | "lcovonly", 8 | "text" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/runner/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | RUNNER_USER="${RUNNER_USER:-runner}" 6 | 7 | if [ "$1" == "start-runner" ]; then 8 | shift 9 | set -- node bin/start-runner "$@" 10 | fi 11 | 12 | exec gosu ${RUNNER_USER} "$@" 13 | -------------------------------------------------------------------------------- /packages/runner/src/index.ts: -------------------------------------------------------------------------------- 1 | export { MessageUtils } from "./message-utils"; 2 | export { Runner } from "./runner"; 3 | -------------------------------------------------------------------------------- /packages/runner/src/message-utils.ts: -------------------------------------------------------------------------------- 1 | import { EncodedMonitoringMessage, WritableStream } from "@scramjet/types"; 2 | 3 | export class MessageUtils { 4 | public static writeMessageOnStream([code, data]: EncodedMonitoringMessage, streamToWrite: WritableStream) { 5 | if (streamToWrite === undefined) { 6 | throw new Error("The Stream is not defined."); 7 | } 8 | 9 | streamToWrite.write(JSON.stringify([code, data]) + "\r\n"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/runner/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/runner` 2 | 3 | This package executes the Sequences and provides control mechanisms to them. 4 | 5 | ## Docs 6 | 7 | >!docs runner/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/runner/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/runner/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/runner", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/runner/unpack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | PACKAGE_DIR=${PACKAGE_DIR:-/package} 4 | 5 | set -e 6 | 7 | tar zxf - -C $PACKAGE_DIR && chown -R 1200:1200 $PACKAGE_DIR && touch $PACKAGE_DIR/.ready || touch $PACKAGE_DIR/.fail 8 | -------------------------------------------------------------------------------- /packages/runner/wait-for-sequence-and-start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | while true; do 6 | sleep 1; 7 | 8 | if test -f /package/.ready; then 9 | docker-entrypoint.sh start-runner; 10 | exit $?; 11 | elif test -f /package/.fail; then 12 | >&2 echo "$(cat /package/.fail)" 13 | exit 10 14 | fi 15 | done; 16 | -------------------------------------------------------------------------------- /packages/sth-config/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/sth-config/src/image-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "prerunner": "scramjetorg/pre-runner:1.0.1", 3 | "runner": { 4 | "node": "scramjetorg/runner:1.0.1", 5 | "python3": "scramjetorg/runner-py:1.0.1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/sth-config/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/sth-config` 2 | 3 | This package executes the Sequences and controls the runner via the wired adapter. 4 | 5 | ## Docs 6 | 7 | >!docs sth-config/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/sth-config/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/sth-config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/sth-config", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/sth/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js", "postinstall.js"], 3 | parserOptions: { 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname, 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/sth/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | scramjet-hub: 4 | image: scramjetorg/sth:0.28.1 5 | volumes: 6 | - /tmp/:/tmp/ 7 | - /var/run/docker.sock:/var/run/docker.sock 8 | ports: 9 | - 8000:8000 10 | restart: unless-stopped 11 | command: ["scramjet-transform-hub"] 12 | -------------------------------------------------------------------------------- /packages/sth/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | HUB_USER="${HUB_USER:-sth}" 6 | 7 | chown -R ${HUB_USER}:${HUB_USER} ${HUB_DIR} 8 | 9 | if [ "${1#-}" != "$1" ]; then 10 | set -- node bin/hub "$@" 11 | fi 12 | 13 | if [ "$1" == "scramjet-transform-hub" ]; then 14 | shift 15 | set -- node bin/hub -H 0.0.0.0 -P 8000 "$@" 16 | fi 17 | 18 | exec gosu ${HUB_USER} "$@" 19 | -------------------------------------------------------------------------------- /packages/sth/src/lib/index.ts: -------------------------------------------------------------------------------- 1 | const HUB = Symbol.for("org.scramjet.hub.instance"); 2 | 3 | export default HUB; 4 | -------------------------------------------------------------------------------- /packages/sth/test/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/packages/sth/test/.keep -------------------------------------------------------------------------------- /packages/sth/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./src/**/*.ts" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/sth/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src/**/*.ts", 8 | "./test/**/*.ts" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/sth", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/symbols/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/symbols/src/communication-channel.ts: -------------------------------------------------------------------------------- 1 | export enum CommunicationChannel { 2 | STDIN, 3 | STDOUT, 4 | STDERR, 5 | CONTROL, 6 | MONITORING, 7 | IN, 8 | OUT, 9 | LOG, 10 | PACKAGE 11 | } 12 | -------------------------------------------------------------------------------- /packages/symbols/src/cpm-message-code.ts: -------------------------------------------------------------------------------- 1 | export enum CPMMessageCode { 2 | STH_ID = 7000, 3 | LOAD = 7001, 4 | 5 | NETWORK_INFO = 7002, 6 | 7 | INSTANCES = 7003, 8 | SEQUENCES = 7004, 9 | INSTANCE = 7005, 10 | SEQUENCE = 7006, 11 | 12 | TOPIC = 7007, 13 | 14 | CONFIRM_MSG = 8000, 15 | 16 | KEY_REVOKED = 9001, 17 | LIMIT_EXCEEDED = 9002, 18 | ID_DROP = 9003 19 | } 20 | -------------------------------------------------------------------------------- /packages/symbols/src/disconnect-error-codes.ts: -------------------------------------------------------------------------------- 1 | export enum DisconnectHubErrors { 2 | STH_NOT_FOUND, 3 | KEY_NOT_FOUND, 4 | BAD_REQUEST, 5 | CONFLICT, 6 | ID_NOT_PROVIDED, 7 | NATIVE_HUB, 8 | CONNECTED, 9 | ALREADY_DISCONNECTED 10 | } 11 | -------------------------------------------------------------------------------- /packages/symbols/src/headers/host.ts: -------------------------------------------------------------------------------- 1 | export enum HostHeaders { 2 | SEQUENCE_FORCE_REMOVE = "x-seq-kill-inst" 3 | } 4 | -------------------------------------------------------------------------------- /packages/symbols/src/headers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./host"; 2 | -------------------------------------------------------------------------------- /packages/symbols/src/instance-status-code.ts: -------------------------------------------------------------------------------- 1 | export enum InstanceMessageCode { 2 | INSTANCE_STARTED, 3 | INSTANCE_STOPPED, 4 | INSTANCE_ENDED, 5 | INSTANCE_TERMINATED, 6 | INSTANCE_CONNECTED 7 | } 8 | -------------------------------------------------------------------------------- /packages/symbols/src/instance-status.ts: -------------------------------------------------------------------------------- 1 | export const enum InstanceStatus { 2 | INITIALIZING = "initializing", 3 | STARTING = "starting", 4 | RUNNING = "running", 5 | STOPPING = "stopping", 6 | KILLING = "killing", 7 | COMPLETED ="completed", 8 | ERRORED = "errored", 9 | GONE = "gone" 10 | } 11 | -------------------------------------------------------------------------------- /packages/symbols/src/op-state.ts: -------------------------------------------------------------------------------- 1 | export enum OpState { 2 | START, 3 | ACTIVE, 4 | END, 5 | ERROR 6 | } 7 | -------------------------------------------------------------------------------- /packages/symbols/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/symbols` 2 | 3 | This package holds the symbols and enumerations for STH. 4 | 5 | ## Docs 6 | 7 | >!docs symbols/modules.md & 8 | 9 | >@sth 10 | >@links 11 | >@license-agpl 12 | >@contrib 13 | -------------------------------------------------------------------------------- /packages/symbols/src/runner-exit-code.ts: -------------------------------------------------------------------------------- 1 | export enum RunnerExitCode { 2 | INVALID_ENV_VARS = 20, 3 | INVALID_SEQUENCE_PATH = 21, 4 | SEQUENCE_FAILED_ON_START = 22, 5 | SEQUENCE_FAILED_DURING_EXECUTION = 23, 6 | SEQUENCE_UNPACK_FAILED = 10, 7 | KILLED = 137, 8 | STOPPED = 138, 9 | SUCCESS = 0, 10 | CLEANUP_FAILED = 223, 11 | PODS_LIMIT_REACHED = 24, 12 | UNCAUGHT_EXCEPTION = 101 13 | } 14 | -------------------------------------------------------------------------------- /packages/symbols/src/runner-message-code.ts: -------------------------------------------------------------------------------- 1 | export enum RunnerMessageCode { 2 | PING = 3000, 3 | MONITORING = 3001, 4 | DESCRIBE_SEQUENCE = 3002, 5 | ERROR = 3003, 6 | SEQUENCE_STOPPED = 3006, 7 | STATUS = 3007, // temporary message code seq.status 8 | ALIVE = 3010, // temporary message code 9 | ACKNOWLEDGE = 3004, 10 | SEQUENCE_COMPLETED = 3011, 11 | PANG = 3012, 12 | INPUT_CONTENT_TYPE = 3013, 13 | 14 | PONG = 4000, 15 | STOP = 4001, 16 | KILL = 4002, 17 | MONITORING_RATE = 4003, 18 | MONITORING_REPLY = 4004, 19 | EVENT = 5001, 20 | } 21 | -------------------------------------------------------------------------------- /packages/symbols/src/sd-stream-handler-state.ts: -------------------------------------------------------------------------------- 1 | export enum WorkState { 2 | Flowing = "flowing", 3 | Close = "close", 4 | Error = "error" 5 | } 6 | 7 | export enum WritableState { 8 | Finish = "finish", 9 | Writable = "writable", 10 | Drain = "drain" 11 | } 12 | 13 | export enum ReadableState { 14 | Readable = "readable", 15 | Pause = "pause", 16 | End = "end" 17 | } 18 | 19 | export enum StreamType { 20 | Instance = "instance", 21 | Topic = "topic", 22 | Api = "api" 23 | } 24 | -------------------------------------------------------------------------------- /packages/symbols/src/sequence-status-code.ts: -------------------------------------------------------------------------------- 1 | export enum SequenceMessageCode { 2 | SEQUENCE_CREATED, 3 | SEQUENCE_DELETED 4 | } 5 | -------------------------------------------------------------------------------- /packages/symbols/src/symbols.ts: -------------------------------------------------------------------------------- 1 | const exposeSequenceSymbol = Symbol.for("org.scramjet.platform.exposeSequence"); 2 | 3 | export { 4 | exposeSequenceSymbol 5 | }; 6 | -------------------------------------------------------------------------------- /packages/symbols/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/symbols/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/symbols", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/telemetry/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/telemetry/src/index.ts: -------------------------------------------------------------------------------- 1 | import { TelemetryAdaptersConfig } from "@scramjet/types"; 2 | import { ITelemetryAdapter } from "./types"; 3 | 4 | const adapters = new Map([ 5 | ["loki", "./adapters/loki"] 6 | ]); 7 | 8 | export const getTelemetryAdapter = 9 | async (adapter: string, config: TelemetryAdaptersConfig): Promise => { 10 | const _adapterLocation = adapters.get(adapter); 11 | 12 | if (_adapterLocation) { 13 | return new (await import(_adapterLocation)).default(config); 14 | } 15 | 16 | throw new Error("Unknown telemetry adapter requested"); 17 | }; 18 | 19 | export * from "./types"; 20 | -------------------------------------------------------------------------------- /packages/telemetry/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # `@scramjet/telemetry` 2 | 3 | This package is part of Scramjet Transform Hub. The package provides modules for gathering analytics data. 4 | 5 | ## Docs 6 | 7 | >!docs telemetry/modules.md & 8 | 9 | >@sth 10 | >@use-cases 11 | >@links 12 | >@license-agpl 13 | >@contrib 14 | -------------------------------------------------------------------------------- /packages/telemetry/src/types.ts: -------------------------------------------------------------------------------- 1 | import { ObjLogger } from "@scramjet/obj-logger"; 2 | import { TelemetryAdaptersConfig } from "@scramjet/types"; 3 | 4 | export type logLevel = "debug" | "info" | "warn" | "error"; 5 | 6 | export interface ITelemetryAdapter { 7 | logger: ObjLogger; 8 | push(level: logLevel, payload: { message: string, labels?: { [key: string]: string }}): void; 9 | } 10 | 11 | export type TelemetryAdapter = { 12 | new (config: TelemetryAdaptersConfig): ITelemetryAdapter 13 | } 14 | -------------------------------------------------------------------------------- /packages/telemetry/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/telemetry/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/telemetry", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/types/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js", "scripts/**"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/types/src/app-config.ts: -------------------------------------------------------------------------------- 1 | 2 | type SimpleType = null | string | number | boolean; 3 | 4 | type MaybeArray = T | T[]; 5 | 6 | /** 7 | * App configuration primitive. 8 | */ 9 | 10 | export type AppConfig = { [key: string]: MaybeArray | MaybeArray; }; 11 | -------------------------------------------------------------------------------- /packages/types/src/client-utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./client-utils"; 2 | -------------------------------------------------------------------------------- /packages/types/src/component.ts: -------------------------------------------------------------------------------- 1 | import { IObjectLogger } from "./object-logger"; 2 | 3 | export interface IComponent { 4 | logger: IObjectLogger; 5 | id?: string 6 | } 7 | -------------------------------------------------------------------------------- /packages/types/src/cpm-connector.ts: -------------------------------------------------------------------------------- 1 | import { STHConfiguration } from "./sth-configuration"; 2 | 3 | export type CPMConnectorOptions = { 4 | id: STHConfiguration["host"]["id"]; 5 | description: STHConfiguration["description"]; 6 | tags: STHConfiguration["tags"]; 7 | infoFilePath: STHConfiguration["host"]["infoFilePath"]; 8 | cpmSslCaPath?: STHConfiguration["cpmSslCaPath"]; 9 | maxReconnections: STHConfiguration["cpm"]["maxReconnections"]; 10 | reconnectionDelay: STHConfiguration["cpm"]["reconnectionDelay"]; 11 | apiKey?: string; 12 | apiVersion: string; 13 | hostType?: NonNullable["hostType"]; 14 | } 15 | -------------------------------------------------------------------------------- /packages/types/src/dto/index.ts: -------------------------------------------------------------------------------- 1 | export { StartSequenceDTO, StartSequenceEndpointPayloadDTO } from "./start-sequence"; 2 | -------------------------------------------------------------------------------- /packages/types/src/dto/start-sequence.ts: -------------------------------------------------------------------------------- 1 | import { AppConfig } from "../app-config"; 2 | 3 | export type StartSequenceDTO = { 4 | id: string, 5 | appConfig?: AppConfig, 6 | args?: string[], 7 | instanceId?: string; 8 | } 9 | 10 | export type StartSequenceEndpointPayloadDTO = { 11 | appConfig?: AppConfig, 12 | instanceId?: string; 13 | args?: string[], 14 | } 15 | -------------------------------------------------------------------------------- /packages/types/src/error-codes/csi-controller-error.ts: -------------------------------------------------------------------------------- 1 | export type CSIControllerErrorCode = 2 | "UNINITIALIZED_STREAM" | 3 | "UNATTACHED_STREAMS" | 4 | "NO_CHILD_PROCESS" 5 | 6 | -------------------------------------------------------------------------------- /packages/types/src/error-codes/host-error.ts: -------------------------------------------------------------------------------- 1 | export type HostErrorCode = 2 | "UNINITIALIZED_STREAM" | 3 | "UNATTACHED_STREAMS" | 4 | "UNKNOWN_CHANNEL" | 5 | "LOG_NOT_AVAILABLE" | 6 | "SEQUENCE_IDENTIFICATION_FAILED" | 7 | "UNKNOWN_SEQUENCE" | 8 | "UNKNOWN_INSTANCE" | 9 | "EVENT_NAME_MISSING" | 10 | "CONTROLLER_ERROR" | 11 | "SOCKET_TAKEN" | 12 | "API_CONFIGURATION_ERROR" | 13 | "SEQUENCE_STARTUP_CONFIG_READ_ERROR" | 14 | "CPM_CONFIGURATION_ERROR" 15 | -------------------------------------------------------------------------------- /packages/types/src/error-codes/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./app-error"; 2 | export * from "./host-error"; 3 | export * from "./runner-error"; 4 | export * from "./instance-adapter-error"; 5 | export * from "./csi-controller-error"; 6 | export * from "./sequence-adapter-error"; 7 | -------------------------------------------------------------------------------- /packages/types/src/error-codes/instance-adapter-error.ts: -------------------------------------------------------------------------------- 1 | export type InstanceAdapterErrorCode = 2 | "INVALID_CONFIGURATION" | "UNINITIALIZED_STREAMS" | 3 | "GENERAL_ERROR" | "SEQUENCE_RUN_BEFORE_INIT" | "RUNNER_ERROR" | 4 | "RUNNER_NON_ZERO_EXITCODE" | "RUNNER_NOT_STARTED" | "DOCKER_ERROR" | "PRERUNNER_ERROR" 5 | -------------------------------------------------------------------------------- /packages/types/src/error-codes/runner-error.ts: -------------------------------------------------------------------------------- 1 | export type RunnerErrorCode = 2 | "SEQUENCE_ENDED_PREMATURE" | 3 | "SEQUENCE_RUNTIME_ERROR" | 4 | "UNINITIALIZED_STREAMS" | 5 | "UNKNOWN_MESSAGE_CODE" | 6 | "NO_MONITORING" | 7 | "UNINITIALIZED_CONTEXT" 8 | -------------------------------------------------------------------------------- /packages/types/src/error-codes/sequence-adapter-error.ts: -------------------------------------------------------------------------------- 1 | export type SequenceAdapterErrorCode = "DOCKER_ERROR" | "PRERUNNER_ERROR" 2 | -------------------------------------------------------------------------------- /packages/types/src/host-proxy.ts: -------------------------------------------------------------------------------- 1 | import { Duplex } from "stream"; 2 | 3 | export type HostProxy = { 4 | onInstanceRequest(socket: Duplex): void; 5 | } 6 | -------------------------------------------------------------------------------- /packages/types/src/instance-limits.ts: -------------------------------------------------------------------------------- 1 | export type InstanceLimits = { 2 | memory?: number; 3 | gpu?: boolean; 4 | } 5 | -------------------------------------------------------------------------------- /packages/types/src/instance-stats.ts: -------------------------------------------------------------------------------- 1 | import { InstanceLimits } from "./instance-limits"; 2 | 3 | export type InstanceStats = { 4 | limits: InstanceLimits; 5 | current: { 6 | memory?: number; 7 | cpu?: number; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/types/src/instance-store.ts: -------------------------------------------------------------------------------- 1 | import { InstanceStatus } from "@scramjet/symbols"; 2 | import { AppConfig } from "./app-config"; 3 | import { InstanceArgs, InstanceId } from "./instance"; 4 | import { SequenceInfoInstance } from "./sequence-adapter"; 5 | 6 | export type Instance = { 7 | id: InstanceId, 8 | appConfig?: AppConfig, 9 | args?: InstanceArgs, 10 | provides?: string, 11 | requires?: string, 12 | sequence: SequenceInfoInstance, 13 | ports?: Record, 14 | created?: Date, 15 | started?: Date, 16 | ended?: Date, 17 | status?: InstanceStatus, 18 | terminated?: { 19 | exitcode: number, 20 | reason: string 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/types/src/instance.ts: -------------------------------------------------------------------------------- 1 | export type InstanceId = string; 2 | 3 | export type InstanceArgs = any[]; 4 | 5 | export type InstanceConnectionInfo = { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /packages/types/src/logger.ts: -------------------------------------------------------------------------------- 1 | import { WritableStream } from "./utils"; 2 | 3 | export type LoggerOutput = { 4 | /** Output stream */ 5 | out: WritableStream; 6 | /** Error stream */ 7 | err?: WritableStream; 8 | } 9 | 10 | export type LoggerOptions = { 11 | /** Should we show callsites to show originating line */ 12 | useCallsite?: boolean; 13 | }; 14 | 15 | export type Logger = Console; 16 | -------------------------------------------------------------------------------- /packages/types/src/messages/error.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type ErrorMessageData = { 4 | 5 | /** The operation's exit code. */ 6 | exitCode: number; 7 | 8 | /** Error message. */ 9 | message: string; 10 | 11 | /** Error's status code */ 12 | errorCode: number; 13 | 14 | /** Error stack trace. */ 15 | stack: string; 16 | } 17 | 18 | /** 19 | * A general purpose error message. 20 | * This message type is sent from Runner. 21 | */ 22 | export type ErrorMessage = { msgCode: RunnerMessageCode.ERROR } & ErrorMessageData; 23 | -------------------------------------------------------------------------------- /packages/types/src/messages/event.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type EventMessageData = { 4 | 5 | /** Name of the event. */ 6 | eventName: string; 7 | 8 | source?: string; 9 | 10 | /** TODO update Informs if keepAlive can be called to prolong the running of the Sequence. */ 11 | message: any; 12 | } 13 | 14 | /** 15 | * TODO update 16 | * Event message emitted by Sequence and handled in the context. 17 | */ 18 | export type EventMessage = { msgCode: RunnerMessageCode.EVENT } & EventMessageData; 19 | -------------------------------------------------------------------------------- /packages/types/src/messages/handshake-acknowledge.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | import { AppConfig } from "../app-config"; 3 | 4 | export type HandshakeAcknowledgeMessageData = { 5 | 6 | /** Sequence configuration passed to the Sequence when it is started by the Runner. */ 7 | appConfig: AppConfig; 8 | args?: any[] 9 | } 10 | 11 | /** 12 | * Cloud Server Host (CSH) sends handshake acknowledge message (PONG) to the Runner in response to 13 | * the received handshake message (PING). 14 | * The message includes the Sequence configuration information. 15 | */ 16 | export type HandshakeAcknowledgeMessage = { msgCode: RunnerMessageCode.PONG } & HandshakeAcknowledgeMessageData; 17 | -------------------------------------------------------------------------------- /packages/types/src/messages/instance.ts: -------------------------------------------------------------------------------- 1 | import { CPMMessageCode, InstanceMessageCode } from "@scramjet/symbols"; 2 | import { Instance } from "../instance-store"; 3 | 4 | export type InstanceMessageData = { 5 | status: InstanceMessageCode; 6 | instance: Instance; 7 | //id : string 8 | } 9 | 10 | export type InstanceMessage = { msgCode: CPMMessageCode.INSTANCE } & InstanceMessageData; 11 | export type InstanceBulkMessage = { msgCode: CPMMessageCode.INSTANCES, instances: InstanceMessageData[] }; 12 | -------------------------------------------------------------------------------- /packages/types/src/messages/keep-alive.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type KeepAliveMessageData = { 4 | 5 | /** Information on how much longer the Sequence will be active (in milliseconds). */ 6 | keepAlive: number; 7 | } 8 | 9 | /** 10 | * Message instructing how much longer to keep Sequence alive. 11 | * This message type is sent from Runner. 12 | */ 13 | export type KeepAliveMessage = { msgCode: RunnerMessageCode.ALIVE } & KeepAliveMessageData; 14 | -------------------------------------------------------------------------------- /packages/types/src/messages/kill-sequence.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type KillMessageData = { 4 | /** 5 | * Bypass waiting. 6 | */ 7 | removeImmediately?: boolean; 8 | } 9 | 10 | /** 11 | * Message instructing Runner to terminate Sequence using the kill signal. 12 | * It causes an ungraceful termination of Sequence. 13 | * This message type is sent from CSIController. 14 | */ 15 | export type KillSequenceMessage = { msgCode: RunnerMessageCode.KILL } & KillMessageData; 16 | -------------------------------------------------------------------------------- /packages/types/src/messages/load.ts: -------------------------------------------------------------------------------- 1 | import { CPMMessageCode } from "@scramjet/symbols"; 2 | import { LoadCheckStat } from "../load-check-stat"; 3 | 4 | export type LoadCheckStatMessage = { msgCode: CPMMessageCode.LOAD } & LoadCheckStat; 5 | -------------------------------------------------------------------------------- /packages/types/src/messages/message.ts: -------------------------------------------------------------------------------- 1 | 2 | import { RunnerMessageCode } from "@scramjet/symbols"; 3 | 4 | /** 5 | * Message indicating whether the command message (e.g. stop or kill) was received. 6 | * Optionally, it can indicate if the command was performed successfully, or 7 | * (in case of issues) attach a related error description. 8 | * This message type is sent from Runner. 9 | */ 10 | export type Message = { 11 | 12 | /** Message type code from RunnerMessageCode enumeration. */ 13 | msgCode: RunnerMessageCode 14 | } 15 | 16 | export type EmptyMessageData = {}; 17 | -------------------------------------------------------------------------------- /packages/types/src/messages/monitor-rate.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type MonitoringRateMessageData = { 4 | 5 | /** Indicates how frequently should monitoring messages be emitted (in milliseconds). */ 6 | monitoringRate: number; 7 | } 8 | 9 | /** 10 | * Message instructing Runner how often to emit monitoring messages. 11 | * This message type is sent from CSIController. 12 | */ 13 | export type MonitoringRateMessage = { msgCode: RunnerMessageCode.MONITORING_RATE} & MonitoringRateMessageData; 14 | -------------------------------------------------------------------------------- /packages/types/src/messages/monitor-reply.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type MonitoringReplyMessageData = {}; 4 | 5 | /** 6 | * Message instructing Runner how often to emit monitoring messages. 7 | * This message type is sent from CSIController. 8 | */ 9 | export type MonitoringReplyMessage = { msgCode: RunnerMessageCode.MONITORING_REPLY} & MonitoringReplyMessageData; 10 | -------------------------------------------------------------------------------- /packages/types/src/messages/network-info.ts: -------------------------------------------------------------------------------- 1 | import { CPMMessageCode } from "@scramjet/symbols"; 2 | import { NetworkInfo } from "../network-info"; 3 | 4 | export type NetworkInfoMessage = { msgCode: CPMMessageCode.NETWORK_INFO } & NetworkInfo[]; 5 | -------------------------------------------------------------------------------- /packages/types/src/messages/sequence-complete.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type SequenceCompleteMessageData = { 4 | timeout?: number 5 | } 6 | 7 | /** 8 | * Message from the Runner indicating that the Sequence has completed sending it's data 9 | * and now can be asked to exit with high probability of accepting the exit gracefully. 10 | */ 11 | export type SequenceCompleteMessage = { msgCode: RunnerMessageCode.SEQUENCE_COMPLETED } & SequenceCompleteMessageData; 12 | -------------------------------------------------------------------------------- /packages/types/src/messages/sequence-end.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type SequenceEndMessageData = { 4 | err: Error; 5 | } 6 | 7 | /** 8 | * Message from the Runner indicating that the Sequence has called the end method 9 | * on context and it should be safe to terminate it without additional waiting, 10 | * unless it exits correctly itself. 11 | */ 12 | export type SequenceEndMessage = { msgCode: RunnerMessageCode.SEQUENCE_COMPLETED } & SequenceEndMessageData; 13 | -------------------------------------------------------------------------------- /packages/types/src/messages/sequence-stopped.ts: -------------------------------------------------------------------------------- 1 | export type SequenceStoppedMessageData = { sequenceError?: unknown } 2 | -------------------------------------------------------------------------------- /packages/types/src/messages/sequence.ts: -------------------------------------------------------------------------------- 1 | import { CPMMessageCode, SequenceMessageCode } from "@scramjet/symbols"; 2 | import { SequenceConfig } from "../runner-config"; 3 | 4 | export type SequenceMessageData = { 5 | id: string, 6 | status: SequenceMessageCode, 7 | config: SequenceConfig 8 | } 9 | 10 | export type SequenceMessage = { msgCode: CPMMessageCode.SEQUENCE } & SequenceMessageData; 11 | export type SequenceBulkMessage = { msgCode: CPMMessageCode.SEQUENCES, sequences: SequenceMessageData[] }; 12 | 13 | -------------------------------------------------------------------------------- /packages/types/src/messages/status.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | import { FunctionDefinition } from "./describe-sequence"; 3 | 4 | export type StatusMessageData = { 5 | 6 | /** Provides the definition of each subsequence. */ 7 | definition?: FunctionDefinition[]; 8 | } 9 | 10 | /** 11 | * Message providing the definition of the Sequence. 12 | * It includes information on stream mode, name, description and scalability of each subsequence. 13 | * This message type is sent from Runner. 14 | */ 15 | export type StatusMessage = { msgCode: RunnerMessageCode.STATUS } & StatusMessageData; 16 | -------------------------------------------------------------------------------- /packages/types/src/messages/sth-id.ts: -------------------------------------------------------------------------------- 1 | import { CPMMessageCode } from "@scramjet/symbols"; 2 | 3 | export type STHIDMessageData = { 4 | id: string; 5 | } 6 | 7 | export type CPMMessageSTHID = { msgCode: CPMMessageCode.STH_ID } & STHIDMessageData; 8 | -------------------------------------------------------------------------------- /packages/types/src/messages/sth-topic.ts: -------------------------------------------------------------------------------- 1 | type Status = "add" | "remove"; 2 | 3 | type BaseSTHTopicEventData = { 4 | status: Status; 5 | topicName: string; 6 | } 7 | 8 | export type AddSTHTopicEventData = BaseSTHTopicEventData & { 9 | contentType: string; 10 | localProvider?: string; 11 | status: "add"; 12 | } & ( 13 | { requires: string; provides?: never } 14 | | { provides: string; requires?: never } 15 | | { requires?: never; provides?: never } 16 | ); 17 | 18 | export type RemoveSTHTopicEventData = BaseSTHTopicEventData & { 19 | status: "remove"; 20 | } 21 | 22 | export type STHTopicEventData = AddSTHTopicEventData | RemoveSTHTopicEventData; 23 | -------------------------------------------------------------------------------- /packages/types/src/messages/stop-sequence.ts: -------------------------------------------------------------------------------- 1 | import { RunnerMessageCode } from "@scramjet/symbols"; 2 | 3 | export type StopSequenceMessageData = { 4 | 5 | /** The number of milliseconds before the Sequence will be killed. */ 6 | timeout: number; 7 | 8 | /** Informs if keepAlive can be called to prolong the running of the Sequence. */ 9 | canCallKeepalive: boolean 10 | } 11 | 12 | /** 13 | * Message instructing Runner to terminate Sequence gracefully after a specified period of time (in seconds). 14 | * It gives Sequence and Runner time to perform a cleanup. 15 | * This message type is sent from CSIController. 16 | */ 17 | export type StopSequenceMessage = { msgCode: RunnerMessageCode.STOP } & StopSequenceMessageData; 18 | -------------------------------------------------------------------------------- /packages/types/src/model.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/packages/types/src/model.ts -------------------------------------------------------------------------------- /packages/types/src/module-loader.ts: -------------------------------------------------------------------------------- 1 | export type ModuleLoaderOpts = { 2 | name: string; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/types/src/network-info.ts: -------------------------------------------------------------------------------- 1 | export type NetworkInfo = { 2 | iface: string, 3 | ifaceName: string; 4 | ip4?: string; 5 | ip4subnet?: string; 6 | ip6?: string; 7 | ip6subnet?: string; 8 | mac: string; 9 | dhcp: boolean; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /packages/types/src/op-response.ts: -------------------------------------------------------------------------------- 1 | import { ReasonPhrases } from "http-status-codes"; 2 | 3 | export type OpResponse> = 4 | | (PayloadType & { 5 | opStatus: ReasonPhrases.OK | ReasonPhrases.ACCEPTED, 6 | message?: string 7 | }) 8 | | { 9 | opStatus: Exclude, 10 | error?: string | Error | unknown 11 | } 12 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-commons/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./load-check"; 2 | export * from "./version"; 3 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-commons/load-check.ts: -------------------------------------------------------------------------------- 1 | import { LoadCheckStat } from "../load-check-stat"; 2 | 3 | export type GetLoadCheckResponse = LoadCheckStat; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-commons/version.ts: -------------------------------------------------------------------------------- 1 | export type GetVersionResponse = { 2 | service: string; 3 | version: string; 4 | build: string; 5 | apiVersion: string; 6 | } 7 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-error/rest-api-error.ts: -------------------------------------------------------------------------------- 1 | import { APIErrorCode } from "@scramjet/symbols"; 2 | 3 | export type APIErrorMessage = { 4 | 5 | /** A unique reference number for a given error type. */ 6 | code: APIErrorCode; 7 | 8 | /** An error message describing the potential cause of the error 9 | * and possibly a way how to fix it. */ 10 | message: string; 11 | 12 | /** A link to the detail information about the error. */ 13 | url?: string; 14 | } 15 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/clear-store.ts: -------------------------------------------------------------------------------- 1 | import { ReasonPhrases } from "http-status-codes"; 2 | 3 | export type StoreClearResponse = { 4 | opStatus: ReasonPhrases; 5 | } | { 6 | opStatus: ReasonPhrases; 7 | error: any; 8 | }; 9 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/common.ts: -------------------------------------------------------------------------------- 1 | export type ConnectedSTHInfoDetails = { 2 | created?: Date; 3 | lastConnected?: Date; 4 | lastDisconnected?: Date; 5 | } 6 | 7 | export type ConnectedSTHInfo = { 8 | id: string, 9 | info: ConnectedSTHInfoDetails, 10 | healthy: boolean, 11 | selfHosted: boolean, 12 | isConnectionActive: boolean, 13 | description?: string, 14 | tags?: string[], 15 | disconnectReason?: string; 16 | }; 17 | 18 | export type HealthCheckInfo = { 19 | uptime: number; 20 | timestamp: number; 21 | modules: { 22 | [key: string]: boolean; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/delete-hub.ts: -------------------------------------------------------------------------------- 1 | import { ReasonPhrases } from "http-status-codes"; 2 | 3 | export type HubDeleteResponse = { 4 | opStatus: ReasonPhrases; 5 | } | { 6 | opStatus: ReasonPhrases; 7 | error: any; 8 | }; 9 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-config.ts: -------------------------------------------------------------------------------- 1 | import { ManagerConfiguration } from "../manager-configuration"; 2 | 3 | export type GetConfigResponse = { 4 | config: ManagerConfiguration 5 | } 6 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-entities.ts: -------------------------------------------------------------------------------- 1 | export type GetEntitiesResponse = { 2 | hubs: string[], 3 | topics: string[], 4 | sequences: string[], 5 | instances: string[], 6 | } 7 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-health.ts: -------------------------------------------------------------------------------- 1 | import { HealthCheckInfo } from "./common"; 2 | 3 | export type GetHealthCheckResponse = HealthCheckInfo; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-host-info.ts: -------------------------------------------------------------------------------- 1 | import { ConnectedSTHInfo } from "./common"; 2 | 3 | export type GetHostInfoResponse = ConnectedSTHInfo; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-instance.ts: -------------------------------------------------------------------------------- 1 | import { Instance } from "../instance-store"; 2 | 3 | export type GetInstanceResponse = Instance 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-instances.ts: -------------------------------------------------------------------------------- 1 | import { GetInstanceResponse } from "../rest-api-sth"; 2 | 3 | export type GetInstancesResponse = GetInstanceResponse[]; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-list.ts: -------------------------------------------------------------------------------- 1 | import { ConnectedSTHInfoDetails } from "./common"; 2 | 3 | export type GetListResponse = { 4 | id: string, 5 | info: ConnectedSTHInfoDetails, 6 | healthy: boolean, 7 | selfHosted: boolean, 8 | isConnectionActive: boolean, 9 | description?: string, 10 | tags?: string[], 11 | disconnectReason?: string, 12 | topics : string[], 13 | sequences: string[], 14 | instances: string[], 15 | }[] 16 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-load.ts: -------------------------------------------------------------------------------- 1 | import { LoadCheckStat } from "../load-check-stat"; 2 | 3 | export type GetLoadResponse = LoadCheckStat; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-sequence-ids.ts: -------------------------------------------------------------------------------- 1 | export type GetSequenceIDSResponse = string[]; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-sequence.ts: -------------------------------------------------------------------------------- 1 | import { SequenceConfig } from "../runner-config"; 2 | 3 | export type GetSequenceResponse = { 4 | instances: string[]; 5 | name?: string; 6 | id: string; 7 | config: SequenceConfig; 8 | location : string; 9 | } 10 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-sequences.ts: -------------------------------------------------------------------------------- 1 | import { GetSequenceResponse } from "./get-sequence"; 2 | 3 | export type GetSequencesResponse = GetSequenceResponse[]; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-store-items.ts: -------------------------------------------------------------------------------- 1 | import { SequenceConfig } from "../runner-config"; 2 | 3 | export type GetStoreItemsResponse = SequenceConfig[]; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-topics.ts: -------------------------------------------------------------------------------- 1 | export type GetTopicsResponse = { 2 | name: string; 3 | contentType: string; 4 | actors: { 5 | hostId?:string; 6 | stream: boolean, 7 | retired: boolean, 8 | role: string, 9 | type: string 10 | }[] 11 | }[]; 12 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/get-version.ts: -------------------------------------------------------------------------------- 1 | export { GetVersionResponse } from "../rest-api-commons"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./common"; 2 | export * from "./get-host-info"; 3 | export * from "./get-version"; 4 | export * from "./get-config"; 5 | export * from "./get-health"; 6 | export * from "./get-load"; 7 | export * from "./get-sequences"; 8 | export * from "./get-sequence"; 9 | export * from "./get-sequence-ids"; 10 | export * from "./get-instance"; 11 | export * from "./get-instances"; 12 | export * from "./get-topics"; 13 | export * from "./get-list"; 14 | export * from "./get-store-items"; 15 | export * from "./put-store-item"; 16 | export * from "./get-entities"; 17 | export * from "./post-disconnect"; 18 | export * from "./delete-hub"; 19 | export * from "./clear-store"; 20 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/post-disconnect.ts: -------------------------------------------------------------------------------- 1 | import { ReasonPhrases } from "http-status-codes"; 2 | import { OpResponse } from "../rest-api-multi-manager"; 3 | 4 | export type PostDisconnectPayload = { 5 | id?: string; 6 | limit?: number; 7 | accessKey?: string; 8 | } 9 | 10 | export type PostDisconnectResponse = OpResponse<{ 11 | managerId: string; 12 | disconnected: { 13 | sthId: string; 14 | reason: string; 15 | }[]; 16 | }> | { 17 | opStatus: ReasonPhrases, 18 | error: string; 19 | }; 20 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-manager/put-store-item.ts: -------------------------------------------------------------------------------- 1 | import { SequenceConfig } from "../runner-config"; 2 | 3 | export type PutStoreItemResponse = SequenceConfig; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-middleware/get-multi-manager.ts: -------------------------------------------------------------------------------- 1 | export type MultiManagerResponse = { 2 | baseUrl: string; 3 | managers: any[]; 4 | id: string; 5 | }; 6 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-middleware/get-multi-managers.ts: -------------------------------------------------------------------------------- 1 | import { MultiManagerResponse } from "./get-multi-manager"; 2 | 3 | export type MultiManagersResponse = MultiManagerResponse[]; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-middleware/get-version.ts: -------------------------------------------------------------------------------- 1 | export { GetVersionResponse } from "../rest-api-commons"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-middleware/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./get-multi-manager"; 2 | export * from "./get-multi-managers"; 3 | export * from "./get-version"; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-host/get-version.ts: -------------------------------------------------------------------------------- 1 | export { GetVersionResponse } from "../rest-api-commons"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-host/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./get-version"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/access-key.ts: -------------------------------------------------------------------------------- 1 | export type GetAccessKeysResponse = { 2 | accessKeys: { 3 | created: number; 4 | description: string; 5 | }[] 6 | } 7 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/common.ts: -------------------------------------------------------------------------------- 1 | import { ReasonPhrases } from "http-status-codes"; 2 | 3 | export type OpResponse> = 4 | | (PayloadType & { opStatus: ReasonPhrases.OK | ReasonPhrases.ACCEPTED }) 5 | | { opStatus: Exclude, error?: unknown } 6 | 7 | export type ControlMessageResponse = { 8 | accepted: ReasonPhrases.OK | ReasonPhrases.ACCEPTED, 9 | } 10 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/get-info.ts: -------------------------------------------------------------------------------- 1 | export type GetInfoReposnse = { 2 | apiBase: string, 3 | apiPort: number, 4 | id: string, 5 | managersCount: number, 6 | } 7 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/get-load-check.ts: -------------------------------------------------------------------------------- 1 | export type { GetLoadCheckResponse } from "../rest-api-commons"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/get-manager.ts: -------------------------------------------------------------------------------- 1 | export type GetManagerResponse = { 2 | id: string 3 | } 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/get-managers.ts: -------------------------------------------------------------------------------- 1 | import { GetManagerResponse } from "./get-manager"; 2 | 3 | export type GetManagersResponse = GetManagerResponse[]; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/get-version.ts: -------------------------------------------------------------------------------- 1 | export { GetVersionResponse } from "../rest-api-commons"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./common"; 2 | export * from "./start-manager"; 3 | export * from "./stop-manager"; 4 | export * from "./get-manager"; 5 | export * from "./get-managers"; 6 | export * from "./get-version"; 7 | export * from "./get-info"; 8 | export * from "./get-load-check"; 9 | export * from "./access-key"; 10 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/start-manager.ts: -------------------------------------------------------------------------------- 1 | export type SendStartManagerResponse = { 2 | id: string; 3 | } 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-multi-manager/stop-manager.ts: -------------------------------------------------------------------------------- 1 | export type SendStopManagerResponse = { 2 | id: string; 3 | } 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/common.ts: -------------------------------------------------------------------------------- 1 | import { ReasonPhrases } from "http-status-codes"; 2 | 3 | export type ControlMessageResponse = { 4 | accepted: ReasonPhrases.OK | ReasonPhrases.ACCEPTED, 5 | } 6 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-config.ts: -------------------------------------------------------------------------------- 1 | import { PublicSTHConfiguration } from "../sth-configuration"; 2 | 3 | export type GetConfigResponse = PublicSTHConfiguration; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-entities.ts: -------------------------------------------------------------------------------- 1 | import { GetInstancesResponse } from "./get-instances"; 2 | import { GetSequencesResponse } from "./get-sequences"; 3 | import { GetTopicsResponse } from "./get-topics"; 4 | 5 | export type GetEntitiesResponse = { 6 | instances: GetInstancesResponse; 7 | sequences: GetSequencesResponse; 8 | topics: GetTopicsResponse; 9 | } 10 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-event.ts: -------------------------------------------------------------------------------- 1 | export type GetEventResponse = { 2 | eventName: string, 3 | message: any 4 | } 5 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-health.ts: -------------------------------------------------------------------------------- 1 | export type GetHealthResponse = { 2 | cpuTotalUsage?: number; // docker specific 3 | healthy: boolean; 4 | limit?: number; // docker specific 5 | memoryMaxUsage?: number; // docker specific 6 | memoryUsage?: number; // docker specific 7 | networkRx?: number; // docker specific 8 | networkTx?: number; // docker specific 9 | containerId?: string; //docker specific 10 | processId?: number; // process specific 11 | } 12 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-instance.ts: -------------------------------------------------------------------------------- 1 | import { Instance } from "../instance-store"; 2 | import { DeepPartial } from "../utils"; 3 | import { GetSequenceResponse } from "./get-sequence"; 4 | 5 | export type GetInstanceResponse = Instance & { 6 | sequence: DeepPartial 7 | }; 8 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-instances.ts: -------------------------------------------------------------------------------- 1 | import { Instance } from "../instance-store"; 2 | 3 | export type GetInstancesResponse = Instance[]; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-load-check.ts: -------------------------------------------------------------------------------- 1 | export type { GetLoadCheckResponse } from "../rest-api-commons"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-sequence-instances.ts: -------------------------------------------------------------------------------- 1 | import { ReasonPhrases } from "http-status-codes"; 2 | 3 | export type GetSequenceInstancesResponse = readonly string[] 4 | | { 5 | opStatus: Exclude, 6 | error?: string | Error | unknown 7 | }; 8 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-sequence.ts: -------------------------------------------------------------------------------- 1 | import { SequenceConfig } from "../runner-config"; 2 | 3 | export type GetSequenceResponse = { 4 | id: string; 5 | name?: string; 6 | config: SequenceConfig, 7 | location: string, 8 | instances: readonly string[] 9 | } 10 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-sequences.ts: -------------------------------------------------------------------------------- 1 | import { SequenceConfig } from "../runner-config"; 2 | 3 | export type GetSequencesResponse = { 4 | instances: readonly string[]; 5 | id: string; 6 | config: SequenceConfig; 7 | }[] 8 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-status.ts: -------------------------------------------------------------------------------- 1 | export type GetStatusResponse = { 2 | cpm: { 3 | cpmId?: string; 4 | connected?: boolean; 5 | } 6 | }; 7 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-topics.ts: -------------------------------------------------------------------------------- 1 | export type GetTopicsResponse = { 2 | contentType: string; 3 | localProvider: string, 4 | topic: string, 5 | topicName: string, 6 | }[]; 7 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/get-version.ts: -------------------------------------------------------------------------------- 1 | export { GetVersionResponse } from "../rest-api-commons"; 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/send-delete-sequence.ts: -------------------------------------------------------------------------------- 1 | export type DeleteSequenceResponse = { 2 | id: string 3 | } 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/send-event.ts: -------------------------------------------------------------------------------- 1 | import { ControlMessageResponse } from "./common"; 2 | 3 | export type SendEventResponse = ControlMessageResponse; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/send-kill-instance.ts: -------------------------------------------------------------------------------- 1 | import { Instance } from "../instance-store"; 2 | 3 | export type SendKillInstanceResponse = Instance; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/send-sequence.ts: -------------------------------------------------------------------------------- 1 | export type SendSequenceResponse = { id: string } 2 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/send-stop-instance.ts: -------------------------------------------------------------------------------- 1 | import { Instance } from "../instance-store"; 2 | 3 | export type SendStopInstanceResponse = Instance; 4 | -------------------------------------------------------------------------------- /packages/types/src/rest-api-sth/start-sequence.ts: -------------------------------------------------------------------------------- 1 | import { RunnerConnectInfo } from "../runner-connect"; 2 | 3 | export type StartSequenceResponse = { id: string }; 4 | 5 | export type StartSequencePayload = Omit, "inputContentType">; 6 | -------------------------------------------------------------------------------- /packages/types/src/runner-connect.ts: -------------------------------------------------------------------------------- 1 | import { AppConfig } from "./app-config"; 2 | import { InstanceLimits } from "./instance-limits"; 3 | 4 | export type RunnerConnectInfo = { 5 | appConfig: AppConfig; 6 | args?: any[]; 7 | outputTopic?: string; 8 | inputTopic?: string; 9 | limits?: InstanceLimits; 10 | instanceId?: string; 11 | system?: Record; 12 | } 13 | -------------------------------------------------------------------------------- /packages/types/src/sd-content-type.ts: -------------------------------------------------------------------------------- 1 | export type ContentType = "text/x-ndjson" | "application/x-ndjson" | "text/plain" | "application/octet-stream"; 2 | -------------------------------------------------------------------------------- /packages/types/src/sd-stream-handler.ts: -------------------------------------------------------------------------------- 1 | import { WorkState, WritableState, ReadableState, StreamType } from "@scramjet/symbols"; 2 | 3 | export type StreamState = WorkState | WritableState | ReadableState; 4 | 5 | export type StreamOptions = Record; 6 | 7 | export type OriginType = "space" | "hub" 8 | 9 | export type StreamOrigin = { 10 | type: OriginType 11 | id: string; 12 | } 13 | 14 | export interface StreamHandler { 15 | id(): string 16 | state(): StreamState 17 | type(): StreamType 18 | options(): StreamOptions 19 | origin(): StreamOrigin 20 | } 21 | 22 | export { WorkState, WritableState, ReadableState, StreamType }; 23 | -------------------------------------------------------------------------------- /packages/types/src/sd-topic-handler.ts: -------------------------------------------------------------------------------- 1 | import { Duplex } from "stream"; 2 | 3 | import { ContentType } from "./sd-content-type"; 4 | import { ReadableState, StreamHandler, WorkState, WritableState } from "./sd-stream-handler"; 5 | 6 | export type TopicOptions = { 7 | contentType: ContentType 8 | } 9 | 10 | export type TopicState = WorkState.Flowing | WorkState.Error | ReadableState.Pause | WritableState.Drain; 11 | 12 | export interface TopicHandler extends Duplex, StreamHandler { 13 | options(): TopicOptions 14 | } 15 | 16 | export default TopicHandler; 17 | -------------------------------------------------------------------------------- /packages/types/src/telemetry-config.ts: -------------------------------------------------------------------------------- 1 | export type TelemetryAdaptersConfig = { 2 | loki?: { 3 | host: string, 4 | replaceTimestamp: boolean, 5 | interval?: number, 6 | labels: { [key: string]: string } 7 | } 8 | } 9 | 10 | export type TelemetryConfig = { 11 | status: boolean, 12 | environment?: string, 13 | adapter: "loki" 14 | } & TelemetryAdaptersConfig; 15 | -------------------------------------------------------------------------------- /packages/types/test/.work/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/packages/types/test/.work/.keep -------------------------------------------------------------------------------- /packages/types/test/lib/transform.d.ts: -------------------------------------------------------------------------------- 1 | import { ReadableStream } from "../../src/utils"; 2 | 3 | declare function exports(str: ReadableStream<{x?: number; y?: number}>): ReadableStream<{z: number}>; 4 | export default exports; 5 | -------------------------------------------------------------------------------- /packages/types/test/lib/transform.js: -------------------------------------------------------------------------------- 1 | const { Transform } = require("stream"); 2 | 3 | module.exports = (stream) => { 4 | return stream.pipe(new Transform({ 5 | transform: ({ x, y }, _enc, cb) => { 6 | this.push({ z:x || y || 0 }); 7 | cb(); 8 | } 9 | })); 10 | }; 11 | -------------------------------------------------------------------------------- /packages/types/test/scramjet_read.spec.ts: -------------------------------------------------------------------------------- 1 | import { ReadableApp } from ".."; 2 | 3 | export const app: ReadableApp<{ x: number }, [{ test: number }]> = 4 | async function abc(_source, { test }) { 5 | const start = this.config.start === null ? 0 : +this.config.start; 6 | const y = async function* () { 7 | let i: number = start + test; 8 | 9 | while (i-- > 0) { 10 | yield { x: i }; 11 | } 12 | }; 13 | 14 | return y; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/types/test/simple_read.spec.ts: -------------------------------------------------------------------------------- 1 | import { ReadableApp } from ".."; 2 | 3 | export const app: ReadableApp<{ x: number }, [{ test: number }], {start: number}> = 4 | async function abc(_source, { test }) { 5 | const start = +(this.config.start || 0) || 0; 6 | const y = async function* () { 7 | let i: number = start + test; 8 | 9 | while (i-- > 0) { 10 | yield { x: i }; 11 | } 12 | }; 13 | 14 | return y; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/types/test/simple_transform.spec.ts: -------------------------------------------------------------------------------- 1 | import { TransformApp } from ".."; 2 | 3 | export const app: TransformApp = 4 | async function abc(source) { 5 | const frm = this.config.from || 0; 6 | const y = async function* () { 7 | let i:number = +frm; 8 | 9 | for await (const x of source) { 10 | if (i-- <= 0) return; 11 | yield { i, x }; 12 | } 13 | }; 14 | 15 | return y; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /packages/types/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/types/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/types", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/types/tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/utility/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/utility/src/config/configurationBase.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Base read only configuration 3 | */ 4 | interface ConfigurationBase { 5 | /** 6 | * Get configuration 7 | * @returns configuration, or null if unable to get 8 | */ 9 | get(): any | null; 10 | /** 11 | * Validate configuration 12 | * @param config configuration to validate 13 | */ 14 | validate(config: any): boolean; 15 | /** 16 | * Check if configuration is valid 17 | * @returns true if configuration object is valid 18 | */ 19 | isValid(): boolean; 20 | } 21 | 22 | export default ConfigurationBase; 23 | -------------------------------------------------------------------------------- /packages/utility/src/config/index.ts: -------------------------------------------------------------------------------- 1 | export { ReadOnlyConfig } from "./readOnlyConfig"; 2 | export { ReadOnlyConfigFile } from "./readOnlyConfigFile"; 3 | export { ReadOnlyConfigFileDefault } from "./readOnlyConfigFileDefault"; 4 | 5 | export { Config } from "./config"; 6 | export { ConfigFile } from "./configFile"; 7 | export { ConfigFileDefault } from "./configFileDefault"; 8 | -------------------------------------------------------------------------------- /packages/utility/src/config/readOnlyConfigFileDefault.ts: -------------------------------------------------------------------------------- 1 | import { ReadOnlyConfigFile } from "./readOnlyConfigFile"; 2 | 3 | /** 4 | * Configuration object held in file 5 | */ 6 | export abstract class ReadOnlyConfigFileDefault extends ReadOnlyConfigFile { 7 | protected readonly defaultConfiguration: Type; 8 | 9 | constructor(filePath: string, defaultConf: Type) { 10 | super(filePath); 11 | this.defaultConfiguration = defaultConf; 12 | } 13 | 14 | get(): Type { 15 | if (!this.isValid()) 16 | return this.defaultConfiguration; 17 | return super.get(); 18 | } 19 | getDefault(): Type { 20 | return this.defaultConfiguration; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/utility/src/constants/index.ts: -------------------------------------------------------------------------------- 1 | export { LogLevelStrings } from "./object-logger"; 2 | -------------------------------------------------------------------------------- /packages/utility/src/constants/object-logger.ts: -------------------------------------------------------------------------------- 1 | import { LogLevel } from "@scramjet/types"; 2 | 3 | export const LogLevelStrings: LogLevel[] = ["FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"]; 4 | -------------------------------------------------------------------------------- /packages/utility/src/file/file.ts: -------------------------------------------------------------------------------- 1 | export interface File { 2 | path: string; 3 | write(value: any): void; 4 | read(): string | any; 5 | 6 | isReadable(): boolean 7 | isReadWritable(): boolean 8 | create(): boolean 9 | remove(): void 10 | exists(): boolean 11 | /** 12 | * @returns filename with extension 13 | */ 14 | fullname(): string 15 | /** 16 | * @returns extension name 17 | */ 18 | extname(): string 19 | /** 20 | * @returns filename without extension 21 | */ 22 | name(): string 23 | } 24 | 25 | -------------------------------------------------------------------------------- /packages/utility/src/file/index.ts: -------------------------------------------------------------------------------- 1 | import { extname } from "path"; 2 | import { TextFile } from "./textFile"; 3 | import { JsonFile } from "./jsonFile"; 4 | import { YamlFile } from "./yamlFile"; 5 | import { File } from "./file"; 6 | 7 | export { File, TextFile, JsonFile, YamlFile }; 8 | 9 | export const FileBuilder = (path: string): File => { 10 | switch (extname(path)) { 11 | case ".json": 12 | return new JsonFile(path); 13 | case ".yaml": 14 | case ".yml": 15 | return new YamlFile(path); 16 | default: 17 | return new TextFile(path); 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /packages/utility/src/file/jsonFile.ts: -------------------------------------------------------------------------------- 1 | import { TextFile } from "./textFile"; 2 | 3 | export class JsonFile extends TextFile { 4 | write(value: any) { 5 | return super.write(JSON.stringify(value, null, 2)); 6 | } 7 | read() { 8 | return JSON.parse(super.read()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/utility/src/file/yamlFile.ts: -------------------------------------------------------------------------------- 1 | import YAML from "yaml"; 2 | import { TextFile } from "./textFile"; 3 | 4 | export class YamlFile extends TextFile { 5 | write(value: any) { 6 | return super.write(YAML.stringify(value)); 7 | } 8 | read() { 9 | return YAML.parse(super.read()); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/utility/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./config"; 2 | export * from "./constants"; 3 | export * from "./defer"; 4 | export * from "./file"; 5 | export * from "./free-ports-finder"; 6 | export * from "./keygen"; 7 | export * from "./merge"; 8 | export * from "./normalize-url"; 9 | export * from "./promise-timeout"; 10 | export * from "./process-env"; 11 | export * from "./read-json-file"; 12 | export * from "./read-streamed-json"; 13 | export * from "./stream-to-string"; 14 | export * from "./typed-emitter"; 15 | export * from "./typeguards"; 16 | export * from "./validators"; 17 | -------------------------------------------------------------------------------- /packages/utility/src/keygen.ts: -------------------------------------------------------------------------------- 1 | import { randomBytes, scryptSync } from "crypto"; 2 | 3 | export function generateSTHKey(daughterKey: string) { 4 | const sessionId = randomBytes(12).toString("base64") + 5 | daughterKey.substring(0, 16); 6 | 7 | return sessionId + scryptSync(sessionId, daughterKey, 96).toString("base64"); 8 | } 9 | -------------------------------------------------------------------------------- /packages/utility/src/normalize-url.ts: -------------------------------------------------------------------------------- 1 | import normalize, { Options } from "normalize-url"; 2 | 3 | /** 4 | * Normalizes provided URL. 5 | * 6 | * @param {string} url URL to be normalized. 7 | * @param {Options} [options] Normalization options. 8 | * @returns {string} Normalized URL. 9 | */ 10 | export function normalizeUrl(url: string, options?: Options): string { 11 | const fullOptions = options || { defaultProtocol: "http:" }; 12 | 13 | // See https://www.npmjs.com/package/normalize-url. 14 | return normalize(url, fullOptions); 15 | } 16 | -------------------------------------------------------------------------------- /packages/utility/src/process-env.ts: -------------------------------------------------------------------------------- 1 | export function processCommanderRunnerEnvs(envString: string): Record { 2 | const pairs = envString.split(";").map(pair => pair.split("=")); 3 | 4 | const transformedObject = pairs.reduce((acc, [key, value]) => { 5 | if (!key || key === "" || !value || value === "") { 6 | throw new Error("Invalid format for ENV variables. Please use the format key1=value1;key2=value2."); 7 | } 8 | 9 | return { ...acc, [key]: value }; 10 | }, {}); 11 | 12 | return transformedObject; 13 | } 14 | -------------------------------------------------------------------------------- /packages/utility/src/promise-timeout.ts: -------------------------------------------------------------------------------- 1 | import { defer } from "./defer"; 2 | 3 | /** 4 | * Returns a promise rejecting after the specified timeout or a given promise. 5 | * 6 | * @param {Promise} promise Promise to wait for. 7 | * @param {number} timeout Timeout in milliseconds. 8 | * @returns {Promise} Promise that reject after timeout or. 9 | */ 10 | export const promiseTimeout = (promise: Promise, timeout: number): Promise => Promise.race([ 11 | promise, 12 | defer(timeout) 13 | .then(() => Promise.reject()) 14 | ]); 15 | -------------------------------------------------------------------------------- /packages/utility/src/read-json-file.ts: -------------------------------------------------------------------------------- 1 | import { join, resolve } from "path"; 2 | import { JsonFile } from "./file"; 3 | 4 | export const readJsonFile = (fileNameCandidate: string, ...path: string[]): { [key: string]: any } => { 5 | const fileName = fileNameCandidate.endsWith(".json") ? fileNameCandidate : `${fileNameCandidate}.json`; 6 | const filePath = join(...path, fileName); 7 | const realPath = resolve(filePath); 8 | 9 | let data = {}; 10 | 11 | try { 12 | const jsonFile = new JsonFile(realPath); 13 | 14 | if (jsonFile.exists() && jsonFile.isReadable()) 15 | data = jsonFile.read(); 16 | } catch (err) { 17 | // Ignore. 18 | } finally { 19 | return data; 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /packages/utility/src/read-streamed-json.ts: -------------------------------------------------------------------------------- 1 | import { Readable } from "stream"; 2 | import { StringDecoder } from "string_decoder"; 3 | 4 | /** 5 | * Reads and parses JSON from a stream. 6 | * 7 | * @param {Readable} readable Stream to read from. 8 | * @returns {Promise} Promise that resolves with the parsed JSON. 9 | */ 10 | export async function readStreamedJSON(readable: Readable): Promise { 11 | const decoder = new StringDecoder("utf-8"); 12 | 13 | let out = ""; 14 | 15 | for await (const chunk of readable) { 16 | out += decoder.write(chunk); 17 | } 18 | 19 | out += decoder.end(); 20 | 21 | return JSON.parse(out); 22 | } 23 | -------------------------------------------------------------------------------- /packages/utility/src/stream-to-string.ts: -------------------------------------------------------------------------------- 1 | import { Readable } from "stream"; 2 | 3 | export async function streamToString(stream: Readable): Promise { 4 | let data = ""; 5 | 6 | for await (const item of stream) { 7 | data = `${data}${item}`; 8 | } 9 | return data; 10 | } 11 | -------------------------------------------------------------------------------- /packages/utility/src/typed-emitter.ts: -------------------------------------------------------------------------------- 1 | import __TypedEmitter from "typed-emitter"; 2 | import { EventEmitter } from "events"; 3 | 4 | /** 5 | * Native Node.JS EventEmitter typed properly. 6 | */ 7 | // eslint-disable-next-line @typescript-eslint/no-extra-parens, @typescript-eslint/no-shadow 8 | export class TypedEmitter extends (EventEmitter as { new(): __TypedEmitter }) {} 9 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./dto/sequence-start"; 2 | export { isDefined } from "./is-defined"; 3 | export { isBoolean } from "./is-boolean"; 4 | export { isEmptyString } from "./is-empty-string"; 5 | export { isApiVersion } from "./is-api-version"; 6 | export { isIdString } from "./is-id-string"; 7 | export { isPort } from "./is-port"; 8 | export { isUrlPath } from "./is-url-path"; 9 | export { isHttpUrl } from "./is-http-url"; 10 | export { isLogLevel } from "./is-log-level"; 11 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-api-version.ts: -------------------------------------------------------------------------------- 1 | import { ApiVersion } from "@scramjet/types"; 2 | 3 | const apiVersionPattern = /^v[0-9]+([.][0-9]+)*$/; 4 | 5 | /** 6 | * Function checking proper version format 7 | * 8 | * Example valid formats: v1, v2.13, v3.333.111 9 | * @param version version to check 10 | * @returns true if valid version format 11 | */ 12 | export const isApiVersion = (version: string): version is ApiVersion => apiVersionPattern.test(version); 13 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-boolean.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Function checking if incoming value is boolean 3 | * 4 | * @param value value to check 5 | * @returns true if value is boolean 6 | */ 7 | export const isBoolean = (value: string) => typeof value === "boolean"; 8 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-defined.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns true if given value is defined. 3 | * 4 | * @param {any} value Value to check. 5 | * @returns {boolean} Returns true if given value is defined. 6 | */ 7 | export function isDefined(value: T | undefined | null): value is T { 8 | return typeof value !== "undefined" && value !== null; 9 | } 10 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-empty-string.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns true if given value is string and is empty. 3 | * 4 | * @param {any} value Value to check. 5 | * @returns {boolean} Returns true if given value is empty string. 6 | */ 7 | export function isEmptyString(value: string) { 8 | return typeof value === "string" && value === ""; 9 | } 10 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-http-url.ts: -------------------------------------------------------------------------------- 1 | import { URL } from "url"; 2 | 3 | /** 4 | * Function checking if provided string is valid http url 5 | * 6 | * Example valid paterns: http[s]://hostname[:port][/path] etc. 7 | * @param {string} urlString url to check 8 | * @returns {boolean} true if url is valid 9 | */ 10 | export const isHttpUrl = (urlString: string): boolean => { 11 | try { 12 | const url = new URL(urlString); 13 | 14 | return url.protocol === "http:" || url.protocol === "https:"; 15 | } catch (_) { 16 | return false; 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-id-string.ts: -------------------------------------------------------------------------------- 1 | import { IdString } from "@scramjet/types"; 2 | 3 | /** 4 | * Basic pattern used in modules id checks 5 | */ 6 | const idPattern = /^[a-zA-z0-9_-]+$/; 7 | 8 | /** 9 | * Function to check for valid id pattern 10 | * 11 | * @param id Id to validate 12 | * @returns true if id is in valid format 13 | */ 14 | export const isIdString = (id: string): id is IdString => { 15 | if (id.length > 50) return false; 16 | return idPattern.test(id); 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-log-level.ts: -------------------------------------------------------------------------------- 1 | import { LogLevel } from "@scramjet/types"; 2 | import { LogLevelStrings } from "../constants"; 3 | 4 | export const isLogLevel = (lvl: string): lvl is LogLevel => { 5 | return (LogLevelStrings as string[]).includes(lvl); 6 | }; 7 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-port.ts: -------------------------------------------------------------------------------- 1 | import { Port } from "@scramjet/types"; 2 | 3 | export const isPort = (port: number | string): port is Port => { 4 | if (typeof port === "string") { 5 | port = parseInt(port, 10); 6 | if (isNaN(port)) return false; 7 | } 8 | return Number.isInteger(port) && port >= 0 && port <= 65535; 9 | }; 10 | -------------------------------------------------------------------------------- /packages/utility/src/typeguards/is-url-path.ts: -------------------------------------------------------------------------------- 1 | import { UrlPath } from "@scramjet/types"; 2 | 3 | const urlPathPartPattern = /^[\b/](([a-z0-9]+(?:-[a-z0-9]+)*)[\b/]{0,1})*$/; 4 | 5 | /** 6 | * Function checking slugs in url 7 | * 8 | * Example valid paterns: /xx /xx/ /xxx/aa /xxx-ddd/ /xxx/aaa-ddd/ /xx-cc/aaa-ddd etc. 9 | * @param url url to check 10 | * @returns true if valid slug format 11 | */ 12 | export const isUrlPath = (url: string): url is UrlPath => urlPathPartPattern.test(url); 13 | -------------------------------------------------------------------------------- /packages/utility/src/validators/api-version.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isApiVersion } from "../typeguards"; 3 | 4 | export const apiVersionValidator: Validator = (message: string) => (version: string) => 5 | !isApiVersion(version) ? message : true; 6 | -------------------------------------------------------------------------------- /packages/utility/src/validators/boolean.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isBoolean } from "../typeguards/is-boolean"; 3 | 4 | export const booleanValidator: Validator = (message: string) => (value: any) => !isBoolean(value) ? message : true; 5 | -------------------------------------------------------------------------------- /packages/utility/src/validators/defined.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isDefined, isEmptyString } from "../typeguards"; 3 | 4 | export const definedValidator: Validator = (message: string) => (value: any) => 5 | isDefined(value) && !isEmptyString(value) ? true : message; 6 | -------------------------------------------------------------------------------- /packages/utility/src/validators/fileExists.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { FileBuilder } from "../file"; 3 | 4 | export const fileExistsValidator: Validator = (message: string) => (value: any) => { 5 | if (typeof value !== "string") return message; 6 | 7 | const file = FileBuilder(value); 8 | 9 | return !file.exists() || !file.isReadable() ? message : true; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/utility/src/validators/http-url.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isHttpUrl } from "../typeguards"; 3 | 4 | export const httpUrlValidator: Validator = (message: string) => (value: string) => !isHttpUrl(value) ? message : true; 5 | -------------------------------------------------------------------------------- /packages/utility/src/validators/id-string.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isIdString } from "../typeguards"; 3 | 4 | export const idStringValidator: Validator = (message: string) => (value: string) => !isIdString(value) ? message : true; 5 | -------------------------------------------------------------------------------- /packages/utility/src/validators/index.ts: -------------------------------------------------------------------------------- 1 | export { apiVersionValidator } from "./api-version"; 2 | export { booleanValidator } from "./boolean"; 3 | export { stringValidator } from "./string"; 4 | export { definedValidator } from "./defined"; 5 | export { optionalValidator } from "./optional"; 6 | export { idStringValidator } from "./id-string"; 7 | export { logLevelValidator } from "./log-level"; 8 | export { portValidator } from "./port"; 9 | export { urlPathValidator } from "./url-path"; 10 | export { httpUrlValidator } from "./http-url"; 11 | export { fileExistsValidator } from "./fileExists"; 12 | export { SchemaValidator } from "./schema-validator"; 13 | -------------------------------------------------------------------------------- /packages/utility/src/validators/log-level.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isLogLevel } from "../typeguards"; 3 | 4 | export const logLevelValidator: Validator = (message: string) => (value: string) => !isLogLevel(value) ? message : true; 5 | -------------------------------------------------------------------------------- /packages/utility/src/validators/optional.ts: -------------------------------------------------------------------------------- 1 | import { isDefined, isEmptyString } from "../typeguards"; 2 | 3 | export const optionalValidator = (value: any) => isDefined(value) && !isEmptyString(value); 4 | -------------------------------------------------------------------------------- /packages/utility/src/validators/port.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isPort } from "../typeguards"; 3 | 4 | export const portValidator: Validator = (message: string) => (value: string) => !isPort(value) ? message : true; 5 | -------------------------------------------------------------------------------- /packages/utility/src/validators/string.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | 3 | export const stringValidator: Validator = (message: string) => (value: any) => 4 | !(typeof value === "string") ? message : true; 5 | -------------------------------------------------------------------------------- /packages/utility/src/validators/url-path.ts: -------------------------------------------------------------------------------- 1 | import { Validator } from "@scramjet/types"; 2 | import { isUrlPath } from "../typeguards"; 3 | 4 | export const urlPathValidator: Validator = (message: string) => (value: string) => !isUrlPath(value) ? message : true; 5 | -------------------------------------------------------------------------------- /packages/utility/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/utility/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "src/index.ts" 16 | ], 17 | "out": "../../docs/utility", 18 | "plugin": "typedoc-plugin-markdown", 19 | "excludePrivate": "true", 20 | "gitRevision": "HEAD", 21 | "sort": "alphabetical" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/verser/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ignorePatterns: [".eslintrc.js", "types.ts"], 3 | parserOptions:{ 4 | project: "./tsconfig.json", 5 | tsconfigRootDir: __dirname 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/verser/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./lib/verser"; 2 | export * from "./lib/verser-client"; 3 | export * from "./lib/verser-connection"; 4 | -------------------------------------------------------------------------------- /packages/verser/src/lib/verser-client-default-config.ts: -------------------------------------------------------------------------------- 1 | import { VerserClientOptions } from "../types"; 2 | 3 | /** 4 | * Default VerserClient configuration. 5 | */ 6 | export const defaultVerserClientOptions: VerserClientOptions = { 7 | headers: {}, 8 | verserUrl: "http://localhost:8080" 9 | }; 10 | -------------------------------------------------------------------------------- /packages/verser/src/readme.mtpl: -------------------------------------------------------------------------------- 1 | # Scramjet Verser 2 | 3 | ![Scramjet Transform Hub](https://assets.scramjet.org/sth-logo.svg "Scramjet Transform Hub Logo") 4 | 5 | This package provides a reverse server functionality. 6 | 7 | ```bash 8 | npm install -g @scramjet/verser 9 | ``` 10 | 11 | ## Docs 12 | 13 | >!docs verser/modules.md & 14 | 15 | >@sth 16 | >@use-cases 17 | >@links 18 | >@license-agpl 19 | >@contrib 20 | -------------------------------------------------------------------------------- /packages/verser/test/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/packages/verser/test/.keep -------------------------------------------------------------------------------- /packages/verser/test/cert/cleanup-localhost-cert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rm {localhost,myCA}.* -------------------------------------------------------------------------------- /packages/verser/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/verser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../../tsconfig.base.json", 6 | "include": [ 7 | "./src/**/*.ts", 8 | "./test/**/*.ts", 9 | "src/types" 10 | ], 11 | "exclude": [ 12 | "node_modules" 13 | ], 14 | "typedocOptions": { 15 | "entryPoints": [ 16 | "src/index.ts" 17 | ], 18 | "out": "../../docs/verser", 19 | "plugin": "typedoc-plugin-markdown", 20 | "excludePrivate": "true", 21 | "gitRevision": "HEAD", 22 | "sort": "alphabetical" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/verser/types.ts: -------------------------------------------------------------------------------- 1 | export * from "./src/types"; 2 | -------------------------------------------------------------------------------- /scripts/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": false, 3 | "rules": { 4 | "no-console": 0, 5 | "import/no-extraneous-dependencies": 0 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /scripts/dev/names.json: -------------------------------------------------------------------------------- 1 | { "name": "a1" } 2 | { "name": "b2" } 3 | { "name": "a3" } 4 | { "name": "b4" } 5 | { "name": "a5" } 6 | { "name": "b6" } 7 | { "name": "a7" } 8 | { "name": "b8" } 9 | -------------------------------------------------------------------------------- /scripts/dev/start-seq.ts: -------------------------------------------------------------------------------- 1 | import { HostClient } from "@scramjet/api-client/"; 2 | import { createReadStream } from "fs"; 3 | import { resolve } from "path"; 4 | 5 | const host = new HostClient("http://localhost:8000/api/v1"); 6 | 7 | // eslint-disable-next-line @typescript-eslint/no-floating-promises 8 | (async () => { 9 | const pkg = createReadStream(resolve(__dirname, "../../sth/packages/reference-apps/stdio-sequence.tar.gz")); 10 | 11 | const sequence = await host.sendSequence(pkg); 12 | const instance = await sequence.start({ appConfig: {} }); 13 | const instanceInfo = { id: instance.id, ...await instance.getInfo() }; 14 | 15 | // eslint-disable-next-line no-console 16 | console.error(instanceInfo); 17 | })(); 18 | -------------------------------------------------------------------------------- /scripts/lib/opts.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function getDepTypes(opts) { 4 | if (opts.a) { 5 | opts.d = opts.D = opts.p = opts.o = true; 6 | } 7 | 8 | const { 9 | d: dependencies, D: devDependencies, p: peerDependencies, o: optionalDependencies 10 | } = opts; 11 | 12 | const depTypes = Object 13 | .entries({ dependencies, devDependencies, peerDependencies, optionalDependencies }) 14 | .filter(([, val]) => val) 15 | .map(([key]) => key); 16 | 17 | return depTypes; 18 | } 19 | 20 | module.exports = { getDepTypes }; 21 | -------------------------------------------------------------------------------- /scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "bin": {}, 3 | "name": "@scramjet/scripts", 4 | "version": "0.12.1", 5 | "description": "Scripts used by scramjet cloud platform", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\"" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "" 12 | }, 13 | "author": "", 14 | "license": "AGPL-3.0", 15 | "private": true 16 | } 17 | -------------------------------------------------------------------------------- /scripts/packsequence.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const Pack = require("./lib/pack"); 4 | const packOptions = { 5 | outDir: process.env.OUT_DIR || "dist", 6 | localPkgs: process.env.LOCAL_PACKAGES, 7 | packagesDir: process.env.PACKAGES_DIR || "packages" 8 | }; 9 | const pack = new Pack(packOptions); 10 | 11 | pack.pack() 12 | .then( 13 | (name) => console.log(name) 14 | ) 15 | .catch(e => { 16 | console.error(e.stack); 17 | process.exitCode = e.exitCode || 10; 18 | }); 19 | -------------------------------------------------------------------------------- /scripts/publish.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const PrePack = require("./lib/pre-pack"); 4 | const prePack = new PrePack({ 5 | outDir: process.env.OUT_DIR || "dist", 6 | packagesDir: process.env.PACKAGES_DIR, 7 | localPkgs: process.env.LOCAL_PACKAGES, 8 | flatPkgs: process.env.FLAT_PACKAGES, 9 | localCopy: process.env.LOCAL_COPY, 10 | noInstall: process.env.NO_INSTALL, 11 | public: process.env.MAKE_PUBLIC 12 | }); 13 | 14 | prePack.build() 15 | .catch(e => { 16 | console.error(e.stack); 17 | process.exitCode = e.exitCode || 10; 18 | }); 19 | -------------------------------------------------------------------------------- /scripts/systemd/README.md: -------------------------------------------------------------------------------- 1 | # Scramjet Transform Hub Systemd Service 2 | 3 | 1. Install Scramjet Transform Hub `npm i -g @scramjet/sth @scramjet/cli --prefix /usr/local/bin` 4 | 2. Create file: `/etc/systemd/system/scramjet-transform-hub.service` 5 | 3. Insert with content of [scramjet-transform-hub.service](scramjet-transform-hub.service) 6 | 4. Start service `systemctl start scramjet-transform-hub.service` 7 | 5. Check status of service `systemctl status scramjet-transform-hub.service` 8 | 6. Stop service `systemctl start scramjet-transform-hub.service` 9 | 7. Get service logs: `journalctl -u scramjet-transform-hub` 10 | 8. To start service automatically after server restart you can enable service: `systemctl enable scramjet-transform-hub.service` 11 | -------------------------------------------------------------------------------- /scripts/systemd/scramjet-transform-hub.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=scramjet-transform-hub 3 | Documentation=https://github.com/scramjetorg/transform-hub 4 | After=network.target 5 | 6 | [Service] 7 | Environment="" 8 | Type=simple 9 | User=www-data 10 | ExecStart=/usr/local/bin/scramjet-transform-hub 11 | ExecStartPre=-/bin/rm /tmp/scramjet-socket-server-path 12 | ExecStop=-/bin/rm /tmp/scramjet-socket-server-path 13 | RemainAfterExit=yes 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /scripts/test-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function runtest { 4 | ( cd $line && npm test ) 5 | return $? 6 | } 7 | 8 | while IFS='' read -r line; do 9 | runtest || exit 11 10 | done < <( 11 | find src/ scripts/ lib/ -name 'package.json' -not -wholename '*node_modules*' -execdir pwd ';' 12 | ) 13 | 14 | -------------------------------------------------------------------------------- /scripts/utils.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | const merge = (target, source = {}, strict = false) => Object.keys(source) 4 | .forEach((key) => { 5 | if (typeof source[key] === "object" && !Array.isArray(source[key])) { 6 | if (target[key] === undefined) target[key] = {}; 7 | merge(target[key], source[key]); 8 | } else if (source[key] !== undefined) { 9 | target[key] = source[key]; 10 | } else if (strict) { 11 | throw new Error(`Unkown option ${String(key)} in config`); 12 | } 13 | }); 14 | 15 | module.exports = { 16 | merge 17 | }; 18 | -------------------------------------------------------------------------------- /scripts/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "minimist@^1.2.6": 6 | "integrity" "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==" 7 | "resolved" "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz" 8 | "version" "1.2.6" 9 | -------------------------------------------------------------------------------- /sth-config-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": { 3 | "hostname": "0.0.0.0", 4 | "port": 9000, 5 | "instancesServerPort": 9001 6 | }, 7 | "timings": { 8 | "instanceLifetimeExtensionDelay": 10000 9 | }, 10 | "cpmId": "", 11 | "cpmUrl": "localhost:11000", 12 | "platform": { 13 | "token": "" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /template/.eslintrc: -------------------------------------------------------------------------------- 1 | {"parserOptions":{"project": "./tsconfig.json", "tsconfigRootDir":"./template"}} 2 | -------------------------------------------------------------------------------- /template/src/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/template/src/index.ts -------------------------------------------------------------------------------- /template/src/lib/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/template/src/lib/.keep -------------------------------------------------------------------------------- /template/test/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scramjetorg/transform-hub/9fbfef249c03c31a0183549852aa0b381cfb3e11/template/test/.keep -------------------------------------------------------------------------------- /template/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "src/**/*" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /template/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./dist" 4 | }, 5 | "extends": "../tsconfig.base.json", 6 | "include": [ 7 | "./src", 8 | "./test" 9 | ], 10 | "exclude": [ 11 | "node_modules" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "index.ts" 16 | ], 17 | "out": "../../docs/template", 18 | "gitRevision": "HEAD" 19 | } 20 | } 21 | --------------------------------------------------------------------------------