Skip to content

Commit

Permalink
Merging Develop into Main for the 2.24.0 release (#3600)
Browse files Browse the repository at this point in the history
* remove console log

Signed-off-by: artembuslaev <[email protected]>

* added displaying transfer token

Signed-off-by: artembuslaev <[email protected]>

* fix error handling in mint block

Signed-off-by: artembuslaev <[email protected]>

* fix notification reciever

Signed-off-by: artembuslaev <[email protected]>

* fix notifications clicking

Signed-off-by: artembuslaev <[email protected]>

* added retry interval

Signed-off-by: artembuslaev <[email protected]>

* fix

Signed-off-by: artembuslaev <[email protected]>

* change name for env variable

Signed-off-by: artembuslaev <[email protected]>

* fix timeout error

Signed-off-by: artembuslaev <[email protected]>

* fix resolving nft mint transactions

Signed-off-by: artembuslaev <[email protected]>

* fix multi policy mint

Signed-off-by: artembuslaev <[email protected]>

* change notification order

Signed-off-by: artembuslaev <[email protected]>

* added check for amount

Signed-off-by: artembuslaev <[email protected]>

* update setting env variables

Signed-off-by: artembuslaev <[email protected]>

* fix transactions serials amount

Signed-off-by: artembuslaev <[email protected]>

* fix

Signed-off-by: artembuslaev <[email protected]>

* fix mint errors

Signed-off-by: artembuslaev <[email protected]>

* fix typo [skip ci]

Signed-off-by: artembuslaev <[email protected]>

* fix transfer amount

Signed-off-by: artembuslaev <[email protected]>

* added irec 4 retry mint policy [skip ci]

Signed-off-by: artembuslaev <[email protected]>

* fix Nobinding schema error
disable creation of schema without policy binded

Signed-off-by: simvalery <[email protected]>

* enable creation of schema without policy binded

Signed-off-by: simvalery <[email protected]>

* disable policy dropdown for editing schemas

Signed-off-by: simvalery <[email protected]>

* fix image upload bug

Signed-off-by: simvalery <[email protected]>

* fix image upload bug

Signed-off-by: simvalery <[email protected]>

* load images into database in dryRun mode

Signed-off-by: simvalery <[email protected]>

* [skip ci] Add swagger.yaml

* remove console.log

Signed-off-by: simvalery <[email protected]>

* GITBOOK-134: Added PWRM0002 Demo guide

* GITBOOK-135: 3311 ticket changes updated

* Create Readme.md of PWRM0002

* Update timestamps of Tool 13, 14 16

* Create readme.md of Hackathon

* Add files via upload

* fix file upload issue
fix clear dry run files

Signed-off-by: simvalery <[email protected]>

* apply only image upload

Signed-off-by: simvalery <[email protected]>

* feat: contarization redis cache service

* fix draft schemas in wisard

Signed-off-by: simvalery <[email protected]>

* fix amount

Signed-off-by: artembuslaev <[email protected]>

* fix

Signed-off-by: artembuslaev <[email protected]>

* use global common and interfaces modules

Signed-off-by: simvalery <[email protected]>

* Add files via upload

* bump version

Signed-off-by: simvalery <[email protected]>

* [skip ci] Add swagger.yaml

* increase timeout for import tool

* feat: add esm for api-tests

* feat: move to esm common service

* feat: move to esm worker-service

* feat: move to esm policy and guardian services

* feat: move dev.js to esm

* feat: move to esm modules in gulp files api auth worker guardian policy logger notification

* feat: esm in ecosystem config

* refactor code

* feat: add js extention for imports in ai analytics services

* feat: add extention in application events service

* feat: add extentions for auth service

* feat: add extention guardian

* fix: ai auth analytics application events services

* feat: add extentions for api gateway service

* fix: api-gateway

* :wqfeat: add extention in common service

* fix: common service

* feat: esm for logger service

* fix: configs for target es2022

* feat: esm to policy service

* feat: esm to notification service

* feat: esm for interfaces

* feat: esm for tree viever mrv sender topic viever

* refactor code

* fix: error with id by create update base entityes

* feat: increase vertions of mongodb and microorm for esm

* fix: policy and guardian services on dry run

* fix: lint error unused import in guardian service

* fix: unit tests pre build

* fix: bson vertion for current mongo

* fix: get user undefined for get blocks and post groups

* fix: dirname in mrv sender

* fix: remove inject decorator in all places

* feat: increase bson guardian and policy

* fix: imports inside services

* fix: merge conflicts

* Revert "fix: merge conflicts"

This reverts commit afc2f2f.

* fix: merge conflicts

* fix: extentions and ts config for microservises

* Update README.md

* fix: pass context across super and declare prop

* fix: revert inject decorators across declare

* [skip ci] Add swagger.yaml

* fix: merge develop ai service

* added change tools while importing policy

Signed-off-by: artembuslaev <[email protected]>

* added token update endpoint

Signed-off-by: artembuslaev <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: artembuslaev <[email protected]>

* fix

Signed-off-by: artembuslaev <[email protected]>

* fix

Signed-off-by: artembuslaev <[email protected]>

* fix

Signed-off-by: artembuslaev <[email protected]>

* update publishing policies script [skip ci]

Signed-off-by: artembuslaev <[email protected]>

* fix auth for update token api

Signed-off-by: artembuslaev <[email protected]>

* [skip ci] Add swagger.yaml

* refactoring

Signed-off-by: artembuslaev <[email protected]>

* [skip ci] Add swagger.yaml

* update cdm policies [skip ci]

Signed-off-by: artembuslaev <[email protected]>

* added some tests for contracts and flow for irec4

* update status code for tests

* fix bottom margin for tools changing [skip ci]

Signed-off-by: artembuslaev <[email protected]>

* Dockerfiles revised

Signed-off-by: Alexander Pyatakov <[email protected]>

* node image replaced with the slim version

Signed-off-by: Alexander Pyatakov <[email protected]>

* node version moved to arg

Signed-off-by: Alexander Pyatakov <[email protected]>

* Dockerfiles has been revamped to reduce the size of the final images

Signed-off-by: Alexander Pyatakov <[email protected]>

* Added/Modified .dockerignore files

Signed-off-by: Alexander Pyatakov <[email protected]>

* Optimize caching with "COPY --link"

Signed-off-by: Alexander Pyatakov <[email protected]>

* Run applications as a non-root user and use init:true for containers

Signed-off-by: Alexander Pyatakov <[email protected]>

* Yarn cache directory defined as an argument

Signed-off-by: Alexander Pyatakov <[email protected]>

* Yarn cache fix

Signed-off-by: Alexander Pyatakov <[email protected]>

* Permissions changes

Signed-off-by: Alexander Pyatakov <[email protected]>

* Base node image is changed to alpine

Signed-off-by: Alexander Pyatakov <[email protected]>

* GITBOOK-136: Added Filebase docs

* added bad_request const for status code

* added publishing contract file script

Signed-off-by: artembuslaev <[email protected]>

* fix: migrate to redict cache store

* Revert "Merge branch 'develop' into feat/move-to-es-modules-develop"

This reverts commit 6da2788, reversing
changes made to 0c8b832.

* Revert "fix: merge with develop"

This reverts commit 0c8b832, reversing
changes made to 0fec16a.

* Revert "Revert "fix: merge with develop""

This reverts commit 5610fa5.

* Revert "Revert "Merge branch 'develop' into feat/move-to-es-modules-develop""

This reverts commit c48aa0f.

* added nfts limit in contracts

Signed-off-by: Artem Buslaev <[email protected]>

* upd contracts [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* fix script [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* GITBOOK-137: Updated Changing Tools in UI section

* Update readme.md of ML readme

* remove output [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* fix

Signed-off-by: Artem Buslaev <[email protected]>

* GITBOOK-139: Added section on how to deploy contracts using your own account

* Update readme.md

* GITBOOK-140: Added Atma Scope 3 policy demo

* GITBOOK-142: Added Dovu MMCM

* update iii.f [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* feat: performance interceptor

* cache-endpoints
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* update policies [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* fix: extentions gulp files in description dockerfiles

* update policies [skip ci]

Signed-off-by: Artem Buslaev <[email protected]>

* feat: wrap endpoinds in cache

* GITBOOK-143: added ExternalDataBlock details

* feat: use cache with apply decorators

* fix: file name import

* fix: get user only if auth token exist

* feat: add perf hooks in performance interceptor

* fix: add express flag for projects/properties route

* setup user profile
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* sign with fireblocks
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* user fireblocks config
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* fix serials column

Signed-off-by: Artem Buslaev <[email protected]>

* remove res where it possible and add res.locals.data

* GITBOOK-144: Added Changing of Tools during Policy import APIs added

* fix fireblocks sign bug
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* add ui validators, add exception
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* temp fix validators
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* GITBOOK-145: Added youtube demo video for PWRM0002

* GITBOOK-146: Updated Guardian Introduction

* fix: remove cache from policies/:policyId/groups

* fix
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* fix
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* Policy Preview/Import performance optimisations

Signed-off-by: Alexander Pyatakov <[email protected]>

* fixed fields parsing for compare

Signed-off-by: Alexander Pyatakov <[email protected]>

* parseConditions function improvements

Signed-off-by: Alexander Pyatakov <[email protected]>

* fix generate xlsx

Signed-off-by: Stepan Kiryakov <[email protected]>

* GITBOOK-147: Made some minor corrections

* test
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* added policy data migration

Signed-off-by: Artem Buslaev <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: Artem Buslaev <[email protected]>

* fix

Signed-off-by: Artem Buslaev <[email protected]>

* fix lint

Signed-off-by: Artem Buslaev <[email protected]>

* remove types/mime resolution
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* fix
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* Add files via upload

* fix signing
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* fix linting
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* fix autocomplete
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* remove singleton from fireblocks-helper.ts
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* fix
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* docs: add instruction for launch cache container in readme file

* bump version
Signed-off-by: simvalery <[email protected]>

Signed-off-by: simvalery <[email protected]>

* [skip ci] Add swagger.yaml

* GITBOOK-148: Added Live Project Data Migration UI

* GITBOOK-149: Fireblocks Docs added

* added migrating retire pools and dynamic tokens

Signed-off-by: Artem Buslaev <[email protected]>

* [skip ci] Add swagger.yaml

* fix

Signed-off-by: Artem Buslaev <[email protected]>

* GITBOOK-150: ACM0001 guide added

* fix lint

Signed-off-by: Artem Buslaev <[email protected]>

* Update readme.md of ACM0001

* fix

Signed-off-by: Artem Buslaev <[email protected]>

* GITBOOK-151: Added migration policy data APIs

* hotfix: remove cache for contract routes

* GITBOOK-152: Added redict in Prerequisites

* GITBOOK-153: Added Prerequisites

* GITBOOK-154: Added Token template to migration

---------

Signed-off-by: artembuslaev <[email protected]>
Signed-off-by: simvalery <[email protected]>
Signed-off-by: Alexander Pyatakov <[email protected]>
Signed-off-by: Artem Buslaev <[email protected]>
Signed-off-by: Stepan Kiryakov <[email protected]>
Co-authored-by: artembuslaev <[email protected]>
Co-authored-by: envision-ci-agent <[email protected]>
Co-authored-by: prernaa.agarwal <[email protected]>
Co-authored-by: Celiant <[email protected]>
Co-authored-by: Ihar <[email protected]>
Co-authored-by: Andrey (Envision Blockchain) <[email protected]>
Co-authored-by: Alexander Pyatakov <[email protected]>
Co-authored-by: Stepan Kiryakov <[email protected]>
  • Loading branch information
9 people authored Apr 30, 2024
1 parent 864733c commit f450893
Show file tree
Hide file tree
Showing 1,442 changed files with 65,789 additions and 32,920 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ EXPOSE 3006
EXPOSE 4200
RUN npm install -g nodemon
RUN npm install -g ts-node
CMD ["node", "dev.js"]
CMD ["node", "dev.mjs"]
Binary file not shown.
116 changes: 111 additions & 5 deletions Methodology Library/CDM/CDM ACM0001/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
- Key Documents & Schemas
- Token (Carbon Emisison Reduction)
- Workflow
- IPFS Timestamp
- Step-by-Step

<!-- /TOC -->
Expand Down Expand Up @@ -89,13 +88,120 @@ Certified Emission Reduction (CER) credits, each equivalent to one tonne of CO2.
## Policy Workflow

![image](https://github.com/hashgraph/guardian/assets/79293833/02c6baf0-3eec-4247-b6c1-7de60029b0fd)

### Step By Step

1. Log in as the Standard Registry and import the policy either by file or through IPFS timestamp by selecting the third button at the top right.

![image](https://github.com/hashgraph/guardian/assets/79293833/f4b27077-d4ab-4c26-8147-f154abc03d8c)

![image](https://github.com/hashgraph/guardian/assets/79293833/edf45195-a9dc-4be2-8fec-7b85ecee9d30)

![image](https://github.com/hashgraph/guardian/assets/79293833/09644fe1-cbdf-4498-9713-a1107bff4c8e)

![image](https://github.com/hashgraph/guardian/assets/79293833/ee9da057-009d-494d-b54c-52831cfbe451)

2. Once the policy has successfully imported, you will be redirected to the policy configurator. The policy configurator can be used to edit the policy using the workflow blocks. There will also be a tab for the “Tools” used within this policy as illustrated in the image below. To start using the policy you must first change the status of the policy from “Draft” to “Dry Run” or “Publish”, then select the “Register” or “Go” button. This can be done through the policy configurator page or though the “Policies” page.

![image](https://github.com/hashgraph/guardian/assets/79293833/0cdba5f4-ff13-4fa7-aa3b-9a6b20438bca)

![image](https://github.com/hashgraph/guardian/assets/79293833/8e01b989-030b-4186-bfd6-472efb6d8d5a)

![image](https://github.com/hashgraph/guardian/assets/79293833/01d23a42-781b-4fc7-b8a3-35515266bd15)

![image](https://github.com/hashgraph/guardian/assets/79293833/bb0967de-41f0-4803-839f-e6b9f5f177b3)

![image](https://github.com/hashgraph/guardian/assets/79293833/420d69b1-f925-49b4-9bcd-8f8190f630df)

3. Create a new user by clicking the “Create User” button and assign their role as “Project Participant”.

![image](https://github.com/hashgraph/guardian/assets/79293833/91c516c2-1ff3-47a6-b776-33b58c991b06)

![image](https://github.com/hashgraph/guardian/assets/79293833/001661ec-c65a-4da6-bcbf-6b525081b6a4)

![image](https://github.com/hashgraph/guardian/assets/79293833/76e07aef-a9ef-4893-89fe-173dacc3c19a)

4. The Project Participant can now provide their name or the name they would like to see reflect when registering for this project (i.e. their organization’s name).

![image](https://github.com/hashgraph/guardian/assets/79293833/10beecbf-d50d-4d2f-b74c-f3290bb6b51a)

5. Сreate a new user again and assign their role as “VVB”.

![image](https://github.com/hashgraph/guardian/assets/79293833/3cab49f3-f403-4b62-9bf4-ba4d9b7da562)

6. The VVB can now provide their name or the name they would like users to see when reviewing projects (i.e. their organization’s name).

![image](https://github.com/hashgraph/guardian/assets/79293833/a87353a7-769c-4ec7-8fab-93342686c7b6)

7. Log in as the SR and select the “Project Participants” or the “VVBs” tab to view the documents submitted by the Project Participant and by the VVB. The SR can approve their requests by clicking on the “Approve" button.

![image](https://github.com/hashgraph/guardian/assets/79293833/1e42c343-4a2b-4ac8-9fed-96ba62ff77ce)

![image](https://github.com/hashgraph/guardian/assets/79293833/2834c776-e2d1-423b-a369-d4007fcd3acf)

8. Log in as the Project Participant and create a new project by clicking on the "New Project" button. This form is used to collect information about the project, organization, and all the data needed to run the emission reduction calculations. Once all the required fields have been filled the “Create” button will turn dark blue. By selecting the “Create” button all the data will be sent to the SR for review/approval.

![image](https://github.com/hashgraph/guardian/assets/79293833/8d823f1f-b39a-4970-98c4-cae37a9721eb)

![image](https://github.com/hashgraph/guardian/assets/79293833/3c631f08-4118-467a-bbac-3e6bbbb59204)

9. Log back in as the SR and after reviewing the document located in the “Projects” tab, the SR can validate the project submitted by the Project Participant by clicking the “Validate” button. If the data does not satisfy the rules set by the SR, then the “Reject” button can be used.

![image](https://github.com/hashgraph/guardian/assets/79293833/7070f6c4-3076-48f1-a72c-dd5d6feea839)

10. Log in as the Project Participant and create a monitoring report by clicking on the “Add Report” button then fill out the monitoring report form.

![image](https://github.com/hashgraph/guardian/assets/79293833/6cd9edee-59ec-4fc4-ab37-b46db71508d7)

![image](https://github.com/hashgraph/guardian/assets/79293833/34f92cd6-e9c1-4dbd-9053-2e19c7068215)

11. After creating the monitoring report, the project participant assigns the VVB to verify it by navigating to the “Monitoring Reports” tab and selecting the dropdown under “Assign”.

![image](https://github.com/hashgraph/guardian/assets/79293833/6f3e8272-4d5a-4713-990f-dbb744e962ae)

12. Log in as the VVB and click the “Monitoring Reports” tab to review the document submitted by the Project Participant. After reviewing the monitoring report by selecting “View Document”, the VVB can select “Verify”.

![image](https://github.com/hashgraph/guardian/assets/79293833/dddd36bf-1b9a-4a7a-91e1-43e5742b2634)

13. Log in as the SR to review the monitoring report by selecting the “View Document” button in the “Monitoring Reports” tab. The SR can approve the monitoring report by selecting “Approve”. This will also trigger the minting process. You can see the minting status under “Status” change from “Minting” to “Minted”.

![image](https://github.com/hashgraph/guardian/assets/79293833/d5e340ec-4559-411c-b7de-8145a3456cbe)

14. Once the minting process is completed, you can view the token amount by navigating to the “VPs” tab.

![image](https://github.com/hashgraph/guardian/assets/79293833/21acc77c-e5dd-4aea-8482-7fdbc7388a04)

15. The TrustChain can also be viewed by clicking on the “View TrustChain” button. Please note that the token amount may show “-1/472495” when the tokens are still minting like the example provided below.

![image](https://github.com/hashgraph/guardian/assets/79293833/ce3f60f3-be3d-4fbe-a729-1fadb7fde8ab)

![image](https://github.com/hashgraph/guardian/assets/79293833/c452e666-f789-4e90-a109-052ab83bd194)

























## IPFS Timestamp

Coming Soon

### Step By Step

Coming Soon

Binary file not shown.
Binary file not shown.
Binary file modified Methodology Library/CDM/CDM ACM0007/ACM0007.policy
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
72 changes: 51 additions & 21 deletions Methodology Library/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,60 @@ This folder contains sub folders for each Methodology and their authors (with ma
7. GCC - KrypC
8. Gold Standard Afforestation / Reforestation - Envision
9. Gold Standard Carbon Sequestration through Accelerated Carbonation of Concrete Aggregate - Envision
10. CDM ACM0007 - Envision
11. CDM AMS-II.G - Envision
12. CDM AMS-III.AR - Envision
13. CDM AMS-III.BB - Envision
14. CDM AMS-III.D - Envision
15. CDM AMS-I.D - Envision
16. CDM AR-ACM0003 - Envision
17. CDM AMS-II.J - Envision
18. CDM ACM0002 - Envision
19. CDM AMS-III.F - Envision
20. CDM AMS-III.AV - Envision
21. CDM AMS-III.H - Envision
22. CDM AMS-I.F - Envision
23. CDM AMS-I.C (Coming Soon)
24. CDM ACM0001 (Coming Soon)
25. CDM ACM0018 (Coming Soon)
26. CDM AMS-I.A (Coming Soon)
10. MMCM - Dovu
11. CDM ACM0007 - Envision
12. CDM AMS-II.G - Envision
13. CDM AMS-III.AR - Envision
14. CDM AMS-III.BB - Envision
15. CDM AMS-III.D - Envision
16. CDM AMS-I.D - Envision
17. CDM AR-ACM0003 - Envision
18. CDM AMS-II.J - Envision
19. CDM ACM0002 - Envision
20. CDM AMS-III.F - Envision
21. CDM AMS-III.AV - Envision
22. CDM AMS-III.H - Envision
23. CDM AMS-I.F - Envision
24. CDM AMS-I.C (Coming Soon)
25. CDM ACM0001 (Coming Soon)
26. CDM ACM0018 (Coming Soon)
27. CDM AMS-I.A (Coming Soon)

### Emission Policies

1. GHG Methodology - Remote Workflow - Envision
2. CET & CRU - Tymlez
3. GHG Scope II - Atma
4. GHGP Corporate Standard - Envision
5. GHGP Product Standard - Avery Dennison (Coming soon)
6. E-Mission (Coming soon)
7. EPA CFR 40 p75 - Serapis (Coming soon)
4. GHG Scope 3 - Atma
5. GHGP Corporate Standard - Envision
6. GHGP Product Standard - Avery Dennison (Coming soon)
7. E-Mission (Coming soon)
8. EPA CFR 40 p75 - Serapis (Coming soon)

### Hackathon Policies (Under Testing)

1. UrbanO2asis
2. Verra VM0048
3. GF0001
4. Puro.Earth Biochar
5. SaniChain
6. Verra VM0047 with Forward Module
7. VErra VMR0006
8. Verra VM0038 ( Electrical vehicle charging systems )
9. CDM AMS-III.Z - Sustainable Brick Manufacturing Methodology
10. SmartCookStove
11. CDM AMS-III.C
12. CDM AM0124
13. SDVISTa SDVM001 - Improved Cookstoves (ICS)
14. CDM ACM0014
15. Improved-Waste-Collection-Segregation-and-Handling (IWCSH)
16. GreenTrace
17. M/CE-R01 Circular Economy Methodology for Encouraging Plastic Recycling (MCER01)
18. Solar Positive Household Methodology
19. ZEV Ledger: Tokenization & management of ZEV credits in alignment with the "VM0038 Methodology for Electric Vehicle Charging Systems" and "Two and Three Wheeled Personal Transportation" methodologies
20. Agrify Regenerative Methodology
21. Sector-Specific Food Loss & Waste GHG Reduction Policy 1.0 (SSFLWGRP001)
22. Food Loss & Waste (International) 1.0 Methodology
23. ESG Verifier
24. Verra VM0019 Methodology
25. EcoRegen Alliance
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ If you want to manually build every component with debug information, then build
* [NodeJS V20](https://nodejs.org)
* [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable)
* [Nats 1.12.2](https://nats.io/)
* [Redict 7.3.0](https://redict.io/)

### Build and start each component

Expand Down
9 changes: 9 additions & 0 deletions ai-service/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.dockerignore
.env
.git
.gitignore
.npmrc
dist
Dockerfile
node_modules
npm-debug.log
99 changes: 52 additions & 47 deletions ai-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,56 @@
FROM node:20 AS interfacesModuleBuilder
WORKDIR /usr/local/interfaces
COPY ./interfaces/package.json ./
COPY ./interfaces/tsconfig*.json ./
ADD ./interfaces/src ./src/.
RUN yarn install
RUN yarn pack

FROM node:20 AS commonModuleBuilder
WORKDIR /usr/local/common
COPY --from=interfacesModuleBuilder /usr/local/interfaces/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY ./common/package.json ./
COPY ./common/tsconfig*.json ./
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN yarn install
ADD ./common/src ./src/.
RUN yarn pack

FROM node:20 AS apiAIServiceBuilder
WORKDIR /usr/local/ai-service
COPY --from=interfacesModuleBuilder /usr/local/interfaces/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --from=commonModuleBuilder /usr/local/common/guardian-common-*.tgz /tmp/common.tgz
COPY ./ai-service/package.json ./
COPY ./ai-service/tsconfig*.json ./
ADD ./ai-service/data ./data/.
ADD ./ai-service/faiss-vector ./faiss-vector/.
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"

RUN yarn install
ADD ./ai-service/src ./src/.
RUN yarn run build:prod

FROM node:20
ENV PLATFORM="docker"
ENV NODE_ENV="production"
WORKDIR /usr/local/ai-service
WORKDIR /usr/local/ai-service
COPY --from=interfacesModuleBuilder /usr/local/interfaces/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --from=commonModuleBuilder /usr/local/common/guardian-common-*.tgz /tmp/common.tgz
COPY ./ai-service/package*.json ./
# syntax=docker/dockerfile:1
# Stage 0: Use node image for base image for all stages
ARG NODE_VERSION=20.11.1-alpine
FROM node:${NODE_VERSION} as base
WORKDIR /usr/local/app
# Define an argument `YARN_CACHE_FOLDER` for the Yarn cache directory
ARG YARN_CACHE_FOLDER=/root/.yarn

# Stage 1: Build interfaces module
FROM base as interfaces
COPY --link interfaces/package.json interfaces/tsconfig*.json yarn.lock ./
COPY --link interfaces/src src/
# Here and after. Leverage a cache mount to /root/.yarn to speed up subsequent builds
RUN --mount=type=cache,target=/root/.yarn \
yarn install --frozen-lockfile && yarn pack

# Stage 2: Build common module
FROM base as common
COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --link common/package.json common/tsconfig*.json yarn.lock ./
COPY --link common/src src/
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN --mount=type=cache,target=/root/.yarn \
yarn install && yarn pack

# Stage 3: Installing production dependecies
FROM base as deps
COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz
COPY --link ai-service/package.json ai-service/tsconfig*.json yarn.lock ./
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN --mount=type=cache,target=/root/.yarn,sharing=private \
yarn install --prod

# Stage 4: Build service
FROM base as build
COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz
COPY --link --from=deps /usr/local/app/package.json /usr/local/app/tsconfig*.json /usr/local/app/yarn.lock ./
COPY --link ai-service/src src/
RUN --mount=type=cache,target=/root/.yarn \
yarn install --frozen-lockfile && yarn run build:prod

# Stage 5: Create the final image
FROM base as image
ENV NODE_ENV production

RUN yarn install
COPY --from=apiAIServiceBuilder /usr/local/ai-service/dist ./dist
ADD ./ai-service/data ./data/.
ADD ./ai-service/faiss-vector ./faiss-vector/.
# Copy the production dependencies from the deps stage and the built application from the build stage into the image
COPY --link --from=deps /usr/local/app/node_modules node_modules/
COPY --link --from=deps /usr/local/app/package.json ./
COPY --link --from=build /usr/local/app/dist dist/

# Change the user to node
USER node

CMD yarn start
CMD [ "node", "dist/index.js" ]
14 changes: 6 additions & 8 deletions ai-service/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "ai-service",
"version": "2.23.1",
"version": "2.24.0",
"main": "dist/app.js",
"license": "Apache-2.0",
"dependencies": {
"@guardian/common": "^2.23.1",
"@guardian/interfaces": "^2.23.1",
"@mikro-orm/core": "5.7.12",
"@mikro-orm/mongodb": "5.7.12",
"@guardian/common": "^2.24.0",
"@guardian/interfaces": "^2.24.0",
"@mikro-orm/core": "^6.1.11",
"@mikro-orm/mongodb": "^6.1.11",
"@nestjs/common": "^9.4.1",
"@nestjs/core": "^9.4.1",
"@types/express": "^4.17.18",
Expand All @@ -32,7 +32,5 @@
"devDependencies": {
"nodemon": "^3.0.1"
},
"resolutions": {
"@types/mime": "3.0.4"
}
"type": "module"
}
11 changes: 5 additions & 6 deletions ai-service/src/ai-manager.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { FilesManager } from './helpers/files-manager-helper';
import { FilesManager } from './helpers/files-manager-helper.js';
import { FaissStore } from 'langchain/vectorstores/faiss';
import { RetrievalQAChain } from 'langchain/chains';
import { OpenAI } from 'langchain/llms/openai';
import { OpenAIConnect } from './helpers/openai-helper';
import { VectorStorage } from './helpers/vector-storage-helper';
import { AISuggestionsDB } from './helpers/ai-suggestions-db';
import { PolicyDescription } from './models/models';

import { OpenAIConnect } from './helpers/openai-helper.js';
import { VectorStorage } from './helpers/vector-storage-helper.js';
import { AISuggestionsDB } from './helpers/ai-suggestions-db.js';
import { PolicyDescription } from './models/models.js';
import * as dotenv from 'dotenv';
import { Logger, Policy, PolicyCategory } from '@guardian/common';

Expand Down
4 changes: 2 additions & 2 deletions ai-service/src/api/service/ai-suggestions-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiResponse } from '../../helpers/api-response';
import { AIManager } from '../../ai-manager';
import { ApiResponse } from '../../helpers/api-response.js';
import { AIManager } from '../../ai-manager.js';
import { MessageAPI } from '@guardian/interfaces';
import { MessageError, MessageResponse } from '@guardian/common';

Expand Down
Loading

0 comments on commit f450893

Please sign in to comment.