├── .dockerignore ├── .env ├── .github ├── labeler.yml ├── settings.yml ├── typos_config.toml └── workflows │ ├── cache-xml.yaml │ ├── grid-dev.yaml │ ├── integration-tests.yaml │ ├── label-prs.yaml │ ├── lint-dockerfiles.yaml │ ├── lint-grid-ui.yaml │ ├── lint-grid.yaml │ ├── lint-openapi.yaml │ ├── lint-typos.yaml │ ├── merge.yaml │ ├── publish-docker-branch.yaml │ ├── publish-release.yaml │ ├── test-docker-build.yaml │ ├── test-grid-ui.yaml │ └── unit-test-grid.yaml ├── .gitignore ├── .pep8 ├── .pylintrc ├── .validaterc ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Cargo.toml ├── LICENSE ├── MAINTAINERS.md ├── README.md ├── RELEASE_NOTES.md ├── SECURITY.md ├── VERSION ├── bin ├── get_version ├── run_lint └── whitelist ├── ci ├── build-contracts ├── docker-bake.hcl ├── grid-dev-buildx ├── grid-dev.dockerfile ├── grid-dev.yaml ├── hadolint.yaml ├── publish-crates ├── publish-docker └── publish-grid-crates.dockerfile ├── cli ├── Cargo.toml ├── Dockerfile ├── build.rs ├── man │ ├── grid-admin-keygen.1.md │ ├── grid-admin.1.md │ ├── grid-agent-create.1.md │ ├── grid-agent-list.1.md │ ├── grid-agent-show.1.md │ ├── grid-agent-update.1.md │ ├── grid-agent.1.md │ ├── grid-database-migrate.1.md │ ├── grid-database.1.md │ ├── grid-download-xsd.1.md │ ├── grid-keygen.1.md │ ├── grid-location-create.1.md │ ├── grid-location-delete.1.md │ ├── grid-location-list.1.md │ ├── grid-location-show.1.md │ ├── grid-location-update.1.md │ ├── grid-location.1.md │ ├── grid-organization-create.1.md │ ├── grid-organization-list.1.md │ ├── grid-organization-show.1.md │ ├── grid-organization-update.1.md │ ├── grid-organization.1.md │ ├── grid-po-create.1.md │ ├── grid-po-list.1.md │ ├── grid-po-revision-list.1.md │ ├── grid-po-revision-show.1.md │ ├── grid-po-revision.1.md │ ├── grid-po-show.1.md │ ├── grid-po-update.1.md │ ├── grid-po-version-create.1.md │ ├── grid-po-version-list.1.md │ ├── grid-po-version-show.1.md │ ├── grid-po-version-update.1.md │ ├── grid-po-version.1.md │ ├── grid-po.1.md │ ├── grid-product-create.1.md │ ├── grid-product-delete.1.md │ ├── grid-product-list.1.md │ ├── grid-product-show.1.md │ ├── grid-product-update.1.md │ ├── grid-product.1.md │ ├── grid-role-create.1.md │ ├── grid-role-delete.1.md │ ├── grid-role-list.1.md │ ├── grid-role-show.1.md │ ├── grid-role-update.1.md │ ├── grid-role.1.md │ ├── grid-schema-create.1.md │ ├── grid-schema-list.1.md │ ├── grid-schema-show.1.md │ ├── grid-schema-update.1.md │ ├── grid-schema.1.md │ └── grid.1.md ├── packaging │ ├── man │ │ └── README.md │ └── ubuntu │ │ └── completions │ │ └── grid ├── schemas │ ├── gdsn_3_1_schema.yaml │ └── location.yaml ├── src │ ├── actions │ │ ├── agent.rs │ │ ├── database │ │ │ ├── mod.rs │ │ │ └── sqlite.rs │ │ ├── keygen.rs │ │ ├── location.rs │ │ ├── mod.rs │ │ ├── organization.rs │ │ ├── product.rs │ │ ├── purchase_order.rs │ │ ├── role.rs │ │ ├── schema.rs │ │ └── xsd_downloader │ │ │ ├── downloader.rs │ │ │ ├── extractor.rs │ │ │ ├── mod.rs │ │ │ └── validator.rs │ ├── error.rs │ ├── http.rs │ ├── main.rs │ ├── signing.rs │ ├── transaction.rs │ └── yaml_parser.rs └── tests │ ├── data_validation.rs │ ├── data_validation │ └── xml │ │ ├── order.xml │ │ └── order_invalid.xml │ ├── locations │ ├── create_location.yaml │ ├── create_location_schema.yaml │ └── update_location.yaml │ ├── product.rs │ └── products │ ├── create_product.yaml │ ├── test_product_schema.yaml │ └── update_product.yaml ├── contracts ├── location │ ├── Cargo.toml │ ├── Dockerfile │ ├── location.yaml │ ├── packaging │ │ └── scar │ │ │ └── manifest.yaml │ └── src │ │ ├── handler.rs │ │ ├── main.rs │ │ ├── permissions.rs │ │ └── state.rs ├── pike │ ├── Cargo.toml │ ├── Dockerfile │ ├── packaging │ │ └── scar │ │ │ └── manifest.yaml │ ├── pike.yaml │ └── src │ │ ├── error.rs │ │ ├── handler.rs │ │ ├── main.rs │ │ ├── permissions.rs │ │ └── state.rs ├── product │ ├── Cargo.toml │ ├── Dockerfile │ ├── packaging │ │ └── scar │ │ │ └── manifest.yaml │ ├── product.yaml │ └── src │ │ ├── handler.rs │ │ ├── main.rs │ │ ├── payload.rs │ │ ├── permissions.rs │ │ ├── state.rs │ │ └── validation.rs ├── purchase_order │ ├── Cargo.toml │ ├── Dockerfile │ ├── packaging │ │ └── scar │ │ │ └── manifest.yaml │ ├── purchase_order.yaml │ └── src │ │ ├── handler.rs │ │ ├── main.rs │ │ ├── payload.rs │ │ ├── permissions.rs │ │ ├── state.rs │ │ └── workflow.rs ├── schema │ ├── Cargo.toml │ ├── Dockerfile │ ├── packaging │ │ └── scar │ │ │ └── manifest.yaml │ ├── schema.yaml │ └── src │ │ ├── handler.rs │ │ ├── main.rs │ │ ├── payload.rs │ │ ├── permissions.rs │ │ └── state.rs └── track_and_trace │ ├── Cargo.toml │ ├── Dockerfile │ ├── packaging │ └── scar │ │ └── manifest.yaml │ ├── src │ ├── handler.rs │ ├── main.rs │ ├── payload.rs │ └── state.rs │ └── track_and_trace.yaml ├── daemon ├── Cargo.toml ├── Dockerfile ├── diesel.toml ├── man │ └── gridd.1.md ├── openapi.yaml ├── packaging │ └── ubuntu │ │ └── postinst ├── src │ ├── config.rs │ ├── database │ │ ├── error.rs │ │ └── mod.rs │ ├── error.rs │ ├── event │ │ ├── db_handler.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── main.rs │ ├── rest_api │ │ ├── error.rs │ │ └── mod.rs │ ├── sawtooth │ │ ├── connection.rs │ │ ├── event.rs │ │ ├── mod.rs │ │ └── run.rs │ ├── schema.patch │ └── splinter │ │ ├── app_auth_handler │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── node.rs │ │ └── sabre.rs │ │ ├── event │ │ ├── error.rs │ │ ├── mod.rs │ │ └── processors.rs │ │ ├── mod.rs │ │ └── run.rs └── test │ └── docker-compose.yaml ├── docker-compose-installed.yaml ├── docker-compose-splinter.yaml ├── docker-compose.yaml ├── docker ├── compose │ ├── .env │ ├── contracts.yaml │ ├── copy-artifacts.yaml │ ├── grid-tests.yaml │ └── run-lint.yaml ├── lint.dockerfile ├── tests.dockerfile └── typos.dockerfile ├── examples ├── griddle │ ├── .env │ ├── docker-compose-dockerhub.yaml │ ├── docker-compose-sawtooth.yaml │ └── docker-compose-splinter.yaml ├── sawtooth │ ├── .env │ ├── README.md │ └── docker-compose.yaml └── splinter │ ├── .env │ ├── README.md │ ├── docker-compose-dockerhub.yaml │ └── docker-compose.yaml ├── griddle ├── Cargo.toml ├── Dockerfile └── src │ ├── config │ ├── builder.rs │ ├── clap.rs │ ├── default.rs │ ├── env.rs │ ├── error.rs │ ├── mod.rs │ └── partial.rs │ ├── error.rs │ ├── main.rs │ └── rest_api │ ├── actix_web_4 │ ├── api.rs │ ├── builder.rs │ ├── mod.rs │ └── runnable.rs │ ├── error.rs │ └── mod.rs ├── integration ├── .env └── docker-compose.yaml ├── justfile ├── load-balancer ├── Dockerfile └── nginx.conf ├── sdk ├── Cargo.toml ├── build.rs ├── protos │ ├── location_payload.proto │ ├── location_state.proto │ ├── pike_payload.proto │ ├── pike_state.proto │ ├── product_payload.proto │ ├── product_state.proto │ ├── purchase_order_payload.proto │ ├── purchase_order_state.proto │ ├── schema_payload.proto │ ├── schema_state.proto │ ├── track_and_trace_payload.proto │ └── track_and_trace_state.proto └── src │ ├── backend │ ├── error.rs │ ├── mod.rs │ ├── sawtooth.rs │ └── splinter.rs │ ├── batch_processor │ ├── mod.rs │ ├── pacemaker.rs │ └── submitter │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── sawtooth.rs │ │ └── splinter.rs │ ├── batch_submission │ ├── mod.rs │ └── submission │ │ ├── mod.rs │ │ ├── submitter │ │ ├── batch_submitter │ │ │ ├── async_batch_submitter.rs │ │ │ └── mod.rs │ │ └── mod.rs │ │ ├── submitter_observer │ │ └── mod.rs │ │ └── url_resolver │ │ ├── basic_url_resolver.rs │ │ └── mod.rs │ ├── batch_tracking │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_batches.rs │ │ │ ├── change_batch_to_submitted.rs │ │ │ ├── clean_stale_records.rs │ │ │ ├── get_batch.rs │ │ │ ├── get_batch_status.rs │ │ │ ├── get_failed_batches.rs │ │ │ ├── get_unsubmitted_batches.rs │ │ │ ├── list_batches_by_status.rs │ │ │ ├── mod.rs │ │ │ └── update_batch_status.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── batches │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_batch.rs │ │ │ ├── change_batch_to_submitted.rs │ │ │ ├── get_batch.rs │ │ │ ├── get_unclaimed_batches.rs │ │ │ ├── list_batches.rs │ │ │ ├── mod.rs │ │ │ ├── relinquish_claim.rs │ │ │ └── update_submission_error_info.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── client │ ├── location.rs │ ├── mod.rs │ ├── pike.rs │ ├── product.rs │ ├── purchase_order.rs │ ├── reqwest │ │ ├── location │ │ │ ├── data.rs │ │ │ └── mod.rs │ │ ├── mod.rs │ │ ├── pike │ │ │ ├── data.rs │ │ │ └── mod.rs │ │ ├── product │ │ │ ├── data.rs │ │ │ └── mod.rs │ │ ├── purchase_order │ │ │ ├── data.rs │ │ │ └── mod.rs │ │ └── schema │ │ │ ├── data.rs │ │ │ └── mod.rs │ └── schema.rs │ ├── commits │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_commit.rs │ │ │ ├── create_db_commit_from_commit_event.rs │ │ │ ├── get_commit_by_commit_num.rs │ │ │ ├── get_current_commit_id.rs │ │ │ ├── get_current_service_commits.rs │ │ │ ├── get_next_commit_num.rs │ │ │ ├── mod.rs │ │ │ └── resolve_fork.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── data_validation │ ├── error.rs │ ├── mod.rs │ ├── purchase_order.rs │ ├── test_files │ │ ├── gdsn_product.xml │ │ └── gdsn_product_invalid.xml │ └── xml │ │ ├── mod.rs │ │ ├── xml_ffi.rs │ │ └── xsd │ │ └── product │ │ └── GridTradeItems.xsd │ ├── error │ ├── client.rs │ ├── constraint_violation.rs │ ├── internal.rs │ ├── invalid_argument.rs │ ├── invalid_state.rs │ ├── mod.rs │ └── unavailable.rs │ ├── hex.rs │ ├── lib.rs │ ├── location │ ├── addressing.rs │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_location.rs │ │ │ ├── delete_location.rs │ │ │ ├── get_location.rs │ │ │ ├── list_locations.rs │ │ │ └── mod.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── migrations │ ├── diesel │ │ ├── mod.rs │ │ ├── postgres │ │ │ ├── migrations │ │ │ │ ├── 00000000000000_diesel_initial_setup │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2020-09-28-165102_initial_grid_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-02-02-223041_batch_table │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-02-05-160000_pike_2_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-03-24-130200_purchase_order_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-03-30-164015_update_batch_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-04-23-151946_add_timestamp │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2021-07-22-161800_drop_unused_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-01-17-100000_purchase_order_tables_0_3 │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-02-09-212341_add_batch_tracking_tables │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ ├── 2022-04-14-215932_add_batch_tracking_tables_2 │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ │ └── 2022-04-19-160501_undo-batch-tracking-key-changes │ │ │ │ │ ├── down.sql │ │ │ │ │ └── up.sql │ │ │ └── mod.rs │ │ └── sqlite │ │ │ ├── migrations │ │ │ ├── 2020-09-28-165102_initial_grid_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-02-05-160000_pike_2_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-03-24-130200_purchase_order_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-03-30-164015_update_batch_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-04-23-151946_add_timestamp │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2021-07-22-161800_drop_unused_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-01-17-100000_purchase_order_tables_0_3 │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-02-09-212341_add_batch_tracking_tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ ├── 2022-04-14-215500_add_batch_tracking_tables_2 │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ └── 2022-04-19-160454_undo-batch-tracking-key-changes │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ └── mod.rs │ ├── error.rs │ └── mod.rs │ ├── paging.rs │ ├── pike │ ├── addressing.rs │ ├── mod.rs │ ├── permissions │ │ ├── error.rs │ │ └── mod.rs │ └── store │ │ ├── builder.rs │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_agent.rs │ │ │ ├── add_organization.rs │ │ │ ├── add_role.rs │ │ │ ├── delete_role.rs │ │ │ ├── get_agent.rs │ │ │ ├── get_organization.rs │ │ │ ├── get_role.rs │ │ │ ├── list_agents.rs │ │ │ ├── list_organizations.rs │ │ │ ├── list_roles_for_organization.rs │ │ │ ├── mod.rs │ │ │ └── update_agent.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── product │ ├── addressing.rs │ ├── gdsn │ │ ├── error.rs │ │ ├── mod.rs │ │ └── test_files │ │ │ ├── gdsn_product.xml │ │ │ ├── gdsn_product_invalid.xml │ │ │ ├── gdsn_product_multiple.xml │ │ │ ├── gdsn_product_poorly_formed.xml │ │ │ ├── test_trade_item_payload_1.xml │ │ │ └── test_trade_item_payload_2.xml │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_product.rs │ │ │ ├── delete_product.rs │ │ │ ├── get_product.rs │ │ │ ├── list_products.rs │ │ │ ├── mod.rs │ │ │ └── update_product.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── protocol │ ├── errors.rs │ ├── location │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── state.rs │ ├── mod.rs │ ├── pike │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── state.rs │ ├── product │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── state.rs │ ├── purchase_order │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── state.rs │ ├── schema │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── state.rs │ └── track_and_trace │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── state.rs │ ├── protos.rs │ ├── proxy │ ├── client │ │ ├── mod.rs │ │ └── reqwest.rs │ ├── error.rs │ ├── mod.rs │ ├── request.rs │ └── response.rs │ ├── purchase_order │ ├── addressing.rs │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_alternate_id.rs │ │ │ ├── add_purchase_order.rs │ │ │ ├── add_purchase_order_version.rs │ │ │ ├── add_purchase_order_version_revision.rs │ │ │ ├── get_latest_revision_id.rs │ │ │ ├── get_purchase_order.rs │ │ │ ├── get_purchase_order_version.rs │ │ │ ├── get_purchase_order_version_revision.rs │ │ │ ├── get_uid_from_alternate_id.rs │ │ │ ├── list_alternate_ids_for_purchase_order.rs │ │ │ ├── list_purchase_order_version_revisions.rs │ │ │ ├── list_purchase_order_versions.rs │ │ │ ├── list_purchase_orders.rs │ │ │ ├── mod.rs │ │ │ └── remove_alternate_id.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── rest_api │ ├── actix_web_4 │ │ ├── backend_state.rs │ │ ├── endpoint.rs │ │ ├── key_state.rs │ │ ├── mod.rs │ │ ├── paging.rs │ │ ├── routes │ │ │ ├── agents.rs │ │ │ ├── batches.rs │ │ │ ├── locations.rs │ │ │ ├── mod.rs │ │ │ ├── organizations.rs │ │ │ ├── products.rs │ │ │ ├── proxy.rs │ │ │ ├── purchase_orders.rs │ │ │ ├── records.rs │ │ │ ├── roles.rs │ │ │ ├── schemas.rs │ │ │ └── submit.rs │ │ ├── run.rs │ │ ├── service.rs │ │ └── store_state.rs │ ├── mod.rs │ └── resources │ │ ├── agents │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── batches │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── error.rs │ │ ├── locations │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── mod.rs │ │ ├── organizations │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── paging │ │ ├── mod.rs │ │ └── v1 │ │ │ └── mod.rs │ │ ├── products │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── purchase_order │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── roles │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── schemas │ │ ├── mod.rs │ │ └── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads.rs │ │ ├── submit │ │ ├── mod.rs │ │ ├── v1 │ │ │ ├── handler.rs │ │ │ ├── mod.rs │ │ │ └── payloads │ │ │ │ ├── location.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── pike.rs │ │ │ │ ├── product.rs │ │ │ │ └── schema.rs │ │ └── v2 │ │ │ ├── error.rs │ │ │ ├── handler │ │ │ ├── mod.rs │ │ │ └── reqwest.rs │ │ │ ├── mod.rs │ │ │ └── payloads │ │ │ ├── batch.rs │ │ │ ├── location.rs │ │ │ ├── mod.rs │ │ │ ├── pike.rs │ │ │ ├── product.rs │ │ │ ├── purchase_order.rs │ │ │ └── schema.rs │ │ └── track_and_trace │ │ ├── mod.rs │ │ └── v1 │ │ ├── handler.rs │ │ ├── mod.rs │ │ └── payloads.rs │ ├── schema │ ├── addressing.rs │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_schema.rs │ │ │ ├── get_property_definition_by_name.rs │ │ │ ├── get_schema.rs │ │ │ ├── list_property_definitions.rs │ │ │ ├── list_property_definitions_with_schema_name.rs │ │ │ ├── list_schemas.rs │ │ │ └── mod.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ ├── scope_id │ ├── mod.rs │ └── service │ │ ├── id │ │ ├── circuit.rs │ │ ├── mod.rs │ │ ├── qualified.rs │ │ └── service.rs │ │ └── mod.rs │ ├── store │ ├── mod.rs │ ├── postgres.rs │ └── sqlite.rs │ ├── threading │ ├── lifecycle.rs │ └── mod.rs │ ├── track_and_trace │ ├── addressing.rs │ ├── mod.rs │ └── store │ │ ├── diesel │ │ ├── mod.rs │ │ ├── models.rs │ │ ├── operations │ │ │ ├── add_associated_agents.rs │ │ │ ├── add_properties.rs │ │ │ ├── add_proposals.rs │ │ │ ├── add_records.rs │ │ │ ├── add_reported_values.rs │ │ │ ├── add_reporters.rs │ │ │ ├── get_property_with_data_type.rs │ │ │ ├── get_record.rs │ │ │ ├── get_reported_value_reporter_to_agent_metadata.rs │ │ │ ├── list_associated_agents.rs │ │ │ ├── list_properties_with_data_type.rs │ │ │ ├── list_proposals.rs │ │ │ ├── list_records.rs │ │ │ ├── list_reported_value_reporter_to_agent_metadata.rs │ │ │ ├── list_reporters.rs │ │ │ └── mod.rs │ │ └── schema.rs │ │ ├── error.rs │ │ └── mod.rs │ └── workflow │ ├── mod.rs │ ├── state.rs │ └── subworkflow.rs └── ui ├── .dockerignore ├── Dockerfile ├── configs └── apache │ └── httpd.conf ├── grid-ui ├── .dockerignore ├── .eslintignore ├── .eslintrc ├── .prettierignore ├── .prettierrc ├── README.md ├── docker │ ├── .env │ ├── docker-compose.yaml │ └── test │ │ └── Dockerfile ├── package.json ├── public │ ├── .htaccess │ ├── favicon.ico │ ├── index.html │ ├── manifest.json │ └── robots.txt └── src │ ├── App.js │ ├── App.scss │ ├── App.test.js │ ├── images │ └── grid.svg │ ├── index.css │ ├── index.js │ ├── setupProxy.js │ ├── setupTests.js │ └── theme │ ├── colors.scss │ ├── index.js │ ├── index.scss │ ├── sizes.scss │ ├── timings.scss │ ├── typography.scss │ └── variables.scss ├── protos ├── location_payload.proto ├── location_state.proto ├── pike_payload.proto ├── pike_state.proto ├── product_payload.proto ├── product_state.proto ├── schema_payload.proto ├── schema_state.proto ├── track_and_trace_payload.proto └── track_and_trace_state.proto ├── sapling-dev-server ├── configSaplings └── userSaplings └── saplings ├── circuits ├── .babelrc ├── .eslintignore ├── .eslintrc ├── .prettierignore ├── .prettierrc ├── images │ └── circuits_logo.svg ├── package.json ├── protos │ └── admin.proto ├── public │ ├── index.html │ ├── manifest.json │ └── robots.txt ├── scripts │ └── compile_protobuf.js ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── api │ │ ├── payload.js │ │ ├── requests.js │ │ └── splinter.js │ ├── components │ │ ├── Chips.js │ │ ├── Chips.scss │ │ ├── Content.js │ │ ├── Content.scss │ │ ├── MainHeader.js │ │ ├── MainHeader.scss │ │ ├── NodeCard.js │ │ ├── NodeCard.scss │ │ ├── OverlayModal.js │ │ ├── OverlayModal.scss │ │ ├── PlusMinusButton.js │ │ ├── PlusMinusButton.scss │ │ ├── ProposalReview.js │ │ ├── ProposalReview.scss │ │ ├── ProposeCircuitButton.js │ │ ├── ProposeCircuitButton.scss │ │ ├── circuitDetails │ │ │ ├── CircuitDetails.js │ │ │ ├── CircuitDetails.scss │ │ │ ├── CircuitMetaData.js │ │ │ ├── CircuitMetaData.scss │ │ │ ├── ServiceDetails.js │ │ │ ├── ServiceDetails.scss │ │ │ ├── VoteButton.js │ │ │ └── VoteButton.scss │ │ ├── circuitsTable │ │ │ ├── CircuitsTable.scss │ │ │ ├── Table.js │ │ │ ├── TableHeader.js │ │ │ └── TableRow.js │ │ └── forms │ │ │ ├── MultiStepForm.js │ │ │ ├── MultiStepForm.scss │ │ │ ├── NewNodeForm.js │ │ │ ├── NewNodeForm.scss │ │ │ ├── VoteOnProposalForm.js │ │ │ ├── VoteOnProposalForm.scss │ │ │ ├── controls │ │ │ ├── index.js │ │ │ └── index.scss │ │ │ └── propose_circuit │ │ │ ├── index.js │ │ │ ├── index.scss │ │ │ ├── service.js │ │ │ └── service.scss │ ├── data │ │ ├── circuits.js │ │ ├── nodeRegistry.js │ │ └── paging.js │ ├── images │ │ └── search_icon.svg │ ├── index.css │ ├── index.js │ ├── protobuf.js │ ├── setupTests.js │ └── state │ │ ├── circuits.js │ │ ├── localNode.js │ │ └── nodeRegistry.js ├── test │ └── Dockerfile └── webpack.config.js ├── product ├── .babelrc ├── .eslintignore ├── .eslintrc ├── .prettierignore ├── .prettierrc ├── package.json ├── product_logo.svg ├── public │ ├── index.html │ ├── manifest.json │ └── robots.txt ├── scripts │ └── compile_protobuf.js ├── src │ ├── App.js │ ├── App.scss │ ├── App.test.js │ ├── api │ │ ├── grid.js │ │ ├── requests.js │ │ ├── splinter.js │ │ └── transactions.js │ ├── components │ │ ├── Chips.js │ │ ├── Chips.scss │ │ ├── CircuitDropdown.js │ │ ├── CircuitDropdown.scss │ │ ├── FilterBar.js │ │ ├── FilterBar.scss │ │ ├── Input.js │ │ ├── Input.scss │ │ ├── Loading.js │ │ ├── Loading.scss │ │ ├── MultiSelect.js │ │ ├── MultiSelect.scss │ │ ├── MultiStepForm.js │ │ ├── MultiStepForm.scss │ │ ├── NotFound.js │ │ ├── NotFound.scss │ │ ├── ProductCard.js │ │ ├── ProductCard.scss │ │ ├── ProductInfo.js │ │ ├── ProductInfo.scss │ │ ├── ProductProperty.js │ │ ├── ProductProperty.scss │ │ ├── ProductsTable.js │ │ ├── ProductsTable.scss │ │ ├── PropertyDetailsModal.js │ │ ├── PropertyDetailsModal.scss │ │ ├── SimpleForm.js │ │ ├── SimpleForm.scss │ │ ├── Table.js │ │ ├── Table.scss │ │ ├── TopBar.js │ │ ├── TopBar.scss │ │ └── forms.scss │ ├── data │ │ └── property-parsing.js │ ├── hooks │ │ └── on-click-outside.js │ ├── img_placeholder.svg │ ├── index.css │ ├── index.js │ ├── protobuf.js │ ├── setupTests.js │ ├── state │ │ └── service-context.js │ └── styles │ │ ├── buttons.scss │ │ ├── colors.scss │ │ ├── index.scss │ │ └── layout.scss ├── test │ └── Dockerfile └── webpack.config.js ├── profile ├── .babelrc ├── .eslintignore ├── .eslintrc ├── README.md ├── package.json ├── public │ ├── index.html │ └── manifest.json ├── src │ ├── ActionList.js │ ├── ActionList.scss │ ├── App.js │ ├── App.scss │ ├── Input.js │ ├── Input.scss │ ├── KeyTable.js │ ├── KeyTable.scss │ ├── Loader.js │ ├── Loader.scss │ ├── OverlayModal.js │ ├── OverlayModal.scss │ ├── Profile.js │ ├── forms │ │ ├── AddKeyForm.js │ │ ├── AddKeyForm.scss │ │ ├── ChangePasswordForm.js │ │ ├── EnterPasswordForm.js │ │ ├── EnterPasswordForm.scss │ │ ├── MultiStepForm.js │ │ ├── MultiStepForm.scss │ │ ├── UpdateKeyForm.js │ │ └── UpdateKeyForm.scss │ ├── http.js │ ├── index.css │ ├── index.js │ └── useDebounce.js ├── test │ └── Dockerfile └── webpack.config.js └── register-login ├── .eslintrc ├── .prettierrc ├── jest.config.js ├── package.json ├── src ├── index.ts └── register-login.html ├── test └── Dockerfile ├── tsconfig.json ├── types └── index.d.ts └── webpack.config.js /.env: -------------------------------------------------------------------------------- 1 | ISOLATION_ID=latest 2 | DISTRO=jammy 3 | REPO_VERSION=0.4.1-dev 4 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | backport-triage: 2 | - '**' 3 | 4 | main: 5 | - '**' 6 | -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | repository: 2 | name: grid 3 | description: Grid has moved to end-of-life status. 4 | topics: supply chain, distributed ledger, smart contract, blockchain 5 | private: false 6 | has_issues: true 7 | has_projects: false 8 | has_wiki: false 9 | has_downloads: false 10 | archived: true 11 | default_branch: main 12 | allow_squash_merge: false 13 | allow_merge_commit: true 14 | allow_rebase_merge: true 15 | -------------------------------------------------------------------------------- /.github/typos_config.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [default.extend-identifiers] 16 | speling_module = "speling_module" 17 | -------------------------------------------------------------------------------- /.github/workflows/grid-dev.yaml: -------------------------------------------------------------------------------- 1 | name: Build grid-dev 2 | on: 3 | - push 4 | - workflow_dispatch 5 | jobs: 6 | build_grid_dev: 7 | if: github.repository == 'hyperledger/grid' 8 | name: Build grid-dev 9 | runs-on: macos-arm 10 | steps: 11 | - name: Login to DockerHub 12 | uses: docker/login-action@v1 13 | with: 14 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 15 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 16 | 17 | - uses: actions/checkout@v2 18 | with: 19 | fetch-depth: 0 20 | 21 | - name: Docker build 22 | env: 23 | NAMESPACE: ${{ secrets.DOCKER_HUB_NAMESPACE }}/ 24 | run: ./ci/grid-dev-buildx 25 | 26 | - name: Notify Slack of Failure 27 | if: cancelled() || failure() 28 | uses: 8398a7/action-slack@v3 29 | with: 30 | status: ${{ job.status }} 31 | fields: repo,message,author,job 32 | env: 33 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 34 | -------------------------------------------------------------------------------- /.github/workflows/integration-tests.yaml: -------------------------------------------------------------------------------- 1 | name: Integration Tests 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | 15 | integration_tests: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Display envvars 21 | run: env 22 | 23 | - name: Install Just 24 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 25 | 26 | - name: Integration Tests 27 | run: just ci-test-integration 28 | -------------------------------------------------------------------------------- /.github/workflows/label-prs.yaml: -------------------------------------------------------------------------------- 1 | name: "Label PRs" 2 | on: 3 | pull_request_target: 4 | types: [ opened ] 5 | 6 | jobs: 7 | label_pr: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/labeler@v3 11 | with: 12 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 13 | -------------------------------------------------------------------------------- /.github/workflows/lint-dockerfiles.yaml: -------------------------------------------------------------------------------- 1 | name: Lint Grid Dockerfiles 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | lint_dockerfiles: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Run hadolint on Grid Dockerfiles 26 | run: just ci-lint-dockerfiles 27 | -------------------------------------------------------------------------------- /.github/workflows/lint-grid-ui.yaml: -------------------------------------------------------------------------------- 1 | name: Lint Grid UI 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | 15 | lint_grid_ui: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Display envvars 21 | run: env 22 | 23 | - name: Install Just 24 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 25 | 26 | - name: Lint Grid UI 27 | run: just ci-lint-ui 28 | -------------------------------------------------------------------------------- /.github/workflows/lint-grid.yaml: -------------------------------------------------------------------------------- 1 | name: Lint Grid 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | 15 | lint_grid: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Display envvars 21 | run: env 22 | 23 | - name: Install Just 24 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 25 | 26 | - name: Run Lint/Clippy on Grid 27 | run: just ci-lint 28 | -------------------------------------------------------------------------------- /.github/workflows/lint-openapi.yaml: -------------------------------------------------------------------------------- 1 | name: Lint OpenAPI spec 2 | 3 | on: 4 | pull_request: 5 | 6 | concurrency: 7 | group: "${{ github.ref }}-${{ github.workflow }}" 8 | cancel-in-progress: true 9 | 10 | jobs: 11 | lint_openapi: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Display envvars 17 | run: env 18 | 19 | - name: Install Just 20 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 21 | 22 | - name: Lint OpenAPI files 23 | run: just ci-lint-openapi 24 | -------------------------------------------------------------------------------- /.github/workflows/lint-typos.yaml: -------------------------------------------------------------------------------- 1 | name: Check For Typos 2 | 3 | on: 4 | pull_request: 5 | 6 | concurrency: 7 | group: "${{ github.ref }}-${{ github.workflow }}" 8 | cancel-in-progress: true 9 | 10 | jobs: 11 | lint_typos: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Display envvars 17 | run: env 18 | 19 | - name: Install Just 20 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 21 | 22 | - name: Check for typos 23 | run: just ci-lint-typos 24 | -------------------------------------------------------------------------------- /.github/workflows/test-docker-build.yaml: -------------------------------------------------------------------------------- 1 | name: Build Docker 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | 15 | build_docker: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | with: 20 | fetch-depth: 0 21 | 22 | - name: Display envvars 23 | run: env 24 | 25 | - name: Install Just 26 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 27 | 28 | - name: Test Docker Build 29 | run: just docker-build 30 | -------------------------------------------------------------------------------- /.github/workflows/test-grid-ui.yaml: -------------------------------------------------------------------------------- 1 | name: Test Grid UI 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | 15 | test-grid-ui: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Display envvars 21 | run: env 22 | 23 | - name: Install Just 24 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 25 | 26 | - name: Grid UI Tests 27 | run: just ci-test-ui 28 | -------------------------------------------------------------------------------- /.github/workflows/unit-test-grid.yaml: -------------------------------------------------------------------------------- 1 | name: Unit Test Grid 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | 15 | unit_test_grid: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/checkout@v2 19 | 20 | - name: Display envvars 21 | run: env 22 | 23 | - name: Install Just 24 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 25 | 26 | - name: Unit Test Grid 27 | run: just ci-test 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Exclude IDE and Editor files 2 | /.idea/ 3 | *.sublime* 4 | *.vscode* 5 | 6 | # Rust 7 | Cargo.lock 8 | target/ 9 | 10 | contracts/*/bin/ 11 | 12 | contracts/track_and_trace/src/messages/ 13 | 14 | # Node 15 | **/node_modules 16 | **/yarn.lock 17 | **/.pnp 18 | **/.pnp.js 19 | **/package-lock.json 20 | **/npm-debug.log 21 | 22 | # testing 23 | **/coverage 24 | 25 | # Webpack 26 | **/build 27 | **/dist 28 | 29 | tests/sawtooth_sc_test/protobuf/ 30 | 31 | /server/config.json 32 | **/generated_protos.json 33 | **/compiled_protos.json 34 | 35 | /docs/build/ 36 | /docs/source/_autogen/ 37 | /docs/source/cli/output/ 38 | 39 | **/sapling-dev-server/circuits 40 | **/sapling-dev-server/product 41 | **/sapling-dev-server/profile 42 | **/sapling-dev-server/register-login.js 43 | 44 | # Generated man pages 45 | /cli/packaging/man/grid* 46 | 47 | # misc 48 | .DS_Store 49 | .env.local 50 | .env.development.local 51 | .env.test.local 52 | .env.production.local 53 | 54 | npm-debug.log* 55 | yarn-debug.log* 56 | yarn-error.log* 57 | -------------------------------------------------------------------------------- /.pep8: -------------------------------------------------------------------------------- 1 | [pep8] 2 | ignore=W503 3 | exclude=build,docs,ECDSARecoverModule.py,poet0_enclave_simulator.py,poet1_enclave_simulator.py,*_pb2.py 4 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @agunde406 @ameliabradley @cleckhardt @davececchi @dcmiddle @dnewh @dplumb94 @jsmitchell @peterschwarz @rberg2 @rbuysse @RyanLassigBanks @shannynalayna @vaporos 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Code of Conduct Guidelines 2 | ========================== 3 | 4 | Please review the Hyperledger [Code of 5 | Conduct](https://tsc.hyperledger.org/code-of-conduct.html) before participating 6 | and abide by these community standards. 7 | 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Hyperledger Grid 2 | 3 | Hyperledger Grid is Apache 2.0 licensed and accepts contributions via GitHub 4 | pull requests. 5 | 6 | Contributions from the community help improve the design and capabilities of 7 | Hyperledger Grid. These contributions are the best way to make a positive impact 8 | on the project. 9 | 10 | This repository contains the core components for Hyperledger Grid. We welcome 11 | contributors who can: 12 | 13 | * Report bugs or issues 14 | * Add features or enhancements 15 | * Create or expand tests 16 | * Improve documentation 17 | 18 | For more information, please see 19 | [Contributing to Grid](https://grid.hyperledger.org/community/contributing.html) 20 | on the Hyperledger Grid website. 21 | 22 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | 3 | members = [ 4 | "cli", 5 | "contracts/location", 6 | "contracts/pike", 7 | "contracts/product", 8 | "contracts/purchase_order", 9 | "contracts/schema", 10 | "contracts/track_and_trace", 11 | "daemon", 12 | "griddle", 13 | "sdk" 14 | ] 15 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Maintainers 2 | 3 | ### Active Maintainers 4 | | Name | GitHub | 5 | | --- | --- | 6 | | Amelia Bradley | ameliabradley | 7 | | Andi Gunderson | agunde406 | 8 | | Chris Eckhardt | cleckhardt | 9 | | Dan Middleton | dcmiddle | 10 | | Darian Plumb | dplumb94 | 11 | | Dave Cecchi | davececchi | 12 | | Davey Newhall | dnewh | 13 | | James Mitchell | jsmitchell | 14 | | Peter Schwarz | peterschwarz | 15 | | Richard Berg | rberg2 | 16 | | Ryan Banks | RyanLassigBanks | 17 | | Ryan Beck-Buysse | rbuysse | 18 | | Shannyn Telander | shannynalayna | 19 | | Shawn Amundson | vaporos | 20 | 21 | ### Retired Maintainers 22 | | Name | GitHub | 23 | | --- | --- | 24 | | Anne Chenette | chenette | 25 | | Boyd Johnson | boydjohnson | 26 | | Eloá Franca Verona | eloaverona | 27 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Hyperledger Security Policy 2 | 3 | ## Reporting a Security Bug 4 | 5 | If you think you have discovered a security issue in any of the Hyperledger 6 | projects, we'd love to hear from you. We will take all security bugs 7 | seriously and if confirmed upon investigation we will patch it within a 8 | reasonable amount of time and release a public security bulletin discussing 9 | the impact and credit the discoverer. 10 | 11 | There are two ways to report a security bug. The easiest is to email a 12 | description of the flaw and any related information (e.g. reproduction 13 | steps, version) to 14 | [security at hyperledger dot org](mailto:security@hyperledger.org). 15 | 16 | The other way is to file a confidential security bug in our 17 | [JIRA bug tracking system](https://jira.hyperledger.org). 18 | Be sure to set the “Security Level” to “Security issue”. 19 | 20 | The process by which the Hyperledger Security Team handles security bugs 21 | is documented further in our 22 | [Defect Response](https://wiki.hyperledger.org/display/HYP/Defect+Response) 23 | page on our [wiki](https://wiki.hyperledger.org). 24 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.4.1 2 | -------------------------------------------------------------------------------- /bin/whitelist: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z $1 || -z $2 ]] 4 | then 5 | echo "USAGE: $0 [user] [whitelist]" 6 | exit 1 7 | fi 8 | 9 | whitelist=$(cat $2 | grep user | sed 's#.*: \(.*$\)#\1#') 10 | for user in $whitelist 11 | do 12 | if [[ $user == $1 ]] 13 | then 14 | echo "SUCCESS: User '$1' whitelisted" 15 | exit 0 16 | fi 17 | done 18 | 19 | echo "FAILED: User '$1' not whitelisted." 20 | exit 1 21 | -------------------------------------------------------------------------------- /ci/build-contracts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2018-2022 Cargill Incorporated 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -e 17 | 18 | top_dir=$(cd $(dirname $(dirname $0)) && pwd) 19 | 20 | export VERSION=AUTO_STRICT 21 | export REPO_VERSION=$($top_dir/bin/get_version) 22 | 23 | echo "Building contracts with version $REPO_VERSION" 24 | 25 | docker-compose -f docker/compose/contracts.yaml up --build 26 | docker-compose -f docker/compose/contracts.yaml down 27 | 28 | zip -r -j grid-contracts.zip build/scar* 29 | -------------------------------------------------------------------------------- /ci/grid-dev-buildx: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2018-2022 Cargill Incorporated 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -e 17 | 18 | docker buildx build \ 19 | --platform linux/amd64,linux/arm64 \ 20 | -t ${NAMESPACE}grid-dev:v12 \ 21 | -f ci/grid-dev.dockerfile \ 22 | --push . 23 | -------------------------------------------------------------------------------- /ci/grid-dev.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ------------------------------------------------------------------------------ 15 | 16 | version: '3.7' 17 | 18 | services: 19 | grid-dev: 20 | image: hyperledger/grid-dev:v12 21 | build: 22 | context: .. 23 | dockerfile: ci/grid-dev.dockerfile 24 | -------------------------------------------------------------------------------- /ci/hadolint.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ignored: 16 | - DL3008 17 | - DL3018 18 | -------------------------------------------------------------------------------- /ci/publish-crates: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2021 Cargill Incorporated 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | top_dir=$(cd $(dirname $(dirname $0)) && pwd) 17 | 18 | export VERSION=AUTO_STRICT 19 | export REPO_VERSION=$($top_dir/bin/get_version) 20 | 21 | docker build -f ci/publish-grid-crates.dockerfile -t publish-grid-crates ci/ 22 | docker run \ 23 | --rm \ 24 | -v $(pwd):/project/grid \ 25 | -e REPO_VERSION=$REPO_VERSION \ 26 | -e CARGO_CRED=$CARGO_TOKEN \ 27 | publish-grid-crates 28 | -------------------------------------------------------------------------------- /cli/man/grid-admin-keygen.1.md: -------------------------------------------------------------------------------- 1 | % GRID-ADMIN-KEYGEN(1) Cargill, Incorporated | Grid 2 | 3 | 8 | 9 | NAME 10 | ==== 11 | 12 | **grid-admin-keygen** - Generates keys for gridd to use to sign transactions and batches. 13 | 14 | SYNOPSIS 15 | ======== 16 | 17 | **grid admin keygen** \[**FLAGS**\] \[**OPTIONS**\] 18 | 19 | FLAGS 20 | ===== 21 | 22 | `--force` 23 | : Overwrite files if they exist. Conflicts with `--skip`. 24 | 25 | `-h`, `--help` 26 | : Prints help information. 27 | 28 | `-q`, `--quiet` 29 | : Do not display output. 30 | 31 | `--skip` 32 | : Check if files exist; generate if missing. Conflicts with `--force`. 33 | 34 | `-V`, `--version` 35 | : Prints version information. 36 | 37 | `-v` 38 | : Log verbosely. 39 | 40 | OPTIONS 41 | ======= 42 | 43 | `-d`, `--directory` 44 | : Specify the directory for the key files; 45 | defaults to /etc/grid/keys. 46 | 47 | SEE ALSO 48 | ======== 49 | | `grid admin(1)` 50 | | 51 | | Grid documentation: https://grid.hyperledger.org/docs/0.3/ 52 | -------------------------------------------------------------------------------- /cli/man/grid-admin.1.md: -------------------------------------------------------------------------------- 1 | % GRID-ADMIN(1) Cargill, Incorporated | Grid 2 | 7 | 8 | NAME 9 | ==== 10 | 11 | **grid-admin** - Supports Grid Administrative functions. 12 | 13 | SYNOPSIS 14 | ======== 15 | 16 | **grid admin** \[**FLAGS**\] \[**OPTIONS**\] SUBCOMMAND 17 | 18 | DESCRIPTION 19 | =========== 20 | 21 | Administrative commands for grid daemon. 22 | 23 | FLAGS 24 | ===== 25 | 26 | `-h`, `--help` 27 | : Prints help information. 28 | 29 | `-q`, `--quiet` 30 | : Do not display output. 31 | 32 | `-V`, `--version` 33 | : Prints version information. 34 | 35 | `-v` 36 | : Log verbosely. 37 | 38 | SUBCOMMANDS 39 | =========== 40 | 41 | `keygen` 42 | : Generates keys for gridd to use to sign transactions and batches. 43 | 44 | `help` 45 | : Prints this message or the help of the given subcommand(s). 46 | 47 | 48 | SEE ALSO 49 | ======== 50 | | `grid admin keygen(1)` 51 | | 52 | | Grid documentation: https://grid.hyperledger.org/docs/0.3/ 53 | -------------------------------------------------------------------------------- /cli/man/grid-database-migrate.1.md: -------------------------------------------------------------------------------- 1 | % GRID-DATABASE-MIGRATE(1) Cargill, Incorporated | Grid 2 | 7 | 8 | NAME 9 | ==== 10 | 11 | **grid-database-migrate** - Performs database migrations. 12 | 13 | SYNOPSIS 14 | ======== 15 | 16 | **grid database migrate** \[**FLAGS**\] \[**OPTIONS**\] 17 | 18 | DESCRIPTION 19 | =========== 20 | 21 | This command performs any outstanding database migrations to the 22 | Grid daemon database. 23 | 24 | FLAGS 25 | ===== 26 | 27 | `-h`, `--help` 28 | : Prints help information. 29 | 30 | `-q`, `--quiet` 31 | : Do not display output. 32 | 33 | `-V`, `--version` 34 | : Prints version information. 35 | 36 | `-v` 37 | : Log verbosely. 38 | 39 | OPTIONS 40 | ======= 41 | 42 | `-C`, `--connect` 43 | : Specifies the URL for the database. 44 | 45 | SEE ALSO 46 | ======== 47 | | `grid database(1)` 48 | | 49 | | Grid documentation: https://grid.hyperledger.org/docs/0.3/ 50 | -------------------------------------------------------------------------------- /cli/man/grid-database.1.md: -------------------------------------------------------------------------------- 1 | % GRID-DATABASE(1) Cargill, Incorporated | Grid 2 | 7 | 8 | NAME 9 | ==== 10 | 11 | **grid-database** - Commands to manage the Grid daemon Database. 12 | 13 | SYNOPSIS 14 | ======== 15 | 16 | **grid database** \[**FLAGS**\] \[**OPTIONS**\] SUBCOMMAND 17 | 18 | DESCRIPTION 19 | =========== 20 | 21 | This command allows for the management of Grid daemon Database. 22 | 23 | FLAGS 24 | ===== 25 | 26 | `-h`, `--help` 27 | : Prints help information. 28 | 29 | `-q`, `--quiet` 30 | : Do not display output. 31 | 32 | `-V`, `--version` 33 | : Prints version information. 34 | 35 | `-v` 36 | : Log verbosely. 37 | 38 | SUBCOMMANDS 39 | =========== 40 | 41 | `migrate` 42 | : Migrates the Grid database to the latest version. 43 | 44 | `help` 45 | : Prints this message or the help of the given subcommand(s). 46 | 47 | SEE ALSO 48 | ======== 49 | | `grid database migrate(1)` 50 | | 51 | | Grid documentation: https://grid.hyperledger.org/docs/0.3/ 52 | -------------------------------------------------------------------------------- /cli/man/grid-role-list.1.md: -------------------------------------------------------------------------------- 1 | % GRID-ROLE-LIST(1) Cargill, Incorporated | Grid 2 | 7 | 8 | NAME 9 | ==== 10 | 11 | **grid-role-list** - List Grid Pike roles for a given organization. 12 | 13 | SYNOPSIS 14 | ======== 15 | 16 | **grid role list** \[**FLAGS**\] 17 | 18 | ARGS 19 | ==== 20 | 21 | `ORG_ID` 22 | : The organization identifier of which to list the roles for. 23 | 24 | FLAGS 25 | ===== 26 | 27 | `-h`, `--help` 28 | : Prints help information. 29 | 30 | `-q`, `--quiet` 31 | : Do not display output. 32 | 33 | `-V`, `--version` 34 | : Prints version information. 35 | 36 | `-v` 37 | : Log verbosely. 38 | 39 | ENVIRONMENT VARIABLES 40 | ===================== 41 | 42 | **`GRID_DAEMON_ENDPOINT`** 43 | : Specifies a default value for `--url`. 44 | 45 | **`GRID_SERVICE_ID`** 46 | : Specifies a default value for `--service-id`. 47 | 48 | SEE ALSO 49 | ======== 50 | | `grid agent(1)` 51 | | `grid organization(1)` 52 | | `grid role(1)` 53 | | `grid role create(1)` 54 | | `grid role delete(1)` 55 | | `grid role update(1)` 56 | | `grid role show(1)` 57 | | 58 | | Grid documentation: https://grid.hyperledger.org/docs/0.3/ 59 | -------------------------------------------------------------------------------- /cli/man/grid-role-show.1.md: -------------------------------------------------------------------------------- 1 | % GRID-ROLE-SHOW(1) Cargill, Incorporated | Grid 2 | 7 | 8 | NAME 9 | ==== 10 | 11 | **grid-role-show** - Show information about a Grid Pike role. 12 | 13 | SYNOPSIS 14 | ======== 15 | 16 | **grid role show** \[**FLAGS**\] \[**OPTIONS**\] 17 | 18 | ARGS 19 | ==== 20 | 21 | `ORG_ID` 22 | : The organization identifier to show the role for. 23 | 24 | `NAME` 25 | : The user-specified name of the role to show. 26 | 27 | FLAGS 28 | ===== 29 | 30 | `-h`, `--help` 31 | : Prints help information. 32 | 33 | `-q`, `--quiet` 34 | : Do not display output. 35 | 36 | `-V`, `--version` 37 | : Prints version information. 38 | 39 | `-v` 40 | : Log verbosely 41 | 42 | ENVIRONMENT VARIABLES 43 | ===================== 44 | 45 | **`GRID_DAEMON_ENDPOINT`** 46 | : Specifies a default value for `--url`. 47 | 48 | **`GRID_SERVICE_ID`** 49 | : Specifies a default value for `--service-id`. 50 | 51 | SEE ALSO 52 | ======== 53 | | `grid agent(1)` 54 | | `grid organization(1)` 55 | | `grid role(1)` 56 | | `grid role list(1)` 57 | | 58 | | Grid documentation: https://grid.hyperledger.org/docs/0.3/ 59 | -------------------------------------------------------------------------------- /cli/packaging/man/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where the generated man pages for the `grid` CLI will 2 | be located. 3 | -------------------------------------------------------------------------------- /cli/tests/locations/create_location.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ----------------------------------------------------------------------------- 15 | 16 | - namespace: GS1 17 | location_id: "762111177704" 18 | owner: cgl 19 | properties: 20 | locationName: Grandma's basement 21 | locationDescription: My grandma's basement 22 | locationType: 3 23 | addressLine1: "612 Worf ave" 24 | city: St. Paul 25 | stateOrRegion: MN 26 | postalCode: "55117" 27 | country: United States 28 | latLong: "46729553,-94685898" 29 | contactName: Lorraine 30 | contactEmail: lorraine@fake-email.bike 31 | contactPhone: 612-555-1234 32 | contactDate: 01/15/2020 33 | -------------------------------------------------------------------------------- /cli/tests/locations/update_location.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Cargill Incorporated # # Licensed under the Apache License, Version 2.0 (the "License"); 2 | # you may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # ----------------------------------------------------------------------------- 13 | 14 | - namespace: GS1 15 | location_id: "762111177704" 16 | properties: 17 | locationName: Grandma's basement 18 | locationDescription: My grandma's basement 19 | locationType: 3 20 | addressLine1: "612 Worf ave" 21 | city: St. Paul 22 | stateOrRegion: MN 23 | postalCode: "55117" 24 | country: United States 25 | latlong: "46729553,-94685898" 26 | contactName: Lorraine 27 | contactEmail: lorraine@fake-email.bike 28 | contactPhone: 612-555-1234 29 | contactDate: 01/15/2020 30 | -------------------------------------------------------------------------------- /cli/tests/products/create_product.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ----------------------------------------------------------------------------- 15 | 16 | - product_namespace: "GS1" 17 | product_id: "762111177704" 18 | owner: "762" 19 | properties: 20 | length: 8 21 | width: 11 22 | depth: 1 23 | -------------------------------------------------------------------------------- /cli/tests/products/test_product_schema.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ----------------------------------------------------------------------------- 15 | 16 | - name: gs1_product 17 | description: "Example product schema" 18 | owner: "762" 19 | properties: 20 | - name: "width" 21 | data_type: NUMBER 22 | number_exponent: 1 23 | required: true 24 | - name: "length" 25 | data_type: NUMBER 26 | number_exponent: 1 27 | required: true 28 | - name: "depth" 29 | data_type: NUMBER 30 | number_exponent: 1 31 | required: true 32 | -------------------------------------------------------------------------------- /cli/tests/products/update_product.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ----------------------------------------------------------------------------- 15 | 16 | - product_namespace: "GS1" 17 | product_id: "762111177704" 18 | properties: 19 | length: 10 20 | width: 10 21 | depth: 10 22 | -------------------------------------------------------------------------------- /contracts/location/location.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_location 16 | version: '2' 17 | wasm: /tmp/grid-location-tp.wasm 18 | inputs: 19 | - '621dee01' 20 | - '621dee04' 21 | - '621dee05' 22 | outputs: 23 | - '621dee04' 24 | -------------------------------------------------------------------------------- /contracts/location/packaging/scar/manifest.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_location 16 | version: '2' 17 | inputs: 18 | - '621dee01' 19 | - '621dee04' 20 | - '621dee05' 21 | outputs: 22 | - '621dee04' 23 | -------------------------------------------------------------------------------- /contracts/location/src/permissions.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub enum Permission { 16 | CanCreateLocation, 17 | CanUpdateLocation, 18 | CanDeleteLocation, 19 | } 20 | 21 | pub fn permission_to_perm_string(permission: Permission) -> String { 22 | match permission { 23 | Permission::CanCreateLocation => String::from("location::can-create-location"), 24 | Permission::CanUpdateLocation => String::from("location::can-update-location"), 25 | Permission::CanDeleteLocation => String::from("location::can-delete-location"), 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contracts/pike/packaging/scar/manifest.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_pike 16 | version: '2' 17 | inputs: 18 | - '621dee05' 19 | outputs: 20 | - '621dee05' 21 | -------------------------------------------------------------------------------- /contracts/pike/pike.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_pike 16 | version: '2' 17 | wasm: /tmp/grid-pike-tp.wasm 18 | inputs: 19 | - '621dee05' 20 | outputs: 21 | - '621dee05' 22 | -------------------------------------------------------------------------------- /contracts/product/packaging/scar/manifest.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 Target Brands, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_product 16 | version: '2' 17 | inputs: 18 | - '621dee01' 19 | - '621dee02' 20 | - '621dee05' 21 | outputs: 22 | - '621dee02' 23 | -------------------------------------------------------------------------------- /contracts/product/product.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 Target Brands, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_product 16 | version: '2' 17 | wasm: /tmp/grid-product-tp.wasm 18 | inputs: 19 | - '621dee01' 20 | - '621dee02' 21 | - '621dee05' 22 | outputs: 23 | - '621dee02' 24 | -------------------------------------------------------------------------------- /contracts/product/src/permissions.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub enum Permission { 16 | CanCreateProduct, 17 | CanUpdateProduct, 18 | CanDeleteProduct, 19 | } 20 | 21 | pub fn permission_to_perm_string(permission: Permission) -> String { 22 | match permission { 23 | Permission::CanCreateProduct => String::from("product::can-create-product"), 24 | Permission::CanUpdateProduct => String::from("product::can-update-product"), 25 | Permission::CanDeleteProduct => String::from("product::can-delete-product"), 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contracts/purchase_order/packaging/scar/manifest.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_purchase_order 16 | version: '2' 17 | inputs: 18 | - '621dee05' 19 | - '621dee06' 20 | outputs: 21 | - '621dee06' 22 | -------------------------------------------------------------------------------- /contracts/purchase_order/purchase_order.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_purchase_order 16 | version: '2' 17 | wasm: /tmp/grid-purchase-order-tp.wasm 18 | inputs: 19 | - '621dee05' 20 | - '621dee06' 21 | outputs: 22 | - '621dee06' 23 | -------------------------------------------------------------------------------- /contracts/schema/packaging/scar/manifest.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_schema 16 | version: '2' 17 | inputs: 18 | - '621dee01' 19 | - '621dee05' 20 | outputs: 21 | - '621dee01' 22 | -------------------------------------------------------------------------------- /contracts/schema/schema.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_schema 16 | version: '2' 17 | wasm: /tmp/grid-schema-tp.wasm 18 | inputs: 19 | - '621dee01' 20 | - '621dee05' 21 | outputs: 22 | - '621dee01' 23 | -------------------------------------------------------------------------------- /contracts/schema/src/permissions.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub enum Permission { 16 | CanCreateSchema, 17 | CanUpdateSchema, 18 | CanDeleteSchema, 19 | } 20 | 21 | pub fn permission_to_perm_string(permission: Permission) -> String { 22 | match permission { 23 | Permission::CanCreateSchema => String::from("schema::can-create-schema"), 24 | Permission::CanUpdateSchema => String::from("schema::can-update-schema"), 25 | Permission::CanDeleteSchema => String::from("schema::can-delete-schema"), 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contracts/track_and_trace/packaging/scar/manifest.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_track_and_trace 16 | version: '2' 17 | inputs: 18 | - 'a43b46' 19 | - '621dee01' 20 | - '621dee05' 21 | outputs: 22 | - 'a43b46' 23 | -------------------------------------------------------------------------------- /contracts/track_and_trace/track_and_trace.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | name: grid_track_and_trace 16 | version: '2' 17 | wasm: /tmp/grid-track-and-trace-tp.wasm 18 | inputs: 19 | - 'a43b46' 20 | - '621dee01' 21 | - '621dee05' 22 | outputs: 23 | - 'a43b46' 24 | -------------------------------------------------------------------------------- /daemon/diesel.toml: -------------------------------------------------------------------------------- 1 | # For documentation on how to configure this file, 2 | # see diesel.rs/guides/configuring-diesel-cli 3 | 4 | [print_schema] 5 | file = "src/database/schema.rs" 6 | 7 | patch_file = "src/schema.patch" 8 | -------------------------------------------------------------------------------- /daemon/src/sawtooth/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * ----------------------------------------------------------------------------- 16 | */ 17 | 18 | pub mod connection; 19 | mod event; 20 | mod run; 21 | 22 | pub use run::run_sawtooth; 23 | -------------------------------------------------------------------------------- /daemon/src/schema.patch: -------------------------------------------------------------------------------- 1 | --- a/daemon/src/database/schema.rs 2 | +++ b/daemon/src/database/schema.rs 3 | @@ -0,0 +1,17 @@ 4 | +/* 5 | + * Copyright 2019 Cargill Incorporated 6 | + * 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); 8 | + * you may not use this file except in compliance with the License. 9 | + * You may obtain a copy of the License at 10 | + * 11 | + * http://www.apache.org/licenses/LICENSE-2.0 12 | + * 13 | + * Unless required by applicable law or agreed to in writing, software 14 | + * distributed under the License is distributed on an "AS IS" BASIS, 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | + * See the License for the specific language governing permissions and 17 | + * limitations under the License. 18 | + * ----------------------------------------------------------------------------- 19 | + */ 20 | + 21 | -------------------------------------------------------------------------------- /daemon/src/splinter/event/error.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * ----------------------------------------------------------------------------- 16 | */ 17 | 18 | #[derive(Debug)] 19 | pub struct ScabbardEventConnectionError(pub String); 20 | 21 | impl std::error::Error for ScabbardEventConnectionError {} 22 | 23 | impl std::fmt::Display for ScabbardEventConnectionError { 24 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 25 | write!(f, "unable to create connection to {}", self.0) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /daemon/src/splinter/mod.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * ----------------------------------------------------------------------------- 16 | */ 17 | 18 | pub mod app_auth_handler; 19 | pub mod event; 20 | mod run; 21 | 22 | pub use run::run_splinter; 23 | -------------------------------------------------------------------------------- /docker/compose/.env: -------------------------------------------------------------------------------- 1 | ISOLATION_ID=latest 2 | DISTRO=jammy 3 | REPO_VERSION=0.4.1-dev 4 | -------------------------------------------------------------------------------- /docker/compose/grid-tests.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ------------------------------------------------------------------------------ 15 | 16 | version: "3.6" 17 | 18 | services: 19 | grid_tests: 20 | build: 21 | context: ../.. 22 | dockerfile: docker/tests.dockerfile 23 | args: 24 | - http_proxy 25 | - https_proxy 26 | - no_proxy 27 | image: grid:tests 28 | volumes: 29 | - ../../cache:/var/cache/grid/ 30 | environment: 31 | - TEST_ARGS=-- --test-threads=1 32 | - GRID_TEST_CACHE_DIR=/var/cache/grid 33 | command: bash -c "just test" 34 | -------------------------------------------------------------------------------- /docker/compose/run-lint.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | version: "3.7" 16 | 17 | services: 18 | 19 | lint-grid: 20 | build: 21 | context: ../ 22 | dockerfile: ./lint.dockerfile 23 | image: lint-grid:${ISOLATION_ID} 24 | volumes: 25 | - ../../:/project/grid 26 | command: just lint 27 | -------------------------------------------------------------------------------- /docker/lint.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | FROM hyperledger/grid-dev:v12 as GRID-LINTER 17 | 18 | ENV PATH=$PATH:/root/.cargo/bin 19 | 20 | # Install rustfmt and clippy 21 | RUN rustup component add rustfmt \ 22 | && rustup component add clippy 23 | 24 | WORKDIR /project/grid 25 | -------------------------------------------------------------------------------- /docker/typos.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine:3 16 | 17 | RUN apk add --no-cache curl 18 | 19 | WORKDIR /tmp 20 | 21 | RUN curl -O -L https://github.com/crate-ci/typos/releases/download/v1.10.2/typos-v1.10.2-x86_64-unknown-linux-musl.tar.gz \ 22 | && tar xzvf typos-v1.10.2-x86_64-unknown-linux-musl.tar.gz 23 | 24 | ENV PATH=$PATH:/tmp 25 | 26 | WORKDIR /project 27 | -------------------------------------------------------------------------------- /examples/griddle/.env: -------------------------------------------------------------------------------- 1 | ISOLATION_ID=latest 2 | DISTRO=jammy 3 | REPO_VERSION=0.4.1-dev 4 | -------------------------------------------------------------------------------- /examples/sawtooth/.env: -------------------------------------------------------------------------------- 1 | ISOLATION_ID=latest 2 | DISTRO=jammy 3 | REPO_VERSION=0.4.1-dev 4 | -------------------------------------------------------------------------------- /examples/sawtooth/README.md: -------------------------------------------------------------------------------- 1 | # Running Hyperledger Grid on Sawtooth 2 | 3 | Documentation on how to set up a Grid-on-Sawtooth environment that runs in a 4 | set of Docker containers can be found on the [Hyperledger Grid website](https://grid.hyperledger.org/docs/0.1/grid_on_sawtooth.html). 5 | 6 | ## For More Information 7 | - Hyperledger Grid documentation: https://grid.hyperledger.org/docs/ 8 | - Sawtooth: https://sawtooth.hyperledger.org/ 9 | - Sawtooth Sabre: https://github.com/hyperledger/sawtooth-sabre 10 | - Pike smart contract: https://grid.hyperledger.org/docs/0.1/pike_smart_contract_specification.html 11 | - Schema smart contract: https://grid.hyperledger.org/docs/0.1/schema_smart_contract_specification.html 12 | - Product RFC: https://github.com/hyperledger/grid-rfcs/blob/master/text/0005-product.md 13 | -------------------------------------------------------------------------------- /examples/splinter/.env: -------------------------------------------------------------------------------- 1 | ISOLATION_ID=latest 2 | DISTRO=jammy 3 | REPO_VERSION=0.4.1-dev 4 | -------------------------------------------------------------------------------- /examples/splinter/README.md: -------------------------------------------------------------------------------- 1 | # Running Hyperledger Grid on Splinter 2 | 3 | Documentation on how to set up a Grid-on-Splinter environment that runs in a 4 | set of Docker containers can be found on the [Hyperledger Grid website](https://grid.hyperledger.org/docs/0.1/grid_on_splinter.html). 5 | 6 | ## For More Information 7 | - Hyperledger Grid documentation: https://grid.hyperledger.org/docs/ 8 | - Splinter: https://www.splinter.dev/ 9 | - Sawtooth Sabre: https://github.com/hyperledger/sawtooth-sabre 10 | - Pike smart contract: https://grid.hyperledger.org/docs/0.1/pike_smart_contract_specification.html 11 | - Schema smart contract: https://grid.hyperledger.org/docs/0.1/schema_smart_contract_specification.html 12 | - Product RFC: https://github.com/hyperledger/grid-rfcs/blob/master/text/0005-product.md 13 | -------------------------------------------------------------------------------- /griddle/src/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::error; 16 | use std::fmt; 17 | 18 | #[derive(Debug)] 19 | pub struct Error { 20 | message: String, 21 | } 22 | 23 | impl Error { 24 | pub fn from_message(message: &str) -> Self { 25 | Self { 26 | message: message.to_string(), 27 | } 28 | } 29 | } 30 | 31 | impl error::Error for Error { 32 | fn source(&self) -> Option<&(dyn error::Error + 'static)> { 33 | None 34 | } 35 | } 36 | 37 | impl fmt::Display for Error { 38 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 39 | write!(f, "{}", self.message) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /griddle/src/rest_api/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "rest-api-actix-web-4")] 16 | pub mod actix_web_4; 17 | mod error; 18 | 19 | pub use error::GriddleRestApiServerError; 20 | 21 | #[derive(Clone, Debug, PartialEq, Eq)] 22 | /// Indicates the service scope intended for incoming requests and is used by the REST API to 23 | /// validate requests. 24 | pub enum Scope { 25 | Global, 26 | Service, 27 | } 28 | -------------------------------------------------------------------------------- /integration/.env: -------------------------------------------------------------------------------- 1 | ISOLATION_ID=latest 2 | DISTRO=jammy 3 | REPO_VERSION=0.4.1-dev 4 | -------------------------------------------------------------------------------- /load-balancer/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM nginx:mainline 16 | COPY load-balancer/nginx.conf /etc/nginx/nginx.conf 17 | -------------------------------------------------------------------------------- /sdk/src/batch_submission/submission/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod submitter; 16 | pub mod submitter_observer; 17 | pub mod url_resolver; 18 | -------------------------------------------------------------------------------- /sdk/src/batch_submission/submission/submitter/batch_submitter/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod async_batch_submitter; 16 | 17 | pub use async_batch_submitter::{ 18 | BatchRunnableSubmitter, BatchRunningSubmitter, BatchSubmitterBuilder, 19 | }; 20 | -------------------------------------------------------------------------------- /sdk/src/batch_submission/submission/submitter_observer/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::scope_id::ScopeId; 16 | 17 | /// An interface for interpreting and recording updates from the submitter 18 | pub trait SubmitterObserver: Sync + Send { 19 | type Id: ScopeId; 20 | /// Notify the observer of an update. The interpretation and recording 21 | /// of the update is determined by the observer's implementation. 22 | fn notify( 23 | &self, 24 | batch_header: String, 25 | scope_id: Self::Id, 26 | status: Option, 27 | message: Option, 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /sdk/src/batch_submission/submission/url_resolver/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod basic_url_resolver; 16 | 17 | use crate::scope_id::ScopeId; 18 | 19 | /// An interface for generating the url to which a batch should be sent. 20 | pub trait UrlResolver: std::fmt::Debug + Sync + Send { 21 | type Id: ScopeId; 22 | /// Generates an address (i.e. URL) to which the batch will be sent. 23 | fn url(&self, scope_id: &Self::Id) -> String; 24 | } 25 | -------------------------------------------------------------------------------- /sdk/src/batch_tracking/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod store; 16 | -------------------------------------------------------------------------------- /sdk/src/batches/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod store; 16 | -------------------------------------------------------------------------------- /sdk/src/batches/store/diesel/operations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod add_batch; 16 | pub(super) mod change_batch_to_submitted; 17 | pub(super) mod get_batch; 18 | pub(super) mod get_unclaimed_batches; 19 | pub(super) mod list_batches; 20 | pub(super) mod relinquish_claim; 21 | pub(super) mod update_submission_error_info; 22 | 23 | pub(super) struct BatchStoreOperations<'a, C> { 24 | conn: &'a C, 25 | } 26 | 27 | impl<'a, C> BatchStoreOperations<'a, C> 28 | where 29 | C: diesel::Connection, 30 | { 31 | pub fn new(conn: &'a C) -> Self { 32 | BatchStoreOperations { conn } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /sdk/src/commits/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod store; 16 | 17 | pub const MAX_COMMIT_NUM: i64 = i64::MAX; 18 | 19 | #[cfg(feature = "diesel")] 20 | pub use store::diesel::DieselCommitStore; 21 | pub use store::CommitStore; 22 | -------------------------------------------------------------------------------- /sdk/src/commits/store/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::commits::store::diesel::schema::*; 16 | 17 | #[derive(Insertable, PartialEq, Eq, Queryable)] 18 | #[table_name = "commits"] 19 | pub struct NewCommitModel { 20 | pub commit_id: String, 21 | pub commit_num: i64, 22 | pub service_id: Option, 23 | } 24 | 25 | #[derive(Queryable, PartialEq, Eq, Identifiable, Debug)] 26 | #[table_name = "commits"] 27 | pub struct CommitModel { 28 | pub id: i64, 29 | pub commit_id: String, 30 | pub commit_num: i64, 31 | pub service_id: Option, 32 | } 33 | -------------------------------------------------------------------------------- /sdk/src/commits/store/diesel/operations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod add_commit; 16 | pub(super) mod create_db_commit_from_commit_event; 17 | pub(super) mod get_commit_by_commit_num; 18 | pub(super) mod get_current_commit_id; 19 | pub(super) mod get_current_service_commits; 20 | pub(super) mod get_next_commit_num; 21 | pub(super) mod resolve_fork; 22 | 23 | pub(super) struct CommitStoreOperations<'a, C> { 24 | conn: &'a C, 25 | } 26 | 27 | impl<'a, C> CommitStoreOperations<'a, C> 28 | where 29 | C: diesel::Connection, 30 | { 31 | pub fn new(conn: &'a C) -> Self { 32 | CommitStoreOperations { conn } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /sdk/src/commits/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | commits (id) { 17 | id -> Int8, 18 | commit_id -> Text, 19 | commit_num -> Int8, 20 | service_id -> Nullable, 21 | } 22 | } 23 | 24 | table! { 25 | chain_record (id) { 26 | id -> Int8, 27 | start_commit_num -> Int8, 28 | end_commit_num -> Int8, 29 | service_id -> Nullable, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sdk/src/location/addressing.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub const GRID_NAMESPACE: &str = "621dee"; 16 | pub const LOCATION_PREFIX: &str = "04"; 17 | pub const GRID_LOCATION_NAMESPACE: &str = "621dee04"; 18 | 19 | pub fn compute_gs1_location_address(gln: &str) -> String { 20 | //621ddee (grid namespace) + 04 (location namespace) + 01 (gs1 namespace) 21 | String::from(GRID_NAMESPACE) 22 | + LOCATION_PREFIX 23 | + "01000000000000000000000000000000000000000000000" 24 | + gln 25 | + "00" 26 | } 27 | -------------------------------------------------------------------------------- /sdk/src/location/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod addressing; 16 | pub mod store; 17 | -------------------------------------------------------------------------------- /sdk/src/location/store/diesel/operations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod add_location; 16 | pub(super) mod delete_location; 17 | pub(super) mod get_location; 18 | pub(super) mod list_locations; 19 | 20 | pub(super) struct LocationStoreOperations<'a, C> { 21 | conn: &'a C, 22 | } 23 | 24 | impl<'a, C> LocationStoreOperations<'a, C> 25 | where 26 | C: diesel::Connection, 27 | { 28 | pub fn new(conn: &'a C) -> Self { 29 | LocationStoreOperations { conn } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "postgres")] 16 | pub mod postgres; 17 | #[cfg(feature = "sqlite")] 18 | pub mod sqlite; 19 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/00000000000000_diesel_initial_setup/down.sql: -------------------------------------------------------------------------------- 1 | -- This file was automatically created by Diesel to setup helper functions 2 | -- and other internal bookkeeping. This file is safe to edit, any future 3 | -- changes will be added to existing projects as new migrations. 4 | 5 | DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass); 6 | DROP FUNCTION IF EXISTS diesel_set_updated_at(); 7 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/2021-02-02-223041_batch_table/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2019 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE batches; 17 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/2021-02-02-223041_batch_table/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2019 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE batches ( 17 | id TEXT PRIMARY KEY, 18 | data TEXT NOT NULL, 19 | status TEXT NOT NULL 20 | ); 21 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/2021-03-24-130200_purchase_order_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE purchase_order; 17 | DROP TABLE purchase_order_version; 18 | DROP TABLE purchase_order_version_revision; 19 | DROP TABLE purchase_order_alternate_id; 20 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/2021-03-30-164015_update_batch_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE transaction_receipts; 17 | DROP TABLE transactions; 18 | DROP TABLE batches; 19 | 20 | CREATE TABLE batches ( 21 | id TEXT PRIMARY KEY, 22 | data TEXT NOT NULL, 23 | status TEXT NOT NULL 24 | ); 25 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/2021-04-23-151946_add_timestamp/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE pike_agent 17 | DROP COLUMN last_updated; 18 | 19 | ALTER TABLE pike_organization 20 | DROP COLUMN last_updated; 21 | 22 | ALTER TABLE pike_role 23 | DROP COLUMN last_updated; 24 | 25 | ALTER TABLE grid_schema 26 | DROP COLUMN last_updated; 27 | 28 | ALTER TABLE product 29 | DROP COLUMN last_updated; 30 | 31 | ALTER TABLE location 32 | DROP COLUMN last_updated; 33 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/2021-07-22-161800_drop_unused_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/postgres/migrations/2021-07-22-161800_drop_unused_tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE grid_circuit; 17 | DROP TABLE grid_circuit_proposal; 18 | DROP TABLE grid_circuit_member; 19 | DROP TABLE grid_circuit_proposal_vote_record; 20 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/sqlite/migrations/2021-03-24-130200_purchase_order_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE purchase_order; 17 | DROP TABLE purchase_order_version; 18 | DROP TABLE purchase_order_version_revision; 19 | DROP TABLE purchase_order_alternate_id; 20 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/sqlite/migrations/2021-03-30-164015_update_batch_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE transaction_receipts; 17 | DROP TABLE transactions; 18 | DROP TABLE batches; 19 | 20 | CREATE TABLE batches ( 21 | id TEXT PRIMARY KEY, 22 | data TEXT NOT NULL, 23 | status TEXT NOT NULL 24 | ); 25 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/sqlite/migrations/2021-07-22-161800_drop_unused_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | -------------------------------------------------------------------------------- /sdk/src/migrations/diesel/sqlite/migrations/2021-07-22-161800_drop_unused_tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2021 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE grid_circuit; 17 | DROP TABLE grid_circuit_proposal; 18 | DROP TABLE grid_circuit_member; 19 | DROP TABLE grid_circuit_proposal_vote_record; 20 | -------------------------------------------------------------------------------- /sdk/src/paging.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Clone, Debug, Serialize, PartialEq, Eq)] 16 | pub struct Paging { 17 | pub offset: i64, 18 | pub limit: i64, 19 | pub total: i64, 20 | } 21 | 22 | impl Paging { 23 | pub fn new(offset: i64, limit: i64, total: i64) -> Self { 24 | Paging { 25 | offset, 26 | limit, 27 | total, 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sdk/src/pike/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod addressing; 16 | pub mod permissions; 17 | pub mod store; 18 | -------------------------------------------------------------------------------- /sdk/src/product/addressing.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub const GRID_NAMESPACE: &str = "621dee"; 16 | pub const PRODUCT_PREFIX: &str = "02"; 17 | pub const GRID_PRODUCT_NAMESPACE: &str = "621dee02"; 18 | 19 | /// Computes the address of a GS1 product based on its GTIN 20 | pub fn compute_gs1_product_address(gtin: &str) -> String { 21 | // 621ddee (grid namespace) + 02 (product namespace) + 01 (gs1 namespace) 22 | String::from(GRID_NAMESPACE) 23 | + PRODUCT_PREFIX 24 | + "01" 25 | + "00000000000000000000000000000000000000000000" 26 | + &format!("{:0>14}", gtin) 27 | + "00" 28 | } 29 | -------------------------------------------------------------------------------- /sdk/src/product/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod addressing; 16 | pub mod store; 17 | 18 | pub const MAX_COMMIT_NUM: i64 = i64::MAX; 19 | 20 | #[cfg(feature = "product-gdsn")] 21 | pub mod gdsn; 22 | -------------------------------------------------------------------------------- /sdk/src/product/store/diesel/operations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod add_product; 16 | pub(super) mod delete_product; 17 | pub(super) mod get_product; 18 | pub(super) mod list_products; 19 | pub(super) mod update_product; 20 | 21 | pub(super) struct ProductStoreOperations<'a, C> { 22 | conn: &'a C, 23 | } 24 | 25 | impl<'a, C> ProductStoreOperations<'a, C> 26 | where 27 | C: diesel::Connection, 28 | { 29 | pub fn new(conn: &'a C) -> Self { 30 | ProductStoreOperations { conn } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /sdk/src/protocol/location/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Protocol structs for the Location smart contract. 16 | //! 17 | //! These structs are used to represent Location transaction payloads and state. 18 | 19 | use super::errors; 20 | 21 | pub mod payload; 22 | pub mod state; 23 | -------------------------------------------------------------------------------- /sdk/src/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod errors; 16 | pub mod location; 17 | pub mod pike; 18 | pub mod product; 19 | #[cfg(feature = "purchase-order")] 20 | pub mod purchase_order; 21 | pub mod schema; 22 | pub mod track_and_trace; 23 | -------------------------------------------------------------------------------- /sdk/src/protocol/pike/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Protocol structs for the Pike smart contract. 16 | //! 17 | //! These structs are used to represent Pike transaction payloads and state. 18 | 19 | pub mod payload; 20 | pub mod state; 21 | -------------------------------------------------------------------------------- /sdk/src/protocol/product/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 Target Brands, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Protocol structs for the Product smart contract. 16 | //! 17 | //! These structs are used to represent Product transaction payloads and state. 18 | 19 | use super::errors; 20 | 21 | pub mod payload; 22 | pub mod state; 23 | -------------------------------------------------------------------------------- /sdk/src/protocol/purchase_order/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Protocol structs for the Purchase Order smart contract. 16 | //! 17 | //! These structs are used to represent Purchase Order transaction payloads and state. 18 | 19 | pub mod payload; 20 | pub mod state; 21 | -------------------------------------------------------------------------------- /sdk/src/protocol/schema/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Protocol structs for the Schema smart contract. 16 | //! 17 | //! These structs are used to represent Schema transaction payloads and state. 18 | 19 | pub mod payload; 20 | pub mod state; 21 | -------------------------------------------------------------------------------- /sdk/src/protocol/track_and_trace/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Protocol structs for the Track and Trace smart contract. 16 | //! 17 | //! These structs are used to represent Track and Trace transaction payloads and state. 18 | 19 | use super::errors; 20 | 21 | pub mod payload; 22 | pub mod state; 23 | -------------------------------------------------------------------------------- /sdk/src/proxy/client/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "proxy-client-reqwest")] 16 | pub mod reqwest; 17 | 18 | use crate::proxy::{request::ProxyRequestBuilder, response::ProxyResponse}; 19 | 20 | pub trait ProxyClient: Send { 21 | fn proxy(&self, req_builder: ProxyRequestBuilder) -> ProxyResponse; 22 | 23 | fn cloned_box(&self) -> Box; 24 | } 25 | 26 | impl Clone for Box { 27 | fn clone(&self) -> Box { 28 | self.cloned_box() 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /sdk/src/proxy/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Traits and implementations useful for proxying requests to a REST API. 16 | 17 | #[cfg(feature = "proxy-client")] 18 | mod client; 19 | #[cfg(feature = "proxy-client-reqwest")] 20 | pub use client::reqwest::ReqwestProxyClient; 21 | #[cfg(feature = "proxy-client")] 22 | pub use client::ProxyClient; 23 | pub mod error; 24 | pub mod request; 25 | pub mod response; 26 | -------------------------------------------------------------------------------- /sdk/src/purchase_order/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod addressing; 16 | pub mod store; 17 | -------------------------------------------------------------------------------- /sdk/src/rest_api/actix_web_4/backend_state.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::sync::Arc; 16 | 17 | use crate::backend::BackendClient; 18 | 19 | #[derive(Clone)] 20 | pub struct BackendState { 21 | pub client: Arc, 22 | } 23 | 24 | impl BackendState { 25 | pub fn new(client: Arc) -> Self { 26 | Self { client } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /sdk/src/rest_api/actix_web_4/key_state.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Clone)] 16 | pub struct KeyState { 17 | pub key_file_name: String, 18 | } 19 | 20 | impl KeyState { 21 | pub fn new(key_file_name: &str) -> Self { 22 | Self { 23 | key_file_name: key_file_name.to_string(), 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sdk/src/rest_api/actix_web_4/paging.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Debug, Serialize, Deserialize)] 16 | pub struct QueryPaging { 17 | pub offset: Option, 18 | pub limit: Option, 19 | } 20 | 21 | impl QueryPaging { 22 | pub fn offset(&self) -> u64 { 23 | self.offset.unwrap_or(0) 24 | } 25 | 26 | pub fn limit(&self) -> u16 { 27 | self.limit 28 | .map(|l| if l > 1024 { 1024 } else { l }) 29 | .unwrap_or(10) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /sdk/src/rest_api/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "rest-api-actix-web-4")] 16 | pub mod actix_web_4; 17 | #[cfg(feature = "rest-api-resources")] 18 | pub mod resources; 19 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/agents/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/agents/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod payloads; 17 | 18 | pub use handler::{get_agent, list_agents}; 19 | pub use payloads::{AgentListSlice, AgentSlice}; 20 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/batches/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/batches/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod handler; 16 | pub mod payloads; 17 | 18 | pub use handler::{get_batch_statuses, submit_batches}; 19 | pub use payloads::{BatchStatus, BatchStatusLink, BatchStatusResponse, InvalidTransaction}; 20 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/locations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/locations/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod handler; 16 | pub mod payloads; 17 | 18 | pub use handler::{get_location, list_locations}; 19 | pub use payloads::{LatLongSlice, LocationListSlice, LocationPropertyValueSlice, LocationSlice}; 20 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/organizations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/organizations/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod payloads; 17 | 18 | pub use handler::{get_organization, list_organizations}; 19 | pub use payloads::{ 20 | AlternateIdSlice, OrganizationListSlice, OrganizationMetadataSlice, OrganizationSlice, 21 | }; 22 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/paging/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/products/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/products/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod payloads; 17 | 18 | pub use handler::{get_product, list_products}; 19 | pub use payloads::{LatLongSlice, ProductListSlice, ProductPropertyValueSlice, ProductSlice}; 20 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/purchase_order/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/purchase_order/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod payloads; 17 | 18 | pub use handler::{ 19 | get_latest_revision_id, get_purchase_order, get_purchase_order_revision, 20 | get_purchase_order_version, list_purchase_order_revisions, list_purchase_order_versions, 21 | list_purchase_orders, 22 | }; 23 | pub use payloads::{ 24 | PurchaseOrderListSlice, PurchaseOrderRevisionListSlice, PurchaseOrderRevisionSlice, 25 | PurchaseOrderSlice, PurchaseOrderVersionListSlice, PurchaseOrderVersionSlice, 26 | }; 27 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/roles/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/roles/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod payloads; 17 | 18 | pub use handler::{get_role, list_roles_for_organization}; 19 | pub use payloads::{RoleListSlice, RoleSlice}; 20 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/schemas/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/schemas/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod payloads; 17 | 18 | pub use handler::{get_schema, list_schemas}; 19 | pub use payloads::{PropertyDefinitionSlice, SchemaListSlice, SchemaSlice}; 20 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/submit/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | #[cfg(feature = "rest-api-resources-batch-tracking")] 17 | #[allow(dead_code)] 18 | pub mod v2; 19 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/submit/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | mod payloads; 17 | 18 | pub use handler::submit_batches; 19 | pub use payloads::*; 20 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/submit/v2/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod error; 16 | #[cfg(feature = "rest-api-batch-submission-handler")] 17 | pub mod handler; 18 | pub mod payloads; 19 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/track_and_trace/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | -------------------------------------------------------------------------------- /sdk/src/rest_api/resources/track_and_trace/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod handler; 16 | pub mod payloads; 17 | 18 | pub use handler::{get_record, get_record_property, list_records}; 19 | pub use payloads::{ 20 | AssociatedAgentSlice, LatLong, PropertySlice, PropertyValueSlice, ProposalSlice, 21 | RecordListSlice, RecordSlice, ReporterSlice, StructPropertyValue, Value, 22 | }; 23 | -------------------------------------------------------------------------------- /sdk/src/schema/addressing.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crypto::digest::Digest; 16 | use crypto::sha2::Sha512; 17 | 18 | pub const GRID_NAMESPACE: &str = "621dee"; 19 | pub const SCHEMA_PREFIX: &str = "01"; 20 | pub const GRID_SCHEMA_NAMESPACE: &str = "621dee01"; 21 | 22 | /// Computes the address a Grid Schema is stored at based on its name 23 | pub fn compute_schema_address(name: &str) -> String { 24 | let mut sha = Sha512::new(); 25 | sha.input(name.as_bytes()); 26 | // (Grid namespace) + (schema namespace) + hash 27 | let hash_str = String::from(GRID_NAMESPACE) + SCHEMA_PREFIX + &sha.result_str(); 28 | hash_str[..70].to_string() 29 | } 30 | -------------------------------------------------------------------------------- /sdk/src/schema/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod addressing; 16 | pub mod store; 17 | 18 | pub const MAX_COMMIT_NUM: i64 = i64::MAX; 19 | -------------------------------------------------------------------------------- /sdk/src/schema/store/diesel/operations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod add_schema; 16 | pub(super) mod get_property_definition_by_name; 17 | pub(super) mod get_schema; 18 | pub(super) mod list_property_definitions; 19 | pub(super) mod list_property_definitions_with_schema_name; 20 | pub(super) mod list_schemas; 21 | 22 | pub(super) struct SchemaStoreOperations<'a, C> { 23 | conn: &'a C, 24 | } 25 | 26 | impl<'a, C> SchemaStoreOperations<'a, C> 27 | where 28 | C: diesel::Connection, 29 | { 30 | pub fn new(conn: &'a C) -> Self { 31 | SchemaStoreOperations { conn } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sdk/src/scope_id/service/id/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Definitions of structs which represent circuit and service identifiers. 16 | 17 | mod circuit; 18 | mod qualified; 19 | mod service; 20 | 21 | pub use circuit::CircuitId; 22 | pub use qualified::FullyQualifiedServiceId; 23 | pub use service::ServiceId; 24 | -------------------------------------------------------------------------------- /sdk/src/scope_id/service/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod id; 16 | 17 | pub use id::{CircuitId, FullyQualifiedServiceId, ServiceId}; 18 | -------------------------------------------------------------------------------- /sdk/src/threading/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module will contain components that will be used to support different threading models 16 | pub mod lifecycle; 17 | -------------------------------------------------------------------------------- /sdk/src/track_and_trace/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod addressing; 16 | pub mod store; 17 | -------------------------------------------------------------------------------- /ui/.dockerignore: -------------------------------------------------------------------------------- 1 | # Node 2 | **/node_modules 3 | **/package-lock.json 4 | 5 | # Webpack 6 | **/build 7 | **/dist 8 | grid-ui/src/setupProxy.js 9 | 10 | # Saplings 11 | sapling-dev-server/circuits 12 | sapling-dev-server/product 13 | sapling-dev-server/profile 14 | sapling-dev-server/register-login.js 15 | -------------------------------------------------------------------------------- /ui/grid-ui/.dockerignore: -------------------------------------------------------------------------------- 1 | # Node 2 | **/node_modules 3 | **/yarn.lock 4 | **/package-lock.json 5 | **/npm-debug.log 6 | 7 | # Build artifacts 8 | **/build 9 | **/dist 10 | 11 | # Sapling artifacts 12 | sapling-dev-server/product 13 | sapling-dev-server/register-login.js 14 | -------------------------------------------------------------------------------- /ui/grid-ui/.eslintignore: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | build/* 16 | src/setupProxy.js 17 | -------------------------------------------------------------------------------- /ui/grid-ui/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "jest": true, 5 | "browser": true 6 | }, 7 | "parserOptions": { 8 | "ecmaVersion": 2020 9 | }, 10 | "extends": ["airbnb", "plugin:prettier/recommended"], 11 | "rules": { 12 | "react/jsx-filename-extension": 0, 13 | "react/prefer-stateless-function": 0, 14 | "import/prefer-default-export": 0 15 | }, 16 | "settings": { 17 | "import/resolver": { 18 | "node": { 19 | "paths": ["src"] 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ui/grid-ui/.prettierignore: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | saplings/* 16 | **/build/* 17 | sapling-dev-server/* 18 | -------------------------------------------------------------------------------- /ui/grid-ui/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "singleQuote": true, 5 | "proseWrap": always 6 | } 7 | -------------------------------------------------------------------------------- /ui/grid-ui/README.md: -------------------------------------------------------------------------------- 1 | This is a Grid branded and themed instance of Splinter Canopy. Its intended 2 | purpose is to provide an interface for Grid apps (saplings) to interface with 3 | shared functionality such as user, key, and session management. 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `yarn start` 10 | 11 | Runs the app in the development mode.
Open 12 | [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.
You will also see any lint errors 15 | in the console. 16 | 17 | ### `yarn test` 18 | 19 | Launches the test runner in the interactive watch mode.
See the section 20 | about 21 | [running tests](https://facebook.github.io/create-react-app/docs/running-tests) 22 | for more information. 23 | 24 | ### `yarn build` 25 | 26 | Builds the app for production to the `build` folder.
It correctly bundles 27 | React in production mode and optimizes the build for the best performance. 28 | 29 | The build is minified and the filenames include the hashes.
Your app is 30 | ready to be deployed! 31 | 32 | See the section about 33 | [deployment](https://facebook.github.io/create-react-app/docs/deployment) for 34 | more information 35 | -------------------------------------------------------------------------------- /ui/grid-ui/docker/.env: -------------------------------------------------------------------------------- 1 | ISOLATION_ID=latest 2 | DISTRO=jammy 3 | REPO_VERSION=0.4.1-dev 4 | -------------------------------------------------------------------------------- /ui/grid-ui/docker/test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Dockerfile for running unit tests and lint on the Grid UI 16 | FROM node:14.18.1-alpine3.11 17 | 18 | SHELL ["/bin/ash", "-eo", "pipefail", "-c"] 19 | 20 | COPY ui/grid-ui/package*.json /ui/grid-ui/ 21 | 22 | RUN apk add --no-cache \ 23 | curl \ 24 | git 25 | 26 | RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh \ 27 | | sh -s -- --to /usr/local/bin 28 | 29 | WORKDIR /ui/grid-ui/ 30 | 31 | # Gives npm permission to run the prepare script in splinter-canopyjs as root 32 | RUN npm config set unsafe-perm true && npm install 33 | 34 | WORKDIR / 35 | 36 | COPY ui/grid-ui/ /ui/grid-ui/ 37 | COPY justfile . 38 | -------------------------------------------------------------------------------- /ui/grid-ui/public/.htaccess: -------------------------------------------------------------------------------- 1 | Options -MultiViews 2 | RewriteEngine On 3 | RewriteCond %{REQUEST_FILENAME} !-f 4 | RewriteRule ^ index.html [QSA,L] 5 | -------------------------------------------------------------------------------- /ui/grid-ui/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hyperledger-archives/grid/0dce5d3362a004cb0301a2a3e0cbe23a70c03a1e/ui/grid-ui/public/favicon.ico -------------------------------------------------------------------------------- /ui/grid-ui/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Grid 12 | 13 | 14 | 15 | 16 |
17 |
18 |
19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ui/grid-ui/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Grid", 3 | "name": "Grid UI", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /ui/grid-ui/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /ui/grid-ui/src/App.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @import './theme/index.scss'; 18 | 19 | .app { 20 | height: 100vh; 21 | display: flex; 22 | align-items: center; 23 | color: var(--text-primary); 24 | 25 | .view { 26 | flex: 0 1 100%; 27 | height: 100vh; 28 | overflow-y: scroll; 29 | overflow-x: none; 30 | background: rgb(238, 238, 238); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ui/grid-ui/src/App.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import React from 'react'; 17 | import ReactDOM from 'react-dom'; 18 | import App from './App'; 19 | 20 | it('renders without crashing', () => { 21 | const div = document.createElement('div'); 22 | ReactDOM.render(, div); 23 | ReactDOM.unmountComponentAtNode(div); 24 | }); 25 | -------------------------------------------------------------------------------- /ui/grid-ui/src/images/grid.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /ui/grid-ui/src/index.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | :root { 18 | --brand-img-url: url('./images/grid.svg'); 19 | } 20 | 21 | html { 22 | box-sizing: border-box; 23 | } 24 | 25 | *, 26 | *:before, 27 | *:after { 28 | box-sizing: inherit; 29 | } 30 | 31 | body { 32 | margin: 0; 33 | font-family: var(--fontFamily-primary); 34 | -webkit-font-smoothing: antialiased; 35 | -moz-osx-font-smoothing: grayscale; 36 | } 37 | 38 | code { 39 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 40 | monospace; 41 | } 42 | -------------------------------------------------------------------------------- /ui/grid-ui/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import ReactDOM from 'react-dom'; 19 | import './index.css'; 20 | import App from './App'; 21 | 22 | ReactDOM.render(, document.getElementById('root')); 23 | -------------------------------------------------------------------------------- /ui/grid-ui/src/setupTests.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 18 | // allows you to do things like: 19 | // expect(element).toHaveTextContent(/react/i) 20 | // learn more: https://github.com/testing-library/jest-dom 21 | import '@testing-library/jest-dom/extend-expect'; 22 | -------------------------------------------------------------------------------- /ui/grid-ui/src/theme/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import './index.scss'; 17 | -------------------------------------------------------------------------------- /ui/grid-ui/src/theme/index.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @import '~splinter-canopyjs/build/themes/default/index.css'; 17 | @import './variables.scss'; 18 | -------------------------------------------------------------------------------- /ui/grid-ui/src/theme/timings.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | $transitionDuration-s: 0.2s; 18 | $transitionDuration-m: 0.3s; 19 | $transitionDuration-l: 0.5s; 20 | -------------------------------------------------------------------------------- /ui/grid-ui/src/theme/typography.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @import url('https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono:400,700&display=swap'); 17 | 18 | :root { 19 | --fontFamily-primary: 'Roboto', 'Helvetica', sans-serif; 20 | --fontFamily-code: 'Roboto Mono', monospace; 21 | } 22 | -------------------------------------------------------------------------------- /ui/grid-ui/src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @import './colors.scss'; 17 | @import './sizes.scss'; 18 | @import './timings.scss'; 19 | @import './typography.scss'; 20 | -------------------------------------------------------------------------------- /ui/sapling-dev-server/configSaplings: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "namespace": "login", 4 | "runtimeFiles": [ 5 | "localhost:3030/sapling-dev-server/register-login.js" 6 | ], 7 | "styleFiles": [], 8 | "workerFiles": [] 9 | }, 10 | { 11 | "namespace": "profile", 12 | "runtimeFiles": [ 13 | "localhost:3030/sapling-dev-server/profile/js/profile.js" 14 | ], 15 | "styleFiles": [ 16 | "localhost:3030/sapling-dev-server/profile/css/profile.css" 17 | ], 18 | "workerFiles": [] 19 | } 20 | ] 21 | -------------------------------------------------------------------------------- /ui/sapling-dev-server/userSaplings: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "displayName": "Product", 4 | "namespace": "product", 5 | "runtimeFiles": [ 6 | "localhost:3030/sapling-dev-server/product/js/product.js" 7 | ], 8 | "styleFiles": [ 9 | "localhost:3030/sapling-dev-server/product/css/product.css" 10 | ], 11 | "workerFiles": [], 12 | "logo": "http://localhost:3030/sapling-dev-server/product/product_logo.svg" 13 | }, 14 | { 15 | "displayName": "Circuits", 16 | "namespace": "circuits", 17 | "runtimeFiles": [ 18 | "localhost:3030/sapling-dev-server/circuits/static/js/circuits.js" 19 | ], 20 | "styleFiles": [ 21 | "localhost:3030/sapling-dev-server/circuits/static/css/circuits.css" 22 | ], 23 | "workerFiles": [], 24 | "logo": "http://localhost:3030/sapling-dev-server/circuits/images/circuits_logo.svg" 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /ui/saplings/circuits/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env", "@babel/preset-react"] 3 | } 4 | -------------------------------------------------------------------------------- /ui/saplings/circuits/.eslintignore: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | build/* 16 | -------------------------------------------------------------------------------- /ui/saplings/circuits/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "jest": true, 5 | "browser": true 6 | }, 7 | "parserOptions": { 8 | "ecmaVersion": 2020 9 | }, 10 | "extends": ["airbnb", "plugin:prettier/recommended"], 11 | "rules": { 12 | "react/jsx-filename-extension": 0, 13 | "react/prefer-stateless-function": 0, 14 | "import/prefer-default-export": 0 15 | }, 16 | "settings": { 17 | "import/resolver": { 18 | "node": { 19 | "paths": ["src"] 20 | }, 21 | "webpack": "./webpack.config.js" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ui/saplings/circuits/.prettierignore: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | build/* 16 | -------------------------------------------------------------------------------- /ui/saplings/circuits/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "singleQuote": true, 5 | "proseWrap": always 6 | } 7 | -------------------------------------------------------------------------------- /ui/saplings/circuits/images/circuits_logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ui/saplings/circuits/public/index.html: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Circuits 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ui/saplings/circuits/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Circuits", 3 | "name": "Circuits sapling", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "theme_color": "#000000", 7 | "background_color": "#ffffff" 8 | } 9 | -------------------------------------------------------------------------------- /ui/saplings/circuits/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /ui/saplings/circuits/scripts/compile_protobuf.js: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | const protobuf = require('protobufjs'); 16 | const process = require('process'); 17 | 18 | const path = require('path'); 19 | const fs = require('fs'); 20 | 21 | const protoDir = process.argv[2]; 22 | 23 | const include = ['admin.proto']; 24 | 25 | let root = new protobuf.Root(); 26 | 27 | const files = fs 28 | .readdirSync(protoDir) 29 | .filter(f => include.includes(f)) 30 | .map(f => path.resolve(protoDir, f)); 31 | 32 | root = root.loadSync(files); 33 | 34 | const output = JSON.stringify(root, null, 2); 35 | 36 | if (output !== '') { 37 | process.stdout.write(output, 'utf8'); 38 | } 39 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/App.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .circuits-app { 18 | height: 100%; 19 | display: flex; 20 | flex-direction: column; 21 | } 22 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/App.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import ReactDOM from 'react-dom'; 19 | import App from './App'; 20 | 21 | it('renders without crashing', () => { 22 | const div = document.createElement('div'); 23 | ReactDOM.render(, div); 24 | ReactDOM.unmountComponentAtNode(div); 25 | }); 26 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/components/MainHeader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import ProposeCircuitButton from './ProposeCircuitButton'; 19 | import './MainHeader.scss'; 20 | 21 | const MainHeader = () => { 22 | return ( 23 |
24 |
25 |

Circuits

26 |
27 | 28 |
29 | ); 30 | }; 31 | 32 | export default MainHeader; 33 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/components/MainHeader.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .main-header { 18 | align-items: center; 19 | display: flex; 20 | flex-direction: row; 21 | justify-content: space-between; 22 | margin: 2rem 3rem 0rem 3rem; 23 | 24 | .circuits-title { 25 | color: var(--color-grey); 26 | font-weight: 100; 27 | margin: 0 1rem 0 0; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/components/PlusMinusButton.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .minus-button, .plus-button { 18 | padding: 0; 19 | border: none; 20 | outline: none; 21 | height: fit-content; 22 | cursor: pointer; 23 | margin-left: 0.5rem; 24 | background-color: transparent; 25 | } 26 | 27 | .plus-button { 28 | color: var(--color-primary-light); 29 | } 30 | 31 | .minus-button { 32 | color: var(--color-attention); 33 | } 34 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/components/circuitDetails/VoteButton.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import PropTypes from 'prop-types'; 19 | 20 | import './VoteButton.scss'; 21 | 22 | const VoteButton = ({ onClickFn }) => { 23 | const userHasKeys = window.$CANOPY.getKeys(); 24 | 25 | return ( 26 | 34 | ); 35 | }; 36 | 37 | VoteButton.propTypes = { 38 | onClickFn: PropTypes.func.isRequired 39 | }; 40 | 41 | export default VoteButton; 42 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/components/circuitDetails/VoteButton.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .vote-button { 18 | background: transparent; 19 | border: 1px solid var(--color-primary); 20 | border-radius: 4px; 21 | box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); 22 | color: var(--color-primary); 23 | cursor: pointer; 24 | height: 3rem; 25 | 26 | &:disabled { 27 | background: var(--color-light-grey); 28 | border: none; 29 | color: var(--color-text-on-dark); 30 | cursor: default; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/data/paging.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | function Paging(responseData) { 18 | this.current = responseData.paging.current; 19 | this.offset = responseData.paging.offset; 20 | this.limit = responseData.paging.limit; 21 | this.total = responseData.paging.total; 22 | this.first = responseData.paging.first; 23 | this.prev = responseData.paging.prev; 24 | this.next = responseData.paging.next; 25 | this.last = responseData.paging.last; 26 | } 27 | 28 | export default Paging; 29 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/index.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | body { 18 | margin: 0; 19 | } 20 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import ReactDOM from 'react-dom'; 19 | import { registerApp } from 'splinter-saplingjs'; 20 | 21 | import './index.css'; 22 | import App from './App'; 23 | 24 | registerApp(domNode => { 25 | ReactDOM.render(, domNode); 26 | }); 27 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/protobuf.js: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | import protobuf from 'protobufjs'; 15 | 16 | // ignoring because this file is generated before deploying 17 | // eslint-disable-next-line import/no-unresolved 18 | const protoJSON = require('./compiled_protos.json'); 19 | 20 | const root = protobuf.Root.fromJSON(protoJSON); 21 | 22 | export default Object.keys(root) 23 | .filter(key => /^[A-Z]/.test(key)) 24 | .reduce((acc, key) => { 25 | acc[key] = root.get(key); 26 | return acc; 27 | }, {}); 28 | -------------------------------------------------------------------------------- /ui/saplings/circuits/src/setupTests.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import '@testing-library/jest-dom/extend-expect'; 18 | 19 | window.$CANOPY = {}; 20 | 21 | window.$CANOPY.getSharedConfig = () => { 22 | return { 23 | canopyConfig: { 24 | splinterURL: 'testSplinterURL', 25 | saplingURL: 'testSaplingURL' 26 | }, 27 | appConfig: {} 28 | }; 29 | }; 30 | -------------------------------------------------------------------------------- /ui/saplings/circuits/test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Dockerfile for running unit tests and lint on the circuits sapling 16 | FROM node:lts-alpine 17 | 18 | WORKDIR /saplings/circuits 19 | 20 | COPY package*.json ./ 21 | 22 | RUN apk add --no-cache git 23 | 24 | # Gives npm permission to run the prepare script in splinter-canopyjs as root 25 | RUN npm config set unsafe-perm true && npm install 26 | 27 | COPY . . 28 | 29 | RUN npm install && \ 30 | npm run generate-proto-files ./protos 31 | -------------------------------------------------------------------------------- /ui/saplings/product/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": [ 3 | ["@babel/plugin-proposal-decorators", { 4 | "decoratorsBeforeExport": true 5 | }] 6 | ], 7 | "presets": [ 8 | ["@babel/preset-env", { 9 | "targets": { "node": "current" } 10 | }], 11 | "@babel/preset-react" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /ui/saplings/product/.eslintignore: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | saplings/* 16 | build/* 17 | sapling-dev-server/* 18 | src/compiled_protos.json 19 | -------------------------------------------------------------------------------- /ui/saplings/product/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "jest": true, 5 | "browser": true 6 | }, 7 | "parserOptions": { 8 | "ecmaVersion": 2020 9 | }, 10 | "extends": [ 11 | "airbnb", 12 | "prettier", 13 | "prettier/react" 14 | ], 15 | "rules": { 16 | "react/jsx-filename-extension": 0, 17 | "react/jsx-props-no-spreading": 0, 18 | "react/forbid-prop-types": 0, 19 | "react/prefer-stateless-function": 0, 20 | "import/prefer-default-export": 0, 21 | "no-console": [ 22 | "error", 23 | { 24 | "allow": [ 25 | "error" 26 | ] 27 | } 28 | ] 29 | }, 30 | "settings": { 31 | "import/resolver": { 32 | "node": { 33 | "paths": [ 34 | "src" 35 | ] 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ui/saplings/product/.prettierignore: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2020 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | saplings/* 16 | build/* 17 | src/compiled_protos.json 18 | -------------------------------------------------------------------------------- /ui/saplings/product/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "singleQuote": true, 5 | "proseWrap": always 6 | } 7 | -------------------------------------------------------------------------------- /ui/saplings/product/public/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | Product 27 | 28 | 29 | 30 | 31 |
32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /ui/saplings/product/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Product", 3 | "name": "Product sapling", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "theme_color": "#000000", 7 | "background_color": "#ffffff" 8 | } 9 | -------------------------------------------------------------------------------- /ui/saplings/product/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /ui/saplings/product/src/App.test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import ReactDOM from 'react-dom'; 19 | import App from './App'; 20 | 21 | it('renders without crashing', () => { 22 | const div = document.createElement('div'); 23 | ReactDOM.render(, div); 24 | ReactDOM.unmountComponentAtNode(div); 25 | }); 26 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/FilterBar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | 19 | import CircuitDropdown from './CircuitDropdown'; 20 | import './FilterBar.scss'; 21 | 22 | function FilterBar() { 23 | return ( 24 |
25 | 26 |
27 | ); 28 | } 29 | 30 | export default FilterBar; 31 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/FilterBar.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .filter-bar { 18 | position: sticky; 19 | z-index: 2; 20 | top: 0; 21 | height: 4rem; 22 | box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); 23 | padding: 1rem; 24 | background-color: white; 25 | } 26 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/Loading.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; 19 | 20 | import './Loading.scss'; 21 | 22 | function Loading() { 23 | return ( 24 |
25 | ; 26 |
27 | ); 28 | } 29 | 30 | export default Loading; 31 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/Loading.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .spinner-wrapper { 18 | display: flex; 19 | width: 100%; 20 | height: 100%; 21 | align-items: center; 22 | justify-content: center; 23 | 24 | .spinner { 25 | color: #999999; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/NotFound.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import PropTypes from 'prop-types'; 19 | 20 | import './NotFound.scss'; 21 | 22 | function NotFound(props) { 23 | const { message } = props; 24 | 25 | return ( 26 |
27 |

{message}

28 |
29 | ); 30 | } 31 | 32 | NotFound.propTypes = { 33 | message: PropTypes.string.isRequired 34 | }; 35 | 36 | export default NotFound; 37 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/NotFound.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .not-found-wrapper { 18 | display: flex; 19 | width: 100%; 20 | height: 100%; 21 | align-items: center; 22 | justify-content: center; 23 | 24 | .not-found-message { 25 | margin: 0; 26 | color: #999999; 27 | user-select: none; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/TopBar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import PropTypes from 'prop-types'; 19 | import CircuitDropdown from './CircuitDropdown'; 20 | import './TopBar.scss'; 21 | 22 | function TopBar({ 23 | saplingName, 24 | }) { 25 | return ( 26 |
27 | {saplingName} 28 | 29 |
30 | ) 31 | } 32 | 33 | TopBar.propTypes = { 34 | saplingName: PropTypes.string 35 | } 36 | 37 | TopBar.defaultProps = { 38 | saplingName: '' 39 | } 40 | 41 | export default TopBar; 42 | -------------------------------------------------------------------------------- /ui/saplings/product/src/components/TopBar.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | @import '../styles/index.scss'; 17 | 18 | .top-bar { 19 | @include grid-full; 20 | 21 | grid-column: full; 22 | align-items: center; 23 | justify-content: space-between; 24 | height: 3.5rem; 25 | position: sticky; 26 | z-index: 2; 27 | top: 0; 28 | box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); 29 | background-color: white; 30 | 31 | .header-5 { 32 | grid-column: main-start / 6; 33 | font-size: 1.5rem; 34 | font-weight: 600; 35 | font-family: var(--fontFamily-primary); 36 | } 37 | 38 | .circuit-select { 39 | grid-column: 9 / main-end; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ui/saplings/product/src/hooks/on-click-outside.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { useEffect } from 'react'; 18 | 19 | function useOnClickOutside(ref, handler) { 20 | useEffect(() => { 21 | const listener = event => { 22 | if (!ref.current || ref.current.contains(event.target)) { 23 | return; 24 | } 25 | 26 | handler(event); 27 | }; 28 | 29 | document.addEventListener('mousedown', listener); 30 | 31 | return () => { 32 | document.removeEventListener('mousedown', listener); 33 | }; 34 | }, [ref, handler]); 35 | } 36 | 37 | export default useOnClickOutside; 38 | -------------------------------------------------------------------------------- /ui/saplings/product/src/index.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | body { 18 | margin: 0; 19 | } 20 | -------------------------------------------------------------------------------- /ui/saplings/product/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import React from 'react'; 18 | import ReactDOM from 'react-dom'; 19 | import { registerApp } from 'splinter-saplingjs'; 20 | 21 | import './index.css'; 22 | import App from './App'; 23 | 24 | registerApp(domNode => { 25 | ReactDOM.render(, domNode); 26 | }); 27 | -------------------------------------------------------------------------------- /ui/saplings/product/src/protobuf.js: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | import protobuf from 'protobufjs'; 15 | 16 | // ignoring because this file is generated before deploying 17 | // eslint-disable-next-line import/no-unresolved 18 | const protoJSON = require('./compiled_protos.json'); 19 | 20 | const root = protobuf.Root.fromJSON(protoJSON); 21 | 22 | export default Object.keys(root) 23 | .filter(key => /^[A-Z]/.test(key)) 24 | .reduce((acc, key) => { 25 | acc[key] = root.get(key); 26 | return acc; 27 | }, {}); 28 | -------------------------------------------------------------------------------- /ui/saplings/product/src/setupTests.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2020 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | window.$CANOPY = {}; 18 | 19 | window.$CANOPY.getSharedConfig = () => { 20 | return { 21 | canopyConfig: { 22 | splinterURL: 'testSplinterURL', 23 | saplingURL: 'testSaplingURL' 24 | }, 25 | appConfig: { 26 | gridURL: 'testGridURL' 27 | } 28 | }; 29 | }; 30 | -------------------------------------------------------------------------------- /ui/saplings/product/src/styles/colors.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Brand 18 | $color-primary: rgb(243, 95, 25); 19 | $color-primary-light: lighten($color-primary, 15%); 20 | $color-primary-dark: darken($color-primary, 15%); 21 | $color-secondary: #50e2ae; 22 | $color-secondary-light: lighten($color-secondary, 15%); 23 | $color-secondary-dark: darken($color-secondary, 15%); 24 | -------------------------------------------------------------------------------- /ui/saplings/product/src/styles/index.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | @import './buttons.scss'; 18 | @import './colors.scss'; 19 | @import './layout.scss'; 20 | -------------------------------------------------------------------------------- /ui/saplings/profile/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env", "@babel/preset-react"] 3 | } 4 | -------------------------------------------------------------------------------- /ui/saplings/profile/.eslintignore: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | saplings/* 16 | build/* 17 | sapling-dev-server/* 18 | scripts/build.js 19 | -------------------------------------------------------------------------------- /ui/saplings/profile/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "es6": true, 4 | "jest": true, 5 | "browser": true 6 | }, 7 | "parserOptions": { 8 | "ecmaVersion": 2020 9 | }, 10 | "extends": [ 11 | "airbnb", 12 | "prettier", 13 | "prettier/react" 14 | ], 15 | "rules": { 16 | "react/jsx-filename-extension": 0, 17 | "react/prefer-stateless-function": 0, 18 | "react/button-has-type": 0, 19 | "react/forbid-prop-types": 0, 20 | "import/prefer-default-export": 0, 21 | "camelcase": 0, 22 | "no-underscore-dangle": 0 23 | }, 24 | "settings": { 25 | "import/resolver": { 26 | "node": { 27 | "paths": [ 28 | "src" 29 | ] 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ui/saplings/profile/public/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | React App 24 | 25 | 26 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /ui/saplings/profile/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Profile Sapling", 3 | "name": "Canopy Profile Sapling", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "theme_color": "#000000", 7 | "background_color": "#ffffff" 8 | } 9 | -------------------------------------------------------------------------------- /ui/saplings/profile/src/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import React from 'react'; 17 | import './App.scss'; 18 | import { Profile } from './Profile'; 19 | 20 | function App() { 21 | return ; 22 | } 23 | 24 | export default App; 25 | -------------------------------------------------------------------------------- /ui/saplings/profile/src/forms/AddKeyForm.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #profile { 17 | .wrapper { 18 | width: 50vw; 19 | 20 | .error-wrapper { 21 | display: flex; 22 | flex-direction: column; 23 | justify-content: center; 24 | align-items: center; 25 | width: 100%; 26 | 27 | .error { 28 | width: 80%; 29 | color: var(--color-failure); 30 | word-wrap: break-word; 31 | } 32 | 33 | .actions { 34 | width: 80%; 35 | display: flex; 36 | flex-direction: row; 37 | justify-content: flex-end; 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ui/saplings/profile/src/index.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | html, 17 | body { 18 | margin: 0; 19 | height: 100vh; 20 | } 21 | -------------------------------------------------------------------------------- /ui/saplings/profile/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import React from 'react'; 17 | import ReactDOM from 'react-dom'; 18 | import './index.css'; 19 | import { registerApp, registerConfigSapling } from 'splinter-saplingjs'; 20 | import App from './App'; 21 | 22 | registerConfigSapling('profile', () => { 23 | if (window.location.pathname === '/profile') { 24 | registerApp(domNode => { 25 | ReactDOM.render(, domNode); 26 | }); 27 | } 28 | }); 29 | -------------------------------------------------------------------------------- /ui/saplings/profile/src/useDebounce.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { useState, useEffect } from 'react'; 18 | 19 | export function useDebounce(value, delay) { 20 | const [debouncedValue, setDebouncedValue] = useState(value); 21 | 22 | useEffect(() => { 23 | const handler = setTimeout(() => { 24 | setDebouncedValue(value); 25 | }, delay); 26 | 27 | return () => { 28 | clearTimeout(handler); 29 | }; 30 | }, [value, delay]); 31 | 32 | return debouncedValue; 33 | } 34 | -------------------------------------------------------------------------------- /ui/saplings/profile/test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Dockerfile for running unit tests and lint on the profile sapling 16 | FROM node:lts-alpine 17 | 18 | WORKDIR /saplings/profile 19 | 20 | COPY package*.json ./ 21 | 22 | RUN apk add --no-cache git 23 | 24 | # Gives npm permission to run the prepare script in splinter-canopyjs as root 25 | RUN npm config set unsafe-perm true && npm install 26 | 27 | COPY . . 28 | -------------------------------------------------------------------------------- /ui/saplings/register-login/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "plugins": [ 4 | "@typescript-eslint", 5 | "html" 6 | ], 7 | "settings": { 8 | "import/resolver": { 9 | "node": { 10 | "extensions": [ 11 | ".js", 12 | ".ts" 13 | ] 14 | } 15 | } 16 | }, 17 | "env": { 18 | "es6": true, 19 | "jest": true, 20 | "browser": true 21 | }, 22 | "parserOptions": { 23 | "ecmaVersion": 2020 24 | }, 25 | "rules": { 26 | "import/no-default-export": 2, 27 | "import/prefer-default-export": 0, 28 | "import/extensions": [ 29 | "error", 30 | "ignorePackages", 31 | { 32 | "js": "never", 33 | "ts": "never" 34 | } 35 | ] 36 | }, 37 | "extends": [ 38 | "plugin:@typescript-eslint/recommended", 39 | "airbnb-base", 40 | "plugin:prettier/recommended" 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /ui/saplings/register-login/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /ui/saplings/register-login/jest.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | preset: 'ts-jest', 19 | testEnvironment: 'jsdom' 20 | }; 21 | -------------------------------------------------------------------------------- /ui/saplings/register-login/test/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Dockerfile for running unit tests and lint on the register-login sapling 16 | FROM node:lts-alpine 17 | 18 | WORKDIR /saplings/register-login 19 | 20 | COPY package*.json ./ 21 | 22 | RUN apk add --no-cache git 23 | 24 | # Gives npm permission to run the prepare script in splinter-canopyjs as root 25 | RUN npm config set unsafe-perm true && npm install 26 | 27 | COPY . . 28 | -------------------------------------------------------------------------------- /ui/saplings/register-login/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": [ 4 | "es2015", 5 | "dom" 6 | ], 7 | "esModuleInterop": true 8 | }, 9 | "exclude": [ 10 | "node_modules", 11 | "**/*.spec.ts" 12 | ], 13 | "include": [ 14 | "src/**/*", 15 | "types/*" 16 | ], 17 | "resolve": { 18 | "extensions": [ 19 | ".ts", 20 | ".html" 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ui/saplings/register-login/types/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | declare module '*.html' { 18 | const value: string; 19 | // eslint-disable-next-line import/no-default-export 20 | export default value; 21 | } 22 | -------------------------------------------------------------------------------- /ui/saplings/register-login/webpack.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018-2021 Cargill Incorporated 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | mode: 'production', 19 | entry: './src/index.ts', 20 | output: { 21 | library: 'register-login', 22 | libraryTarget: 'umd', 23 | filename: 'register-login.js', 24 | globalObject: 'this' 25 | }, 26 | resolve: { 27 | extensions: ['.ts', '.js'] 28 | }, 29 | module: { 30 | rules: [ 31 | { test: /\.ts$/, loader: 'ts-loader' }, 32 | { 33 | test: /\.html$/i, 34 | loader: 'html-loader' 35 | } 36 | ] 37 | } 38 | }; 39 | --------------------------------------------------------------------------------