diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d0d648d2c1..b3b0e85b3f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,19 +28,19 @@ repos: - id: deno-fmt name: Deno format language: system - entry: bash -c 'cd typegate && deno fmt --ignore=native,src/typegraphs,tmp,tests/e2e/nextjs,tests/metagen/typegraphs/sample/ts/client.ts && cd ../dev && deno fmt && cd ../typegraph/deno && deno fmt --ignore=node_modules,dist && cd ../../libs/metagen/src && deno fmt' + entry: bash -c 'cd src/typegate && deno fmt --ignore=native,src/typegraphs,tmp,tests/e2e/nextjs,tests/metagen/typegraphs/sample/ts/client.ts && cd ../../tools && deno fmt && cd ../src/typegraph/deno && deno fmt --ignore=node_modules,dist && cd ../../../src/metagen/src && deno fmt' pass_filenames: false types: - ts - files: ^(typegate|dev|typegraph/deno)/ + files: ^(src/typegate|tools|src/typegraph/deno)/ - id: deno-lint name: Deno lint language: system - entry: bash -c 'cd typegate && deno lint --rules-exclude=no-explicit-any --ignore=native,tmp,tests/e2e/nextjs && cd ../dev && deno lint && cd ../libs/metagen/src/ && deno lint' + entry: bash -c 'cd src/typegate && deno lint --rules-exclude=no-explicit-any --ignore=native,tmp,tests/e2e/nextjs && cd ../../tools && deno lint && cd ../src/metagen/src/ && deno lint' pass_filenames: false types: - ts - files: ^(typegate|dev)/ + files: ^(src/typegate|tools)/ - id: es-lint name: Eslint website language: system @@ -100,17 +100,17 @@ repos: name: "License MPL-2.0 python" args: #- --remove-header - - --license-filepath=dev/license-header-MPL-2.0.txt + - --license-filepath=tools/license-header-MPL-2.0.txt - "--comment-style=#" - "--skip-license-insertion-comment=no-auto-license-header" types_or: - python files: ^typegraph/ - id: insert-license - name: "License Elastic-2.0 rust" + name: "License MPL-2.0 rust" args: #- --remove-header - - --license-filepath=dev/license-header-Elastic-2.0.txt + - --license-filepath=tools/license-header-MPL-2.0.txt - "--comment-style=//" - "--skip-license-insertion-comment=no-auto-license-header" - "--skip-license-insertion-comment=@generated" @@ -121,38 +121,38 @@ repos: name: "License MPL-2.0 rust" args: #- --remove-header - - --license-filepath=dev/license-header-MPL-2.0.txt + - --license-filepath=tools/license-header-MPL-2.0.txt - "--comment-style=//" - "--skip-license-insertion-comment=no-auto-license-header" types_or: - rust files: ^(meta-cli|typegraph|libs/metagen)/ - id: insert-license - name: "License Elastic-2.0 deno" + name: "License MPL-2.0 deno" args: #- --remove-header - - --license-filepath=dev/license-header-Elastic-2.0.txt + - --license-filepath=tools/license-header-MPL-2.0.txt - "--comment-style=//" - "--skip-license-insertion-comment=no-auto-license-header" - "--skip-license-insertion-comment=@generated" types_or: - ts - files: ^(typegate|dev)/ + files: ^(typegate|tools)/ - id: insert-license name: "License MPL-2.0 deno" args: #- --remove-header - - --license-filepath=dev/license-header-MPL-2.0.txt + - --license-filepath=tools/license-header-MPL-2.0.txt - "--comment-style=//" - "--skip-license-insertion-comment=no-auto-license-header" types_or: - ts files: ^typegraph/ - id: insert-license - name: "License Elastic-2.0 typescript" + name: "License MPL-2.0 typescript" args: #- --remove-header - - --license-filepath=dev/license-header-Elastic-2.0.txt + - --license-filepath=tools/license-header-MPL-2.0.txt - "--comment-style=//" - "--skip-license-insertion-comment=no-auto-license-header" types_or: diff --git a/Cargo.lock b/Cargo.lock index 193fe71cb9..db49daf380 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1600,7 +1600,7 @@ dependencies = [ [[package]] name = "common" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "async-trait", @@ -6891,7 +6891,7 @@ dependencies = [ [[package]] name = "meta-cli" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "actix", "assert_cmd", @@ -6958,7 +6958,7 @@ dependencies = [ [[package]] name = "metagen" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "color-eyre", "common", @@ -7307,7 +7307,7 @@ dependencies = [ [[package]] name = "mt_deno" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "deno", @@ -11268,7 +11268,7 @@ dependencies = [ [[package]] name = "substantial" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "chrono", @@ -12756,7 +12756,7 @@ dependencies = [ [[package]] name = "typegate" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "colored", "env_logger 0.11.0", @@ -12769,7 +12769,7 @@ dependencies = [ [[package]] name = "typegate_engine" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "base64 0.22.1", @@ -12814,7 +12814,7 @@ dependencies = [ [[package]] name = "typegraph_core" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "color-eyre", @@ -14567,7 +14567,7 @@ checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" [[package]] name = "xtask" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 4deca359b8..dc6aa63196 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ exclude = [ ] [workspace.package] -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" [workspace.dependencies] diff --git a/LICENSE.md b/LICENSE.md index f92a4d1827..9c9d472da2 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,35 +1,359 @@ -# License +# Mozilla Public License Version 2.0 (MPL-2.0) -Copyright © Metatype OÜ. +1. Definitions -Portions of this repository are licensed as follows: +--- -- all third party components incorporated into the repository are licensed under - the original license provided by the owner of the applicable component (see - the license header of the relevant files) -- all content under `typegraph/` and `meta-cli/` is licensed under - [Mozilla Public License 2.0 (MPL-2.0)](./tools/LICENSE-MPL-2.0.md) -- all content outside the above-mentioned files or restrictions is available - under the [Elastic License 2.0 (Elastic-2.0)](./tools/LICENSE-Elastic-2.0.md) -- alternatively, the Metatype Commercial Licensing can take precedence in case - your usage requires ad-hoc clarifications (reach out!) +1.1. "Contributor" means each individual or legal entity that creates, +contributes to the creation of, or owns Covered Software. -**Are all of Metatype's components open source?** +1.2. "Contributor Version" means the combination of the Contributions of others +(if any) used by a Contributor and that particular Contributor's Contribution. -Strictly speaking, only the ones licensed under the MPL-2.0 license are. The -rest is not an open source software as define by the -[Open Source Initiative](https://opensource.org/osd). However, they belong to -the [Fair-code](https://faircode.io) family and promotes similar values (free to -use, distribution-friendly, open source code, easily extensible), yet allowing -to build a sustainable ecosystem for all around it. +1.3. "Contribution" means Covered Software of a particular Contributor. -We are strong believer in open source mindset and are committed to contribute -back as much as possible of the internals to the community as Metatype grows. +1.4. "Covered Software" means Source Code Form to which the initial Contributor +has attached the notice in Exhibit A, the Executable Form of such Source Code +Form, and Modifications of such Source Code Form, in each case including +portions thereof. -**Conditions or obligations of the license is not clear enough for me or my -company, what can I do?** +1.5. "Incompatible With Secondary Licenses" means -Fair-code licenses may have some fuzzy license boundaries, and we definitely do -not want this to stop your usage. In case there is any doubt, please reach out -to our support for clarification. We will be pleased to help you build the -future with Metatype as a core element. + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" means any form of the work other than Source Code Form. + +1.7. "Larger Work" means a work that combines Covered Software with other +material, in a separate file or files, that is not Covered Software. + +1.8. "License" means this document. + +1.9. "Licensable" means having the right to grant, to the maximum extent +possible, whether at the time of the initial grant or subsequently, any and all +of the rights conveyed by this License. + +1.10. "Modifications" means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor means any patent claim(s), including +without limitation, method, process, and apparatus claims, in any patent +Licensable by such Contributor that would be infringed, but for the grant of the +License, by the making, using, selling, offering for sale, having made, import, +or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" means either the GNU General Public License, Version +2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General +Public License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" means the form of the work preferred for making +modifications. + +1.14. "You" (or "Your") means an individual or a legal entity exercising rights +under this License. For legal entities, "You" includes any entity that controls, +is controlled by, or is under common control with You. For purposes of this +definition, "control" means (a) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or otherwise, or (b) +ownership of more than fifty percent (50%) of the outstanding shares or +beneficial ownership of such entity. + +2. License Grants and Conditions + +--- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive +license: + +(a) under intellectual property rights (other than patent or trademark) +Licensable by such Contributor to use, reproduce, make available, modify, +display, perform, distribute, and otherwise exploit its Contributions, either on +an unmodified basis, with Modifications, or as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer for sale, +have made, import, and otherwise transfer either its Contributions or its +Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution become +effective for each Contribution on the date the Contributor first distributes +such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under this +License. No additional rights or licenses will be implied from the distribution +or licensing of Covered Software under this License. Notwithstanding Section +2.1(b) above, no patent license is granted by a Contributor: + +(a) for any code that a Contributor has removed from Covered Software; or + +(b) for infringements caused by: (i) Your and any other third party's +modifications of Covered Software, or (ii) the combination of its Contributions +with other software (except as part of its Contributor Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of its +Contributions. + +This License does not grant any rights in the trademarks, service marks, or +logos of any Contributor (except as may be necessary to comply with the notice +requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to distribute +the Covered Software under a subsequent version of this License (see Section +10.2) or under the terms of a Secondary License (if permitted under the terms of +Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its Contributions are +its original creation(s) or it has sufficient rights to grant the rights to its +Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under applicable +copyright doctrines of fair use, fair dealing, or other equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in +Section 2.1. + +3. Responsibilities + +--- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under the +terms of this License. You must inform recipients that the Source Code Form of +the Covered Software is governed by the terms of this License, and how they can +obtain a copy of this License. You may not attempt to alter or restrict the +recipients' rights in the Source Code Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code Form, as +described in Section 3.1, and You must inform recipients of the Executable Form +how they can obtain a copy of such Source Code Form by reasonable means in a +timely manner, at a charge no more than the cost of distribution to the +recipient; and + +(b) You may distribute such Executable Form under the terms of this License, or +sublicense it under different terms, provided that the license for the +Executable Form does not attempt to limit or alter the recipients' rights in the +Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, provided +that You also comply with the requirements of this License for the Covered +Software. If the Larger Work is a combination of Covered Software with a work +governed by one or more Secondary Licenses, and the Covered Software is not +Incompatible With Secondary Licenses, this License permits You to additionally +distribute such Covered Software under the terms of such Secondary License(s), +so that the recipient of the Larger Work may, at their option, further +distribute the Covered Software under the terms of either this License or such +Secondary License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices (including +copyright notices, patent notices, disclaimers of warranty, or limitations of +liability) contained within the Source Code Form of the Covered Software, except +that You may alter any license notices to the extent required to remedy known +factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, indemnity +or liability obligations to one or more recipients of Covered Software. However, +You may do so only on Your own behalf, and not on behalf of any Contributor. You +must make it absolutely clear that any such warranty, support, indemnity, or +liability obligation is offered by You alone, and You hereby agree to indemnify +every Contributor for any liability incurred by such Contributor as a result of +warranty, support, indemnity or liability terms You offer. You may include +additional disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + +--- + +If it is impossible for You to comply with any of the terms of this License with +respect to some or all of the Covered Software due to statute, judicial order, +or regulation then You must: (a) comply with the terms of this License to the +maximum extent possible; and (b) describe the limitations and the code they +affect. Such description must be placed in a text file included with all +distributions of the Covered Software under this License. Except to the extent +prohibited by statute or regulation, such description must be sufficiently +detailed for a recipient of ordinary skill to be able to understand it. + +5. Termination + +--- + +5.1. The rights granted under this License will terminate automatically if You +fail to comply with any of its terms. However, if You become compliant, then the +rights granted under this License from a particular Contributor are reinstated +(a) provisionally, unless and until such Contributor explicitly and finally +terminates Your grants, and (b) on an ongoing basis, if such Contributor fails +to notify You of the non-compliance by some reasonable means prior to 60 days +after You have come back into compliance. Moreover, Your grants from a +particular Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the first +time You have received notice of non-compliance with this License from such +Contributor, and You become compliant prior to 30 days after Your receipt of the +notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, counter-claims, and +cross-claims) alleging that a Contributor Version directly or indirectly +infringes any patent, then the rights granted to You by any and all Contributors +for the Covered Software under Section 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user +license agreements (excluding distributors and resellers) which have been +validly granted by You or Your distributors under this License prior to +termination shall survive termination. + +--- + +- + - +- + 6. Disclaimer of Warranty * +- ------------------------- * +- + - +- Covered Software is provided under this License on an "as is" * +- basis, without warranty of any kind, either expressed, implied, or * +- statutory, including, without limitation, warranties that the * +- Covered Software is free of defects, merchantable, fit for a * +- particular purpose or non-infringing. The entire risk as to the * +- quality and performance of the Covered Software is with You. * +- Should any Covered Software prove defective in any respect, You * +- (not any Contributor) assume the cost of any necessary servicing, * +- repair, or correction. This disclaimer of warranty constitutes an * +- essential part of this License. No use of any Covered Software is * +- authorized under this License except under this disclaimer. * +- + - + +--- + +--- + +- + - +- + 7. Limitation of Liability * +- -------------------------- * +- + - +- Under no circumstances and under no legal theory, whether tort * +- (including negligence), contract, or otherwise, shall any * +- Contributor, or anyone who distributes Covered Software as * +- permitted above, be liable to You for any direct, indirect, * +- special, incidental, or consequential damages of any character * +- including, without limitation, damages for lost profits, loss of * +- goodwill, work stoppage, computer failure or malfunction, or any * +- and all other commercial damages or losses, even if such party * +- shall have been informed of the possibility of such damages. This * +- limitation of liability shall not apply to liability for death or * +- personal injury resulting from such party's negligence to the * +- extent applicable law prohibits such limitation. Some * +- jurisdictions do not allow the exclusion or limitation of * +- incidental or consequential damages, so this exclusion and * +- limitation may not apply to You. * +- + - + +--- + +8. Litigation + +--- + +Any litigation relating to this License may be brought only in the courts of a +jurisdiction where the defendant maintains its principal place of business and +such litigation shall be governed by laws of that jurisdiction, without +reference to its conflict-of-law provisions. Nothing in this Section shall +prevent a party's ability to bring cross-claims or counter-claims. + +9. Miscellaneous + +--- + +This License represents the complete agreement concerning the subject matter +hereof. If any provision of this License is held to be unenforceable, such +provision shall be reformed only to the extent necessary to make it enforceable. +Any law or regulation which provides that the language of a contract shall be +construed against the drafter shall not be used to construe this License against +a Contributor. + +10. Versions of the License + +--- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section 10.3, +no one other than the license steward has the right to modify or publish new +versions of this License. Each version will be given a distinguishing version +number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version of the +License under which You originally received the Covered Software, or under the +terms of any subsequent version published by the license steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to create a +new license for such software, you may create and use a modified version of this +License if you rename the license and remove any references to the name of the +license steward (except to note that such modified license differs from this +License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + +If You choose to distribute Source Code Form that is Incompatible With Secondary +Licenses under the terms of this version of the License, the notice described in +Exhibit B of this License must be attached. + +## Exhibit A - Source Code Form License Notice + +This Source Code Form is subject to the terms of the Mozilla Public License, v. +2.0. If a copy of the MPL was not distributed with this file, You can obtain one +at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, then +You may include the notice in a location (such as a LICENSE file in a relevant +directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. + +## Exhibit B - "Incompatible With Secondary Licenses" Notice + +This Source Code Form is "Incompatible With Secondary Licenses", as defined by +the Mozilla Public License, v. 2.0. diff --git a/deno.lock b/deno.lock index e6c4617d83..aa1b3b2474 100644 --- a/deno.lock +++ b/deno.lock @@ -9,7 +9,6 @@ "jsr:@std/assert@^1.0.2": "jsr:@std/assert@1.0.4", "jsr:@std/assert@^1.0.4": "jsr:@std/assert@1.0.6", "jsr:@std/assert@^1.0.6": "jsr:@std/assert@1.0.6", - "jsr:@std/async@^1.0.3": "jsr:@std/async@1.0.3", "jsr:@std/bytes@^0.221.0": "jsr:@std/bytes@0.221.0", "jsr:@std/bytes@^1.0.2": "jsr:@std/bytes@1.0.2", "jsr:@std/bytes@^1.0.2-rc.3": "jsr:@std/bytes@1.0.2", @@ -47,7 +46,6 @@ "jsr:@std/semver@^1.0.1": "jsr:@std/semver@1.0.2", "jsr:@std/streams@0.221.0": "jsr:@std/streams@0.221.0", "jsr:@std/streams@1": "jsr:@std/streams@1.0.4", - "jsr:@std/streams@^1.0.2": "jsr:@std/streams@1.0.4", "jsr:@std/testing@^1.0.1": "jsr:@std/testing@1.0.2", "jsr:@std/url@^0.225.0": "jsr:@std/url@0.225.0", "jsr:@std/uuid@^1.0.1": "jsr:@std/uuid@1.0.2", @@ -114,9 +112,6 @@ "jsr:@std/internal@^1.0.4" ] }, - "@std/async@1.0.3": { - "integrity": "6ed64678db43451683c6c176a21426a2ccd21ba0269ebb2c36133ede3f165792" - }, "@std/bytes@0.221.0": { "integrity": "64a047011cf833890a4a2ab7293ac55a1b4f5a050624ebc6a0159c357de91966" }, @@ -2085,6 +2080,122 @@ "https://raw.githubusercontent.com/metatypedev/ghjk/v0.2.1/utils/unarchive.ts": "f6d0e9e75f470eeef5aecd0089169f4350fc30ebfdc05466bb7b30042294d6d3", "https://raw.githubusercontent.com/metatypedev/ghjk/v0.2.1/utils/url.ts": "e1ada6fd30fc796b8918c88456ea1b5bbd87a07d0a0538b092b91fd2bb9b7623", "https://raw.githubusercontent.com/metatypedev/ghjk/v0.2.1/utils/worker.ts": "ac4caf72a36d2e4af4f4e92f2e0a95f9fc2324b568640f24c7c2ff6dc0c11d62", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/engine/bindings.ts": "7c3e28ec60a0381030310228be6c02f1a434046b4cbcf793a537aaef47be949f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/engine/runtime.js": "1ae55e76d3de8e79c37054d9127c92af496ce10aa905ea64021893048bb33794", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config.ts": "63ea402f9a993888a9e3ec88d35112186f8f13bcd3a5fe358e69e0bb603311a5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config/loader.ts": "91cc2b67cc9bee413b0b44f9aa2ea7814f50e2465e6bc114eece248554d7477d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config/shared.ts": "252b42038eb68059b2cac85c792e36f5849b8e7392b98452341ccc3ee680a774", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/config/types.ts": "73357168542ef041da67997acdd98097444d92f0a1663be03ad1523fd20f768c", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/crypto.ts": "f550775b9e5bf9e7ec286a1596246a631b117fd91e093169bcad4898fb729634", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/computation_engine.ts": "07a3826fcf0bb13eb3912b8e5cbf69932848cd28c1c4ebda7042f977510d00a5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/args.ts": "de16ba5c087afae319f65d02ab39779146da37ea925f610da8887cffe7828060", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/dependency_resolver.ts": "b851f4a6e2d500f9427dd1a59920d6c71f10904b31863bb1fac4d26e01d02b67", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/injection_utils.ts": "6f9ad0f8f9cde9a985b6ad36bf58418637a85f50749abe6870c792ade7dc45a2", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/mod.ts": "9a4429e7a579903f4f67ab53bd602b2d05a58138bdbd91c7cc5b1b44cf714b68", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/parameter_transformer.ts": "3ba3b9603c6d28c0d54648f8177bce30b8b667e0e1be903d468af3f2645649ff", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/planner/policies.ts": "caf3cfd8a46e21a5d09fdb46882d6ea4ffb376c56070bdb1ccff92fa70989d63", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/query_engine.ts": "39281c309b3d72123fcd8695700bd2831956e09d2b1c082ef899886beea6ae82", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/stage_id.ts": "b3b3c62215ff421103788079b77943af8f0026a56eafaa929415cb39ccde3cca", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/code_generator.ts": "edb77e2b98da2f040d3f7567d204dba2a3d8c66ae1a7c2709c049e464763f0cd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/common.ts": "b585975e1a978dfa966df1a549261049ab159077bc90203a33bfe8ae055b3c6f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/common.ts": "112f56c8e590215b0af0c1b46dc84b85cb5b9b43621a52646876c35a43103499", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/constraints.ts": "3237d0acce31aca8b2f2bbc0cae8a82d86f3671fcc7fabc3158037c4f79008f5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/list.ts": "bd70fef3bc3840cfb6255a518de5fdb3db79a68a4481594475aebcbdd6a10102", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/number.ts": "9890c8af998dca2e573fc2ad02e63d9abc9b506b4a0c451d31f5916a8888e401", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/object.ts": "bd4f8891ee823bf82481df2ee181256514fd7299b5fe4fd7cd7194defa228f57", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/inline_validators/string.ts": "914a2b809a344075279578cb35ac3d03cb6025eb9f62c1f9f86958191b9857da", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/input.ts": "cf24fcffa1891dfc2f2af941a64aade9da069a6ef92baa432e2d7dcf5f9a8b86", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/matching_variant.ts": "aca8db649194921a01aca42b02113d0735262bb63d41ec44174e61c4cfa85369", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/engine/typecheck/result.ts": "6544f206b67c32015950ec96134415c261a60f54c469c1cd73f8accadf87fff6", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/errors.ts": "29dfbfdc8b7a85ee9551831d6db882e50a4e0104102b5885b2bd9a42878365f6", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/libs/jsonpath.ts": "f6851288fb8600dec0e62d5f804f41332b6197b255b6497360ba7e4b7f375cba", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/log.ts": "1330c01d489956c7530e2f2e2e60967f30c6b3a0c5c1d6c18d161ea2cf44fa0e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/main.ts": "f390cfd2b5b836f1a54fa9ea7d8a5f5ba80430b6e849032145c0a7c0ae7216f3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/Runtime.ts": "cc476f09f7d32d10dec3812a9a589da2866247e2064ce149ea2dc68fca833730", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno.ts": "c893dcf170b38547239d550080a856aca46a788de9922f282bbacf9b5841b5fe", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/deno.ts": "bb0cdad8e785d43f6c59232e214fab82d43476acbcef740f561708b064bae172", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/deno_messenger.ts": "81160c8a9c9817b46b52c4eee15cde880fb3f6b013c3b5110ee07a4c9c7f7a5e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/shared_types.ts": "34d56aa89c5a34e943a34b623b20d13ca54ab5466ea5313e0543da68b7aebcb1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/deno/worker.ts": "ffeabab915301a666ac06b28989d5be4b29e600fb2932e25005ec1c9f48aac1d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/graphql.ts": "5f0f4125367fd5fc43ccb2b8c9e8ba1f9c84348595e70e5ed9870e776d2efed3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/grpc.ts": "92b2f5214ebe0f7b61e582faa67d6759641feaf788166a939ec6db8d819708da", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/http.ts": "f598a33aa3cafcf37a1f33d84c06bfd0ef5fd768f72837042c83ac6ae1d90762", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/kv.ts": "7d87409d8f93a4f684e1a0aabd020e5f3e559669fe3ca8efee9cd5045fde99dd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/mod.ts": "26c06f1bff03255c20df97e1a109944b6fd2872acbb27aa97ab38b081fb19d7e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/patterns/messenger/async_messenger.ts": "40644e011e3a258138ff1fb7a5323754a547016da9c1deb2114cfc471ee28bf0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/patterns/messenger/lazy_async_messenger.ts": "b93d5e7252231d27d6b76ec4172d67cc23880b78411fb371d0cba2db712e2161", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma.ts": "e4b679c3b5e28a323d72bde5ebbcc113abe0efc8da82d70b3b2e390149c57d84", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/hooks/generate_schema.ts": "f55ffcb6fdfdfcb29eb5543ac23f89e224fc7e233f4ec598f7c5f44f05eefed2", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/hooks/mod.ts": "3e33752e3676b538c7016f3ddd4f1f49d75e217c410bcaa6319d33ed987d3c60", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts": "b94b09ecdc7d81ddcfd7596ae8cfb1ebbc8896d4c67207da627dcd79d19c658c", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/migration.ts": "f501540557b13a32f7b57e5a87f4ae1794cdd95214a49b34a429d7a33a96d5d8", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/mod.ts": "a0e44e86a45aad8b2bb0357ddbe8ba02802e6979451553940ec3688be571127f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/prisma.ts": "bc370cfcb0f2aad520b8d2fd082e18dad5d41386225b50c9ce577b6c45df55b3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/prisma/types.ts": "b4912f164aa8cdb1db3a98238a0271882864ff2778c10920dd7f0f3d59165dd6", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/python.ts": "77e7f683830962365ce7ce0af5fc5d326e11bc9751ab33d7add16d27feb32633", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/random.ts": "e7651e262ef5857e777ad46877c66f9098a2dfe774c13720a4cd38be327b53ff", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/s3.ts": "d7a0372faf555180bd4326550c1c6a07b156d3c5f0bbbcf9c0f6eb4b0f2bfff1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial.ts": "175644d75911d09919c06577bfa86239b3a44b1217664035551ff0989e22882a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial/agent.ts": "223288cb3d7baa02fa2d4e37207da7fa69cf4f16eb04ed7810d3e91ac725615b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial/types.ts": "8255ea84c5129ffc049d6fa88ad57eadf298d420ff11782c43eae9d2031efed1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts": "589611456b82df0637db5f63af0881a459747d7c8963684bdcde291af13515cd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/temporal.ts": "fef8a8f70d3f75957a5a741c275abea96cc492722784ea4aadffd9fce9cbff3f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/typegate.ts": "52d49471d2682c1be323b53e4cca9866f2babb93708a855daa8c471ba4174b64", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/typegraph.ts": "e5808e5a20080fc260e54113e5941e5dffaeead5e3b7448dc17a48031d4799cf", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/utils/graphql_forward_vars.ts": "f0bb091aadd191eb1491dd86b7abd311ab60e09f532d226c8328b2cfa6025d9e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/utils/graphql_inline_vars.ts": "9c3c339ee596c93cf65cda696d756c9ef08d34b78e4136472e27a92f2254ec8a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/utils/http.ts": "842af99040fd0e3456690f7674311da3a0b9ea64c608d7bc588df1ab28f163a3", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/wasm_reflected.ts": "99d59cdd0c4b228c42ac90099036ecf5d2e14d6758916b27e4017d53b69cf481", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/wasm_wire.ts": "d10c891f12c9521bcd1a7e1cb459f642a5f4e0936f25f4e04174141691ba06d1", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/runtimes/wit_wire/mod.ts": "78ff89ee3972aafd73be8965e1f682b5877c9d1fc4ec2bce0db09f7bc13a0252", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/artifact_service.ts": "282a9a6c3d89afc8955aabab6b3b242edccba664f5f41558e9c9b07d43dd8d13", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/cookies.ts": "ee17535cb19eab884732cefcdc46e63a2905041d5b5942e9ad6783c50a1f8624", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/mod.ts": "5b15823ec19cec1c985a77d525ee2e9e5c5aa367f5e24c96e305e485b6c633a9", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/basic.ts": "3c233ae1ccd0d3a8ff47a32c74682921abaf84e0de7c096f220f63b05756fc58", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/internal.ts": "7a9173406fbc1b885e08dd74a8dd34f168de2f1e9bedef4cdd88dad613e59166", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/jwt.ts": "e39249df7c2d088da07af1ccf5e97815addb46a994469efd4a335f6ae8618bc5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/oauth2.ts": "7172cc6da5ecba71775bbc2d467d52d1f78505204e55452170f35004923b847b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/protocols/protocol.ts": "158c55618be6165a9ee393ccd1a9da267b084ff04df7e627af1e4fc8fe636644", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/routes/mod.ts": "8fe85c16feb3da7086d3d6fd19a4579585b632893f3534c533c60aed84b9413a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/routes/take.ts": "bc343c5d34870aeeaf9b0cc9473ba18fe7b324a23a630a57c9fd41eea4418a46", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/auth/routes/validate.ts": "56e52bb6d1660735683bdd398a86936f24ad8a00e402b7d88790867ad559e476", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/graphql_service.ts": "458e3cedcd22a44e166e531bcac4c65972916d81f3776c8161b2440ad212626f", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/info_service.ts": "a9a1f6ebdcbe64d55806597b879dd5714c32b8b861bed695a944f5e2f1213beb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/middlewares.ts": "8af6277ce67c940564538f4def8e6567b5783b51f7c5f38c902736d620ffe405", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/playground_service.ts": "2cc8689899be7c31ad6c2e9c2c5adde0c6cc1f1442b27a55e8ead830e867dbe5", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/responses.ts": "5c45923c1374aab1ac8dd5b1a09ae69062ab34a448f8e92630678a236e38b2ba", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/services/rest_service.ts": "ae6ffdbddaccdbc7ed11dfb86511f2917332dcf5ae22ed814e1059e640ff7b08", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/sync/replicated_map.ts": "6b94fb884ce81d7e17572ae0abbeb91ceadb31f9356c4e9255982a00edcfe729", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/sync/typegraph.ts": "78120bc4d35e728ed86a98781c5d60996050fa8b35fa91f563c3c8b2a964b5dd", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/system_typegraphs.ts": "51299d60c1bb75b3e74998eb77bdf1680ee9d4a2f29a267d3ca90b2867c577fb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/gq.ts": "78435e53ec1c5b7aec29364c051eb8f10802714050d24ee68a65e1e263495d7d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/graphql.ts": "9f4aa79276e05acc6020da2a18472a1cc54c0ecf42efcbf017d67a88b0b90af2", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/request_parser.ts": "afbc95debcb1bbfa6fc2b88937d7abedbed1f4335bb2d17bf98c7293761cfdb0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/typegraph.ts": "fc0ba3f62e1dd687a0545adb1dbaf7185176e0f1e938bfdd29cfef7f85951635", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/graphql/utils.ts": "d09147add80f5e53a643ed3126ee8675a1655480728311de2def04ffe6262a4b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/transports/rest/rest_schema_generator.ts": "c776e83c6a55e9bee3ec72c36c1d771b3ca711e4086b3728e4983ab866472624", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/artifacts/local.ts": "d36ece0f53a56922744dd4d3e170101466b3816ba136f9574e799880e27d1a4b", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/artifacts/mod.ts": "fc931ffd49dc168da12882acf1055d3252e0cb3b666928e67d08d2a6c5be3447", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/artifacts/shared.ts": "5061a07eb880e33c1543e7397e945d50b476ed51d81fc01d109c53295f089131", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/hooks.ts": "ea97c08285388300802676d03dbc06caadf060093736abce07ef8f99a60e9a04", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/memory_register.ts": "6eab24914a941f85c233037013dc13749d8b689c5f9ffb38600df4c7b00a94f0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/mod.ts": "d9f10b53a40192863a431c6be541effb4fd3c012ed8a716712d5176eba8c884a", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/no_limiter.ts": "1e98610a737bd74668f80b7014c64669a59a801355340eaa14411e07f4a8a94e", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/rate_limiter.ts": "b5718ab9e718314f11f5d88d84795bd0e61575856470793f1fe83d499f4a9d40", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegate/register.ts": "d7a8732386ad019d4dcee0372b6cab93bfc55e0146729842db2aaecf1411b15d", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/mod.ts": "27c917783dd8cf99d06290c0768e852ab348c3e989e47c77e648ffcc564b79fb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/type_node.ts": "7f721cd5f6da2cbc7e66b804e0f81e0429aa2893e0a93244f9e66b39cb96b1a0", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/types.ts": "fc813b5f18e71b58e5f7904cd7fe3d6cae38b3c7055a8875042588c1561df160", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/utils.ts": "66fe8e1b5072f52ea2efebc5cf42001c3b858068b2d970ee3c8558032ff53103", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/versions.ts": "cdab4b07960f78c1f18511a8cc464a7e97c4c1fd15c6e8678c109483d3c26508", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraph/visitor.ts": "0fb0f89d92cb1654c1b010494a14c1aad88c7923102ea3e89866b232d3bcdf04", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraphs/introspection.json": "bbcf2c4233371c7f36052e5fe9e1cb1d18a46d3f31391cfcba2a3063c9141adb", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraphs/prisma_migration.json": "dfc346ff8fc2cef611c8f172b90e9d13eae6fed8b3dd65dea8631f9533159173", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/typegraphs/typegate.json": "bc0cbf4cd2c5de34410779994240993db4f1dd3d1eeda10b6045efdc37eb48a4", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/types.ts": "a36918c2bfab397edec906c23d2cd7558246337bb16fdf1ea4e353cffea5f2b4", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/utils.ts": "de1a17260e76607e1a8fd6d7384cbc21bb26e08f64bffc41d6508bf5a8359311", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/utils/hash.ts": "df6cf462c7a6a805b91dce9d3e7bbbd00ea3bfd8dcc973fb3e6c94e48e33d9b9", + "https://raw.githubusercontent.com/metatypedev/metatype/43faf1107eae75aacd3cb30d46ad0fba368eba7e/src/typegate/src/worker_utils.ts": "19f686d729b947ab3eb2f29e99ccd07578037a3bccced65fc0dce42d5338cd31", "https://raw.githubusercontent.com/metatypedev/metatype/54558c719cf3d491c396af019a50b68159c5209f/src/typegate/engine/bindings.ts": "4529b86703a1512302164bca346c29df2a246d0ebbf20248cc39ee9745490dc1", "https://raw.githubusercontent.com/metatypedev/metatype/54558c719cf3d491c396af019a50b68159c5209f/src/typegate/engine/runtime.js": "1ae55e76d3de8e79c37054d9127c92af496ce10aa905ea64021893048bb33794", "https://raw.githubusercontent.com/metatypedev/metatype/54558c719cf3d491c396af019a50b68159c5209f/src/typegate/src/config.ts": "63ea402f9a993888a9e3ec88d35112186f8f13bcd3a5fe358e69e0bb603311a5", diff --git a/docs/metatype.dev/blog/2024-09-26-introducing-grpc-runtime/GrpcMetatype.drawio.png b/docs/metatype.dev/blog/2024-09-26-introducing-grpc-runtime/GrpcMetatype.drawio.png new file mode 100644 index 0000000000..d62e1b535d Binary files /dev/null and b/docs/metatype.dev/blog/2024-09-26-introducing-grpc-runtime/GrpcMetatype.drawio.png differ diff --git a/docs/metatype.dev/blog/2024-09-26-introducing-grpc-runtime/index.mdx b/docs/metatype.dev/blog/2024-09-26-introducing-grpc-runtime/index.mdx new file mode 100644 index 0000000000..b5773abc52 --- /dev/null +++ b/docs/metatype.dev/blog/2024-09-26-introducing-grpc-runtime/index.mdx @@ -0,0 +1,110 @@ +# Introducing gRPC Runtime + +We're excited to announce the new gRPC Runtime feature in Metatype, further enhancing our platform's ability to create versatile and powerful backends through typegraphs. + +## What is gRPC? + +gRPC, or **g**oogle **R**emote **P**rocedure **C**all, is a high-performance, open-source communication framework initially developed by Google. It enables **efficient and fast communication between microservices** in a distributed system, making it ideal for modern backend architectures. + +Unlike traditional HTTP APIs that use JSON, gRPC relies on **Protocol Buffers** (protobufs) for serializing data, which are more compact and faster to process. This approach allows gRPC to support high-throughput, low-latency communication, which is crucial for applications where speed and efficiency matter, such as in real-time data processing or large-scale distributed systems. + +Key benefits of gRPC include: +- **Cross-language support**: gRPC supports multiple programming languages, allowing services written in different languages to communicate seamlessly. +- **Strong type safety**: Protocol Buffers ensure type-safe communication, catching errors early and improving reliability. +- **Bidirectional streaming**: gRPC allows for client and server streaming, enabling continuous data transfer in both directions, ideal for applications like real-time analytics. + +In short, gRPC is well-suited for high-performance, scalable backend systems where speed and type safety are essential. + +## Why gRPC Matters for Metatype + +Metatype is a platform that enables developers to create **typegraphs**—strongly-typed, composable backend structures that can support multiple protocols and runtime environments. With the introduction of the gRPC Runtime, Metatype allows developers to incorporate gRPC services into these typegraphs, further enhancing the platform’s versatility. + +By integrating gRPC, Metatype empowers developers to: +- **Expose gRPC services via GraphQL or HTTP endpoints**, making them accessible to clients in a way that best suits their needs. +- **Compose gRPC services with other backend components**, such as databases or other APIs, to create powerful and cohesive backend systems. + +## Diagram: gRPC and Metatype Integration + +
+ ![gRPC and Metatype Integration Diagram](./GrpcMetatype.drawio.png) +
+ + +*Metatype’s gRPC Runtime allows developers to integrate gRPC services into their typegraphs, enabling seamless interaction with gRPC services in the backend.* + +## Introducing gRPC Runtime in Metatype + +The new gRPC Runtime is the latest addition to Metatype's suite of runtimes, joining existing options like the HTTP runtime. This expansion allows you to incorporate gRPC services into your typegraphs, further enhancing the versatility of your Metatype-powered backends. + +## Key Technical Details + +### Architecture +The gRPC Runtime integrates seamlessly with Metatype's existing architecture. It acts as a bridge between your typegraph and external gRPC services, allowing you to incorporate gRPC calls alongside other runtime operations in your backend logic. + +1. **GrpcRuntime Class**: The main interface for defining gRPC interactions within your typegraph. +2. **proto_file**: Path to the .proto file that defines the gRPC service. +3. **endpoint**: The gRPC server address in the format `tcp://:`. +4. **call method**: Creates a typegraph function for gRPC method calls. + +### Implementation + +Here's how the gRPC Runtime fits into a Metatype typegraph: + +```python +from typegraph import Graph, Policy, typegraph +from typegraph.graph.params import Cors +from typegraph.runtimes.grpc import GrpcRuntime + +@typegraph( + cors=Cors(allow_origin=["https://metatype.dev", "http://localhost:3000"]), +) +def create_grpc_typegraph(g: Graph): + # The GrpcRuntime acts as a bridge between your typegraph and external gRPC services + grpc_runtime = GrpcRuntime( + # proto_file: Path to the .proto file that defines the gRPC service + proto_file="proto/helloworld.proto", + # endpoint: The gRPC server address in the format tcp://: + endpoint="tcp://localhost:4770" + ) + + # Expose the gRPC service within your typegraph + # This allows you to incorporate gRPC calls alongside other runtime operations + g.expose( + Policy.public(), + # call method: Creates a typegraph function for gRPC method calls + # It uses the full path to the gRPC method: /package_name.service_name/method_name + greet=grpc_runtime.call("/helloworld.Greeter/SayHello"), + ) + +# The typegraph can now be exposed via GraphQL or HTTP, +# allowing clients to interact with the gRPC service through Metatype's unified interface +``` +This implementation demonstrates how the gRPC Runtime integrates with your typegraph, allowing you to: + +1. Define gRPC service connections using the GrpcRuntime class +2. Expose gRPC methods as part of your typegraph +3. Combine gRPC functionality with other Metatype features and runtimes + +By structuring your gRPC interactions this way, you can seamlessly incorporate gRPC services into your larger Metatype-powered backend, alongside other data sources and business logic. + +## Benefits for Developers + +1. **Unified Backend Structure**: Incorporate gRPC services alongside other protocols and data sources in a single, coherent typegraph. +2. **Type Safety**: Leverage Metatype's strong typing system in conjunction with gRPC's protocol buffers for end-to-end type safety. +3. **Flexible Exposure**: Easily expose your gRPC services via GraphQL or HTTP endpoints, allowing clients to interact with them using their preferred protocol. +4. **Composability**: Combine gRPC calls with other runtime operations, database queries, or business logic within your typegraph. + +## Getting Started + +To start using the gRPC Runtime in your Metatype project: + +1. Ensure you have the latest version of Metatype installed. +2. Prepare your .proto files for the gRPC services you want to integrate. +3. Set up your typegraph as shown in the example above, incorporating the GrpcRuntime. +4. Configure your Metatype backend to expose the typegraph via GraphQL or HTTP as needed. + +## Conclusion + +The addition of the gRPC Runtime to Metatype further solidifies its position as a comprehensive platform for building robust, type-safe backends. By allowing seamless integration of gRPC services alongside other protocols and data sources, Metatype empowers developers to create versatile and powerful backend systems with ease. + +For more detailed documentation, code examples, and best practices, check out our [official Metatype docs](https://metatype.dev/docs)#. diff --git a/docs/metatype.dev/docs/reference/typegate/authentication/oauth2.tsx b/docs/metatype.dev/docs/reference/typegate/authentication/oauth2.tsx index 49663b0cb1..a555e6a6b2 100644 --- a/docs/metatype.dev/docs/reference/typegate/authentication/oauth2.tsx +++ b/docs/metatype.dev/docs/reference/typegate/authentication/oauth2.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React, { useCallback, useState } from "react"; import Link from "@docusaurus/Link"; diff --git a/docs/metatype.dev/docs/tutorials/metatype-basics/md2html.ts.src b/docs/metatype.dev/docs/tutorials/metatype-basics/md2html.ts.src index 63aa78ea51..0bb183ad42 100644 --- a/docs/metatype.dev/docs/tutorials/metatype-basics/md2html.ts.src +++ b/docs/metatype.dev/docs/tutorials/metatype-basics/md2html.ts.src @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import * as marked from "https://deno.land/x/marked/mod.ts"; diff --git a/docs/metatype.dev/globals.d.ts b/docs/metatype.dev/globals.d.ts index 3d2e322a14..6e901d07dc 100644 --- a/docs/metatype.dev/globals.d.ts +++ b/docs/metatype.dev/globals.d.ts @@ -1,4 +1,4 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 declare module "*.scss"; diff --git a/docs/metatype.dev/src/components/BlogIntro/index.tsx b/docs/metatype.dev/src/components/BlogIntro/index.tsx index 2e6c85ada1..c2b6bf7dfb 100644 --- a/docs/metatype.dev/src/components/BlogIntro/index.tsx +++ b/docs/metatype.dev/src/components/BlogIntro/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React from "react"; diff --git a/docs/metatype.dev/src/components/ChoicePicker/index.tsx b/docs/metatype.dev/src/components/ChoicePicker/index.tsx index fefac3fd6e..f5d58e0429 100644 --- a/docs/metatype.dev/src/components/ChoicePicker/index.tsx +++ b/docs/metatype.dev/src/components/ChoicePicker/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React, { PropsWithChildren } from "react"; diff --git a/docs/metatype.dev/src/components/CompareLandscape.tsx b/docs/metatype.dev/src/components/CompareLandscape.tsx index 47777b580c..d42f6ac7c9 100644 --- a/docs/metatype.dev/src/components/CompareLandscape.tsx +++ b/docs/metatype.dev/src/components/CompareLandscape.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React from "react"; diff --git a/docs/metatype.dev/src/components/DocButton/index.tsx b/docs/metatype.dev/src/components/DocButton/index.tsx index 69faba3c87..24fde09c18 100644 --- a/docs/metatype.dev/src/components/DocButton/index.tsx +++ b/docs/metatype.dev/src/components/DocButton/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React from "react"; import PaginatorNavLink from "@theme/PaginatorNavLink"; diff --git a/docs/metatype.dev/src/components/Features/index.tsx b/docs/metatype.dev/src/components/Features/index.tsx index e8e32bdf6b..be240d5c25 100644 --- a/docs/metatype.dev/src/components/Features/index.tsx +++ b/docs/metatype.dev/src/components/Features/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /* eslint-disable @typescript-eslint/no-var-requires */ diff --git a/docs/metatype.dev/src/components/Giscus/index.tsx b/docs/metatype.dev/src/components/Giscus/index.tsx index b84c18444c..4d1d3c15e8 100644 --- a/docs/metatype.dev/src/components/Giscus/index.tsx +++ b/docs/metatype.dev/src/components/Giscus/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React from "react"; import { default as Component } from "@giscus/react"; diff --git a/docs/metatype.dev/src/components/MiniQL/index.tsx b/docs/metatype.dev/src/components/MiniQL/index.tsx index 6b58ed1b56..e2efe2ef74 100644 --- a/docs/metatype.dev/src/components/MiniQL/index.tsx +++ b/docs/metatype.dev/src/components/MiniQL/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React, { useMemo, useState } from "react"; import { createGraphiQLFetcher } from "@graphiql/toolkit"; diff --git a/docs/metatype.dev/src/components/MiniQL/memory_store.ts b/docs/metatype.dev/src/components/MiniQL/memory_store.ts index fd1a0728b7..37ee910859 100644 --- a/docs/metatype.dev/src/components/MiniQL/memory_store.ts +++ b/docs/metatype.dev/src/components/MiniQL/memory_store.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export class MemoryStorage { private map: Map; diff --git a/docs/metatype.dev/src/components/Newsletter/index.tsx b/docs/metatype.dev/src/components/Newsletter/index.tsx index efcf5afe34..5c3f8b5720 100644 --- a/docs/metatype.dev/src/components/Newsletter/index.tsx +++ b/docs/metatype.dev/src/components/Newsletter/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React, { useMemo, useState } from "react"; import { ApolloClient, gql, InMemoryCache } from "@apollo/client"; diff --git a/docs/metatype.dev/src/components/PythonPackageManagerTabs/index.tsx b/docs/metatype.dev/src/components/PythonPackageManagerTabs/index.tsx index 9123232baa..d7de55e932 100644 --- a/docs/metatype.dev/src/components/PythonPackageManagerTabs/index.tsx +++ b/docs/metatype.dev/src/components/PythonPackageManagerTabs/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React, { PropsWithChildren } from "react"; import { usePythonPackageManager } from "../../states/package_manager"; diff --git a/docs/metatype.dev/src/components/SDKTabs/index.tsx b/docs/metatype.dev/src/components/SDKTabs/index.tsx index 1df20d596e..04630bae65 100644 --- a/docs/metatype.dev/src/components/SDKTabs/index.tsx +++ b/docs/metatype.dev/src/components/SDKTabs/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React, { PropsWithChildren } from "react"; import { SDK, useSDK } from "../../states/sdk"; diff --git a/docs/metatype.dev/src/components/TGExample/index.tsx b/docs/metatype.dev/src/components/TGExample/index.tsx index 351dd23afb..aee0d2380d 100644 --- a/docs/metatype.dev/src/components/TGExample/index.tsx +++ b/docs/metatype.dev/src/components/TGExample/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import MiniQL, { MiniQLProps } from "@site/src/components/MiniQL"; import React from "react"; diff --git a/docs/metatype.dev/src/components/TsPackageManagerTabs/index.tsx b/docs/metatype.dev/src/components/TsPackageManagerTabs/index.tsx index 926f2296ac..928dd619e1 100644 --- a/docs/metatype.dev/src/components/TsPackageManagerTabs/index.tsx +++ b/docs/metatype.dev/src/components/TsPackageManagerTabs/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React, { PropsWithChildren } from "react"; import { useTsPackageManager } from "../../states/package_manager"; diff --git a/docs/metatype.dev/src/components/animations/animated.tsx b/docs/metatype.dev/src/components/animations/animated.tsx index 84f0d1e061..41e17a92e0 100644 --- a/docs/metatype.dev/src/components/animations/animated.tsx +++ b/docs/metatype.dev/src/components/animations/animated.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React from "react"; import { WithAnimated, a } from "@react-spring/konva"; diff --git a/docs/metatype.dev/src/components/animations/animated_canvas.tsx b/docs/metatype.dev/src/components/animations/animated_canvas.tsx index 4060a89137..1172cee9d3 100644 --- a/docs/metatype.dev/src/components/animations/animated_canvas.tsx +++ b/docs/metatype.dev/src/components/animations/animated_canvas.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React from "react"; import { Stage } from "react-konva"; diff --git a/docs/metatype.dev/src/components/animations/block.tsx b/docs/metatype.dev/src/components/animations/block.tsx index 6e0485a969..b24ad98f75 100644 --- a/docs/metatype.dev/src/components/animations/block.tsx +++ b/docs/metatype.dev/src/components/animations/block.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import Konva from "konva"; import { RectConfig } from "konva/lib/shapes/Rect"; diff --git a/docs/metatype.dev/src/components/animations/doublearrow.tsx b/docs/metatype.dev/src/components/animations/doublearrow.tsx index 1b35c564af..0f3a6b0983 100644 --- a/docs/metatype.dev/src/components/animations/doublearrow.tsx +++ b/docs/metatype.dev/src/components/animations/doublearrow.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { ArrowConfig } from "konva/lib/shapes/Arrow"; import React from "react"; diff --git a/docs/metatype.dev/src/components/animations/hooks.tsx b/docs/metatype.dev/src/components/animations/hooks.tsx index c34f98fdbb..67d3b4801a 100644 --- a/docs/metatype.dev/src/components/animations/hooks.tsx +++ b/docs/metatype.dev/src/components/animations/hooks.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { KeyboardEvent, useEffect, useRef, useState } from "react"; import { useSpring, SpringValue, useSpringValue } from "@react-spring/konva"; diff --git a/docs/metatype.dev/src/components/animations/textarrow.tsx b/docs/metatype.dev/src/components/animations/textarrow.tsx index 1cfd5a8a05..748c56b40c 100644 --- a/docs/metatype.dev/src/components/animations/textarrow.tsx +++ b/docs/metatype.dev/src/components/animations/textarrow.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import Konva from "konva"; import React, { useEffect, useRef, useState } from "react"; diff --git a/docs/metatype.dev/src/components/castles.tsx b/docs/metatype.dev/src/components/castles.tsx index cda107b69f..8ed3bae23d 100644 --- a/docs/metatype.dev/src/components/castles.tsx +++ b/docs/metatype.dev/src/components/castles.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import React from "react"; diff --git a/docs/metatype.dev/src/pages/index.tsx b/docs/metatype.dev/src/pages/index.tsx index b17d926a3c..48be7509c0 100644 --- a/docs/metatype.dev/src/pages/index.tsx +++ b/docs/metatype.dev/src/pages/index.tsx @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /* eslint-disable @typescript-eslint/no-var-requires */ diff --git a/docs/metatype.dev/src/states/package_manager.ts b/docs/metatype.dev/src/states/package_manager.ts index fb8343fc70..d369d7a644 100644 --- a/docs/metatype.dev/src/states/package_manager.ts +++ b/docs/metatype.dev/src/states/package_manager.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { atom, useAtom } from "jotai"; import { atomWithLocation } from "jotai-location"; diff --git a/docs/metatype.dev/src/states/sdk.ts b/docs/metatype.dev/src/states/sdk.ts index a7a86cb9fc..7724b28c7e 100644 --- a/docs/metatype.dev/src/states/sdk.ts +++ b/docs/metatype.dev/src/states/sdk.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { atom, useAtom } from "jotai"; import { atomWithStorage, createJSONStorage } from "jotai/utils"; diff --git a/examples/templates/deno/api/example.ts b/examples/templates/deno/api/example.ts index f852c3fab4..65ca612621 100644 --- a/examples/templates/deno/api/example.ts +++ b/examples/templates/deno/api/example.ts @@ -1,6 +1,6 @@ -import { Policy, t, typegraph } from "jsr:@typegraph/sdk@0.5.0-rc.4/index.ts"; -import { PythonRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.4/runtimes/python.ts"; -import { DenoRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.4/runtimes/deno.ts"; +import { Policy, t, typegraph } from "jsr:@typegraph/sdk@0.5.0-rc.5/index.ts"; +import { PythonRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.5/runtimes/python.ts"; +import { DenoRuntime } from "jsr:@typegraph/sdk@0.5.0-rc.5/runtimes/deno.ts"; await typegraph("example", (g) => { const pub = Policy.public(); diff --git a/examples/templates/deno/compose.yml b/examples/templates/deno/compose.yml index 82d20d6cc6..32eaab03f6 100644 --- a/examples/templates/deno/compose.yml +++ b/examples/templates/deno/compose.yml @@ -1,6 +1,6 @@ services: typegate: - image: ghcr.io/metatypedev/typegate:v0.5.0-rc.4 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.5 restart: always ports: - "7890:7890" diff --git a/examples/templates/node/compose.yml b/examples/templates/node/compose.yml index 77c4f00ae7..1814897da9 100644 --- a/examples/templates/node/compose.yml +++ b/examples/templates/node/compose.yml @@ -1,6 +1,6 @@ services: typegate: - image: ghcr.io/metatypedev/typegate:v0.5.0-rc.4 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.5 restart: always ports: - "7890:7890" diff --git a/examples/templates/node/package.json b/examples/templates/node/package.json index 617098c32d..8fd1ab330a 100644 --- a/examples/templates/node/package.json +++ b/examples/templates/node/package.json @@ -6,7 +6,7 @@ "dev": "MCLI_LOADER_CMD='npm x tsx' meta dev" }, "dependencies": { - "@typegraph/sdk": "^0.5.0-rc.4" + "@typegraph/sdk": "^0.5.0-rc.5" }, "devDependencies": { "tsx": "^3.13.0", diff --git a/examples/templates/python/compose.yml b/examples/templates/python/compose.yml index 77c4f00ae7..1814897da9 100644 --- a/examples/templates/python/compose.yml +++ b/examples/templates/python/compose.yml @@ -1,6 +1,6 @@ services: typegate: - image: ghcr.io/metatypedev/typegate:v0.5.0-rc.4 + image: ghcr.io/metatypedev/typegate:v0.5.0-rc.5 restart: always ports: - "7890:7890" diff --git a/examples/templates/python/pyproject.toml b/examples/templates/python/pyproject.toml index a801a8b75a..4f7581522c 100644 --- a/examples/templates/python/pyproject.toml +++ b/examples/templates/python/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] name = "example" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "" authors = [] [tool.poetry.dependencies] python = ">=3.8,<4.0" -typegraph = "0.5.0-rc.4" +typegraph = "0.5.0-rc.5" [build-system] requires = ["poetry-core"] diff --git a/examples/typegraphs/scripts/md2html.ts.src b/examples/typegraphs/scripts/md2html.ts.src index 63aa78ea51..0bb183ad42 100644 --- a/examples/typegraphs/scripts/md2html.ts.src +++ b/examples/typegraphs/scripts/md2html.ts.src @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import * as marked from "https://deno.land/x/marked/mod.ts"; diff --git a/pyproject.toml b/pyproject.toml index b10c72007d..3fe6894989 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ [tool.poetry] name = "metatype" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "" authors = [] diff --git a/src/common/src/archive.rs b/src/common/src/archive.rs index 1aa5f8f5e2..ad39d098e4 100644 --- a/src/common/src/archive.rs +++ b/src/common/src/archive.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use anyhow::{Context, Result}; use base64::{engine::general_purpose::STANDARD, Engine}; diff --git a/src/common/src/graphql.rs b/src/common/src/graphql.rs index 5c0ce16c89..fd88c3f741 100644 --- a/src/common/src/graphql.rs +++ b/src/common/src/graphql.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use anyhow::{bail, Result}; use async_trait::async_trait; diff --git a/src/common/src/grpc.rs b/src/common/src/grpc.rs index ec76f685c5..d2de2bf9dd 100644 --- a/src/common/src/grpc.rs +++ b/src/common/src/grpc.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use anyhow::{Context, Result}; diff --git a/src/common/src/lib.rs b/src/common/src/lib.rs index 9e9eee51cb..013467534d 100644 --- a/src/common/src/lib.rs +++ b/src/common/src/lib.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 pub mod archive; pub mod grpc; diff --git a/src/common/src/node.rs b/src/common/src/node.rs index 894dc95c84..92b105a879 100644 --- a/src/common/src/node.rs +++ b/src/common/src/node.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use anyhow::{Context, Result}; use indoc::indoc; diff --git a/src/common/src/typegraph/mod.rs b/src/common/src/typegraph/mod.rs index 989e56440a..1dd4d9556f 100644 --- a/src/common/src/typegraph/mod.rs +++ b/src/common/src/typegraph/mod.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 pub mod parameter_transform; pub mod runtimes; diff --git a/src/common/src/typegraph/parameter_transform.rs b/src/common/src/typegraph/parameter_transform.rs index 523c3f1a39..045836319c 100644 --- a/src/common/src/typegraph/parameter_transform.rs +++ b/src/common/src/typegraph/parameter_transform.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::collections::HashMap; diff --git a/src/common/src/typegraph/runtimes/deno.rs b/src/common/src/typegraph/runtimes/deno.rs index e04eaf34d3..c370c06d7f 100644 --- a/src/common/src/typegraph/runtimes/deno.rs +++ b/src/common/src/typegraph/runtimes/deno.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use indexmap::IndexMap; use serde::{Deserialize, Serialize}; diff --git a/src/common/src/typegraph/runtimes/graphql.rs b/src/common/src/typegraph/runtimes/graphql.rs index dbdca32ce6..f258543c96 100644 --- a/src/common/src/typegraph/runtimes/graphql.rs +++ b/src/common/src/typegraph/runtimes/graphql.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; diff --git a/src/common/src/typegraph/runtimes/grpc.rs b/src/common/src/typegraph/runtimes/grpc.rs index 02826f08ff..cc94490685 100644 --- a/src/common/src/typegraph/runtimes/grpc.rs +++ b/src/common/src/typegraph/runtimes/grpc.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; diff --git a/src/common/src/typegraph/runtimes/http.rs b/src/common/src/typegraph/runtimes/http.rs index f7b38e2831..bdcd8a74a6 100644 --- a/src/common/src/typegraph/runtimes/http.rs +++ b/src/common/src/typegraph/runtimes/http.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; diff --git a/src/common/src/typegraph/runtimes/kv.rs b/src/common/src/typegraph/runtimes/kv.rs index 8767a97b92..3bc29f67d5 100644 --- a/src/common/src/typegraph/runtimes/kv.rs +++ b/src/common/src/typegraph/runtimes/kv.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; diff --git a/src/common/src/typegraph/runtimes/mod.rs b/src/common/src/typegraph/runtimes/mod.rs index 11882f2f80..4015509a57 100644 --- a/src/common/src/typegraph/runtimes/mod.rs +++ b/src/common/src/typegraph/runtimes/mod.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::path::PathBuf; diff --git a/src/common/src/typegraph/runtimes/prisma.rs b/src/common/src/typegraph/runtimes/prisma.rs index 2213d16f5b..ea0ca494df 100644 --- a/src/common/src/typegraph/runtimes/prisma.rs +++ b/src/common/src/typegraph/runtimes/prisma.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; diff --git a/src/common/src/typegraph/runtimes/python.rs b/src/common/src/typegraph/runtimes/python.rs index 01c3f7156b..61a825f739 100644 --- a/src/common/src/typegraph/runtimes/python.rs +++ b/src/common/src/typegraph/runtimes/python.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::path::PathBuf; diff --git a/src/common/src/typegraph/runtimes/random.rs b/src/common/src/typegraph/runtimes/random.rs index 3d8e036547..4b446a9d09 100644 --- a/src/common/src/typegraph/runtimes/random.rs +++ b/src/common/src/typegraph/runtimes/random.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; diff --git a/src/common/src/typegraph/runtimes/s3.rs b/src/common/src/typegraph/runtimes/s3.rs index e6ca882e66..e2db166bed 100644 --- a/src/common/src/typegraph/runtimes/s3.rs +++ b/src/common/src/typegraph/runtimes/s3.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; use serde_with::skip_serializing_none; diff --git a/src/common/src/typegraph/runtimes/substantial.rs b/src/common/src/typegraph/runtimes/substantial.rs index e88bb8fd16..91797bbb18 100644 --- a/src/common/src/typegraph/runtimes/substantial.rs +++ b/src/common/src/typegraph/runtimes/substantial.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::path::PathBuf; diff --git a/src/common/src/typegraph/runtimes/temporal.rs b/src/common/src/typegraph/runtimes/temporal.rs index 38357e172e..cc5bf84d79 100644 --- a/src/common/src/typegraph/runtimes/temporal.rs +++ b/src/common/src/typegraph/runtimes/temporal.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; diff --git a/src/common/src/typegraph/runtimes/wasm.rs b/src/common/src/typegraph/runtimes/wasm.rs index 737c4d6703..1fd32bf3c8 100644 --- a/src/common/src/typegraph/runtimes/wasm.rs +++ b/src/common/src/typegraph/runtimes/wasm.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use serde::{Deserialize, Serialize}; use std::path::PathBuf; diff --git a/src/common/src/typegraph/types.rs b/src/common/src/typegraph/types.rs index 58f3f7faa1..8827536d60 100644 --- a/src/common/src/typegraph/types.rs +++ b/src/common/src/typegraph/types.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::collections::BTreeMap; diff --git a/src/common/src/typegraph/utils.rs b/src/common/src/typegraph/utils.rs index 73a21fe733..73d5a6c2a3 100644 --- a/src/common/src/typegraph/utils.rs +++ b/src/common/src/typegraph/utils.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::typegraph::{runtimes::TGRuntime, Typegraph}; use anyhow::{bail, Result}; diff --git a/src/common/src/typegraph/validator/common.rs b/src/common/src/typegraph/validator/common.rs index f67ea5a05c..e499478878 100644 --- a/src/common/src/typegraph/validator/common.rs +++ b/src/common/src/typegraph/validator/common.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::typegraph::{EitherTypeData, TypeNode, Typegraph, UnionTypeData}; diff --git a/src/common/src/typegraph/validator/input.rs b/src/common/src/typegraph/validator/input.rs index fe4c23c0ed..eac871462b 100644 --- a/src/common/src/typegraph/validator/input.rs +++ b/src/common/src/typegraph/validator/input.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::typegraph::{ visitor::{CurrentNode, TypeVisitor, VisitResult}, diff --git a/src/common/src/typegraph/validator/mod.rs b/src/common/src/typegraph/validator/mod.rs index 5d40ab583c..2b95ff865f 100644 --- a/src/common/src/typegraph/validator/mod.rs +++ b/src/common/src/typegraph/validator/mod.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 mod common; mod injection; diff --git a/src/common/src/typegraph/validator/types.rs b/src/common/src/typegraph/validator/types.rs index bee20a8803..9d1a62b909 100644 --- a/src/common/src/typegraph/validator/types.rs +++ b/src/common/src/typegraph/validator/types.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::typegraph::{ EitherTypeData, FileTypeData, FloatTypeData, IntegerTypeData, ListTypeData, ObjectTypeData, diff --git a/src/common/src/typegraph/validator/value.rs b/src/common/src/typegraph/validator/value.rs index dc9527ce40..bab4c599cd 100644 --- a/src/common/src/typegraph/validator/value.rs +++ b/src/common/src/typegraph/validator/value.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::collections::HashSet; diff --git a/src/common/src/typegraph/visitor.rs b/src/common/src/typegraph/visitor.rs index 996ffa055c..b7ddd05b5c 100644 --- a/src/common/src/typegraph/visitor.rs +++ b/src/common/src/typegraph/visitor.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use indexmap::IndexMap; use std::{ diff --git a/src/meta-cli/src/deploy/actors/task/deploy.rs b/src/meta-cli/src/deploy/actors/task/deploy.rs index 0809e8aab1..f526d775b4 100644 --- a/src/meta-cli/src/deploy/actors/task/deploy.rs +++ b/src/meta-cli/src/deploy/actors/task/deploy.rs @@ -9,12 +9,13 @@ use super::action::{ }; use super::command::build_task_command; use crate::deploy::actors::console::Console; -use crate::deploy::actors::task_manager::TaskRef; +use crate::deploy::actors::task_manager::{self, TaskRef}; use crate::interlude::*; use crate::secrets::Secrets; use color_eyre::owo_colors::OwoColorize; use common::node::Node; -use serde::Deserialize; +use common::typegraph::Typegraph; +use serde::{Deserialize, Deserializer}; use std::{path::Path, sync::Arc}; use tokio::process::Command; @@ -113,9 +114,27 @@ pub struct Migration { pub archive: String, } +#[derive(Deserialize, Debug, Clone)] +pub struct TypegraphData { + pub name: String, + pub path: PathBuf, + #[serde(deserialize_with = "deserialize_typegraph")] + pub value: Arc, +} + +fn deserialize_typegraph<'de, D>(deserializer: D) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + let serialized = String::deserialize(deserializer)?; + let typegraph = + serde_json::from_str(&serialized).map_err(|e| serde::de::Error::custom(e.to_string()))?; + Ok(Arc::new(typegraph)) +} + #[derive(Deserialize, Debug)] pub struct DeploySuccess { - pub typegraph: String, + pub typegraph: TypegraphData, pub messages: Vec, pub migrations: Vec, pub failure: Option, @@ -129,7 +148,7 @@ pub struct DeployError { impl OutputData for DeploySuccess { fn get_typegraph_name(&self) -> String { - self.typegraph.clone() + self.typegraph.name.clone() } fn is_success(&self) -> bool { @@ -267,6 +286,10 @@ impl TaskAction for DeployAction { })) } None => { + ctx.task_manager + .do_send(task_manager::message::TypegraphDeployed( + data.typegraph.clone(), + )); ctx.console.info(format!( "{icon} successfully deployed typegraph {name} from {path}", icon = "✓".green(), diff --git a/src/meta-cli/src/deploy/actors/task_manager.rs b/src/meta-cli/src/deploy/actors/task_manager.rs index 43334b3ac3..0c495593c0 100644 --- a/src/meta-cli/src/deploy/actors/task_manager.rs +++ b/src/meta-cli/src/deploy/actors/task_manager.rs @@ -4,7 +4,7 @@ use super::console::{Console, ConsoleActor}; use super::discovery::DiscoveryActor; use super::task::action::{TaskAction, TaskActionGenerator}; use super::task::{self, TaskActor, TaskFinishStatus}; -use super::watcher::WatcherActor; +use super::watcher::{self, WatcherActor}; use crate::{config::Config, interlude::*}; use colored::OwoColorize; use futures::channel::oneshot; @@ -14,6 +14,7 @@ use signal_handler::set_stop_recipient; use std::collections::VecDeque; use std::sync::atomic::{AtomicUsize, Ordering}; use std::time::Duration; +use task::deploy::TypegraphData; pub mod report; pub use report::Report; @@ -56,6 +57,10 @@ pub mod message { #[derive(Message)] #[rtype(result = "()")] pub struct DiscoveryDone; + + #[derive(Message)] + #[rtype(result = "()")] + pub struct TypegraphDeployed(pub TypegraphData); } use message::*; @@ -526,3 +531,13 @@ impl Handler for TaskManager { ctx.address().do_send(ForceStop); } } + +impl Handler for TaskManager { + type Result = (); + + fn handle(&mut self, msg: TypegraphDeployed, _ctx: &mut Self::Context) -> Self::Result { + if let Some(addr) = &self.watcher_addr { + addr.do_send(watcher::message::UpdateDependencies(msg.0)); + } + } +} diff --git a/src/meta-cli/src/deploy/actors/watcher.rs b/src/meta-cli/src/deploy/actors/watcher.rs index d579e0b481..c9301627b6 100644 --- a/src/meta-cli/src/deploy/actors/watcher.rs +++ b/src/meta-cli/src/deploy/actors/watcher.rs @@ -6,11 +6,11 @@ use super::task::action::TaskAction; use super::task_manager::{self, TaskGenerator, TaskManager, TaskReason}; use crate::config::Config; use crate::deploy::actors::console::ConsoleActor; +use crate::deploy::actors::task::deploy::TypegraphData; use crate::deploy::push::pusher::RetryManager; use crate::interlude::*; use crate::typegraph::dependency_graph::DependencyGraph; use crate::typegraph::loader::discovery::FileFilter; -use common::typegraph::Typegraph; use notify_debouncer_mini::notify::{RecommendedWatcher, RecursiveMode}; use notify_debouncer_mini::{new_debouncer, notify, DebounceEventResult, Debouncer}; use pathdiff::diff_paths; @@ -31,7 +31,7 @@ pub mod message { #[derive(Message)] #[rtype(result = "()")] - pub struct UpdateDependencies(pub Arc); + pub struct UpdateDependencies(pub TypegraphData); #[derive(Message)] #[rtype(result = "()")] @@ -152,7 +152,7 @@ impl Handler for WatcherActor { let path = msg.0; if &path == self.config.path.as_ref().unwrap() { self.console - .warning("metatype configuration filie changed".to_owned()); + .warning("metatype configuration file changed".to_owned()); self.console .warning("reloading all the typegraphs".to_owned()); self.task_manager.do_send(task_manager::message::Restart); @@ -202,7 +202,8 @@ impl Handler for WatcherActor { type Result = (); fn handle(&mut self, msg: UpdateDependencies, _ctx: &mut Self::Context) -> Self::Result { - self.dependency_graph.update_typegraph(&msg.0) + let TypegraphData { path, value, .. } = msg.0; + self.dependency_graph.update_typegraph(path, &value) } } diff --git a/src/meta-cli/src/typegraph/dependency_graph.rs b/src/meta-cli/src/typegraph/dependency_graph.rs index dbd6d15923..cd15799365 100644 --- a/src/meta-cli/src/typegraph/dependency_graph.rs +++ b/src/meta-cli/src/typegraph/dependency_graph.rs @@ -15,20 +15,18 @@ pub struct DependencyGraph { } impl DependencyGraph { - pub fn update_typegraph(&mut self, tg: &Typegraph) { - let path = tg.path.clone().unwrap(); - if !self.deps.contains_key(path.as_ref()) { - self.deps.insert(path.to_path_buf(), HashSet::default()); - } - - let deps = self.deps.get_mut(path.as_ref()).unwrap(); - let old_deps = std::mem::replace(deps, tg.deps.iter().cloned().collect()); + pub fn update_typegraph(&mut self, path: PathBuf, tg: &Typegraph) { + let parent_dir = path.parent().unwrap(); + let artifacts = tg.meta.artifacts.values(); + let artifact_paths = artifacts.flat_map(|a| parent_dir.join(&a.path).canonicalize()); + let deps = self.deps.entry(path.clone()).or_default(); + let old_deps = std::mem::replace(deps, artifact_paths.collect()); let removed_deps = old_deps.difference(deps); let added_deps = deps.difference(&old_deps); for removed in removed_deps { let rdeps = self.reverse_deps.get_mut(removed).unwrap(); - rdeps.take(path.as_ref()).unwrap(); + rdeps.take(&path).unwrap(); if rdeps.is_empty() { self.reverse_deps.remove(removed); } @@ -36,10 +34,10 @@ impl DependencyGraph { for added in added_deps { if let Some(set) = self.reverse_deps.get_mut(added) { - set.insert(path.to_path_buf()); + set.insert(path.clone()); } else { self.reverse_deps - .insert(added.clone(), HashSet::from_iter(Some(path.to_path_buf()))); + .insert(added.clone(), HashSet::from_iter(Some(path.clone()))); } } } diff --git a/src/meta-lsp/package.json b/src/meta-lsp/package.json index f088c8b096..6d5daf839f 100644 --- a/src/meta-lsp/package.json +++ b/src/meta-lsp/package.json @@ -4,7 +4,7 @@ "description": "VSCode extension for Metatype support", "icon": "logo.png", "author": "Metatype Team", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "repository": { "type": "git", "url": "https://github.com/metatypedev/metatype" diff --git a/src/meta-lsp/ts-language-server/package.json b/src/meta-lsp/ts-language-server/package.json index 31c733135b..e3f80f4774 100644 --- a/src/meta-lsp/ts-language-server/package.json +++ b/src/meta-lsp/ts-language-server/package.json @@ -2,7 +2,7 @@ "name": "typegraph-ts-server", "description": "TypeScript language server for TypeGraph", "author": "Metatype Team", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "repository": { "type": "git", "url": "https://github.com/metatypedev/metatype" diff --git a/src/meta-lsp/vscode-metatype-support/package.json b/src/meta-lsp/vscode-metatype-support/package.json index 9b7f735336..a8cf018d26 100644 --- a/src/meta-lsp/vscode-metatype-support/package.json +++ b/src/meta-lsp/vscode-metatype-support/package.json @@ -2,7 +2,7 @@ "name": "vscode-metatype-support", "description": "VSCode extension for Metatype support", "author": "Metatype Team", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "repository": { "type": "git", "url": "https://github.com/metatypedev/metatype" diff --git a/src/metagen/fixtures/client_ts/main.ts b/src/metagen/fixtures/client_ts/main.ts index e8abfc47e1..5213ad7eb1 100644 --- a/src/metagen/fixtures/client_ts/main.ts +++ b/src/metagen/fixtures/client_ts/main.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { alias, PreparedArgs, QueryGraph } from "./client.ts"; diff --git a/src/metagen/fixtures/tg2.ts b/src/metagen/fixtures/tg2.ts index 88d1f62a98..caf28480fe 100644 --- a/src/metagen/fixtures/tg2.ts +++ b/src/metagen/fixtures/tg2.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { fx, Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/src/mt_deno/src/lib.rs b/src/mt_deno/src/lib.rs index b7c969190e..14fee91c01 100644 --- a/src/mt_deno/src/lib.rs +++ b/src/mt_deno/src/lib.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 #![allow(dead_code, clippy::let_and_return)] diff --git a/src/pyrt_wit_wire/pyproject.toml b/src/pyrt_wit_wire/pyproject.toml index 9a99d15ecd..429c6d1d1c 100644 --- a/src/pyrt_wit_wire/pyproject.toml +++ b/src/pyrt_wit_wire/pyproject.toml @@ -1,8 +1,8 @@ [tool.poetry] name = "pyrt_wit_wire" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "Wasm component implementing the PythonRuntime host using wit_wire protocol." -license = "Elastic-2.0" +license = "MPL-2.0" readme = "README.md" [tool.poetry.dependencies] diff --git a/src/typegate/engine/00_runtime.js b/src/typegate/engine/00_runtime.js index 412d71c056..caf7bb7e74 100644 --- a/src/typegate/engine/00_runtime.js +++ b/src/typegate/engine/00_runtime.js @@ -73,8 +73,12 @@ const Meta = { metadataAppend: getOp("op_sub_metadata_append"), metadataWriteWorkflowLink: getOp("op_sub_metadata_write_workflow_link"), metadataReadWorkflowLinks: getOp("op_sub_metadata_read_workflow_links"), - metadataWriteParentChildLink: getOp("op_sub_metadata_write_parent_child_link"), - metadataEnumerateAllChildren: getOp("op_sub_metadata_enumerate_all_children"), + metadataWriteParentChildLink: getOp( + "op_sub_metadata_write_parent_child_link", + ), + metadataEnumerateAllChildren: getOp( + "op_sub_metadata_enumerate_all_children", + ), }, grpc: { register: getOp("op_grpc_register"), @@ -83,6 +87,4 @@ const Meta = { }, }; - - globalThis.Meta = Meta; diff --git a/src/typegate/engine/bindings.ts b/src/typegate/engine/bindings.ts index 3c125c6fcb..c4d1e5d0b8 100644 --- a/src/typegate/engine/bindings.ts +++ b/src/typegate/engine/bindings.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { CallGrpcMethodInput, @@ -32,15 +32,15 @@ export type FormatCodeInp = { }; export type FormatCodeOut = | { - Ok: { - formatted_code: string; - }; - } + Ok: { + formatted_code: string; + }; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export type ValidateInput = { // deno-lint-ignore no-explicit-any @@ -51,7 +51,7 @@ export type ValidateResult = { }; export function validate_prisma_runtime_data( - a0: ValidateInput + a0: ValidateInput, ): ValidateResult { try { Meta.validatePrismaRuntimeData(a0.obj); @@ -65,18 +65,18 @@ export type TypegraphValidateInp = { }; export type TypegraphValidateOut = | { - Valid: { - json: string; - }; - } + Valid: { + json: string; + }; + } | { - NotValid: { - reason: string; - }; + NotValid: { + reason: string; }; + }; export function typegraph_validate( - a0: TypegraphValidateInp + a0: TypegraphValidateInp, ): TypegraphValidateOut { try { const res = Meta.typegraphValidate(a0.json); @@ -91,15 +91,15 @@ export function typegraph_validate( } export type WasiOutput = | { - Ok: { - res: string; - }; - } + Ok: { + res: string; + }; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export function wasmtime_wit(a0: WasmInput): Promise { try { @@ -113,13 +113,13 @@ export function wasmtime_wit(a0: WasmInput): Promise { export type TemporalRegisterOutput = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function temporal_register( - a0: TemporalRegisterInput + a0: TemporalRegisterInput, ): Promise { try { await Meta.temporal.clientRegister(a0); @@ -135,13 +135,13 @@ export type TemporalUnregisterInput = { export type TemporalUnregisterOutput = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export function temporal_unregister( - a0: TemporalUnregisterInput + a0: TemporalUnregisterInput, ): Promise { try { Meta.temporal.clientUnregister(a0.client_id); @@ -153,17 +153,17 @@ export function temporal_unregister( export type TemporalWorkflowStartOutput = | { - Ok: { - run_id: string; - }; - } + Ok: { + run_id: string; + }; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function temporal_workflow_start( - a0: TemporalWorkflowStartInput + a0: TemporalWorkflowStartInput, ): Promise { try { const out = await Meta.temporal.workflowStart(a0); @@ -176,13 +176,13 @@ export async function temporal_workflow_start( export type TemporalWorkflowSignalOutput = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function temporal_workflow_signal( - a0: TemporalWorkflowSignalInput + a0: TemporalWorkflowSignalInput, ): Promise { try { await Meta.temporal.workflowSignal(a0); @@ -194,16 +194,16 @@ export async function temporal_workflow_signal( export type TemporalWorkflowDescribeRes = | { - Ok: TemporalWorkflowDescribeOutput; - } + Ok: TemporalWorkflowDescribeOutput; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function temporal_workflow_describe( - a0: TemporalWorkflowDescribeInput + a0: TemporalWorkflowDescribeInput, ): Promise { try { const out = await Meta.temporal.workflowDescribe(a0); @@ -215,18 +215,18 @@ export async function temporal_workflow_describe( export type TemporalWorkflowQueryOutput = | { - Ok: { - data: Array; - }; - } + Ok: { + data: Array; + }; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function temporal_workflow_query( - a0: TemporalWorkflowQueryInput + a0: TemporalWorkflowQueryInput, ): Promise { try { const out = await Meta.temporal.workflowQuery(a0); @@ -239,13 +239,13 @@ export async function temporal_workflow_query( export type PrismaRegisterEngineOut = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function prisma_register_engine( - a0: PrismaRegisterEngineInp + a0: PrismaRegisterEngineInp, ): Promise { try { await Meta.prisma.registerEngine(a0); @@ -261,13 +261,13 @@ export type PrismaUnregisterEngineInp = { export type PrismaUnregisterEngineOut = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function prisma_unregister_engine( - a0: PrismaUnregisterEngineInp + a0: PrismaUnregisterEngineInp, ): Promise { try { await Meta.prisma.unregisterEngine(a0.engine_name); @@ -279,17 +279,17 @@ export async function prisma_unregister_engine( export type PrismaQueryOut = | { - Ok: { - res: string; - }; - } + Ok: { + res: string; + }; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function prisma_query( - a0: PrismaQueryInp + a0: PrismaQueryInp, ): Promise { try { const res = await Meta.prisma.query(a0); @@ -312,17 +312,17 @@ export type PrismaDiffInp = { }; export async function prisma_diff( - a0: PrismaDiffInp + a0: PrismaDiffInp, ): Promise<[string, ParsedDiff[]] | null | undefined> { return await Meta.prisma.diff(a0); } export type PrismaApplyResult = | { - Err: { - message: string; - }; - } + Err: { + message: string; + }; + } | PrismaApplyOut; export type PrismaDevInp = { datasource: string; @@ -332,7 +332,7 @@ export type PrismaDevInp = { }; export async function prisma_apply( - a0: PrismaDevInp + a0: PrismaDevInp, ): Promise { try { return (await Meta.prisma.apply(a0)) as PrismaApplyResult; @@ -347,14 +347,14 @@ export type PrismaDeployInp = { }; export type PrismaDeployRes = | { - Err: { - message: string; - }; - } + Err: { + message: string; + }; + } | { Ok: PrismaDeployOut }; export async function prisma_deploy( - a0: PrismaDeployInp + a0: PrismaDeployInp, ): Promise { try { const res = await Meta.prisma.deploy(a0); @@ -373,14 +373,14 @@ export type PrismaCreateInp = { }; export type PrismaCreateResult = | { - Err: { - message: string; - }; - } + Err: { + message: string; + }; + } | { Ok: PrismaCreateOut }; export async function prisma_create( - a0: PrismaCreateInp + a0: PrismaCreateInp, ): Promise { try { const res = await Meta.prisma.create(a0); @@ -394,17 +394,17 @@ export type PrismaResetInp = { }; export type PrismaResetResult = | { - Err: { - message: string; - }; - } + Err: { + message: string; + }; + } | { - Ok: { - reset: boolean; - }; + Ok: { + reset: boolean; }; + }; export async function prisma_reset( - a0: PrismaResetInp + a0: PrismaResetInp, ): Promise { try { const res = await Meta.prisma.reset(a0.datasource); @@ -420,10 +420,10 @@ export type UnpackInp = { export type UnpackResult = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export function unpack(a0: UnpackInp): UnpackResult { try { Meta.prisma.unpack(a0); @@ -438,15 +438,15 @@ export type ArchiveInp = { }; export type ArchiveResult = | { - Ok: { - base64: string | undefined | null; - }; - } + Ok: { + base64: string | undefined | null; + }; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export function archive(a0: ArchiveInp): ArchiveResult { try { const res = Meta.prisma.archive(a0.path); @@ -459,13 +459,13 @@ export function archive(a0: ArchiveInp): ArchiveResult { export type GrpcRegisterOutput = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function grpc_register( - a0: GrpcRegisterInput + a0: GrpcRegisterInput, ): Promise { try { await Meta.grpc.register(a0); @@ -482,13 +482,13 @@ export type GrpcUnregisterInput = { export type GrpcUnRegisterOutput = | "Ok" | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function grpc_unregister( - a0: GrpcUnregisterInput + a0: GrpcUnregisterInput, ): Promise { try { await Meta.grpc.unregister(a0.client_id); @@ -500,16 +500,16 @@ export async function grpc_unregister( export type CallGrpcMethodOutput = | { - Ok: string; - } + Ok: string; + } | { - Err: { - message: string; - }; + Err: { + message: string; }; + }; export async function call_grpc_method( - a0: CallGrpcMethodInput + a0: CallGrpcMethodInput, ): Promise { try { return { Ok: await Meta.grpc.callGrpcMethod(a0) }; diff --git a/src/typegate/engine/build.rs b/src/typegate/engine/build.rs index be0b024fec..006f51962c 100644 --- a/src/typegate/engine/build.rs +++ b/src/typegate/engine/build.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::path::PathBuf; diff --git a/src/typegate/engine/runtime.d.ts b/src/typegate/engine/runtime.d.ts index 109491903d..9b482ccd1b 100644 --- a/src/typegate/engine/runtime.d.ts +++ b/src/typegate/engine/runtime.d.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 declare global { const Meta: MetaNS; @@ -17,7 +17,7 @@ export type MetaNS = { unregisterEngine: (engine_name: string) => Promise; query: (inp: PrismaQueryInp) => Promise; diff: ( - inp: PrismaDiffInp + inp: PrismaDiffInp, ) => Promise<[string, ParsedDiff[]] | undefined | null>; apply: (inp: PrismaDevInp) => Promise; deploy: (inp: PrismaDeployInp) => Promise; @@ -34,7 +34,7 @@ export type MetaNS = { workflowSignal: (inp: TemporalWorkflowSignalInput) => Promise; workflowQuery: (inp: TemporalWorkflowQueryInput) => Promise>; workflowDescribe: ( - inp: TemporalWorkflowDescribeInput + inp: TemporalWorkflowDescribeInput, ) => Promise; }; @@ -43,12 +43,12 @@ export type MetaNS = { componentPath: string, instanceId: string, args: WitWireInitArgs, - cb: (op_name: string, json: string) => Promise + cb: (op_name: string, json: string) => Promise, ) => Promise; destroy: (instanceId: string) => Promise; handle: ( instanceId: string, - args: WitWireReq + args: WitWireReq, ) => Promise; }; @@ -63,7 +63,7 @@ export type MetaNS = { storePersistRun: (inp: PersistRunInput) => Promise; storeAddSchedule: (inp: AddScheduleInput) => Promise; storeReadSchedule: ( - inp: ReadOrCloseScheduleInput + inp: ReadOrCloseScheduleInput, ) => Promise; storeCloseSchedule: (inp: ReadOrCloseScheduleInput) => Promise; agentNextRun: (inp: NextRunInput) => Promise; @@ -72,18 +72,18 @@ export type MetaNS = { agentRenewLease: (inp: LeaseInput) => Promise; agentRemoveLease: (inp: LeaseInput) => Promise; metadataReadAll: ( - inp: ReadAllMetadataInput + inp: ReadAllMetadataInput, ) => Promise>; metadataAppend: (inp: AppendMetadataInput) => Promise; metadataWriteWorkflowLink: (inp: WriteLinkInput) => Promise; metadataReadWorkflowLinks: ( - inp: ReadWorkflowLinkInput + inp: ReadWorkflowLinkInput, ) => Promise>; metadataWriteParentChildLink: ( - inp: WriteParentChildLinkInput + inp: WriteParentChildLinkInput, ) => Promise; metadataEnumerateAllChildren: ( - inp: EnumerateAllChildrenInput + inp: EnumerateAllChildrenInput, ) => Promise>; }; }; @@ -116,16 +116,16 @@ interface PrismaDevInp { } type PrismaApplyOut = | { - ResetRequired: { - reset_reason: string; - }; - } + ResetRequired: { + reset_reason: string; + }; + } | { - Ok: { - applied_migrations: Array; - reset_reason: string | undefined | null; - }; + Ok: { + applied_migrations: Array; + reset_reason: string | undefined | null; }; + }; interface PrismaDeployOut { migration_count: number; applied_migrations: Array; @@ -237,14 +237,14 @@ export type WitWireReq = { export type WitWireHandleError = | { - InstanceNotFound: string; - } + InstanceNotFound: string; + } | { - ModuleErr: string; - } + ModuleErr: string; + } | { - MatErr: string; - }; + MatErr: string; + }; export type WitWireMatInfo = { op_name: string; @@ -261,29 +261,29 @@ export type WitWireInitArgs = { export type WitWireInitResponse = object; export type WitWireInitError = | { - VersionMismatch: string; - } + VersionMismatch: string; + } | { - UnexpectedMat: string; - } + UnexpectedMat: string; + } | { - ModuleErr: string; - } + ModuleErr: string; + } | { - Other: string; - }; + Other: string; + }; export type WitWireHandleResponse = | { - Ok: string; - } + Ok: string; + } | "NoHandler" | { - InJsonErr: string; - } + InJsonErr: string; + } | { - HandlerErr: string; - }; + HandlerErr: string; + }; export type GrpcRegisterInput = { proto_file_content: string; @@ -301,20 +301,20 @@ export type Backend = | { type: "fs" } | { type: "memory" } | { - type: "redis"; - connection_string: string; - }; + type: "redis"; + connection_string: string; + }; export type OperationEvent = | { type: "Sleep"; id: number; start: string; end: string } | { - type: "Save"; - id: number; - value: - | { type: "Retry"; wait_until: string; counter: number } - | { type: "Resolved"; payload: unknown } - | { type: "Failed"; err: unknown }; - } + type: "Save"; + id: number; + value: + | { type: "Retry"; wait_until: string; counter: number } + | { type: "Resolved"; payload: unknown } + | { type: "Failed"; err: unknown }; + } | { type: "Send"; event_name: string; value: unknown } | { type: "Stop"; result: unknown } | { type: "Start"; kwargs: Record } diff --git a/src/typegate/engine/src/ext.rs b/src/typegate/engine/src/ext.rs index 2f2ca8de81..72d4c13686 100644 --- a/src/typegate/engine/src/ext.rs +++ b/src/typegate/engine/src/ext.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::interlude::*; use crate::{ diff --git a/src/typegate/engine/src/lib.rs b/src/typegate/engine/src/lib.rs index 5d6ba03fcc..2145776f6b 100644 --- a/src/typegate/engine/src/lib.rs +++ b/src/typegate/engine/src/lib.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 mod ext; mod runtimes; diff --git a/src/typegate/engine/src/runtimes.rs b/src/typegate/engine/src/runtimes.rs index 102d2704e1..463eadf0e0 100644 --- a/src/typegate/engine/src/runtimes.rs +++ b/src/typegate/engine/src/runtimes.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 pub mod grpc; pub mod prisma; diff --git a/src/typegate/engine/src/runtimes/grpc.rs b/src/typegate/engine/src/runtimes/grpc.rs index 0b87a39c55..276188ba0c 100644 --- a/src/typegate/engine/src/runtimes/grpc.rs +++ b/src/typegate/engine/src/runtimes/grpc.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::{cell::RefCell, ops::Deref, rc::Rc, str::FromStr, sync::Arc}; diff --git a/src/typegate/engine/src/runtimes/prisma.rs b/src/typegate/engine/src/runtimes/prisma.rs index 0d70ec4723..cb77a73c22 100644 --- a/src/typegate/engine/src/runtimes/prisma.rs +++ b/src/typegate/engine/src/runtimes/prisma.rs @@ -1,7 +1,7 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 pub mod engine; pub mod engine_import; diff --git a/src/typegate/engine/src/runtimes/prisma/engine.rs b/src/typegate/engine/src/runtimes/prisma/engine.rs index 2c15dff5aa..9d8421905a 100644 --- a/src/typegate/engine/src/runtimes/prisma/engine.rs +++ b/src/typegate/engine/src/runtimes/prisma/engine.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::interlude::*; use std::{collections::BTreeMap, path::PathBuf, str::FromStr}; diff --git a/src/typegate/engine/src/runtimes/prisma/migration.rs b/src/typegate/engine/src/runtimes/prisma/migration.rs index 40f5cebb43..6e9d8bc73d 100644 --- a/src/typegate/engine/src/runtimes/prisma/migration.rs +++ b/src/typegate/engine/src/runtimes/prisma/migration.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // https://github.com/prisma/prisma-engines/blob/main/migration-engine/core/src/rpc.rs // https://github.com/prisma/prisma-engines/blob/main/migration-engine/core/src/api.rs diff --git a/src/typegate/engine/src/runtimes/prisma/utils.rs b/src/typegate/engine/src/runtimes/prisma/utils.rs index f9a533719e..a20a89c8ed 100644 --- a/src/typegate/engine/src/runtimes/prisma/utils.rs +++ b/src/typegate/engine/src/runtimes/prisma/utils.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use schema_connector::{BoxFuture, ConnectorHost, ConnectorResult}; use std::sync::{Arc, Mutex}; diff --git a/src/typegate/engine/src/runtimes/substantial.rs b/src/typegate/engine/src/runtimes/substantial.rs index 9420c61e34..416609319d 100644 --- a/src/typegate/engine/src/runtimes/substantial.rs +++ b/src/typegate/engine/src/runtimes/substantial.rs @@ -1,7 +1,7 @@ #![allow(clippy::not_unsafe_ptr_arg_deref)] -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::interlude::*; diff --git a/src/typegate/engine/src/runtimes/temporal.rs b/src/typegate/engine/src/runtimes/temporal.rs index 5484dbf590..f25945935e 100644 --- a/src/typegate/engine/src/runtimes/temporal.rs +++ b/src/typegate/engine/src/runtimes/temporal.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::interlude::*; diff --git a/src/typegate/engine/src/runtimes/wasm.rs b/src/typegate/engine/src/runtimes/wasm.rs index 6da88b34c7..98958932d8 100644 --- a/src/typegate/engine/src/runtimes/wasm.rs +++ b/src/typegate/engine/src/runtimes/wasm.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::interlude::*; #[rustfmt::skip] diff --git a/src/typegate/engine/src/runtimes/wasm/conversion.rs b/src/typegate/engine/src/runtimes/wasm/conversion.rs index 1b99ee1618..d93c26aa42 100644 --- a/src/typegate/engine/src/runtimes/wasm/conversion.rs +++ b/src/typegate/engine/src/runtimes/wasm/conversion.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use std::collections::HashSet; diff --git a/src/typegate/engine/src/runtimes/wit_wire.rs b/src/typegate/engine/src/runtimes/wit_wire.rs index c45c425fdf..e74bc1a151 100644 --- a/src/typegate/engine/src/runtimes/wit_wire.rs +++ b/src/typegate/engine/src/runtimes/wit_wire.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::interlude::*; use dashmap::DashMap; diff --git a/src/typegate/engine/src/typegraph.rs b/src/typegate/engine/src/typegraph.rs index fe21d67fe2..0451052bee 100644 --- a/src/typegate/engine/src/typegraph.rs +++ b/src/typegate/engine/src/typegraph.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use crate::interlude::*; use common::typegraph::{runtimes::prisma::PrismaRuntimeData, Typegraph}; diff --git a/src/typegate/src/config.ts b/src/typegate/src/config.ts index fdd487c15b..4d3fd33c87 100644 --- a/src/typegate/src/config.ts +++ b/src/typegate/src/config.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { z } from "zod"; @@ -26,7 +26,7 @@ async function getHostname() { return new TextDecoder().decode(stdout).trim(); } catch (_e) { console.debug( - `Not hostname binary found, falling back to env var HOSTNAME` + `Not hostname binary found, falling back to env var HOSTNAME`, ); return Deno.env.get("HOSTNAME") ?? "UNKNOWN_HOSTNAME"; } @@ -51,7 +51,7 @@ export const globalConfig = configOrExit( [ mapKeys(Deno.env.toObject(), (k: string) => k.toLowerCase()), parseArgs(Deno.args) as Record, - ] + ], ); export const defaultTypegateConfigBase = { @@ -70,7 +70,7 @@ const SYNC_PREFIX = "sync_"; function filterMapSyncKeys(obj: Record) { return mapKeys( filterKeys(obj, (k) => k.startsWith(SYNC_PREFIX)), - (k) => k.slice(SYNC_PREFIX.length) + (k) => k.slice(SYNC_PREFIX.length), ); } @@ -79,8 +79,9 @@ function envsAsConfig() { } function argsAsConfig() { - return mapKeys(parseArgs(Deno.args) as Record, (k) => - k.toLocaleLowerCase().replace("-", "_") + return mapKeys( + parseArgs(Deno.args) as Record, + (k) => k.toLocaleLowerCase().replace("-", "_"), ); } diff --git a/src/typegate/src/config/loader.ts b/src/typegate/src/config/loader.ts index 68b39dc43a..c8f71167c1 100644 --- a/src/typegate/src/config/loader.ts +++ b/src/typegate/src/config/loader.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { z } from "zod"; import { deepMerge } from "@std/collections/deep-merge"; diff --git a/src/typegate/src/config/shared.ts b/src/typegate/src/config/shared.ts index 95574de662..0865788fb0 100644 --- a/src/typegate/src/config/shared.ts +++ b/src/typegate/src/config/shared.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { sharedConfigSchema } from "./types.ts"; import { configOrExit } from "./loader.ts"; @@ -24,7 +24,7 @@ export const sharedConfig = await configOrExit( Object.fromEntries( envSharedWithWorkers .map((k) => [k.toLocaleLowerCase(), Deno.env.get(k)]) - .filter(([_, v]) => v !== undefined) + .filter(([_, v]) => v !== undefined), ), - ] + ], ); diff --git a/src/typegate/src/config/types.ts b/src/typegate/src/config/types.ts index a9a5ec634a..cf8cbd4225 100644 --- a/src/typegate/src/config/types.ts +++ b/src/typegate/src/config/types.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { RefinementCtx, z } from "zod"; import { decodeBase64 } from "@std/encoding/base64"; diff --git a/src/typegate/src/crypto.ts b/src/typegate/src/crypto.ts index e34ddd0320..bf3a72b1b6 100644 --- a/src/typegate/src/crypto.ts +++ b/src/typegate/src/crypto.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { crypto } from "@std/crypto"; import { decodeBase64Url, encodeBase64Url } from "@std/encoding/base64url"; diff --git a/src/typegate/src/engine/computation_engine.ts b/src/typegate/src/engine/computation_engine.ts index a2cfb62db7..afeeb2a036 100644 --- a/src/typegate/src/engine/computation_engine.ts +++ b/src/typegate/src/engine/computation_engine.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { distinct } from "@std/collections/distinct"; import type { ComputeStage } from "./query_engine.ts"; diff --git a/src/typegate/src/engine/planner/args.ts b/src/typegate/src/engine/planner/args.ts index b034f4ebbe..f84452b2e5 100644 --- a/src/typegate/src/engine/planner/args.ts +++ b/src/typegate/src/engine/planner/args.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type * as ast from "graphql/ast"; import { Kind } from "graphql"; diff --git a/src/typegate/src/engine/planner/dependency_resolver.ts b/src/typegate/src/engine/planner/dependency_resolver.ts index fc3442ce8e..a055899f94 100644 --- a/src/typegate/src/engine/planner/dependency_resolver.ts +++ b/src/typegate/src/engine/planner/dependency_resolver.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { ComputeStage } from "../query_engine.ts"; import { type FieldNode, Kind, type SelectionSetNode } from "graphql"; diff --git a/src/typegate/src/engine/planner/injection_utils.ts b/src/typegate/src/engine/planner/injection_utils.ts index 5acfe33c82..d253c5dbee 100644 --- a/src/typegate/src/engine/planner/injection_utils.ts +++ b/src/typegate/src/engine/planner/injection_utils.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { EffectType, InjectionData } from "../../typegraph/types.ts"; diff --git a/src/typegate/src/engine/planner/mod.ts b/src/typegate/src/engine/planner/mod.ts index a70bed4517..ed4709ef92 100644 --- a/src/typegate/src/engine/planner/mod.ts +++ b/src/typegate/src/engine/planner/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type * as ast from "graphql/ast"; import { type FieldNode, Kind } from "graphql"; diff --git a/src/typegate/src/engine/planner/parameter_transformer.ts b/src/typegate/src/engine/planner/parameter_transformer.ts index 80e66e815f..22b3b5b68e 100644 --- a/src/typegate/src/engine/planner/parameter_transformer.ts +++ b/src/typegate/src/engine/planner/parameter_transformer.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type QueryFn, QueryFunction } from "../../libs/jsonpath.ts"; import type { TypeGraph } from "../../typegraph/mod.ts"; diff --git a/src/typegate/src/engine/planner/policies.ts b/src/typegate/src/engine/planner/policies.ts index 48278dc7cf..d82cbcd8cc 100644 --- a/src/typegate/src/engine/planner/policies.ts +++ b/src/typegate/src/engine/planner/policies.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { DenoRuntime } from "../../runtimes/deno/deno.ts"; import type { TypeGraph } from "../../typegraph/mod.ts"; diff --git a/src/typegate/src/engine/query_engine.ts b/src/typegate/src/engine/query_engine.ts index d36f74018d..7be7ad412c 100644 --- a/src/typegate/src/engine/query_engine.ts +++ b/src/typegate/src/engine/query_engine.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { parse } from "graphql"; import type * as ast from "graphql/ast"; diff --git a/src/typegate/src/engine/stage_id.ts b/src/typegate/src/engine/stage_id.ts index 590034f81d..935645abd8 100644 --- a/src/typegate/src/engine/stage_id.ts +++ b/src/typegate/src/engine/stage_id.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function getChildId(parentId: string | null, node: string) { if (parentId === null || parentId === "") { diff --git a/src/typegate/src/engine/typecheck/code_generator.ts b/src/typegate/src/engine/typecheck/code_generator.ts index 66990d62ba..6a5473acd2 100644 --- a/src/typegate/src/engine/typecheck/code_generator.ts +++ b/src/typegate/src/engine/typecheck/code_generator.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type BooleanNode, diff --git a/src/typegate/src/engine/typecheck/common.ts b/src/typegate/src/engine/typecheck/common.ts index 5c2d6f4607..8a10101042 100644 --- a/src/typegate/src/engine/typecheck/common.ts +++ b/src/typegate/src/engine/typecheck/common.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { StringFormat } from "../../typegraph/types.ts"; import * as uuid from "@std/uuid"; diff --git a/src/typegate/src/engine/typecheck/inline_validators/boolean.ts b/src/typegate/src/engine/typecheck/inline_validators/boolean.ts index 9085514b55..eec04768eb 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/boolean.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/boolean.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { BooleanNode } from "../../../typegraph/types.ts"; import { check } from "./common.ts"; diff --git a/src/typegate/src/engine/typecheck/inline_validators/common.ts b/src/typegate/src/engine/typecheck/inline_validators/common.ts index edc360b35d..6a65592f32 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/common.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/common.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function check(condition: string, message: string) { return `if (!(${condition})) throw new Error(${message});`; diff --git a/src/typegate/src/engine/typecheck/inline_validators/constraints.ts b/src/typegate/src/engine/typecheck/inline_validators/constraints.ts index 1fd6296062..35a38cfff3 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/constraints.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/constraints.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypeNode } from "../../../typegraph/type_node.ts"; import { check } from "./common.ts"; diff --git a/src/typegate/src/engine/typecheck/inline_validators/file.ts b/src/typegate/src/engine/typecheck/inline_validators/file.ts index 70bd38da3f..be630b50ea 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/file.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/file.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { FileNode } from "../../../typegraph/types.ts"; import { check } from "./common.ts"; diff --git a/src/typegate/src/engine/typecheck/inline_validators/list.ts b/src/typegate/src/engine/typecheck/inline_validators/list.ts index 2bea54163c..f1d6bdd523 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/list.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/list.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { ListNode } from "../../../typegraph/type_node.ts"; import { check } from "./common.ts"; diff --git a/src/typegate/src/engine/typecheck/inline_validators/mod.ts b/src/typegate/src/engine/typecheck/inline_validators/mod.ts index 074471e15f..1c5121f3fa 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/mod.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /// These validators are used to generate validator code to be inlined into /// the generated code. diff --git a/src/typegate/src/engine/typecheck/inline_validators/number.ts b/src/typegate/src/engine/typecheck/inline_validators/number.ts index f7168c43ee..8380ce7e50 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/number.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/number.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { FloatNode, IntegerNode } from "../../../typegraph/types.ts"; import { check } from "./common.ts"; diff --git a/src/typegate/src/engine/typecheck/inline_validators/object.ts b/src/typegate/src/engine/typecheck/inline_validators/object.ts index ca51927a6a..6fba958b3e 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/object.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/object.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type ObjectNode, diff --git a/src/typegate/src/engine/typecheck/inline_validators/string.ts b/src/typegate/src/engine/typecheck/inline_validators/string.ts index c3edc88d92..1ca436dddc 100644 --- a/src/typegate/src/engine/typecheck/inline_validators/string.ts +++ b/src/typegate/src/engine/typecheck/inline_validators/string.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { StringNode } from "../../../typegraph/type_node.ts"; import { check } from "./common.ts"; diff --git a/src/typegate/src/engine/typecheck/input.ts b/src/typegate/src/engine/typecheck/input.ts index f128d04129..bbba81f1b5 100644 --- a/src/typegate/src/engine/typecheck/input.ts +++ b/src/typegate/src/engine/typecheck/input.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypeGraph } from "../../typegraph/mod.ts"; import type { TypeNode } from "../../typegraph/types.ts"; diff --git a/src/typegate/src/engine/typecheck/matching_variant.ts b/src/typegate/src/engine/typecheck/matching_variant.ts index e1b4191fa3..2d59c882aa 100644 --- a/src/typegate/src/engine/typecheck/matching_variant.ts +++ b/src/typegate/src/engine/typecheck/matching_variant.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type EitherNode, diff --git a/src/typegate/src/engine/typecheck/result.ts b/src/typegate/src/engine/typecheck/result.ts index b528cfe574..760bb8a89f 100644 --- a/src/typegate/src/engine/typecheck/result.ts +++ b/src/typegate/src/engine/typecheck/result.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { FragmentDefs } from "../../transports/graphql/graphql.ts"; import type { @@ -30,7 +30,7 @@ import { export function generateValidator( tg: TypeGraph, operation: OperationDefinitionNode, - fragments: FragmentDefs + fragments: FragmentDefs, ): Validator { const code = new ResultValidationCompiler(tg, fragments).generate(operation); const validator = new Function(code)() as ValidatorFn; @@ -108,7 +108,7 @@ export class ResultValidationCompiler { } else if (isScalar(typeNode)) { if (entry.selectionSet != null) { throw new Error( - `Unexpected selection set for scalar type '${typeNode.type}' at '${entry.path}'` + `Unexpected selection set for scalar type '${typeNode.type}' at '${entry.path}'`, ); } @@ -135,7 +135,7 @@ export class ResultValidationCompiler { case "optional": { const itemValidatorName = this.validatorName( typeNode.item, - entry.selectionSet != null + entry.selectionSet != null, ); cg.generateOptionalValidator(typeNode, itemValidatorName); queue.push({ @@ -150,7 +150,7 @@ export class ResultValidationCompiler { case "list": { const itemValidatorName = this.validatorName( typeNode.items, - entry.selectionSet != null + entry.selectionSet != null, ); cg.generateArrayValidator(typeNode, itemValidatorName); queue.push({ @@ -163,11 +163,11 @@ export class ResultValidationCompiler { } case "object": { - const childEntries: Record = - this.getChildEntries(typeNode, entry); + const childEntries: Record = this + .getChildEntries(typeNode, entry); cg.generateObjectValidator( typeNode, - mapValues(childEntries, (e) => e.name) + mapValues(childEntries, (e) => e.name), ); queue.push(...Object.values(childEntries)); break; @@ -177,7 +177,7 @@ export class ResultValidationCompiler { const childEntries = this.getVariantEntries(typeNode.anyOf, entry); cg.generateUnionValidator( typeNode, - childEntries.map((e) => e.name) + childEntries.map((e) => e.name), ); queue.push(...childEntries); break; @@ -187,7 +187,7 @@ export class ResultValidationCompiler { const childEntries = this.getVariantEntries(typeNode.oneOf, entry); cg.generateEitherValidator( typeNode, - childEntries.map((e) => e.name) + childEntries.map((e) => e.name), ); queue.push(...childEntries); break; @@ -196,7 +196,7 @@ export class ResultValidationCompiler { case "function": { const outputValidator = this.validatorName( typeNode.output, - entry.selectionSet != null + entry.selectionSet != null, ); cg.line(`${outputValidator}(value, path, errors, context)`); queue.push({ @@ -217,7 +217,7 @@ export class ResultValidationCompiler { const fnBody = cg.reset().join("\n"); this.codes.set( fnName, - `function ${fnName}(value, path, errors, context) {\n${fnBody}\n}` + `function ${fnName}(value, path, errors, context) {\n${fnBody}\n}`, ); } @@ -231,7 +231,7 @@ export class ResultValidationCompiler { private getChildEntryFromFieldNode( typeNode: ObjectNode, entry: QueueEntry, - node: FieldNode + node: FieldNode, ): [string, QueueEntry] { const { name, selectionSet, alias } = node; const propName = alias?.value ?? name.value; @@ -279,7 +279,7 @@ export class ResultValidationCompiler { private getChildEntriesFromSelectionNode( typeNode: ObjectNode, entry: QueueEntry, - node: SelectionNode + node: SelectionNode, ): Array<[string, QueueEntry]> { switch (node.kind) { case Kind.FIELD: @@ -308,13 +308,13 @@ export class ResultValidationCompiler { private getChildEntries( typeNode: ObjectNode, - entry: QueueEntry + entry: QueueEntry, ): Record { if (entry.selectionSet?.selections) { return Object.fromEntries( entry.selectionSet!.selections.flatMap((node) => this.getChildEntriesFromSelectionNode(typeNode, entry, node) - ) + ), ); } @@ -324,21 +324,23 @@ export class ResultValidationCompiler { private getVariantEntries( variants: number[], - entry: QueueEntry + entry: QueueEntry, ): QueueEntry[] { const multilevelVariants = this.tg.typeUtils.flattenUnionVariants(variants); const selectableVariants = multilevelVariants.filter( (variant) => - !this.tg.typeUtils.isScalarOrListOfScalars(this.tg.type(variant)) + !this.tg.typeUtils.isScalarOrListOfScalars(this.tg.type(variant)), ); if (entry.selectionSet == null) { if (selectableVariants.length > 0) { const s = selectableVariants.length === 1 ? "" : "s"; const names = selectableVariants.map((idx) => this.tg.type(idx).title); throw new Error( - `at '${entry.path}': selection set required for type${s} ${names.join( - ", " - )}` + `at '${entry.path}': selection set required for type${s} ${ + names.join( + ", ", + ) + }`, ); } } @@ -347,18 +349,18 @@ export class ResultValidationCompiler { const variantSelections: Map = entry.selectionSet != null ? new Map( - entry.selectionSet.selections.map((node) => { - if ( - node.kind !== Kind.INLINE_FRAGMENT || - node.typeCondition == null - ) { - throw new Error( - `at '${entry.path}': selection nodes must be inline fragments with type condition` - ); - } - return [node.typeCondition.name.value, node]; - }) - ) + entry.selectionSet.selections.map((node) => { + if ( + node.kind !== Kind.INLINE_FRAGMENT || + node.typeCondition == null + ) { + throw new Error( + `at '${entry.path}': selection nodes must be inline fragments with type condition`, + ); + } + return [node.typeCondition.name.value, node]; + }), + ) : new Map(); const entries: QueueEntry[] = variants.map((variantIdx) => { @@ -371,7 +373,7 @@ export class ResultValidationCompiler { if (selectionSet == null) { // TODO link to matching documentation page throw new Error( - `at '${entry.path}': variant type '${typeName}' must have a selection set on an inline fragment with type condition` + `at '${entry.path}': variant type '${typeName}' must have a selection set on an inline fragment with type condition`, ); } variantSelections.delete(typeName); @@ -385,7 +387,7 @@ export class ResultValidationCompiler { case Type.UNION: case Type.EITHER: { const nestedVariants = this.tg.typeUtils.getFlatUnionVariants( - typeNode as UnionNode | EitherNode + typeNode as UnionNode | EitherNode, ); return { name: this.validatorName(variantIdx, true), @@ -420,7 +422,7 @@ export class ResultValidationCompiler { if (variantSelections.size > 0) { const names = [...variantSelections.keys()].join(", "); throw new Error( - `at '${entry.path}': Unexpected type conditions: ${names}` + `at '${entry.path}': Unexpected type conditions: ${names}`, ); } return entries; diff --git a/src/typegate/src/errors.ts b/src/typegate/src/errors.ts index f34992294e..e460ac5621 100644 --- a/src/typegate/src/errors.ts +++ b/src/typegate/src/errors.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { basename, dirname } from "@std/url"; import { extname } from "@std/path"; diff --git a/src/typegate/src/libs/jsonpath.ts b/src/typegate/src/libs/jsonpath.ts index d2bcad72b7..c2c733c78b 100644 --- a/src/typegate/src/libs/jsonpath.ts +++ b/src/typegate/src/libs/jsonpath.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /** * JsonPath query compiler: jsonpath query to javascript function; diff --git a/src/typegate/src/log.ts b/src/typegate/src/log.ts index 9371866724..d1dbeef25f 100644 --- a/src/typegate/src/log.ts +++ b/src/typegate/src/log.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { ConsoleHandler, type LevelName, Logger } from "@std/log"; import { basename, dirname } from "@std/url"; diff --git a/src/typegate/src/main.ts b/src/typegate/src/main.ts index 53dfa22e96..f6e1f0e1e3 100644 --- a/src/typegate/src/main.ts +++ b/src/typegate/src/main.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { init_native } from "native"; diff --git a/src/typegate/src/runtimes/Runtime.ts b/src/typegate/src/runtimes/Runtime.ts index 3b0ef87d75..3c4c0d6e5f 100644 --- a/src/typegate/src/runtimes/Runtime.ts +++ b/src/typegate/src/runtimes/Runtime.ts @@ -1,9 +1,9 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { ComputeStage } from "../engine/query_engine.ts"; import { equal } from "@std/assert/equal"; -import type { Resolver, ResolverArgs } from "../types.ts"; +import type { Resolver } from "../types.ts"; export abstract class Runtime { readonly id: string; @@ -65,10 +65,9 @@ export abstract class Runtime { materializedStages.push(...materializeRoot(s)); } else { materializedStages.push( - s.withResolver( - Runtime.resolveFromParent(s.props.node), - [s.props.parent!.id()], - ), + s.withResolver(Runtime.resolveFromParent(s.props.node), [ + s.props.parent!.id(), + ]), ); } } diff --git a/src/typegate/src/runtimes/deno.ts b/src/typegate/src/runtimes/deno.ts index acc0928409..5b2242b20e 100644 --- a/src/typegate/src/runtimes/deno.ts +++ b/src/typegate/src/runtimes/deno.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { DenoRuntime } from "./deno/deno.ts"; import { registerRuntime } from "./mod.ts"; diff --git a/src/typegate/src/runtimes/deno/deno.ts b/src/typegate/src/runtimes/deno/deno.ts index 92c4af3a8d..04d1e828cd 100644 --- a/src/typegate/src/runtimes/deno/deno.ts +++ b/src/typegate/src/runtimes/deno/deno.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { ComputeStage } from "../../engine/query_engine.ts"; import type { TypeGraphDS, TypeMaterializer } from "../../typegraph/mod.ts"; @@ -13,9 +13,6 @@ import { DenoMessenger } from "./deno_messenger.ts"; import type { Task } from "./shared_types.ts"; import { path } from "compress/deps.ts"; import { globalConfig as config } from "../../config.ts"; -import { getLogger } from "../../log.ts"; - -const logger = getLogger(import.meta); const predefinedFuncs: Record>> = { identity: ({ _, ...args }) => args, @@ -188,9 +185,7 @@ export class DenoRuntime extends Runtime { const typename = getTypename(); - return [ - stage.withResolver(() => typename), - ]; + return [stage.withResolver(() => typename)]; } if (stage.props.materializer != null) { diff --git a/src/typegate/src/runtimes/deno/deno_messenger.ts b/src/typegate/src/runtimes/deno/deno_messenger.ts index 306ccd54e9..27050f26eb 100644 --- a/src/typegate/src/runtimes/deno/deno_messenger.ts +++ b/src/typegate/src/runtimes/deno/deno_messenger.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import * as Sentry from "sentry"; import { envSharedWithWorkers } from "../../config/shared.ts"; diff --git a/src/typegate/src/runtimes/deno/shared_types.ts b/src/typegate/src/runtimes/deno/shared_types.ts index 7bbb446fe0..acfdac9c4c 100644 --- a/src/typegate/src/runtimes/deno/shared_types.ts +++ b/src/typegate/src/runtimes/deno/shared_types.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { Context } from "../../types.ts"; import type { EffectType } from "../../typegraph/types.ts"; @@ -70,6 +70,6 @@ export interface TaskExec { ( args: Record, context: TaskContext, - helpers: Record + helpers: Record, ): unknown; } diff --git a/src/typegate/src/runtimes/deno/worker.ts b/src/typegate/src/runtimes/deno/worker.ts index b2f76a4419..424e295374 100644 --- a/src/typegate/src/runtimes/deno/worker.ts +++ b/src/typegate/src/runtimes/deno/worker.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // bring the unstable WorkerOptions api into scope /// @@ -43,7 +43,7 @@ async function import_func(op: number, task: ImportFuncTask) { return await mod[name]( args, internals, - make_internal(internals, additionalHeaders) + make_internal(internals, additionalHeaders), ); } throw new Error(`"${name}" is not a valid method`); @@ -75,7 +75,7 @@ function register_func(_: null, task: RegisterFuncTask) { registry.set( op, - new Function(`"use strict"; ${fnCode}; return _my_lambda;`)() + new Function(`"use strict"; ${fnCode}; return _my_lambda;`)(), ); } diff --git a/src/typegate/src/runtimes/graphql.ts b/src/typegate/src/runtimes/graphql.ts index 5cf6116fa3..727a50b6b2 100644 --- a/src/typegate/src/runtimes/graphql.ts +++ b/src/typegate/src/runtimes/graphql.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { ComputeStage } from "../engine/query_engine.ts"; import { gq } from "../transports/graphql/gq.ts"; diff --git a/src/typegate/src/runtimes/grpc.ts b/src/typegate/src/runtimes/grpc.ts index 6b6c13058b..3fbb52b131 100644 --- a/src/typegate/src/runtimes/grpc.ts +++ b/src/typegate/src/runtimes/grpc.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "./Runtime.ts"; import * as native from "native"; diff --git a/src/typegate/src/runtimes/http.ts b/src/typegate/src/runtimes/http.ts index e8db167641..79176e8fed 100644 --- a/src/typegate/src/runtimes/http.ts +++ b/src/typegate/src/runtimes/http.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { ComputeStage } from "../engine/query_engine.ts"; import { Runtime } from "./Runtime.ts"; diff --git a/src/typegate/src/runtimes/kv.ts b/src/typegate/src/runtimes/kv.ts index 7ceec77696..437c0f44cc 100644 --- a/src/typegate/src/runtimes/kv.ts +++ b/src/typegate/src/runtimes/kv.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { connect, parseURL, type Redis } from "redis"; import { ComputeStage } from "../engine/query_engine.ts"; @@ -10,8 +10,6 @@ import type { Resolver, RuntimeInitParams } from "../types.ts"; import { registerRuntime } from "./mod.ts"; import { Runtime } from "./Runtime.ts"; -const logger = getLogger(import.meta); - @registerRuntime("kv") export class KvRuntime extends Runtime { private logger: Logger; diff --git a/src/typegate/src/runtimes/mod.ts b/src/typegate/src/runtimes/mod.ts index 5abd627c45..88365dc200 100644 --- a/src/typegate/src/runtimes/mod.ts +++ b/src/typegate/src/runtimes/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { Runtime } from "./Runtime.ts"; import type { RuntimeInit, RuntimeInitParams } from "../types.ts"; @@ -11,7 +11,7 @@ interface RegistrableRuntime { } export function registerRuntime( - name: string + name: string, ): (runtime: T) => void { return (runtime: T) => { if (registeredRuntimes.has(name)) { @@ -23,7 +23,7 @@ export function registerRuntime( export async function initRuntime( name: string, - params: RuntimeInitParams + params: RuntimeInitParams, ): Promise { const init = registeredRuntimes.get(name); if (!init) { diff --git a/src/typegate/src/runtimes/patterns/messenger/async_messenger.ts b/src/typegate/src/runtimes/patterns/messenger/async_messenger.ts index 12d15287cc..d77a4c3604 100644 --- a/src/typegate/src/runtimes/patterns/messenger/async_messenger.ts +++ b/src/typegate/src/runtimes/patterns/messenger/async_messenger.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { getLogger } from "../../../log.ts"; import type { Answer, Message, TaskData } from "./types.ts"; diff --git a/src/typegate/src/runtimes/patterns/messenger/lazy_async_messenger.ts b/src/typegate/src/runtimes/patterns/messenger/lazy_async_messenger.ts index 5b7f37df30..e645734dad 100644 --- a/src/typegate/src/runtimes/patterns/messenger/lazy_async_messenger.ts +++ b/src/typegate/src/runtimes/patterns/messenger/lazy_async_messenger.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { getLogger } from "../../../log.ts"; import { maxi32 } from "../../../utils.ts"; diff --git a/src/typegate/src/runtimes/patterns/messenger/types.ts b/src/typegate/src/runtimes/patterns/messenger/types.ts index fd75e012b8..202d67a7c6 100644 --- a/src/typegate/src/runtimes/patterns/messenger/types.ts +++ b/src/typegate/src/runtimes/patterns/messenger/types.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export interface Message { id: number; diff --git a/src/typegate/src/runtimes/prisma.ts b/src/typegate/src/runtimes/prisma.ts index 60fc178640..dac508a1e6 100644 --- a/src/typegate/src/runtimes/prisma.ts +++ b/src/typegate/src/runtimes/prisma.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { registerRuntime } from "./mod.ts"; import { PrismaRuntime } from "./prisma/mod.ts"; diff --git a/src/typegate/src/runtimes/prisma/hooks/generate_schema.ts b/src/typegate/src/runtimes/prisma/hooks/generate_schema.ts index cbc4711768..c4e9336185 100644 --- a/src/typegate/src/runtimes/prisma/hooks/generate_schema.ts +++ b/src/typegate/src/runtimes/prisma/hooks/generate_schema.ts @@ -1,12 +1,11 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Type, type TypeNode } from "../../../typegraph/type_node.ts"; import type { PushHandler } from "../../../typegate/hooks.ts"; import type { SecretManager, TypeGraphDS } from "../../../typegraph/mod.ts"; import type { Cardinality, - Injection, Model, Property, Relationship, @@ -108,9 +107,7 @@ class FieldBuilder { tags.push("@default(uuid())"); break; default: - throw new Error( - "unsupported auto attribute on type string", - ); + throw new Error("unsupported auto attribute on type string"); } break; case "Int": @@ -133,8 +130,8 @@ class FieldBuilder { case "relationship": { const quant = FieldBuilder.#quantifier(prop.cardinality); - const rel = this.relationships.find((r) => - r.name === prop.relationshipName + const rel = this.relationships.find( + (r) => r.name === prop.relationshipName, ); const tags: string[] = []; if (rel == null) { @@ -155,20 +152,21 @@ class FieldBuilder { case "left": { const toPascalCase = (s: string) => s[0].toUpperCase() + s.slice(1); - const leftModel = this.models.find((m) => - m.typeIdx === rel.left.type_idx + const leftModel = this.models.find( + (m) => m.typeIdx === rel.left.type_idx, ); if (leftModel == null) { throw new Error("left model not found"); } - const fields = leftModel.idFields.map((key) => - `${prop.key}${toPascalCase(key)}` + const fields = leftModel.idFields.map( + (key) => `${prop.key}${toPascalCase(key)}`, ); const fkeys = leftModel.idFields.map((key) => { const idProp = leftModel.props.find((p) => p.key === key)!; - const modelField = this.build( - { ...idProp, cardinality: prop.cardinality }, - ); + const modelField = this.build({ + ...idProp, + cardinality: prop.cardinality, + }); modelField.name = `${prop.key}${toPascalCase(modelField.name)}`; modelField.tags = modelField.tags.filter( (t) => !t.startsWith("@default"), @@ -269,7 +267,7 @@ class FieldBuilder { } const SUPPORTED_PROVIDERS = ["postgresql", "mysql", "mongodb"] as const; -type Provider = typeof SUPPORTED_PROVIDERS[number]; +type Provider = (typeof SUPPORTED_PROVIDERS)[number]; export class SchemaGenerator { #provider: Provider; @@ -316,7 +314,10 @@ export class SchemaGenerator { modelFields.push(field); modelFields.push(...field.fkeys); if (field.fkeys.length > 0) { - fkeysMap.set(field.name, field.fkeys.map((fkey) => fkey.name)); + fkeysMap.set( + field.name, + field.fkeys.map((fkey) => fkey.name), + ); } if ( field.fkeysUnique && @@ -342,17 +343,16 @@ export class SchemaGenerator { } // expand foreign keys - const uniqueConstraints = model.uniqueConstraints.map( - (constraint) => constraint.flatMap((key) => fkeysMap.get(key) ?? [key]), + const uniqueConstraints = model.uniqueConstraints.map((constraint) => + constraint.flatMap((key) => fkeysMap.get(key) ?? [key]) ); for (const constraint of uniqueConstraints) { const names = constraint.join(", "); tags.push(`@@unique([${names}])`); } - const formattedFields = modelFields.map((field) => - ` ${field.stringify()}\n` - ) + const formattedFields = modelFields + .map((field) => ` ${field.stringify()}\n`) .join(""); const formattedTags = tags.length > 0 ? "\n" + tags.map((tag) => ` ${tag}\n`).join("") @@ -362,9 +362,7 @@ export class SchemaGenerator { } generate() { - return this.#models.map((model) => this.generateModel(model)).join( - "\n\n", - ); + return this.#models.map((model) => this.generateModel(model)).join("\n\n"); } } diff --git a/src/typegate/src/runtimes/prisma/hooks/mod.ts b/src/typegate/src/runtimes/prisma/hooks/mod.ts index efc14133b9..8bcff2c031 100644 --- a/src/typegate/src/runtimes/prisma/hooks/mod.ts +++ b/src/typegate/src/runtimes/prisma/hooks/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export { runMigrations } from "./run_migrations.ts"; export { generateSchema } from "./generate_schema.ts"; diff --git a/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts b/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts index 31ccf54572..81555ef76f 100644 --- a/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts +++ b/src/typegate/src/runtimes/prisma/hooks/run_migrations.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { PushFailure, diff --git a/src/typegate/src/runtimes/prisma/migration.ts b/src/typegate/src/runtimes/prisma/migration.ts index 3470edf927..eeea3a839e 100644 --- a/src/typegate/src/runtimes/prisma/migration.ts +++ b/src/typegate/src/runtimes/prisma/migration.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "../Runtime.ts"; import type { Resolver, ResolverArgs } from "../../types.ts"; diff --git a/src/typegate/src/runtimes/prisma/mod.ts b/src/typegate/src/runtimes/prisma/mod.ts index 8c277c5c93..1594aeaf4e 100644 --- a/src/typegate/src/runtimes/prisma/mod.ts +++ b/src/typegate/src/runtimes/prisma/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { PrismaRuntime } from "./prisma.ts"; import { PrismaMigrate, PrismaMigrationRuntime } from "./migration.ts"; diff --git a/src/typegate/src/runtimes/prisma/prisma.ts b/src/typegate/src/runtimes/prisma/prisma.ts index 9daf9cb847..c8e828a215 100644 --- a/src/typegate/src/runtimes/prisma/prisma.ts +++ b/src/typegate/src/runtimes/prisma/prisma.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "../Runtime.ts"; import * as native from "native"; diff --git a/src/typegate/src/runtimes/prisma/types.ts b/src/typegate/src/runtimes/prisma/types.ts index d84833b9cf..99b4717d27 100644 --- a/src/typegate/src/runtimes/prisma/types.ts +++ b/src/typegate/src/runtimes/prisma/types.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { RuntimeDataBase } from "../../types.ts"; import type { PrismaRuntimeData, TGRuntime } from "../../typegraph/types.ts"; diff --git a/src/typegate/src/runtimes/python.ts b/src/typegate/src/runtimes/python.ts index 0514eefea7..a96df05138 100644 --- a/src/typegate/src/runtimes/python.ts +++ b/src/typegate/src/runtimes/python.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { registerRuntime } from "./mod.ts"; import { getLogger, type Logger } from "../log.ts"; diff --git a/src/typegate/src/runtimes/random.ts b/src/typegate/src/runtimes/random.ts index 91411413fa..0972a7db37 100644 --- a/src/typegate/src/runtimes/random.ts +++ b/src/typegate/src/runtimes/random.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "./Runtime.ts"; import { ComputeStage } from "../engine/query_engine.ts"; diff --git a/src/typegate/src/runtimes/s3.ts b/src/typegate/src/runtimes/s3.ts index 285cc896b0..b09f8dcb9b 100644 --- a/src/typegate/src/runtimes/s3.ts +++ b/src/typegate/src/runtimes/s3.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "./Runtime.ts"; import type { ComputeStage } from "../engine/query_engine.ts"; diff --git a/src/typegate/src/runtimes/substantial.ts b/src/typegate/src/runtimes/substantial.ts index 80886ecfdd..3f4ac726f2 100644 --- a/src/typegate/src/runtimes/substantial.ts +++ b/src/typegate/src/runtimes/substantial.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "./Runtime.ts"; import { Resolver, RuntimeInitParams } from "../types.ts"; @@ -15,12 +15,11 @@ import { Backend } from "../../engine/runtime.js"; import { Agent, AgentConfig, + type StdKwargs, WorkflowDescription, } from "./substantial/agent.ts"; import { closestWord } from "../utils.ts"; import { InternalAuth } from "../services/auth/protocols/internal.ts"; -import { TaskContext } from "./deno/shared_types.ts"; -import { globalConfig } from "../config.ts"; const logger = getLogger(import.meta); @@ -67,7 +66,8 @@ export class SubstantialRuntime extends Runtime { backend: Backend, queue: string, agent: Agent, - typegate: Typegate + typegate: Typegate, + private secrets: Record, ) { super(typegraphName); this.logger = getLogger(`substantial:'${typegraphName}'`); @@ -112,26 +112,13 @@ export class SubstantialRuntime extends Runtime { maxAcquirePerTick: typegate.config.base.substantial_max_acquire_per_tick, } satisfies AgentConfig; - // Note: required for ctx.gql() - const token = await InternalAuth.emit(typegate.cryptoKeys); - const internalTCtx = { - context: {}, - secrets: {}, - effect: null, - meta: { - url: `http://127.0.0.1:${globalConfig.tg_port}/${tgName}`, - token, - }, - headers: {}, - } satisfies TaskContext; - - const agent = new Agent(backend, queue, agentConfig, internalTCtx); + const agent = new Agent(backend, queue, agentConfig); const wfDescriptions = await getWorkflowDescriptions( tgName, tg.meta.artifacts, runtimeArgs.workflows, - typegate + typegate, ); agent.start(wfDescriptions); @@ -143,12 +130,13 @@ export class SubstantialRuntime extends Runtime { backend, queue, agent, - typegate + typegate, + secrets, ); await instance.#prepareWorkflowFiles( tg.meta.artifacts, runtimeArgs.workflows, - typegate + typegate, ); return instance; @@ -211,9 +199,9 @@ export class SubstantialRuntime extends Runtime { switch (matName) { case "start": - return this.#startResolver(false); + return this.#startResolver(mat, false); case "start_raw": - return this.#startResolver(true); + return this.#startResolver(mat, true); case "stop": return this.#stopResolver(); case "send": @@ -224,8 +212,9 @@ export class SubstantialRuntime extends Runtime { return ({ name: workflowName }) => { this.#checkWorkflowExistOrThrow(workflowName); - const res = - this.agent.workerManager.getAllocatedResources(workflowName); + const res = this.agent.workerManager.getAllocatedResources( + workflowName, + ); return JSON.parse(JSON.stringify(res)); }; case "results": @@ -239,15 +228,43 @@ export class SubstantialRuntime extends Runtime { } } - #startResolver(enableGenerics: boolean): Resolver { - return async ({ name: workflowName, kwargs }) => { + #startResolver(mat: TypeMaterializer, enableGenerics: boolean): Resolver { + const secrets = ((mat.data.secrets as []) ?? []).reduce( + (agg, secretName) => ({ ...agg, [secretName]: this.secrets[secretName] }), + {}, + ); + return async ({ + name: workflowName, + kwargs, + _: { + context, + parent, + info: { url, headers }, + }, + }) => { this.#checkWorkflowExistOrThrow(workflowName); const runId = Agent.nextId(workflowName); const schedule = new Date().toJSON(); + const token = await InternalAuth.emit(this.typegate.cryptoKeys); + const stdKwargs = { + kwargs: enableGenerics ? JSON.parse(kwargs) : kwargs, + taskContext: { + parent, + context, + secrets, + effect: mat.effect.effect ?? null, + meta: { + url: `${url.protocol}//${url.host}/${this.typegraphName}`, + token, + }, + headers, + }, + } satisfies StdKwargs; + logger.info( - `Start request "${workflowName}" received: new run "${runId}" should be scheduled.` + `Start request "${workflowName}" received: new run "${runId}" should be scheduled.`, ); await this.agent.schedule({ backend: this.backend, @@ -258,7 +275,7 @@ export class SubstantialRuntime extends Runtime { at: schedule, event: { type: "Start", - kwargs: enableGenerics ? JSON.parse(kwargs) : kwargs, + kwargs: stdKwargs, }, }, }); @@ -404,13 +421,13 @@ export class SubstantialRuntime extends Runtime { async #prepareWorkflowFiles( artifacts: Record, fileDescriptions: Array, - typegate: Typegate + typegate: Typegate, ) { const descriptions = await getWorkflowDescriptions( this.typegraphName, artifacts, fileDescriptions, - typegate + typegate, ); for (const wf of descriptions) { @@ -424,14 +441,16 @@ export class SubstantialRuntime extends Runtime { const closest = closestWord(name, known); if (closest) { throw new Error( - `workflow "${name}" does not exist, did you mean "${closest}"?` + `workflow "${name}" does not exist, did you mean "${closest}"?`, ); } throw new Error( - `workflow "${name}" does not exist, available workflows are ${known - .map((name) => `"${name}"`) - .join(", ")}` + `workflow "${name}" does not exist, available workflows are ${ + known + .map((name) => `"${name}"`) + .join(", ") + }`, ); } } @@ -441,7 +460,7 @@ async function getWorkflowDescriptions( typegraphName: string, artifacts: Record, descriptions: Array, - typegate: Typegate + typegate: Typegate, ) { const basePath = path.join(typegate.config.base.tmp_dir, "artifacts"); logger.info(`Resolved runtime artifacts at ${basePath}`); @@ -456,7 +475,7 @@ async function getWorkflowDescriptions( typegraphName, artifacts, description, - typegate + typegate, ); workflowDescriptions.push({ @@ -477,7 +496,7 @@ async function getWorkflowEntryPointPath( typegraphName: string, artifacts: Record, description: WorkflowFileDescription, - typegate: Typegate + typegate: Typegate, ) { const entryPoint = artifacts[description.file as string]; const deps = (description.deps as string[]).map((dep) => artifacts[dep]); diff --git a/src/typegate/src/runtimes/substantial/agent.ts b/src/typegate/src/runtimes/substantial/agent.ts index 330afd6a60..185a33eb9b 100644 --- a/src/typegate/src/runtimes/substantial/agent.ts +++ b/src/typegate/src/runtimes/substantial/agent.ts @@ -18,6 +18,11 @@ import { RunId, WorkerManager } from "./workflow_worker_manager.ts"; const logger = getLogger(import.meta, "WARN"); +export interface StdKwargs { + taskContext: TaskContext; + kwargs: Record; +} + export interface WorkflowDescription { name: string; path: string; @@ -39,7 +44,6 @@ export class Agent { private backend: Backend, private queue: string, private config: AgentConfig, - private internalTCtx: TaskContext, ) {} async schedule(input: AddScheduleInput) { @@ -245,6 +249,7 @@ export class Agent { return; } + const { taskContext, kwargs } = first.event.kwargs as unknown as StdKwargs; try { this.workerManager.triggerStart( workflow.name, @@ -252,8 +257,8 @@ export class Agent { workflow.path, run, next.schedule_date, - first.event.kwargs, - this.internalTCtx, + kwargs, + taskContext, ); this.workerManager.listen( diff --git a/src/typegate/src/runtimes/substantial/deno_context.ts b/src/typegate/src/runtimes/substantial/deno_context.ts index 44a48f81e0..32b85f66b3 100644 --- a/src/typegate/src/runtimes/substantial/deno_context.ts +++ b/src/typegate/src/runtimes/substantial/deno_context.ts @@ -1,12 +1,9 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 - -// FIXME: DO NOT IMPORT any file that refers to Meta, this will be instantiated in a Worker -// import { sleep } from "../../utils.ts"; // will silently fail?? +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { make_internal } from "../../worker_utils.ts"; import { TaskContext } from "../deno/shared_types.ts"; -import { Interrupt, OperationEvent, Run, appendIfOngoing } from "./types.ts"; +import { appendIfOngoing, Interrupt, OperationEvent, Run } from "./types.ts"; // const isTest = Deno.env.get("DENO_TESTING") === "true"; const testBaseUrl = Deno.env.get("TEST_OVERRIDE_GQL_ORIGIN"); @@ -14,13 +11,13 @@ const testBaseUrl = Deno.env.get("TEST_OVERRIDE_GQL_ORIGIN"); const additionalHeaders = { connection: "keep-alive" }; export class Context { - private id: number = 0; + private id = 0; gql: ReturnType; constructor( private run: Run, private kwargs: Record, - private internal: TaskContext + private internal: TaskContext, ) { this.gql = createGQLClient(internal); } @@ -86,7 +83,7 @@ export class Context { const strategy = new RetryStrategy( retry.maxRetries, retry.minBackoffMs, - retry.maxBackoffMs + retry.maxBackoffMs, ); const retriesLeft = Math.max(retry.maxRetries - currRetryCount, 0); @@ -170,7 +167,7 @@ export class Context { async handle( eventName: string, - fn: (received: unknown) => unknown | Promise + fn: (received: unknown) => unknown | Promise, ) { for (const { event } of this.run.operations) { if (event.type == "Send" && event.event_name == eventName) { @@ -208,7 +205,7 @@ export class Context { createWorkflowHandle(handleDef: SerializableWorkflowHandle) { if (!handleDef.runId) { throw new Error( - "Cannot create handle from a definition that was not run" + "Cannot create handle from a definition that was not run", ); } return new ChildWorkflowHandle(this, handleDef); @@ -227,11 +224,11 @@ interface SerializableWorkflowHandle { export class ChildWorkflowHandle { constructor( private ctx: Context, - public handleDef: SerializableWorkflowHandle + public handleDef: SerializableWorkflowHandle, ) {} async start(): Promise { - const { data } = await this.ctx.gql/**/ ` + const { data } = await this.ctx.gql /**/` mutation ($name: String!, $kwargs: String!) { _sub_internal_start(name: $name, kwargs: $kwargs) } @@ -243,7 +240,7 @@ export class ChildWorkflowHandle { this.handleDef.runId = (data as any)._sub_internal_start as string; this.#checkRunId(); - const { data: _ } = await this.ctx.gql/**/ ` + const { data: _ } = await this.ctx.gql /**/` mutation ($parent_run_id: String!, $child_run_id: String!) { _sub_internal_link_parent_child(parent_run_id: $parent_run_id, child_run_id: $child_run_id) } @@ -258,7 +255,7 @@ export class ChildWorkflowHandle { async result(): Promise { this.#checkRunId(); - const { data } = await this.ctx.gql/**/ ` + const { data } = await this.ctx.gql /**/` query ($name: String!) { _sub_internal_results(name: $name) { completed { @@ -292,7 +289,7 @@ export class ChildWorkflowHandle { async stop(): Promise { this.#checkRunId(); - const { data } = await this.ctx.gql/**/ ` + const { data } = await this.ctx.gql /**/` mutation ($run_id: String!) { _sub_internal_stop(run_id: $run_id) } @@ -306,7 +303,7 @@ export class ChildWorkflowHandle { async hasStopped(): Promise { this.#checkRunId(); - const { data } = await this.ctx.gql/**/ ` + const { data } = await this.ctx.gql /**/` query { _sub_internal_results(name: $name) { completed { @@ -329,7 +326,7 @@ export class ChildWorkflowHandle { #checkRunId() { if (!this.handleDef.runId) { throw new Error( - "Invalid state: run_id is not properly set, this could mean that the workflow was not started yet" + "Invalid state: run_id is not properly set, this could mean that the workflow was not started yet", ); } } @@ -371,7 +368,7 @@ class RetryStrategy { constructor( maxRetries: number, minBackoffMs?: number, - maxBackoffMs?: number + maxBackoffMs?: number, ) { this.maxRetries = maxRetries; this.minBackoffMs = minBackoffMs; diff --git a/src/typegate/src/runtimes/substantial/types.ts b/src/typegate/src/runtimes/substantial/types.ts index e7defcf5bd..c750130e6d 100644 --- a/src/typegate/src/runtimes/substantial/types.ts +++ b/src/typegate/src/runtimes/substantial/types.ts @@ -1,12 +1,12 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Operation, Run } from "../../../engine/runtime.js"; export type { + Backend, Operation, OperationEvent, Run, - Backend, } from "../../../engine/runtime.js"; export type AnyString = string & Record; diff --git a/src/typegate/src/runtimes/substantial/worker.ts b/src/typegate/src/runtimes/substantial/worker.ts index fcbc626421..61f7a5dec5 100644 --- a/src/typegate/src/runtimes/substantial/worker.ts +++ b/src/typegate/src/runtimes/substantial/worker.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { errorToString } from "../../worker_utils.ts"; import { Context } from "./deno_context.ts"; @@ -28,31 +28,38 @@ self.onmessage = async function (event) { runCtx = new Context(run, kwargs, internal); - workflowFn(runCtx) + workflowFn(runCtx, internal) .then((wfResult: unknown) => { self.postMessage( Ok( - Msg(type, { - kind: "SUCCESS", - result: wfResult, - run: runCtx!.getRun(), - schedule, - } satisfies WorkflowResult) - ) + Msg( + type, + { + kind: "SUCCESS", + result: wfResult, + run: runCtx!.getRun(), + schedule, + } satisfies WorkflowResult, + ), + ), ); }) .catch((wfException: unknown) => { self.postMessage( Ok( - Msg(type, { - kind: "FAIL", - result: errorToString(wfException), - exception: - wfException instanceof Error ? wfException : undefined, - run: runCtx!.getRun(), - schedule, - } satisfies WorkflowResult) - ) + Msg( + type, + { + kind: "FAIL", + result: errorToString(wfException), + exception: wfException instanceof Error + ? wfException + : undefined, + run: runCtx!.getRun(), + schedule, + } satisfies WorkflowResult, + ), + ), ); }); break; diff --git a/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts b/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts index b7c95993d3..f40a299d4d 100644 --- a/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts +++ b/src/typegate/src/runtimes/substantial/workflow_worker_manager.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { envSharedWithWorkers } from "../../config/shared.ts"; import { getLogger } from "../../log.ts"; diff --git a/src/typegate/src/runtimes/temporal.ts b/src/typegate/src/runtimes/temporal.ts index 7c4687a1f9..c3af66a796 100644 --- a/src/typegate/src/runtimes/temporal.ts +++ b/src/typegate/src/runtimes/temporal.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "./Runtime.ts"; import * as native from "native"; diff --git a/src/typegate/src/runtimes/typegate.ts b/src/typegate/src/runtimes/typegate.ts index 81c8878280..bec4fea41a 100644 --- a/src/typegate/src/runtimes/typegate.ts +++ b/src/typegate/src/runtimes/typegate.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Runtime } from "./Runtime.ts"; import { ComputeStage } from "../engine/query_engine.ts"; diff --git a/src/typegate/src/runtimes/typegraph.ts b/src/typegate/src/runtimes/typegraph.ts index b109a0df7e..36ef2fdc59 100644 --- a/src/typegate/src/runtimes/typegraph.ts +++ b/src/typegate/src/runtimes/typegraph.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { TypeGraph, diff --git a/src/typegate/src/runtimes/utils/graphql_forward_vars.ts b/src/typegate/src/runtimes/utils/graphql_forward_vars.ts index e16c113e3e..94dedd77af 100644 --- a/src/typegate/src/runtimes/utils/graphql_forward_vars.ts +++ b/src/typegate/src/runtimes/utils/graphql_forward_vars.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { ensure } from "../../utils.ts"; import type { ComputeStage } from "../../engine/query_engine.ts"; diff --git a/src/typegate/src/runtimes/utils/graphql_inline_vars.ts b/src/typegate/src/runtimes/utils/graphql_inline_vars.ts index 194a5a699e..3b6630a932 100644 --- a/src/typegate/src/runtimes/utils/graphql_inline_vars.ts +++ b/src/typegate/src/runtimes/utils/graphql_inline_vars.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { JSONValue } from "../../utils.ts"; import type { FromVars } from "../graphql.ts"; diff --git a/src/typegate/src/runtimes/utils/http.ts b/src/typegate/src/runtimes/utils/http.ts index 7610cf9679..a3a2d48fac 100644 --- a/src/typegate/src/runtimes/utils/http.ts +++ b/src/typegate/src/runtimes/utils/http.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export interface ReplaceDynamicPathParamsResult { pathname: string; diff --git a/src/typegate/src/runtimes/wasm_reflected.ts b/src/typegate/src/runtimes/wasm_reflected.ts index 724f646120..3b3b6286b8 100644 --- a/src/typegate/src/runtimes/wasm_reflected.ts +++ b/src/typegate/src/runtimes/wasm_reflected.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { registerRuntime } from "./mod.ts"; import { Runtime } from "./Runtime.ts"; diff --git a/src/typegate/src/runtimes/wasm_wire.ts b/src/typegate/src/runtimes/wasm_wire.ts index de143b7225..d6d9b549a1 100644 --- a/src/typegate/src/runtimes/wasm_wire.ts +++ b/src/typegate/src/runtimes/wasm_wire.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { registerRuntime } from "./mod.ts"; import { Runtime } from "./Runtime.ts"; diff --git a/src/typegate/src/runtimes/wit_wire/mod.ts b/src/typegate/src/runtimes/wit_wire/mod.ts index 5374ae7361..0270fd2214 100644 --- a/src/typegate/src/runtimes/wit_wire/mod.ts +++ b/src/typegate/src/runtimes/wit_wire/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import * as zod from "zod"; import type { WitWireMatInfo } from "../../../engine/runtime.js"; @@ -9,7 +9,7 @@ import { getLogger } from "../../log.ts"; const logger = getLogger(import.meta); -const METATYPE_VERSION = "0.5.0-rc.4"; +const METATYPE_VERSION = "0.5.0-rc.5"; export class WitWireMessenger { static async init( diff --git a/src/typegate/src/services/artifact_service.ts b/src/typegate/src/services/artifact_service.ts index 555e118a72..1a9489a65c 100644 --- a/src/typegate/src/services/artifact_service.ts +++ b/src/typegate/src/services/artifact_service.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type ArtifactMeta, diff --git a/src/typegate/src/services/auth/cookies.ts b/src/typegate/src/services/auth/cookies.ts index aaf7b2c478..2a528e7204 100644 --- a/src/typegate/src/services/auth/cookies.ts +++ b/src/typegate/src/services/auth/cookies.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { deleteCookie, getCookies, setCookie } from "@std/http/cookie"; import type { TypegateCryptoKeys } from "../../crypto.ts"; diff --git a/src/typegate/src/services/auth/mod.ts b/src/typegate/src/services/auth/mod.ts index 0cd23a06a3..16175e4ea2 100644 --- a/src/typegate/src/services/auth/mod.ts +++ b/src/typegate/src/services/auth/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { JWTAuth } from "./protocols/jwt.ts"; import { BasicAuth } from "./protocols/basic.ts"; diff --git a/src/typegate/src/services/auth/protocols/basic.ts b/src/typegate/src/services/auth/protocols/basic.ts index f72f344e64..a6f52312be 100644 --- a/src/typegate/src/services/auth/protocols/basic.ts +++ b/src/typegate/src/services/auth/protocols/basic.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { SystemTypegraph } from "../../../system_typegraphs.ts"; import { b64decode } from "../../../utils.ts"; diff --git a/src/typegate/src/services/auth/protocols/internal.ts b/src/typegate/src/services/auth/protocols/internal.ts index b92959225b..bd1a82e832 100644 --- a/src/typegate/src/services/auth/protocols/internal.ts +++ b/src/typegate/src/services/auth/protocols/internal.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypegateCryptoKeys } from "../../../crypto.ts"; import { getLogger } from "../../../log.ts"; diff --git a/src/typegate/src/services/auth/protocols/jwt.ts b/src/typegate/src/services/auth/protocols/jwt.ts index 7d93e32a97..a4788268cb 100644 --- a/src/typegate/src/services/auth/protocols/jwt.ts +++ b/src/typegate/src/services/auth/protocols/jwt.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import * as jwt from "jwt"; import { getLogger } from "../../../log.ts"; diff --git a/src/typegate/src/services/auth/protocols/oauth2.ts b/src/typegate/src/services/auth/protocols/oauth2.ts index 0615565604..09729b4402 100644 --- a/src/typegate/src/services/auth/protocols/oauth2.ts +++ b/src/typegate/src/services/auth/protocols/oauth2.ts @@ -1,8 +1,12 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypegateConfigBase } from "../../../config.ts"; -import { OAuth2Client, type OAuth2ClientConfig, type Tokens } from "oauth2_client"; +import { + OAuth2Client, + type OAuth2ClientConfig, + type Tokens, +} from "oauth2_client"; import { randomUUID, type TypegateCryptoKeys } from "../../../crypto.ts"; import type { AdditionalAuthParams, JWTClaims } from "../mod.ts"; import { getLogger } from "../../../log.ts"; diff --git a/src/typegate/src/services/auth/protocols/protocol.ts b/src/typegate/src/services/auth/protocols/protocol.ts index cc2ce980cf..115d73db48 100644 --- a/src/typegate/src/services/auth/protocols/protocol.ts +++ b/src/typegate/src/services/auth/protocols/protocol.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { notFound } from "../../../services/responses.ts"; diff --git a/src/typegate/src/services/auth/routes/mod.ts b/src/typegate/src/services/auth/routes/mod.ts index 4fe31f2a22..c11247f0e0 100644 --- a/src/typegate/src/services/auth/routes/mod.ts +++ b/src/typegate/src/services/auth/routes/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { QueryEngine } from "../../../engine/query_engine.ts"; diff --git a/src/typegate/src/services/auth/routes/take.ts b/src/typegate/src/services/auth/routes/take.ts index bd29792060..53d8845686 100644 --- a/src/typegate/src/services/auth/routes/take.ts +++ b/src/typegate/src/services/auth/routes/take.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { getLogger } from "../../../log.ts"; import { clearCookie, getEncryptedCookie } from "../cookies.ts"; diff --git a/src/typegate/src/services/auth/routes/validate.ts b/src/typegate/src/services/auth/routes/validate.ts index 9ed4a8c6ca..7e97d9172e 100644 --- a/src/typegate/src/services/auth/routes/validate.ts +++ b/src/typegate/src/services/auth/routes/validate.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { RouteParams } from "./mod.ts"; diff --git a/src/typegate/src/services/graphql_service.ts b/src/typegate/src/services/graphql_service.ts index 7e0ce139e4..65be78f48e 100644 --- a/src/typegate/src/services/graphql_service.ts +++ b/src/typegate/src/services/graphql_service.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { getLogger } from "../log.ts"; import { parse } from "graphql"; @@ -9,7 +9,10 @@ import { type Operations, parseRequest, } from "../transports/graphql/request_parser.ts"; -import { findOperation, type FragmentDefs } from "../transports/graphql/graphql.ts"; +import { + findOperation, + type FragmentDefs, +} from "../transports/graphql/graphql.ts"; import { forceAnyToOption } from "../utils.ts"; import type { QueryEngine } from "../engine/query_engine.ts"; import type * as ast from "graphql/ast"; diff --git a/src/typegate/src/services/info_service.ts b/src/typegate/src/services/info_service.ts index 2883f0c874..932561d2cd 100644 --- a/src/typegate/src/services/info_service.ts +++ b/src/typegate/src/services/info_service.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export const handleInfo = ( _request: Request, diff --git a/src/typegate/src/services/middlewares.ts b/src/typegate/src/services/middlewares.ts index 04cb7eccfb..0d9b0b0234 100644 --- a/src/typegate/src/services/middlewares.ts +++ b/src/typegate/src/services/middlewares.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { globalConfig } from "../config.ts"; import type { QueryEngine } from "../engine/query_engine.ts"; diff --git a/src/typegate/src/services/playground_service.ts b/src/typegate/src/services/playground_service.ts index b713f583c1..6b90403c9e 100644 --- a/src/typegate/src/services/playground_service.ts +++ b/src/typegate/src/services/playground_service.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { globalConfig } from "../config.ts"; import type { QueryEngine } from "../engine/query_engine.ts"; diff --git a/src/typegate/src/services/responses.ts b/src/typegate/src/services/responses.ts index 98744c61d2..f188940bfa 100644 --- a/src/typegate/src/services/responses.ts +++ b/src/typegate/src/services/responses.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { JSONValue } from "../utils.ts"; import { BaseError, ErrorKind } from "../errors.ts"; diff --git a/src/typegate/src/services/rest_service.ts b/src/typegate/src/services/rest_service.ts index 15af7dab66..7bce7387d0 100644 --- a/src/typegate/src/services/rest_service.ts +++ b/src/typegate/src/services/rest_service.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { QueryEngine } from "../engine/query_engine.ts"; import { BadContext, ResolverError } from "../errors.ts"; diff --git a/src/typegate/src/sync/mod.ts b/src/typegate/src/sync/mod.ts index e0bcf40f75..5391384fae 100644 --- a/src/typegate/src/sync/mod.ts +++ b/src/typegate/src/sync/mod.ts @@ -1,4 +1,4 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // diff --git a/src/typegate/src/sync/replicated_map.ts b/src/typegate/src/sync/replicated_map.ts index 373b1923f0..b7317cb9c9 100644 --- a/src/typegate/src/sync/replicated_map.ts +++ b/src/typegate/src/sync/replicated_map.ts @@ -1,7 +1,12 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 - -import { connect, type Redis, type RedisConnectOptions, type XIdInput } from "redis"; +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 + +import { + connect, + type Redis, + type RedisConnectOptions, + type XIdInput, +} from "redis"; import * as Sentry from "sentry"; import { getLogger } from "../log.ts"; import { ensure } from "../utils.ts"; diff --git a/src/typegate/src/sync/typegraph.ts b/src/typegate/src/sync/typegraph.ts index 370596a950..232c57e08f 100644 --- a/src/typegate/src/sync/typegraph.ts +++ b/src/typegate/src/sync/typegraph.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { SecretManager, diff --git a/src/typegate/src/system_typegraphs.ts b/src/typegate/src/system_typegraphs.ts index 86c37772bc..3c4e934e8d 100644 --- a/src/typegate/src/system_typegraphs.ts +++ b/src/typegate/src/system_typegraphs.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { basename } from "@std/url"; import { fromFileUrl, toFileUrl } from "@std/path"; diff --git a/src/typegate/src/transports/graphql/gq.ts b/src/typegate/src/transports/graphql/gq.ts index 23e6e312ff..be04b0543a 100644 --- a/src/typegate/src/transports/graphql/gq.ts +++ b/src/typegate/src/transports/graphql/gq.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type * as ast from "graphql/ast"; diff --git a/src/typegate/src/transports/graphql/graphql.ts b/src/typegate/src/transports/graphql/graphql.ts index dc76f94d6a..dcaca7b1c7 100644 --- a/src/typegate/src/transports/graphql/graphql.ts +++ b/src/typegate/src/transports/graphql/graphql.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type * as ast from "graphql/ast"; import { Kind } from "graphql"; diff --git a/src/typegate/src/transports/graphql/request_parser.ts b/src/typegate/src/transports/graphql/request_parser.ts index 2f9d1c89f2..8a000250f8 100644 --- a/src/typegate/src/transports/graphql/request_parser.ts +++ b/src/typegate/src/transports/graphql/request_parser.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export interface Operations { query: string; diff --git a/src/typegate/src/transports/graphql/typegraph.ts b/src/typegate/src/transports/graphql/typegraph.ts index df08e087df..9c2f1ba890 100644 --- a/src/typegate/src/transports/graphql/typegraph.ts +++ b/src/typegate/src/transports/graphql/typegraph.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypeGraphDS } from "../../typegraph/mod.ts"; import type { ObjectNode } from "../../typegraph/type_node.ts"; diff --git a/src/typegate/src/transports/graphql/utils.ts b/src/typegate/src/transports/graphql/utils.ts index 5de5b550c4..19ea210811 100644 --- a/src/typegate/src/transports/graphql/utils.ts +++ b/src/typegate/src/transports/graphql/utils.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypeGraphDS } from "../../typegraph/mod.ts"; import type { TypeNode } from "../../typegraph/type_node.ts"; diff --git a/src/typegate/src/transports/rest/rest_schema_generator.ts b/src/typegate/src/transports/rest/rest_schema_generator.ts index e209d4e9f3..96dffff707 100644 --- a/src/typegate/src/transports/rest/rest_schema_generator.ts +++ b/src/typegate/src/transports/rest/rest_schema_generator.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypeGraph } from "../../typegraph/mod.ts"; diff --git a/src/typegate/src/typegate/artifacts/local.ts b/src/typegate/src/typegate/artifacts/local.ts index 8d661c30e6..44e7ea0f52 100644 --- a/src/typegate/src/typegate/artifacts/local.ts +++ b/src/typegate/src/typegate/artifacts/local.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { resolve } from "@std/path/resolve"; import { HashTransformStream } from "../../utils/hash.ts"; @@ -60,7 +60,7 @@ export class LocalArtifactPersistence implements ArtifactPersistence { await Deno.remove(this.dirs.artifacts, { recursive: true }); } - async save(stream: ReadableStream, size: number): Promise { + async save(stream: ReadableStream, _size: number): Promise { const tmpFile = await Deno.makeTempFile({ dir: this.dirs.temp }); const file = await Deno.open(tmpFile, { write: true, truncate: true }); const hasher = createHash("sha256"); diff --git a/src/typegate/src/typegate/artifacts/mod.ts b/src/typegate/src/typegate/artifacts/mod.ts index e7ede30440..34fb655dab 100644 --- a/src/typegate/src/typegate/artifacts/mod.ts +++ b/src/typegate/src/typegate/artifacts/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { sha256, type TypegateCryptoKeys } from "../../crypto.ts"; import { getLogger } from "../../log.ts"; diff --git a/src/typegate/src/typegate/artifacts/shared.ts b/src/typegate/src/typegate/artifacts/shared.ts index 50055b290c..6871bc0d09 100644 --- a/src/typegate/src/typegate/artifacts/shared.ts +++ b/src/typegate/src/typegate/artifacts/shared.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { connect, type Redis, type RedisConnectOptions } from "redis"; import { getLogger } from "../../log.ts"; @@ -53,14 +53,19 @@ class SharedArtifactPersistence implements ArtifactPersistence { ): Promise { const localShadow = await LocalArtifactPersistence.init(baseDir); const s3 = new S3(syncConfig.s3); - return new SharedArtifactPersistence(localShadow, s3, syncConfig.s3Bucket, syncConfig); + return new SharedArtifactPersistence( + localShadow, + s3, + syncConfig.s3Bucket, + syncConfig, + ); } constructor( private localShadow: LocalArtifactPersistence, private s3: S3, private s3Bucket: string, - private syncConfig: SyncConfig + private syncConfig: SyncConfig, ) {} get dirs() { @@ -76,12 +81,13 @@ class SharedArtifactPersistence implements ArtifactPersistence { const hasher = createHash("sha256"); const stream2 = stream.pipeThrough(new HashTransformStream(hasher)); - + // temporary key is needed as we won't be able to get the hash sum of the file, // which we use as the key of the object, // before going through whole stream. - // so we create a temporary key to store the file/object and then copy the object after we have computed the hash. - const tempKey = resolveS3Key(this.s3Bucket, + // so we create a temporary key to store the file/object and then copy the object after we have computed the hash. + const tempKey = resolveS3Key( + this.s3Bucket, `tmp/${Math.random().toString(36).substring(2)}`, ); @@ -94,23 +100,23 @@ class SharedArtifactPersistence implements ArtifactPersistence { ContentLength: size, }, }); - + const _ = await upload.done(); - + const hash = hasher.digest("hex"); logger.info(`persisting artifact to S3: ${hash}`); - + await this.s3.copyObject({ Bucket: this.s3Bucket, CopySource: `${this.s3Bucket}/${tempKey}`, Key: resolveS3Key(this.s3Bucket, hash), }); - + await this.s3.deleteObject({ Bucket: this.s3Bucket, Key: tempKey, }); - + return hash; } diff --git a/src/typegate/src/typegate/hooks.ts b/src/typegate/src/typegate/hooks.ts index ca58c38858..5752773261 100644 --- a/src/typegate/src/typegate/hooks.ts +++ b/src/typegate/src/typegate/hooks.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { MessageEntry, Migrations } from "../typegate/register.ts"; import type { SecretManager, TypeGraphDS } from "../typegraph/mod.ts"; diff --git a/src/typegate/src/typegate/memory_register.ts b/src/typegate/src/typegate/memory_register.ts index a4fea212ad..5f2a8e1b89 100644 --- a/src/typegate/src/typegate/memory_register.ts +++ b/src/typegate/src/typegate/memory_register.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { QueryEngine } from "../engine/query_engine.ts"; import { Register } from "../typegate/register.ts"; diff --git a/src/typegate/src/typegate/mod.ts b/src/typegate/src/typegate/mod.ts index 0deb05fc9a..69c1d60a39 100644 --- a/src/typegate/src/typegate/mod.ts +++ b/src/typegate/src/typegate/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type Register, ReplicatedRegister } from "./register.ts"; import * as Sentry from "sentry"; diff --git a/src/typegate/src/typegate/no_limiter.ts b/src/typegate/src/typegate/no_limiter.ts index ef18dac12b..4d6f156393 100644 --- a/src/typegate/src/typegate/no_limiter.ts +++ b/src/typegate/src/typegate/no_limiter.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { RateLimiter } from "../typegate/rate_limiter.ts"; diff --git a/src/typegate/src/typegate/rate_limiter.ts b/src/typegate/src/typegate/rate_limiter.ts index 1c2629ad3c..46cc482859 100644 --- a/src/typegate/src/typegate/rate_limiter.ts +++ b/src/typegate/src/typegate/rate_limiter.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { connect, type Redis, type RedisConnectOptions } from "redis"; import type { QueryEngine } from "../engine/query_engine.ts"; diff --git a/src/typegate/src/typegate/register.ts b/src/typegate/src/typegate/register.ts index 917d41f7bd..42d3ebbdcb 100644 --- a/src/typegate/src/typegate/register.ts +++ b/src/typegate/src/typegate/register.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { QueryEngine } from "../engine/query_engine.ts"; import type { RedisConnectOptions, XIdInput } from "redis"; diff --git a/src/typegate/src/typegraph/mod.ts b/src/typegate/src/typegraph/mod.ts index 883ef2fe65..83b6a4ffcc 100644 --- a/src/typegate/src/typegraph/mod.ts +++ b/src/typegate/src/typegraph/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type * as ast from "graphql/ast"; import { Kind } from "graphql"; diff --git a/src/typegate/src/typegraph/type_node.ts b/src/typegate/src/typegraph/type_node.ts index 105a120231..3aafdf7b91 100644 --- a/src/typegate/src/typegraph/type_node.ts +++ b/src/typegate/src/typegraph/type_node.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export const Type = { OPTIONAL: "optional", diff --git a/src/typegate/src/typegraph/types.ts b/src/typegate/src/typegraph/types.ts index 6607cc9515..edaaeb5c2c 100644 --- a/src/typegate/src/typegraph/types.ts +++ b/src/typegate/src/typegraph/types.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // deno-lint-ignore-file no-explicit-any no-empty-interface diff --git a/src/typegate/src/typegraph/utils.ts b/src/typegate/src/typegraph/utils.ts index 1acd2c8a29..88bf0152be 100644 --- a/src/typegate/src/typegraph/utils.ts +++ b/src/typegate/src/typegraph/utils.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypeGraph, TypeGraphDS } from "../typegraph/mod.ts"; import { diff --git a/src/typegate/src/typegraph/versions.ts b/src/typegate/src/typegraph/versions.ts index 26a2f0389e..ae16cf7a75 100644 --- a/src/typegate/src/typegraph/versions.ts +++ b/src/typegate/src/typegraph/versions.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { TypeGraph, type TypeGraphDS } from "../typegraph/mod.ts"; import { globalConfig } from "../config.ts"; diff --git a/src/typegate/src/typegraph/visitor.ts b/src/typegate/src/typegraph/visitor.ts index bfa44d7174..9b928f9fb9 100644 --- a/src/typegate/src/typegraph/visitor.ts +++ b/src/typegate/src/typegraph/visitor.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { TypeGraphDS } from "../typegraph/mod.ts"; import { Type, type TypeNode } from "./type_node.ts"; diff --git a/src/typegate/src/typegraphs/introspection.py b/src/typegate/src/typegraphs/introspection.py index c39358beee..1cef3dbe91 100644 --- a/src/typegate/src/typegraphs/introspection.py +++ b/src/typegate/src/typegraphs/introspection.py @@ -1,4 +1,5 @@ -# Copyright Metatype under the Elastic License 2.0. +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import Graph, Policy, fx, t, typegraph from typegraph.gen.exports.runtimes import ( diff --git a/src/typegate/src/typegraphs/prisma_migration.py b/src/typegate/src/typegraphs/prisma_migration.py index c15b1c66fa..ddc96df004 100644 --- a/src/typegate/src/typegraphs/prisma_migration.py +++ b/src/typegate/src/typegraphs/prisma_migration.py @@ -1,3 +1,6 @@ +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 + from typegraph import Graph, t, typegraph from typegraph.gen.exports.runtimes import ( PrismaMigrationOperation, diff --git a/src/typegate/src/typegraphs/typegate.py b/src/typegate/src/typegraphs/typegate.py index 581fb9e7ad..2b65527830 100644 --- a/src/typegate/src/typegraphs/typegate.py +++ b/src/typegate/src/typegraphs/typegate.py @@ -1,4 +1,5 @@ -# Copyright Metatype under the Elastic License 2.0. +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import Graph, fx, t, typegraph from typegraph.gen.exports.runtimes import TypegateOperation diff --git a/src/typegate/src/types.ts b/src/typegate/src/types.ts index a0d9600351..81d90949b6 100644 --- a/src/typegate/src/types.ts +++ b/src/typegate/src/types.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { ComputeStage } from "./engine/query_engine.ts"; import type { Runtime } from "./runtimes/Runtime.ts"; diff --git a/src/typegate/src/utils.ts b/src/typegate/src/utils.ts index 5d6570fafc..8b98fd28a6 100644 --- a/src/typegate/src/utils.ts +++ b/src/typegate/src/utils.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { ComputeStage } from "./engine/query_engine.ts"; import type * as ast from "graphql/ast"; @@ -44,7 +44,7 @@ export const forceOptionToValue = (m: Option): T | undefined => { export const createUrl = ( base: string, path: string, - search_params?: URLSearchParams + search_params?: URLSearchParams, ): string => { if (!base.endsWith("/")) { base = base + "/"; @@ -74,7 +74,7 @@ export const createUrl = ( export function ensure( predicat: boolean, - message: string | (() => string) + message: string | (() => string), ): asserts predicat is true { if (!predicat) { throw Error(typeof message === "function" ? message() : message); @@ -83,7 +83,7 @@ export function ensure( export function ensureNonNullable( value: T, - message: string | (() => string) + message: string | (() => string), ): asserts value is NonNullable { if (value == null) { throw Error(typeof message === "function" ? message() : message); @@ -92,7 +92,7 @@ export function ensureNonNullable( export const collectFields = ( obj: Record, - fields: string[] + fields: string[], ) => { return fields.reduce((agg, f) => ({ ...agg, [f]: obj[f] }), {}); }; @@ -118,7 +118,7 @@ function isChildStage(parentId: string, stageId: string) { export function iterParentStages( stages: ComputeStage[], - cb: (stage: ComputeStage, children: ComputeStage[]) => void + cb: (stage: ComputeStage, children: ComputeStage[]) => void, ) { let cursor = 0; while (cursor < stages.length) { @@ -140,7 +140,7 @@ export const b64encode = (v: string): string => { }; export function nativeResult( - res: { Ok: R } | { Err: { message: string } } + res: { Ok: R } | { Err: { message: string } }, ): R { if ("Err" in res) { throw new Error(res.Err.message); @@ -163,7 +163,7 @@ export function closestWord( str: string, list: string[], ignoreCase = true, - maxDistance = 3 + maxDistance = 3, ) { if (list.length == 0) { return null; diff --git a/src/typegate/src/utils/hash.ts b/src/typegate/src/utils/hash.ts index 0cccff3499..ed451d0255 100644 --- a/src/typegate/src/utils/hash.ts +++ b/src/typegate/src/utils/hash.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // deno-lint-ignore no-external-import import type { Hash } from "node:crypto"; diff --git a/src/typegate/src/worker_utils.ts b/src/typegate/src/worker_utils.ts index 1eaa69d05e..f508c162fd 100644 --- a/src/typegate/src/worker_utils.ts +++ b/src/typegate/src/worker_utils.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // WARNING: Assume any content or state in this file will run inside a Web Worker @@ -7,7 +7,7 @@ import { TaskContext } from "./runtimes/deno/shared_types.ts"; export function make_internal( { meta: { url, token } }: TaskContext, - additionalHeaders: Record + additionalHeaders: Record, ) { const gql = (query: readonly string[], ...args: unknown[]) => { if (args.length > 0) { @@ -16,7 +16,7 @@ export function make_internal( // console.log(query); return { run: async ( - variables: Record + variables: Record, ): Promise> => { const res = await fetch(url, { method: "POST", diff --git a/src/typegate/standalone/src/config.rs b/src/typegate/standalone/src/config.rs index 305679d4ec..d8404042d9 100644 --- a/src/typegate/standalone/src/config.rs +++ b/src/typegate/standalone/src/config.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use envconfig::Envconfig; diff --git a/src/typegate/standalone/src/logger.rs b/src/typegate/standalone/src/logger.rs index 4e07a93b68..991efe4c6c 100644 --- a/src/typegate/standalone/src/logger.rs +++ b/src/typegate/standalone/src/logger.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. // SPDX-License-Identifier: MPL-2.0 diff --git a/src/typegate/standalone/src/main.rs b/src/typegate/standalone/src/main.rs index bb51f0b4de..012dcb520c 100644 --- a/src/typegate/standalone/src/main.rs +++ b/src/typegate/standalone/src/main.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 mod config; mod logger; diff --git a/src/typegraph/core/Cargo.toml b/src/typegraph/core/Cargo.toml index 2fd6f83b36..6752ff48f0 100644 --- a/src/typegraph/core/Cargo.toml +++ b/src/typegraph/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "typegraph_core" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" [lib] diff --git a/src/typegraph/core/src/global_store.rs b/src/typegraph/core/src/global_store.rs index 118b5ac8ca..dd31e9f310 100644 --- a/src/typegraph/core/src/global_store.rs +++ b/src/typegraph/core/src/global_store.rs @@ -107,7 +107,7 @@ const PREDEFINED_DENO_FUNCTIONS: &[&str] = &["identity", "true"]; thread_local! { pub static STORE: RefCell = RefCell::new(Store::new()); - pub static SDK_VERSION: String = "0.5.0-rc.4".to_owned(); + pub static SDK_VERSION: String = "0.5.0-rc.5".to_owned(); } fn with_store T>(f: F) -> T { diff --git a/src/typegraph/core/src/lib.rs b/src/typegraph/core/src/lib.rs index f44c45e921..e13e0db35c 100644 --- a/src/typegraph/core/src/lib.rs +++ b/src/typegraph/core/src/lib.rs @@ -42,6 +42,7 @@ use wit::runtimes::{Guest, MaterializerDenoFunc}; pub mod wit { wit_bindgen::generate!({ + world: "typegraph" }); use crate::Lib; diff --git a/src/typegraph/core/src/params/apply.rs b/src/typegraph/core/src/params/apply.rs index e90f31b45a..92fa675347 100644 --- a/src/typegraph/core/src/params/apply.rs +++ b/src/typegraph/core/src/params/apply.rs @@ -3,7 +3,7 @@ use crate::errors::{ErrorContext, Result, TgError}; use crate::t::{self, TypeBuilder}; -use crate::types::{Type, TypeDef, TypeId}; +use crate::types::{AsTypeDefEx as _, TypeDef, TypeId}; use crate::wit::core::{ParameterTransform, TransformData}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -307,26 +307,30 @@ impl TransformDataBuildContext { .filter_map(|(&k, &type_id)| { TypeId(type_id) .as_type() - .map(|ty| { - if !matches!(ty, Type::Def(TypeDef::Optional(_))) { - Some(k) - } else { - None - } - }) .with_context(|| { format!( "Error while resolving type #{type_id} at the field {k:?} at {path:?}", path = stringify_path(&self.path).unwrap() ) }) + .and_then(|ty| { + ty.as_xdef() + .with_context(|| format!("resolving type: {}", ty.id().repr().unwrap())) + }) + .map(|ty| { + if !matches!(ty.type_def, TypeDef::Optional(_)) { + Some(k) + } else { + None + } + }) .transpose() }) .collect::>>()?; if !non_optional_fields.is_empty() { Err(format!( - "Missing non-optional fields {non_optional_fields:?} at {path:?}", + "missing non-optional fields {non_optional_fields:?} at {path:?}", path = stringify_path(&self.path).unwrap() ) .into()) diff --git a/src/typegraph/core/src/runtimes/substantial.rs b/src/typegraph/core/src/runtimes/substantial.rs index 552cd78f85..23a8245538 100644 --- a/src/typegraph/core/src/runtimes/substantial.rs +++ b/src/typegraph/core/src/runtimes/substantial.rs @@ -10,15 +10,14 @@ use crate::types::WithRuntimeConfig; use crate::wit::core::FuncParams; use crate::wit::{ core::RuntimeId, runtimes::Effect as WitEffect, runtimes::SubstantialOperationData, - runtimes::SubstantialOperationType, }; use common::typegraph::Materializer; use serde_json::json; #[derive(Debug)] pub enum SubstantialMaterializer { - Start, - StartRaw, + Start { secrets: Vec }, + StartRaw { secrets: Vec }, Stop, Send, SendRaw, @@ -38,8 +37,15 @@ impl MaterializerConverter for SubstantialMaterializer { let runtime = c.register_runtime(runtime_id)?; let (name, data) = match self { - SubstantialMaterializer::Start => ("start".to_string(), json!({})), - SubstantialMaterializer::StartRaw => ("start_raw".to_string(), json!({})), + SubstantialMaterializer::Start { secrets } => { + ("start".to_string(), json!({ "secrets":secrets })) + } + SubstantialMaterializer::StartRaw { secrets } => ( + "start_raw".to_string(), + json!({ + "secrets": secrets + }), + ), SubstantialMaterializer::Stop => ("stop".to_string(), json!({})), SubstantialMaterializer::Send => ("send".to_string(), json!({})), SubstantialMaterializer::SendRaw => ("send_raw".to_string(), json!({})), @@ -65,23 +71,37 @@ pub fn substantial_operation( data: SubstantialOperationData, ) -> Result { let mut inp = t::struct_(); - let (effect, mat_data, out_ty) = match data.operation { - SubstantialOperationType::Start | SubstantialOperationType::StartRaw => { - let (mat, flag) = match data.operation { - SubstantialOperationType::Start => (SubstantialMaterializer::Start, true), - SubstantialOperationType::StartRaw => (SubstantialMaterializer::StartRaw, false), - _ => unreachable!(), - }; - + let (effect, mat_data, out_ty) = match data { + SubstantialOperationData::Start(data) => { inp.prop("name", t::string().build()?); inp.prop( "kwargs", - use_arg_or_json_string(data.func_arg, flag)?.into(), + data.func_arg + .ok_or("input or output shape is not defined on the typegraph".to_string())? + .into(), ); - (WitEffect::Create(true), mat, t::string().build()?) + ( + WitEffect::Create(true), + SubstantialMaterializer::Start { + secrets: data.secrets, + }, + t::string().build()?, + ) + } + SubstantialOperationData::StartRaw(data) => { + inp.prop("name", t::string().build()?); + inp.prop("kwargs", t_json_string()?.into()); + + ( + WitEffect::Create(true), + SubstantialMaterializer::StartRaw { + secrets: data.secrets, + }, + t::string().build()?, + ) } - SubstantialOperationType::Stop => { + SubstantialOperationData::Stop => { inp.prop("run_id", t::string().build()?); ( @@ -90,27 +110,37 @@ pub fn substantial_operation( t::list(t::string().build()?).build()?, ) } - SubstantialOperationType::Send | SubstantialOperationType::SendRaw => { - let (mat, flag) = match data.operation { - SubstantialOperationType::Send => (SubstantialMaterializer::Send, true), - SubstantialOperationType::SendRaw => (SubstantialMaterializer::SendRaw, false), - _ => unreachable!(), - }; + SubstantialOperationData::Send(data) => { + let event = t::struct_() + .prop("name", t::string().build()?) + .prop("payload", data.into()) + .build()?; + + inp.prop("run_id", t::string().build()?); + inp.prop("event", event); + ( + WitEffect::Create(false), + SubstantialMaterializer::Send, + t::string().build()?, + ) + } + SubstantialOperationData::SendRaw => { let event = t::struct_() .prop("name", t::string().build()?) - .prop( - "payload", - use_arg_or_json_string(data.func_arg, flag)?.into(), - ) + .prop("payload", t_json_string()?.into()) .build()?; inp.prop("run_id", t::string().build()?); inp.prop("event", event); - (WitEffect::Create(false), mat, t::string().build()?) + ( + WitEffect::Create(false), + SubstantialMaterializer::SendRaw, + t::string().build()?, + ) } - SubstantialOperationType::Resources => { + SubstantialOperationData::Resources => { inp.prop("name", t::string().build()?); let row = t::struct_() @@ -129,65 +159,23 @@ pub fn substantial_operation( (WitEffect::Read, SubstantialMaterializer::Resources, out) } - SubstantialOperationType::Results | SubstantialOperationType::ResultsRaw => { - let (mat, flag) = match data.operation { - SubstantialOperationType::Results => (SubstantialMaterializer::Results, true), - SubstantialOperationType::ResultsRaw => { - (SubstantialMaterializer::ResultsRaw, false) - } - _ => unreachable!(), - }; - + SubstantialOperationData::Results(data) => { inp.prop("name", t::string().build()?); - let out = use_arg_or_json_string(data.func_out, flag)?; - - let count = t::integer().build()?; - - let result = t::struct_() - .prop("status", t::string().build()?) - .prop("value", t::optional(out.into()).build()?) - .build()?; - - let ongoing_runs = t::list( - t::struct_() - .prop("run_id", t::string().build()?) - .prop("started_at", t::string().build()?) - .build()?, - ) - .build()?; - - let completed_runs = t::list( - t::struct_() - .prop("run_id", t::string().build()?) - .prop("started_at", t::string().build()?) - .prop("ended_at", t::string().build()?) - .prop("result", result) - .build()?, + ( + WitEffect::Read, + SubstantialMaterializer::Results, + results_op_results_ty(data)?, ) - .build()?; - + } + SubstantialOperationData::ResultsRaw => { + inp.prop("name", t::string().build()?); ( WitEffect::Read, - mat, - t::struct_() - .prop( - "ongoing", - t::struct_() - .prop("count", count) - .prop("runs", ongoing_runs) - .build()?, - ) - .prop( - "completed", - t::struct_() - .prop("count", count) - .prop("runs", completed_runs) - .build()?, - ) - .build()?, + SubstantialMaterializer::ResultsRaw, + results_op_results_ty(t_json_string()?)?, ) } - SubstantialOperationType::InternalLinkParentChild => { + SubstantialOperationData::InternalLinkParentChild => { inp.prop("parent_run_id", t::string().build()?); inp.prop("child_run_id", t::string().build()?); @@ -208,12 +196,7 @@ pub fn substantial_operation( }) } -fn use_arg_or_json_string(arg: Option, flag: bool) -> Result { - if flag { - let arg = arg.ok_or("input or output shape is not defined on the typegraph".to_string())?; - return Ok(arg); - }; - +fn t_json_string() -> Result { t::string() .build() .and_then(|r| { @@ -223,3 +206,47 @@ fn use_arg_or_json_string(arg: Option, flag: bool) -> Result { }) .map(|r| r.id().into()) } + +fn results_op_results_ty(out: u32) -> Result { + let count = t::integer().build()?; + + let result = t::struct_() + .prop("status", t::string().build()?) + .prop("value", t::optional(out.into()).build()?) + .build()?; + + let ongoing_runs = t::list( + t::struct_() + .prop("run_id", t::string().build()?) + .prop("started_at", t::string().build()?) + .build()?, + ) + .build()?; + + let completed_runs = t::list( + t::struct_() + .prop("run_id", t::string().build()?) + .prop("started_at", t::string().build()?) + .prop("ended_at", t::string().build()?) + .prop("result", result) + .build()?, + ) + .build()?; + + t::struct_() + .prop( + "ongoing", + t::struct_() + .prop("count", count) + .prop("runs", ongoing_runs) + .build()?, + ) + .prop( + "completed", + t::struct_() + .prop("count", count) + .prop("runs", completed_runs) + .build()?, + ) + .build() +} diff --git a/src/typegraph/core/wit/typegraph.wit b/src/typegraph/core/wit/typegraph.wit index 611fe47393..19ff85ccfa 100644 --- a/src/typegraph/core/wit/typegraph.wit +++ b/src/typegraph/core/wit/typegraph.wit @@ -514,24 +514,25 @@ interface runtimes { file-descriptions: list } - variant substantial-operation-type { - start, - start-raw, + record substantial-start-data { + func-arg: option, + secrets: list, + } + + variant substantial-operation-data { + start(substantial-start-data), + start-raw(substantial-start-data), stop, - send, + // type of send value + send(type-id), send-raw, resources, - results, + // type of result + results(type-id), results-raw, internal-link-parent-child } - record substantial-operation-data { - func-arg: option, - func-out: option, - operation: substantial-operation-type, - } - register-substantial-runtime: func(data: substantial-runtime-data) -> result; generate-substantial-operation: func(runtime: runtime-id, data: substantial-operation-data) -> result; diff --git a/src/typegraph/deno/deno.json b/src/typegraph/deno/deno.json index c63181d72d..99d2a8b2d9 100644 --- a/src/typegraph/deno/deno.json +++ b/src/typegraph/deno/deno.json @@ -1,6 +1,6 @@ { "name": "@typegraph/sdk", - "version": "0.5.0-rc.4", + "version": "0.5.0-rc.5", "publish": { "exclude": [ "!src/gen", diff --git a/src/typegraph/deno/src/runtimes/python.ts b/src/typegraph/deno/src/runtimes/python.ts index 447c65d3cf..791a59306f 100644 --- a/src/typegraph/deno/src/runtimes/python.ts +++ b/src/typegraph/deno/src/runtimes/python.ts @@ -41,7 +41,7 @@ export class PythonRuntime extends Runtime { fromLambda< P extends Record = Record, I extends t.Struct

= t.Struct

, - O extends t.Typedef = t.Typedef + O extends t.Typedef = t.Typedef, >(inp: I, out: O, { code }: { code: string }): t.Func { const matId = runtimes.fromPythonLambda( { @@ -51,7 +51,7 @@ export class PythonRuntime extends Runtime { { fn: code, // not formatted runtime: this._id, - } + }, ); return t.func(inp, out, { @@ -64,7 +64,7 @@ export class PythonRuntime extends Runtime { fromDef< P extends Record = Record, I extends t.Struct

= t.Struct

, - O extends t.Typedef = t.Typedef + O extends t.Typedef = t.Typedef, >(inp: I, out: O, { code }: { code: string }): t.Func { const name = code.trim().match(/def\s+([A-Za-z0-9_]+)/)?.[1]; if (name == undefined) { @@ -79,7 +79,7 @@ export class PythonRuntime extends Runtime { name: name, fn: code, runtime: this._id, - } + }, ); return t.func(inp, out, { @@ -92,7 +92,7 @@ export class PythonRuntime extends Runtime { import( inp: I, out: O, - { name, module, deps = [], effect = fx.read(), secrets = [] }: PythonImport + { name, module, deps = [], effect = fx.read(), secrets = [] }: PythonImport, ): t.Func { const base = { runtime: this._id, diff --git a/src/typegraph/deno/src/runtimes/substantial.ts b/src/typegraph/deno/src/runtimes/substantial.ts index 4ad4145d6f..7e9c81f858 100644 --- a/src/typegraph/deno/src/runtimes/substantial.ts +++ b/src/typegraph/deno/src/runtimes/substantial.ts @@ -7,28 +7,12 @@ import { Func, type Typedef } from "../types.ts"; import type { SubstantialBackend, SubstantialOperationData, - SubstantialOperationType, WorkflowFileDescription, WorkflowKind, } from "../gen/typegraph_core.d.ts"; -export class Backend { - static devMemory(): SubstantialBackend { - return { tag: "memory" }; - } - - static devFs(): SubstantialBackend { - return { tag: "fs" }; - } - - static redis(connectionStringSecret: string): SubstantialBackend { - return { - tag: "redis", - val: { - connectionStringSecret, - }, - }; - } +interface StartFunc { + secrets?: string[]; } export class SubstantialRuntime extends Runtime { @@ -36,7 +20,7 @@ export class SubstantialRuntime extends Runtime { constructor( backend: SubstantialBackend, - fileDescriptions: Array + fileDescriptions: Array, ) { const id = runtimes.registerSubstantialRuntime({ backend, @@ -47,31 +31,30 @@ export class SubstantialRuntime extends Runtime { } _genericSubstantialFunc( - operation: SubstantialOperationType, - funcArg?: Typedef, - funcOut?: Typedef + data: SubstantialOperationData, ): Func { - const data = { - funcArg: funcArg?._id, - funcOut: funcOut?._id, - operation, - } as SubstantialOperationData; const funcData = runtimes.generateSubstantialOperation(this._id, data); return Func.fromTypeFunc(funcData); } - start(kwargs: Typedef): Func { + start( + kwargs: Typedef, + { secrets }: StartFunc = {}, + ): Func { return this._genericSubstantialFunc( { tag: "start", + val: { secrets: secrets ?? [], funcArg: kwargs._id }, }, - kwargs ); } - startRaw(): Func { + startRaw( + { secrets }: StartFunc = {}, + ): Func { return this._genericSubstantialFunc({ tag: "start-raw", + val: { secrets: secrets ?? [] }, }); } @@ -85,8 +68,8 @@ export class SubstantialRuntime extends Runtime { return this._genericSubstantialFunc( { tag: "send", + val: payload._id, }, - payload ); } @@ -106,9 +89,8 @@ export class SubstantialRuntime extends Runtime { return this._genericSubstantialFunc( { tag: "results", + val: output._id, }, - undefined, - output ); } @@ -135,13 +117,32 @@ export class SubstantialRuntime extends Runtime { } } +export class Backend { + static devMemory(): SubstantialBackend { + return { tag: "memory" }; + } + + static devFs(): SubstantialBackend { + return { tag: "fs" }; + } + + static redis(connectionStringSecret: string): SubstantialBackend { + return { + tag: "redis", + val: { + connectionStringSecret, + }, + }; + } +} + export class WorkflowFile { private workflows: Array = []; private constructor( public readonly file: string, public readonly kind: WorkflowKind, - public deps: Array = [] + public deps: Array = [], ) {} static deno(file: string, deps: Array = []): WorkflowFile { diff --git a/src/typegraph/deno/src/tg_deploy.ts b/src/typegraph/deno/src/tg_deploy.ts index a748bd99d3..0443cae334 100644 --- a/src/typegraph/deno/src/tg_deploy.ts +++ b/src/typegraph/deno/src/tg_deploy.ts @@ -119,9 +119,9 @@ export async function tgDeploy( const addTypegraph = response.data.addTypegraph; - /* + /* // FIXME: failure field is used by interactive deployment - // which means errors need to be ignored here but this + // which means errors need to be ignored here but this // allows deployment errors in non-interactive scenarios if (addTypegraph.failure) { console.error(addTypegraph.failure); diff --git a/src/typegraph/deno/src/tg_manage.ts b/src/typegraph/deno/src/tg_manage.ts index cc682ef7e4..57bcfc6e17 100644 --- a/src/typegraph/deno/src/tg_manage.ts +++ b/src/typegraph/deno/src/tg_manage.ts @@ -115,7 +115,7 @@ export class Manager { } as TypegraphOutput; const deployTarget = await rpc.getDeployTarget(); - const { response } = await tgDeploy(reusableTgOutput, { + const { response, serialized } = await tgDeploy(reusableTgOutput, { typegate: { url: deployTarget.baseUrl, auth: new BasicAuth( @@ -131,7 +131,14 @@ export class Manager { defaultMigrationAction: deployData.defaultMigrationAction, }); - log.success({ typegraph: this.#typegraph.name, ...response }); + log.success({ + typegraph: { + name: this.#typegraph.name, + path: env.typegraph_path, + value: serialized, + }, + ...response, + }); } catch (err: any) { log.failure({ typegraph: this.#typegraph.name, diff --git a/src/typegraph/deno/src/typegraph.ts b/src/typegraph/deno/src/typegraph.ts index d89ce9a3bb..9387d10c23 100644 --- a/src/typegraph/deno/src/typegraph.ts +++ b/src/typegraph/deno/src/typegraph.ts @@ -187,7 +187,6 @@ export async function typegraph( rate: rate ? { ...defaultRateFields, ...rate } : undefined, }; - core.initTypegraph({ name, dynamic, path, ...tgParams }); const g: TypegraphBuilderArgs = { diff --git a/src/typegraph/deno/src/utils/func_utils.ts b/src/typegraph/deno/src/utils/func_utils.ts index b227f4875a..bd02a69214 100644 --- a/src/typegraph/deno/src/utils/func_utils.ts +++ b/src/typegraph/deno/src/utils/func_utils.ts @@ -167,7 +167,10 @@ export async function execRequest( try { const response = await fetch(url, reqInit); if (!response.ok) { - log.error("error response json", await response.json().catch(_err => 'non json response')); + log.error( + "error response json", + await response.json().catch((_err) => "non json response"), + ); throw Error( `${errMsg}: request failed with status ${response.status} (${response.statusText})`, ); diff --git a/src/typegraph/python/pyproject.toml b/src/typegraph/python/pyproject.toml index bdddb1e818..bc4c252bd3 100644 --- a/src/typegraph/python/pyproject.toml +++ b/src/typegraph/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "typegraph" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" description = "Declarative API development platform. Build backend components with WASM, Typescript and Python, no matter where and how your (legacy) systems are." authors = ["Metatype Contributors "] license = "MPL-2.0" diff --git a/src/typegraph/python/typegraph/__init__.py b/src/typegraph/python/typegraph/__init__.py index b73ccef9b1..ef07c55fd5 100644 --- a/src/typegraph/python/typegraph/__init__.py +++ b/src/typegraph/python/typegraph/__init__.py @@ -5,4 +5,4 @@ from typegraph.policy import Policy # noqa from typegraph import effects as fx # noqa -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" diff --git a/src/typegraph/python/typegraph/graph/tg_deploy.py b/src/typegraph/python/typegraph/graph/tg_deploy.py index e5fbdc6afe..af5d01e311 100644 --- a/src/typegraph/python/typegraph/graph/tg_deploy.py +++ b/src/typegraph/python/typegraph/graph/tg_deploy.py @@ -126,17 +126,17 @@ def tg_deploy(tg: TypegraphOutput, params: TypegraphDeployParams) -> DeployResul response = response.read().decode() response = handle_response(response) - if response.get("errors") is not None: - for err in response.errors: - Log.error(err.message) + if "errors" in response: + for err in response["errors"]: + Log.error(err["message"]) raise Exception(f"failed to deploy typegraph {tg.name}") add_typegraph = response.get("data").get("addTypegraph") """ # FIXME: read comments in similar section of typescript - if add_typegraph.get("failure") is not None: - Log.error(add_typegraph.failure) + if "failure" in add_typegraph: + Log.error(add_typegraph["failure"]) raise Exception(f"failed to deploy typegraph {tg.name}") """ return DeployResult(serialized=tg_json, response=add_typegraph) diff --git a/src/typegraph/python/typegraph/graph/tg_manage.py b/src/typegraph/python/typegraph/graph/tg_manage.py index 1d71cd921f..d2ab111606 100644 --- a/src/typegraph/python/typegraph/graph/tg_manage.py +++ b/src/typegraph/python/typegraph/graph/tg_manage.py @@ -121,7 +121,16 @@ def deploy(self): if not isinstance(response, dict): raise Exception("unexpected") - Log.success({"typegraph": self.typegraph.name, **response}) + Log.success( + { + "typegraph": { + "name": self.typegraph.name, + "path": env.typegraph_path, + "value": ret.serialized, + }, + **response, + } + ) except Exception as err: Log.debug(traceback.format_exc()) if isinstance(err, ErrorStack): diff --git a/src/typegraph/python/typegraph/runtimes/deno.py b/src/typegraph/python/typegraph/runtimes/deno.py index 99a9c7e51d..58657df4a9 100644 --- a/src/typegraph/python/typegraph/runtimes/deno.py +++ b/src/typegraph/python/typegraph/runtimes/deno.py @@ -159,7 +159,7 @@ def import_policy( res = runtimes.import_deno_function( store, MaterializerDenoImport( - func_name=func_name, module=module, secrets=secrets or [] + func_name=func_name, module=module, secrets=secrets or [], deps=[] ), EffectRead(), ) diff --git a/src/typegraph/python/typegraph/runtimes/substantial.py b/src/typegraph/python/typegraph/runtimes/substantial.py index 836d35ccdd..f0cb7a80c6 100644 --- a/src/typegraph/python/typegraph/runtimes/substantial.py +++ b/src/typegraph/python/typegraph/runtimes/substantial.py @@ -1,7 +1,7 @@ # Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. # SPDX-License-Identifier: MPL-2.0 -from typing import List, Union +from typing import List, Optional from typegraph import t from typegraph.gen.exports.runtimes import ( RedisBackend, @@ -10,17 +10,17 @@ SubstantialBackendMemory, SubstantialBackendRedis, SubstantialOperationData, - SubstantialOperationType, - SubstantialOperationTypeSend, - SubstantialOperationTypeSendRaw, - SubstantialOperationTypeStart, - SubstantialOperationTypeStartRaw, - SubstantialOperationTypeStop, - SubstantialOperationTypeResources, - SubstantialOperationTypeResults, - SubstantialOperationTypeResultsRaw, - SubstantialOperationTypeInternalLinkParentChild, + SubstantialOperationDataInternalLinkParentChild, + SubstantialOperationDataResources, + SubstantialOperationDataResults, + SubstantialOperationDataResultsRaw, + SubstantialOperationDataSend, + SubstantialOperationDataSendRaw, + SubstantialOperationDataStart, + SubstantialOperationDataStartRaw, + SubstantialOperationDataStop, SubstantialRuntimeData, + SubstantialStartData, WorkflowFileDescription, WorkflowKind, ) @@ -29,17 +29,6 @@ from typegraph.wit import runtimes, store -class Backend: - def dev_memory(): - return SubstantialBackendMemory() - - def dev_fs(): - return SubstantialBackendFs() - - def redis(connection_string_secret: str): - return SubstantialBackendRedis(value=RedisBackend(connection_string_secret)) - - class SubstantialRuntime(Runtime): def __init__( self, @@ -47,62 +36,59 @@ def __init__( file_descriptions: List[WorkflowFileDescription], ): data = SubstantialRuntimeData(backend, file_descriptions) - super().__init__(runtimes.register_substantial_runtime(store, data)) + res = runtimes.register_substantial_runtime(store, data) + if isinstance(res, Err): + raise Exception(res.value) + super().__init__(res.value) self.backend = backend def _generic_substantial_func( self, - operation: SubstantialOperationType, - func_arg: Union[None, "t.typedef"] = None, - func_out: Union[None, "t.typedef"] = None, + data: SubstantialOperationData, ): - data = SubstantialOperationData( - func_arg=None if func_arg is None else func_arg._id, - func_out=None if func_out is None else func_out._id, - operation=operation, - ) - func_data = runtimes.generate_substantial_operation(store, self.id.value, data) + func_data = runtimes.generate_substantial_operation(store, self.id, data) if isinstance(func_data, Err): raise Exception(func_data.value) return t.func.from_type_func(func_data.value) - def start(self, kwargs: "t.struct"): - operation = SubstantialOperationTypeStart() - return self._generic_substantial_func(operation, kwargs, None) + def start(self, kwargs: "t.struct", *, secrets: Optional[List[str]] = None): + return self._generic_substantial_func( + SubstantialOperationDataStart( + SubstantialStartData(kwargs._id, secrets or []) + ) + ) - def start_raw(self): - operation = SubstantialOperationTypeStartRaw() - return self._generic_substantial_func(operation, None, None) + def start_raw(self, *, secrets: Optional[List[str]] = None): + return self._generic_substantial_func( + SubstantialOperationDataStartRaw(SubstantialStartData(None, secrets or [])) + ) def stop(self): - operation = SubstantialOperationTypeStop() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataStop()) def send(self, payload: "t.typedef"): - operation = SubstantialOperationTypeSend() - return self._generic_substantial_func(operation, payload, None) + return self._generic_substantial_func(SubstantialOperationDataSend(payload._id)) def send_raw(self): - operation = SubstantialOperationTypeSendRaw() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataSendRaw()) def query_resources(self): - operation = SubstantialOperationTypeResources() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataResources()) def query_results(self, output: "t.typedef"): - operation = SubstantialOperationTypeResults() - return self._generic_substantial_func(operation, None, output) + return self._generic_substantial_func( + SubstantialOperationDataResults(output._id) + ) def query_results_raw(self): - operation = SubstantialOperationTypeResultsRaw() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func(SubstantialOperationDataResultsRaw()) def _internal_link_parent_child(self): - operation = SubstantialOperationTypeInternalLinkParentChild() - return self._generic_substantial_func(operation, None, None) + return self._generic_substantial_func( + SubstantialOperationDataInternalLinkParentChild() + ) def internals(self): return { @@ -114,6 +100,20 @@ def internals(self): } +class Backend: + @staticmethod + def dev_memory(): + return SubstantialBackendMemory() + + @staticmethod + def dev_fs(): + return SubstantialBackendFs() + + @staticmethod + def redis(connection_string_secret: str): + return SubstantialBackendRedis(value=RedisBackend(connection_string_secret)) + + class WorkflowFile: def __init__(self, file: str, kind: WorkflowKind, deps: List[str] = []): self.file = file diff --git a/src/xtask/Cargo.toml b/src/xtask/Cargo.toml index da75373dd1..a93a17451c 100644 --- a/src/xtask/Cargo.toml +++ b/src/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" # this allows us to exclude the rust files diff --git a/src/xtask/src/deno.rs b/src/xtask/src/deno.rs index c757a09264..2b94b6dbc0 100644 --- a/src/xtask/src/deno.rs +++ b/src/xtask/src/deno.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 use anyhow::Result; use clap::{Parser, Subcommand}; diff --git a/src/xtask/src/main.rs b/src/xtask/src/main.rs index 2c2081da0f..8c0d266ffa 100644 --- a/src/xtask/src/main.rs +++ b/src/xtask/src/main.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 mod deno; diff --git a/tests/artifacts/artifacts_test.ts b/tests/artifacts/artifacts_test.ts index cf88e10768..17fafc273b 100644 --- a/tests/artifacts/artifacts_test.ts +++ b/tests/artifacts/artifacts_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { join } from "@std/path/join"; diff --git a/tests/auth/auth_test.ts b/tests/auth/auth_test.ts index 830066e01f..1ee2f7502c 100644 --- a/tests/auth/auth_test.ts +++ b/tests/auth/auth_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertEquals, assertStringIncludes } from "@std/assert"; import { execute, gql, Meta, sleep } from "../utils/mod.ts"; diff --git a/tests/auto/auto_test.ts_ b/tests/auto/auto_test.ts_ index 9f956d595b..ee91d22a1d 100644 --- a/tests/auto/auto_test.ts_ +++ b/tests/auto/auto_test.ts_ @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dirname, fromFileUrl, join } from "std/path/mod.ts"; import { Meta } from "../utils/mod.ts"; diff --git a/tests/auto/test/test.py b/tests/auto/test/test.py index bd655961c2..c71dccec53 100644 --- a/tests/auto/test/test.py +++ b/tests/auto/test/test.py @@ -1,4 +1,5 @@ -# Copyright Metatype under the Elastic License 2.0. +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import typegraph, Policy, t, Graph from typegraph.runtimes.deno import DenoRuntime diff --git a/tests/common_utils/proposition_test.ts b/tests/common_utils/proposition_test.ts index fa891fb704..0d67b0b5be 100644 --- a/tests/common_utils/proposition_test.ts +++ b/tests/common_utils/proposition_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertEquals } from "@std/assert"; import { closestWord } from "@metatype/typegate/utils.ts"; diff --git a/tests/common_utils/url_test.ts b/tests/common_utils/url_test.ts index 85f8892759..b9917e9b3f 100644 --- a/tests/common_utils/url_test.ts +++ b/tests/common_utils/url_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertEquals } from "@std/assert"; import { createUrl } from "@metatype/typegate/utils.ts"; diff --git a/tests/crypto/crypto_test.ts b/tests/crypto/crypto_test.ts index a77acc2472..fe794b1763 100644 --- a/tests/crypto/crypto_test.ts +++ b/tests/crypto/crypto_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { defaultTypegateConfigBase, diff --git a/tests/dedup/tg.ts b/tests/dedup/tg.ts index 19aaa2eec6..fcc495725c 100644 --- a/tests/dedup/tg.ts +++ b/tests/dedup/tg.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { RandomRuntime } from "@typegraph/sdk/runtimes/random.ts"; diff --git a/tests/docs/how-tos/prog_deploy/prog_deploy.ts b/tests/docs/how-tos/prog_deploy/prog_deploy.ts index e19234d1e8..2f58409edf 100644 --- a/tests/docs/how-tos/prog_deploy/prog_deploy.ts +++ b/tests/docs/how-tos/prog_deploy/prog_deploy.ts @@ -1,6 +1,6 @@ // skip:start -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // skip:end import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; diff --git a/tests/docs/how-tos/prog_deploy/prog_deploy_test.ts b/tests/docs/how-tos/prog_deploy/prog_deploy_test.ts index e9f11bdbee..b771a9fa29 100644 --- a/tests/docs/how-tos/prog_deploy/prog_deploy_test.ts +++ b/tests/docs/how-tos/prog_deploy/prog_deploy_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { MetaTest } from "../../../utils/test.ts"; diff --git a/tests/docs/how-tos/prog_deploy/prog_remove.ts b/tests/docs/how-tos/prog_deploy/prog_remove.ts index 7fdd936ae6..244aa5aa82 100644 --- a/tests/docs/how-tos/prog_deploy/prog_remove.ts +++ b/tests/docs/how-tos/prog_deploy/prog_remove.ts @@ -1,6 +1,6 @@ // skip:start -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // skip:end import { typegraph } from "@typegraph/sdk/index.ts"; diff --git a/tests/docs/how-tos/prog_deploy/scripts/say_hello.ts b/tests/docs/how-tos/prog_deploy/scripts/say_hello.ts index 620c7b8971..35e84061e2 100644 --- a/tests/docs/how-tos/prog_deploy/scripts/say_hello.ts +++ b/tests/docs/how-tos/prog_deploy/scripts/say_hello.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function sayHello() { return "Hell0"; diff --git a/tests/e2e/cli/artifacts/ops.ts b/tests/e2e/cli/artifacts/ops.ts new file mode 100644 index 0000000000..cbd08ebe39 --- /dev/null +++ b/tests/e2e/cli/artifacts/ops.ts @@ -0,0 +1,3 @@ +export function add({ lhs, rhs }: { lhs: number; rhs: number }) { + return lhs + rhs; +} diff --git a/tests/e2e/cli/deploy_test.ts b/tests/e2e/cli/deploy_test.ts index e45312c34a..18f783487e 100644 --- a/tests/e2e/cli/deploy_test.ts +++ b/tests/e2e/cli/deploy_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../../utils/mod.ts"; import { TestModule } from "../../utils/test_module.ts"; diff --git a/tests/e2e/cli/dev_test.ts b/tests/e2e/cli/dev_test.ts index 7e9ba41c96..d7b06ea134 100644 --- a/tests/e2e/cli/dev_test.ts +++ b/tests/e2e/cli/dev_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta, sleep } from "test-utils/mod.ts"; import { join, resolve } from "@std/path"; diff --git a/tests/e2e/cli/typegraphs/deps.ts b/tests/e2e/cli/typegraphs/deps.ts new file mode 100644 index 0000000000..b5b9472d5c --- /dev/null +++ b/tests/e2e/cli/typegraphs/deps.ts @@ -0,0 +1,19 @@ +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 + +import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; +import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; + +await typegraph("deps", (g) => { + const pub = Policy.public(); + const deno = new DenoRuntime(); + + g.expose({ + add: deno + .import(t.struct({ lhs: t.integer(), rhs: t.integer() }), t.integer(), { + name: "add", + module: "../deps/ops.ts", + }) + .withPolicy(pub), + }); +}); diff --git a/tests/e2e/cli/undeploy_test.ts b/tests/e2e/cli/undeploy_test.ts index 2a2494f2df..7fb63a9f66 100644 --- a/tests/e2e/cli/undeploy_test.ts +++ b/tests/e2e/cli/undeploy_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { TestModule } from "test-utils/test_module.ts"; diff --git a/tests/e2e/cli/watch_test.ts b/tests/e2e/cli/watch_test.ts new file mode 100644 index 0000000000..e0c58c7b9d --- /dev/null +++ b/tests/e2e/cli/watch_test.ts @@ -0,0 +1,76 @@ +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 + +import * as path from "@std/path"; +import { Meta } from "test-utils/mod.ts"; +import { MetaTest } from "test-utils/test.ts"; +import { killProcess, Lines } from "test-utils/process.ts"; + +const typegraphConfig = ` +typegraphs: + typescript: + include: "api/example.ts"`; + +async function setupDirectory(t: MetaTest, dir: string) { + await t.shell([ + "bash", + "-c", + ` + rm -rf ./tmp && mkdir -p tmp/deps + meta new --template deno ${dir} + cp ./e2e/cli/typegraphs/deps.ts ${path.join(dir, "api", "example.ts")} + cp ./e2e/cli/artifacts/ops.ts ${path.join(dir, "deps", "ops.ts")} + echo "${typegraphConfig}" >> ${path.join(dir, "metatype.yaml")} + `, + ]); +} + +Meta.test({ name: "meta dev: watch artifacts" }, async (t) => { + const targetDir = path.join(t.workingDir, "tmp"); + + console.log("Preparing test directory..."); + + await setupDirectory(t, targetDir); + + const metadev = new Deno.Command("meta", { + cwd: targetDir, + args: ["dev", `--gate=http://localhost:${t.port}`], + stderr: "piped", + }).spawn(); + + const stderr = new Lines(metadev.stderr); + + await t.should("upload artifact", async () => { + await stderr.readWhile((line) => !line.includes("artifact uploaded")); + }); + + await t.should("deploy typegraph", async () => { + await stderr.readWhile( + (line) => !line.includes("successfully deployed typegraph") + ); + }); + + await t.shell(["bash", "-c", "echo '' >> deps/ops.ts"], { + currentDir: targetDir, + }); + + await t.should("watch modified file", async () => { + await stderr.readWhile((line) => !line.includes("File modified")); + }); + + await t.should("re-upload artifact", async () => { + await stderr.readWhile((line) => !line.includes("artifact uploaded")); + }); + + await t.should("re-deploy typegraph", async () => { + await stderr.readWhile( + (line) => !line.includes("successfully deployed typegraph") + ); + }); + + t.addCleanup(async () => { + await stderr.close(); + await killProcess(metadev); + await t.shell(["rm", "-rf", targetDir]); + }); +}); diff --git a/tests/e2e/nextjs/apollo/pages/api/apollo.ts b/tests/e2e/nextjs/apollo/pages/api/apollo.ts index 918934cbf1..098ffa0411 100644 --- a/tests/e2e/nextjs/apollo/pages/api/apollo.ts +++ b/tests/e2e/nextjs/apollo/pages/api/apollo.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { NextApiRequest, NextApiResponse } from "next"; import { ApolloClient, gql, InMemoryCache } from "@apollo/client/index"; diff --git a/tests/e2e/nextjs/apollo/tailwind.config.ts b/tests/e2e/nextjs/apollo/tailwind.config.ts index ee2151538d..e82281f92c 100644 --- a/tests/e2e/nextjs/apollo/tailwind.config.ts +++ b/tests/e2e/nextjs/apollo/tailwind.config.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { Config } from "tailwindcss"; diff --git a/tests/e2e/nextjs/apollo_test.ts b/tests/e2e/nextjs/apollo_test.ts index a99a013d48..17932b94c0 100644 --- a/tests/e2e/nextjs/apollo_test.ts +++ b/tests/e2e/nextjs/apollo_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "../../utils/mod.ts"; import { diff --git a/tests/e2e/published/published_test.ts b/tests/e2e/published/published_test.ts index 338a70c0c4..e7f6092cb1 100644 --- a/tests/e2e/published/published_test.ts +++ b/tests/e2e/published/published_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { projectDir } from "@local/tools/utils.ts"; diff --git a/tests/e2e/self_deploy/scripts/main.ts b/tests/e2e/self_deploy/scripts/main.ts index fb47d1a825..c1a6b3126f 100644 --- a/tests/e2e/self_deploy/scripts/main.ts +++ b/tests/e2e/self_deploy/scripts/main.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function sayHello({ name }: any) { return `Hello ${name}`; diff --git a/tests/e2e/self_deploy/self_deploy.ts b/tests/e2e/self_deploy/self_deploy.ts index 72c085184c..c039be3c09 100644 --- a/tests/e2e/self_deploy/self_deploy.ts +++ b/tests/e2e/self_deploy/self_deploy.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/e2e/self_deploy/self_deploy_test.ts b/tests/e2e/self_deploy/self_deploy_test.ts index 933cee8668..2361ad0a32 100644 --- a/tests/e2e/self_deploy/self_deploy_test.ts +++ b/tests/e2e/self_deploy/self_deploy_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { BasicAuth, tgDeploy, tgRemove } from "@typegraph/sdk/tg_deploy.ts"; import { Meta } from "test-utils/mod.ts"; diff --git a/tests/e2e/templates/templates_test.ts b/tests/e2e/templates/templates_test.ts index b7f2760fa8..1de81e336a 100644 --- a/tests/e2e/templates/templates_test.ts +++ b/tests/e2e/templates/templates_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { newTempDir, workspaceDir } from "test-utils/dir.ts"; diff --git a/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap b/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap index 2f6d86db09..555023cea5 100644 --- a/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap +++ b/tests/e2e/typegraph/__snapshots__/typegraph_test.ts.snap @@ -654,8 +654,8 @@ snapshot[`typegraphs creation 3`] = ` "artifacts": { "scripts/three.ts": { "path": "scripts/three.ts", - "hash": "564fe4792102c50aac9801faeb3c6402c49b1f7c7cbb22dc6d54886e45cfa3b2", - "size": 307 + "hash": "16352d61551cb6d6a8c54efb8179858a4aadb1110517a8dbbf9932a5d71bb51a", + "size": 318 } } } @@ -1317,8 +1317,8 @@ snapshot[`typegraphs creation 6`] = ` "artifacts": { "scripts/three.ts": { "path": "scripts/three.ts", - "hash": "564fe4792102c50aac9801faeb3c6402c49b1f7c7cbb22dc6d54886e45cfa3b2", - "size": 307 + "hash": "16352d61551cb6d6a8c54efb8179858a4aadb1110517a8dbbf9932a5d71bb51a", + "size": 318 } } } diff --git a/tests/e2e/typegraph/typegraph_test.ts b/tests/e2e/typegraph/typegraph_test.ts index 203cdce594..174b361f3e 100644 --- a/tests/e2e/typegraph/typegraph_test.ts +++ b/tests/e2e/typegraph/typegraph_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { expandGlob } from "@std/fs/expand-glob"; import { dirname, fromFileUrl } from "@std/path"; diff --git a/tests/e2e/typegraph/typegraphs/deno/complex.ts b/tests/e2e/typegraph/typegraphs/deno/complex.ts index b72fefd211..12cb5c0ced 100644 --- a/tests/e2e/typegraph/typegraphs/deno/complex.ts +++ b/tests/e2e/typegraph/typegraphs/deno/complex.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { fx, Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/e2e/typegraph/typegraphs/deno/multiple_runtimes.ts b/tests/e2e/typegraph/typegraphs/deno/multiple_runtimes.ts index 965492d8f8..656c075689 100644 --- a/tests/e2e/typegraph/typegraphs/deno/multiple_runtimes.ts +++ b/tests/e2e/typegraph/typegraphs/deno/multiple_runtimes.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/e2e/typegraph/typegraphs/deno/scripts/three.ts b/tests/e2e/typegraph/typegraphs/deno/scripts/three.ts index c47af049a1..9f1c8a9005 100644 --- a/tests/e2e/typegraph/typegraphs/deno/scripts/three.ts +++ b/tests/e2e/typegraph/typegraphs/deno/scripts/three.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 interface ThreeInput { b: number; diff --git a/tests/e2e/typegraph/typegraphs/deno/simple.ts b/tests/e2e/typegraph/typegraphs/deno/simple.ts index 866c26a154..6f86e40797 100644 --- a/tests/e2e/typegraph/typegraphs/deno/simple.ts +++ b/tests/e2e/typegraph/typegraphs/deno/simple.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/e2e/typegraph/typegraphs/python/scripts/three.ts b/tests/e2e/typegraph/typegraphs/python/scripts/three.ts index c47af049a1..9f1c8a9005 100644 --- a/tests/e2e/typegraph/typegraphs/python/scripts/three.ts +++ b/tests/e2e/typegraph/typegraphs/python/scripts/three.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 interface ThreeInput { b: number; diff --git a/tests/e2e/typegraph/validator_test.ts b/tests/e2e/typegraph/validator_test.ts index b86a816488..6ddf7e2428 100644 --- a/tests/e2e/typegraph/validator_test.ts +++ b/tests/e2e/typegraph/validator_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { TestModule } from "test-utils/test_module.ts"; import { Meta } from "test-utils/mod.ts"; diff --git a/tests/e2e/website/website_test.ts b/tests/e2e/website/website_test.ts index 9aa55049c8..f4785d11e1 100644 --- a/tests/e2e/website/website_test.ts +++ b/tests/e2e/website/website_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { expandGlob } from "@std/fs/expand-glob"; import { basename, dirname, fromFileUrl, join } from "@std/path"; diff --git a/tests/graphql/graphql_test.ts b/tests/graphql/graphql_test.ts index 67d6583b25..efc9b90663 100644 --- a/tests/graphql/graphql_test.ts +++ b/tests/graphql/graphql_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import * as mf from "test/mock_fetch"; diff --git a/tests/graphql/request_parser_test.ts b/tests/graphql/request_parser_test.ts index eff6a8c7f0..997312038b 100644 --- a/tests/graphql/request_parser_test.ts +++ b/tests/graphql/request_parser_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { FormDataParser } from "@metatype/typegate/transports/graphql/request_parser.ts"; import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/http_utils/http_utils_test.ts b/tests/http_utils/http_utils_test.ts index 8c157d8286..2bd76dab7f 100644 --- a/tests/http_utils/http_utils_test.ts +++ b/tests/http_utils/http_utils_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertEquals } from "@std/assert"; import { replaceDynamicPathParams } from "@metatype/typegate/runtimes/utils/http.ts"; diff --git a/tests/importers/importers_test.ts.disabled b/tests/importers/importers_test.ts.disabled index ccac4cdf81..ee87b91ab5 100644 --- a/tests/importers/importers_test.ts.disabled +++ b/tests/importers/importers_test.ts.disabled @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { copyFile, gql, Meta } from "../utils/mod.ts"; import * as mf from "test/mock_fetch"; diff --git a/tests/injection/injection.ts b/tests/injection/injection.ts index 42cabf36e0..fc8bceebc9 100644 --- a/tests/injection/injection.ts +++ b/tests/injection/injection.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { CREATE, DELETE, READ, UPDATE } from "@typegraph/sdk/effects.ts"; diff --git a/tests/injection/injection_test.ts b/tests/injection/injection_test.ts index 8831ebad1f..9612b7222d 100644 --- a/tests/injection/injection_test.ts +++ b/tests/injection/injection_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import { assertRejects } from "@std/assert"; diff --git a/tests/injection/random_injection.ts b/tests/injection/random_injection.ts index dec1a051e0..2033b1eb81 100644 --- a/tests/injection/random_injection.ts +++ b/tests/injection/random_injection.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/injection/random_injection_test.ts b/tests/injection/random_injection_test.ts index 285ae8ff93..93061d16c4 100644 --- a/tests/injection/random_injection_test.ts +++ b/tests/injection/random_injection_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; diff --git a/tests/internal/internal_test.ts b/tests/internal/internal_test.ts index 73643c224b..63aedcacce 100644 --- a/tests/internal/internal_test.ts +++ b/tests/internal/internal_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import { join } from "@std/path/join"; diff --git a/tests/internal/py/logic.py b/tests/internal/py/logic.py index c8ea39393c..f5d37da715 100644 --- a/tests/internal/py/logic.py +++ b/tests/internal/py/logic.py @@ -1,5 +1,5 @@ -# Copyright Metatype OÜ, licensed under the Elastic License 2.0. -# SPDX-License-Identifier: Elastic-2.0 +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from .logic_types import Ctx import json diff --git a/tests/internal/ts/logic.ts b/tests/internal/ts/logic.ts index 607b1e6b27..541b7e2333 100644 --- a/tests/internal/ts/logic.ts +++ b/tests/internal/ts/logic.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export const remoteSum = async ( { first, second }: any, diff --git a/tests/introspection/introspection_test.ts b/tests/introspection/introspection_test.ts index 2bb2212c87..5a7f8cea88 100644 --- a/tests/introspection/introspection_test.ts +++ b/tests/introspection/introspection_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/introspection/union_either_test.ts b/tests/introspection/union_either_test.ts index b1381ec320..38f0150257 100644 --- a/tests/introspection/union_either_test.ts +++ b/tests/introspection/union_either_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/metagen/__snapshots__/metagen_test.ts.snap b/tests/metagen/__snapshots__/metagen_test.ts.snap index 63a65f5e2b..87775e9dbe 100644 --- a/tests/metagen/__snapshots__/metagen_test.ts.snap +++ b/tests/metagen/__snapshots__/metagen_test.ts.snap @@ -448,7 +448,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.4"; + static MT_VERSION: &str = "0.5.0-rc.5"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } @@ -1254,7 +1254,7 @@ impl Router { } pub fn init(&self, args: InitArgs) -> Result { - static MT_VERSION: &str = "0.5.0-rc.4"; + static MT_VERSION: &str = "0.5.0-rc.5"; if args.metatype_version != MT_VERSION { return Err(InitError::VersionMismatch(MT_VERSION.into())); } diff --git a/tests/metagen/metagen_test.ts b/tests/metagen/metagen_test.ts index 12ad310f80..59f16ed76e 100644 --- a/tests/metagen/metagen_test.ts +++ b/tests/metagen/metagen_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { join } from "@std/path/join"; diff --git a/tests/metagen/typegraphs/identities/rs/lib.rs b/tests/metagen/typegraphs/identities/rs/lib.rs index 0214d4a872..ac085da35b 100644 --- a/tests/metagen/typegraphs/identities/rs/lib.rs +++ b/tests/metagen/typegraphs/identities/rs/lib.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 mod fdk; pub use fdk::*; diff --git a/tests/metagen/typegraphs/identities/ts/handlers.ts b/tests/metagen/typegraphs/identities/ts/handlers.ts index 3f9fad44c9..34e9c92c19 100644 --- a/tests/metagen/typegraphs/identities/ts/handlers.ts +++ b/tests/metagen/typegraphs/identities/ts/handlers.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { Composites, diff --git a/tests/metagen/typegraphs/metagen.ts b/tests/metagen/typegraphs/metagen.ts index 6f2b34d66a..82f82958b2 100644 --- a/tests/metagen/typegraphs/metagen.ts +++ b/tests/metagen/typegraphs/metagen.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { PythonRuntime } from "@typegraph/sdk/runtimes/python.ts"; diff --git a/tests/metagen/typegraphs/sample.ts b/tests/metagen/typegraphs/sample.ts index 1ab9422a47..2699b7373f 100644 --- a/tests/metagen/typegraphs/sample.ts +++ b/tests/metagen/typegraphs/sample.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { fx, Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/metagen/typegraphs/sample/py/client.py b/tests/metagen/typegraphs/sample/py/client.py index 10a2eb34dc..935d695e9a 100644 --- a/tests/metagen/typegraphs/sample/py/client.py +++ b/tests/metagen/typegraphs/sample/py/client.py @@ -608,7 +608,7 @@ class NodeDescs: @staticmethod def scalar(): return NodeMeta() - + @staticmethod def Post(): return NodeMeta( @@ -736,29 +736,42 @@ def RootMixedUnionFn(): }, ) + UserIdStringUuid = str PostSlugString = str -Post = typing.TypedDict("Post", { - "id": UserIdStringUuid, - "slug": PostSlugString, - "title": PostSlugString, -}, total=False) - -RootCompositeArgsFnInput = typing.TypedDict("RootCompositeArgsFnInput", { - "id": PostSlugString, -}, total=False) +Post = typing.TypedDict( + "Post", + { + "id": UserIdStringUuid, + "slug": PostSlugString, + "title": PostSlugString, + }, + total=False, +) + +RootCompositeArgsFnInput = typing.TypedDict( + "RootCompositeArgsFnInput", + { + "id": PostSlugString, + }, + total=False, +) UserEmailStringEmail = str UserPostsPostList = typing.List[Post] -User = typing.TypedDict("User", { - "id": UserIdStringUuid, - "email": UserEmailStringEmail, - "posts": UserPostsPostList, -}, total=False) +User = typing.TypedDict( + "User", + { + "id": UserIdStringUuid, + "email": UserEmailStringEmail, + "posts": UserPostsPostList, + }, + total=False, +) RootScalarUnionFnOutputT1Integer = int @@ -782,111 +795,140 @@ def RootMixedUnionFn(): ] - -PostSelections = typing.TypedDict("PostSelections", { - "_": SelectionFlags, - "id": ScalarSelectNoArgs, - "slug": ScalarSelectNoArgs, - "title": ScalarSelectNoArgs, -}, total=False) - -UserSelections = typing.TypedDict("UserSelections", { - "_": SelectionFlags, - "id": ScalarSelectNoArgs, - "email": ScalarSelectNoArgs, - "posts": CompositeSelectNoArgs["PostSelections"], -}, total=False) - -RootCompositeUnionFnOutputSelections = typing.TypedDict("RootCompositeUnionFnOutputSelections", { - "_": SelectionFlags, - "post": CompositeSelectNoArgs["PostSelections"], - "user": CompositeSelectNoArgs["UserSelections"], -}, total=False) - -RootMixedUnionFnOutputSelections = typing.TypedDict("RootMixedUnionFnOutputSelections", { - "_": SelectionFlags, - "post": CompositeSelectNoArgs["PostSelections"], - "user": CompositeSelectNoArgs["UserSelections"], -}, total=False) +PostSelections = typing.TypedDict( + "PostSelections", + { + "_": SelectionFlags, + "id": ScalarSelectNoArgs, + "slug": ScalarSelectNoArgs, + "title": ScalarSelectNoArgs, + }, + total=False, +) + +UserSelections = typing.TypedDict( + "UserSelections", + { + "_": SelectionFlags, + "id": ScalarSelectNoArgs, + "email": ScalarSelectNoArgs, + "posts": CompositeSelectNoArgs["PostSelections"], + }, + total=False, +) + +RootCompositeUnionFnOutputSelections = typing.TypedDict( + "RootCompositeUnionFnOutputSelections", + { + "_": SelectionFlags, + "post": CompositeSelectNoArgs["PostSelections"], + "user": CompositeSelectNoArgs["UserSelections"], + }, + total=False, +) + +RootMixedUnionFnOutputSelections = typing.TypedDict( + "RootMixedUnionFnOutputSelections", + { + "_": SelectionFlags, + "post": CompositeSelectNoArgs["PostSelections"], + "user": CompositeSelectNoArgs["UserSelections"], + }, + total=False, +) class QueryGraph(QueryGraphBase): def __init__(self): - super().__init__({ - "UserIdStringUuid": "String!", - "PostSlugString": "String!", - "post": "post!", - "user": "user!", - }) - + super().__init__( + { + "UserIdStringUuid": "String!", + "PostSlugString": "String!", + "post": "post!", + "user": "user!", + } + ) + def get_user(self, select: UserSelections) -> QueryNode[User]: node = selection_to_nodes( - {"getUser": select}, - {"getUser": NodeDescs.RootGetUserFn}, - "$q" + {"getUser": select}, {"getUser": NodeDescs.RootGetUserFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) def get_posts(self, select: PostSelections) -> QueryNode[Post]: node = selection_to_nodes( - {"getPosts": select}, - {"getPosts": NodeDescs.RootGetPostsFn}, - "$q" + {"getPosts": select}, {"getPosts": NodeDescs.RootGetPostsFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) def scalar_no_args(self) -> QueryNode[PostSlugString]: node = selection_to_nodes( - {"scalarNoArgs": True}, - {"scalarNoArgs": NodeDescs.RootScalarNoArgsFn}, - "$q" + {"scalarNoArgs": True}, {"scalarNoArgs": NodeDescs.RootScalarNoArgsFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) - def scalar_args(self, args: typing.Union[Post, PlaceholderArgs]) -> MutationNode[PostSlugString]: + def scalar_args( + self, args: typing.Union[Post, PlaceholderArgs] + ) -> MutationNode[PostSlugString]: node = selection_to_nodes( - {"scalarArgs": args}, - {"scalarArgs": NodeDescs.RootScalarArgsFn}, - "$q" + {"scalarArgs": args}, {"scalarArgs": NodeDescs.RootScalarArgsFn}, "$q" )[0] - return MutationNode(node.node_name, node.instance_name, node.args, node.sub_nodes) + return MutationNode( + node.node_name, node.instance_name, node.args, node.sub_nodes + ) def composite_no_args(self, select: PostSelections) -> MutationNode[Post]: node = selection_to_nodes( - {"compositeNoArgs": select}, - {"compositeNoArgs": NodeDescs.RootCompositeNoArgsFn}, - "$q" + {"compositeNoArgs": select}, + {"compositeNoArgs": NodeDescs.RootCompositeNoArgsFn}, + "$q", )[0] - return MutationNode(node.node_name, node.instance_name, node.args, node.sub_nodes) + return MutationNode( + node.node_name, node.instance_name, node.args, node.sub_nodes + ) - def composite_args(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], select: PostSelections) -> MutationNode[Post]: + def composite_args( + self, + args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + select: PostSelections, + ) -> MutationNode[Post]: node = selection_to_nodes( - {"compositeArgs": (args, select)}, - {"compositeArgs": NodeDescs.RootCompositeArgsFn}, - "$q" + {"compositeArgs": (args, select)}, + {"compositeArgs": NodeDescs.RootCompositeArgsFn}, + "$q", )[0] - return MutationNode(node.node_name, node.instance_name, node.args, node.sub_nodes) + return MutationNode( + node.node_name, node.instance_name, node.args, node.sub_nodes + ) - def scalar_union(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs]) -> QueryNode[RootScalarUnionFnOutput]: + def scalar_union( + self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs] + ) -> QueryNode[RootScalarUnionFnOutput]: node = selection_to_nodes( - {"scalarUnion": args}, - {"scalarUnion": NodeDescs.RootScalarUnionFn}, - "$q" + {"scalarUnion": args}, {"scalarUnion": NodeDescs.RootScalarUnionFn}, "$q" )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) - def composite_union(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], select: RootCompositeUnionFnOutputSelections) -> QueryNode[RootCompositeUnionFnOutput]: + def composite_union( + self, + args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + select: RootCompositeUnionFnOutputSelections, + ) -> QueryNode[RootCompositeUnionFnOutput]: node = selection_to_nodes( - {"compositeUnion": (args, select)}, - {"compositeUnion": NodeDescs.RootCompositeUnionFn}, - "$q" + {"compositeUnion": (args, select)}, + {"compositeUnion": NodeDescs.RootCompositeUnionFn}, + "$q", )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) - def mixed_union(self, args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], select: RootMixedUnionFnOutputSelections) -> QueryNode[RootMixedUnionFnOutput]: + def mixed_union( + self, + args: typing.Union[RootCompositeArgsFnInput, PlaceholderArgs], + select: RootMixedUnionFnOutputSelections, + ) -> QueryNode[RootMixedUnionFnOutput]: node = selection_to_nodes( - {"mixedUnion": (args, select)}, - {"mixedUnion": NodeDescs.RootMixedUnionFn}, - "$q" + {"mixedUnion": (args, select)}, + {"mixedUnion": NodeDescs.RootMixedUnionFn}, + "$q", )[0] return QueryNode(node.node_name, node.instance_name, node.args, node.sub_nodes) diff --git a/tests/metagen/typegraphs/sample/ts/main.ts b/tests/metagen/typegraphs/sample/ts/main.ts index 987577de1d..6416ac3ccf 100644 --- a/tests/metagen/typegraphs/sample/ts/main.ts +++ b/tests/metagen/typegraphs/sample/ts/main.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { alias, PreparedArgs, QueryGraph } from "./client.ts"; diff --git a/tests/misc/publish_test.ts b/tests/misc/publish_test.ts index c9aaf38b70..be4f50d7ce 100644 --- a/tests/misc/publish_test.ts +++ b/tests/misc/publish_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assert } from "@std/assert/assert"; import { exists } from "@std/fs/exists"; import { Meta } from "test-utils/mod.ts"; diff --git a/tests/misc/typegate_config_test.ts.disabled b/tests/misc/typegate_config_test.ts.disabled index 9ad04c7967..c9e02cfd6a 100644 --- a/tests/misc/typegate_config_test.ts.disabled +++ b/tests/misc/typegate_config_test.ts.disabled @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { assert } from "std/assert/mod.ts"; diff --git a/tests/multi_typegraph/multi_typegraph.ts b/tests/multi_typegraph/multi_typegraph.ts index 34957744b0..214030deaf 100644 --- a/tests/multi_typegraph/multi_typegraph.ts +++ b/tests/multi_typegraph/multi_typegraph.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { RandomRuntime } from "@typegraph/sdk/runtimes/random.ts"; diff --git a/tests/multi_typegraph/multi_typegraph_test.ts b/tests/multi_typegraph/multi_typegraph_test.ts index 485dd4ef24..58d76bfa30 100644 --- a/tests/multi_typegraph/multi_typegraph_test.ts +++ b/tests/multi_typegraph/multi_typegraph_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import * as mf from "test/mock_fetch"; diff --git a/tests/nesting/nesting_test.ts b/tests/nesting/nesting_test.ts index cc387f9a17..d71c0c5b23 100644 --- a/tests/nesting/nesting_test.ts +++ b/tests/nesting/nesting_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import * as mf from "test/mock_fetch"; diff --git a/tests/params/apply_test.ts b/tests/params/apply_test.ts index 78e41f716f..217a9b4fb5 100644 --- a/tests/params/apply_test.ts +++ b/tests/params/apply_test.ts @@ -1,7 +1,10 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 -import { gql, Meta } from "../utils/mod.ts"; +import { randomPGConnStr } from "test-utils/database.ts"; +import { gql, Meta } from "test-utils/mod.ts"; +import { dropSchemas, recreateMigrations } from "test-utils/migrations.ts"; +import { assertEquals } from "@std/assert/equals"; Meta.test("(python (sdk): apply)", async (t) => { const e = await t.engine("params/apply.py", { @@ -253,3 +256,66 @@ Meta.test("nested context access", async (t) => { .on(e); }); }); + +Meta.test("apply with prisma generated types", async (t) => { + const { connStr, schema: _ } = randomPGConnStr(); + const e = await t.engine("params/prisma_apply.py", { + secrets: { + "POSTGRES": connStr, + }, + }); + await dropSchemas(e); + await recreateMigrations(e); + + let id: string = null!; + + await t.should("create user", async () => { + await gql` + mutation { + createUser( + name: "Alice" + email: "alice@example.com" + age: 30 + ) { + id + name + email + age + } + } + ` + .expectBody((body) => { + id = body.data.createUser.id; + assertEquals(body.data.createUser, { + id: id, + name: "Alice", + email: "alice@example.com", + age: 30, + }); + }) + .on(e); + }); + + await t.should("find user by id", async () => { + await gql` + query Q($id: ID!) { + findUser(id: $id) { + id + name + email + age + } + } + ` + .withVars({ id }) + .expectData({ + findUser: { + id, + name: "Alice", + email: "alice@example.com", + age: 30, + }, + }) + .on(e); + }); +}); diff --git a/tests/params/prisma_apply.py b/tests/params/prisma_apply.py new file mode 100644 index 0000000000..78afba91b7 --- /dev/null +++ b/tests/params/prisma_apply.py @@ -0,0 +1,38 @@ +from typegraph import Graph, Policy, t, typegraph +from typegraph.providers import PrismaRuntime + + +@typegraph() +def prisma_apply(g: Graph): + prisma = PrismaRuntime("db", "POSTGRES") + public = Policy.public() + + user = t.struct( + { + "id": t.uuid(config=["auto"]).id(), + "name": t.string(), + "email": t.email(config=["unique"]), + "age": t.integer(), + }, + name="user", + ) + + g.expose( + public, + createUser=prisma.create(user).apply( + { + "data": { + "name": g.as_arg(), + "email": g.as_arg(), + "age": g.as_arg(), + } + } + ), + findUser=prisma.find_unique(user).apply( + { + "where": { + "id": g.as_arg(), + } + } + ), + ) diff --git a/tests/planner/default_args_test.ts b/tests/planner/default_args_test.ts index 4a0bb847e6..6df4c5bfe6 100644 --- a/tests/planner/default_args_test.ts +++ b/tests/planner/default_args_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "test-utils/migrations.ts"; import { gql, Meta } from "test-utils/mod.ts"; diff --git a/tests/planner/planner_test.ts b/tests/planner/planner_test.ts index d6e37985f4..c0797c6a32 100644 --- a/tests/planner/planner_test.ts +++ b/tests/planner/planner_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import { mapValues } from "@std/collections/map-values"; diff --git a/tests/policies/policies_jwt_test.ts b/tests/policies/policies_jwt_test.ts index 35b9802505..12f9b88cce 100644 --- a/tests/policies/policies_jwt_test.ts +++ b/tests/policies/policies_jwt_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; import * as jwt from "jwt"; diff --git a/tests/policies/policies_test.ts b/tests/policies/policies_test.ts index a2c40bfe15..988734b6a5 100644 --- a/tests/policies/policies_test.ts +++ b/tests/policies/policies_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { TypegateConfig } from "@metatype/typegate/config.ts"; import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/policies/ts/effects.ts b/tests/policies/ts/effects.ts index 96dfdacdb7..5e4ba665fd 100644 --- a/tests/policies/ts/effects.ts +++ b/tests/policies/ts/effects.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function currentUserOnly( args: Record>, diff --git a/tests/policies/ts/policies.ts b/tests/policies/ts/policies.ts index 97d71ea27c..f6ed021293 100644 --- a/tests/policies/ts/policies.ts +++ b/tests/policies/ts/policies.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 interface ReadSecretInput { username: string; diff --git a/tests/prisma_migrate/prisma_migrate_test.ts b/tests/prisma_migrate/prisma_migrate_test.ts index 6f899508ca..b145bb8738 100644 --- a/tests/prisma_migrate/prisma_migrate_test.ts +++ b/tests/prisma_migrate/prisma_migrate_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assert, diff --git a/tests/query_parsers/query_parsers_test.ts b/tests/query_parsers/query_parsers_test.ts index 1430f4ca2d..5198892175 100644 --- a/tests/query_parsers/query_parsers_test.ts +++ b/tests/query_parsers/query_parsers_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import * as mf from "test/mock_fetch"; diff --git a/tests/rate_limiter/rate_limiter_test.ts b/tests/rate_limiter/rate_limiter_test.ts index dc5e6c8aee..8186954b7a 100644 --- a/tests/rate_limiter/rate_limiter_test.ts +++ b/tests/rate_limiter/rate_limiter_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { decrPosCmd, diff --git a/tests/regression/invalid_ref_error_message/invalid_ref_test.ts b/tests/regression/invalid_ref_error_message/invalid_ref_test.ts index f9633fb9c6..035a82cb59 100644 --- a/tests/regression/invalid_ref_error_message/invalid_ref_test.ts +++ b/tests/regression/invalid_ref_error_message/invalid_ref_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { assertRejects } from "@std/assert"; diff --git a/tests/rest/custom/custom_loader.ts b/tests/rest/custom/custom_loader.ts index 3db39d6999..9443d773cb 100644 --- a/tests/rest/custom/custom_loader.ts +++ b/tests/rest/custom/custom_loader.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dirname } from "@std/path/dirname"; import { resolve } from "@std/path/resolve"; diff --git a/tests/rest/rest_custom_loader.ts b/tests/rest/rest_custom_loader.ts index c4c10ed890..cd99d8628c 100644 --- a/tests/rest/rest_custom_loader.ts +++ b/tests/rest/rest_custom_loader.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { fx, Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/rest/rest_schema.ts b/tests/rest/rest_schema.ts index 5f3cca2843..81b6029431 100644 --- a/tests/rest/rest_schema.ts +++ b/tests/rest/rest_schema.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { fx, Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/rest/rest_test.ts b/tests/rest/rest_test.ts index 41a2e3e954..4e2a86a8d5 100644 --- a/tests/rest/rest_test.ts +++ b/tests/rest/rest_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertEquals, assertStringIncludes } from "@std/assert"; import { gql, Meta, rest } from "../utils/mod.ts"; diff --git a/tests/runtimes/deno/deno_dep.ts b/tests/runtimes/deno/deno_dep.ts index a0f2be5763..b7e87da08c 100644 --- a/tests/runtimes/deno/deno_dep.ts +++ b/tests/runtimes/deno/deno_dep.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/runtimes/deno/deno_dir.ts b/tests/runtimes/deno/deno_dir.ts index 635090512c..11b352ebbd 100644 --- a/tests/runtimes/deno/deno_dir.ts +++ b/tests/runtimes/deno/deno_dir.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/runtimes/deno/deno_dir_test.ts b/tests/runtimes/deno/deno_dir_test.ts index 9139ee1a8d..04cea044c5 100644 --- a/tests/runtimes/deno/deno_dir_test.ts +++ b/tests/runtimes/deno/deno_dir_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/deno/deno_duplicate_artifact.ts b/tests/runtimes/deno/deno_duplicate_artifact.ts index 5705581152..077cef9327 100644 --- a/tests/runtimes/deno/deno_duplicate_artifact.ts +++ b/tests/runtimes/deno/deno_duplicate_artifact.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/runtimes/deno/deno_glob_test.ts b/tests/runtimes/deno/deno_glob_test.ts index ce5783aebe..6745dd7a37 100644 --- a/tests/runtimes/deno/deno_glob_test.ts +++ b/tests/runtimes/deno/deno_glob_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/deno/deno_globs.ts b/tests/runtimes/deno/deno_globs.ts index f95f7c7847..a4f2b6d1ee 100644 --- a/tests/runtimes/deno/deno_globs.ts +++ b/tests/runtimes/deno/deno_globs.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/runtimes/deno/deno_sync_test.ts b/tests/runtimes/deno/deno_sync_test.ts index a9e2477833..00278d92fc 100644 --- a/tests/runtimes/deno/deno_sync_test.ts +++ b/tests/runtimes/deno/deno_sync_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta, sleep } from "../../utils/mod.ts"; import * as path from "@std/path"; diff --git a/tests/runtimes/deno/deno_test.ts b/tests/runtimes/deno/deno_test.ts index 3e7498623d..cf18f285d7 100644 --- a/tests/runtimes/deno/deno_test.ts +++ b/tests/runtimes/deno/deno_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta, sleep } from "../../utils/mod.ts"; import * as path from "@std/path"; diff --git a/tests/runtimes/deno/deno_typescript.ts b/tests/runtimes/deno/deno_typescript.ts index f89bfdd1da..f6ef827028 100644 --- a/tests/runtimes/deno/deno_typescript.ts +++ b/tests/runtimes/deno/deno_typescript.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/runtimes/deno/dynamic/1.ts b/tests/runtimes/deno/dynamic/1.ts index f48fff673e..6bc53565e1 100644 --- a/tests/runtimes/deno/dynamic/1.ts +++ b/tests/runtimes/deno/dynamic/1.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function fire() { return 1; diff --git a/tests/runtimes/deno/dynamic/2.ts b/tests/runtimes/deno/dynamic/2.ts index 2504caf7f9..b733db6994 100644 --- a/tests/runtimes/deno/dynamic/2.ts +++ b/tests/runtimes/deno/dynamic/2.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function fire() { return 2; diff --git a/tests/runtimes/deno/reload/template.ts b/tests/runtimes/deno/reload/template.ts index 59f158c270..ac626f8a1d 100644 --- a/tests/runtimes/deno/reload/template.ts +++ b/tests/runtimes/deno/reload/template.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function fire() { return "REWRITE_ME"; diff --git a/tests/runtimes/deno/ts/deno.ts b/tests/runtimes/deno/ts/deno.ts index d35ef40976..5da50ea679 100644 --- a/tests/runtimes/deno/ts/deno.ts +++ b/tests/runtimes/deno/ts/deno.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 let count = 0; diff --git a/tests/runtimes/deno/ts/dep/main.ts b/tests/runtimes/deno/ts/dep/main.ts index e7dd4ccde1..ca26d7b12e 100644 --- a/tests/runtimes/deno/ts/dep/main.ts +++ b/tests/runtimes/deno/ts/dep/main.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { add } from "./nested/dep.ts"; diff --git a/tests/runtimes/deno/ts/dep/nested/dep.ts b/tests/runtimes/deno/ts/dep/nested/dep.ts index 14d1e32252..ce1ce3940c 100644 --- a/tests/runtimes/deno/ts/dep/nested/dep.ts +++ b/tests/runtimes/deno/ts/dep/nested/dep.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function add(a: number, b: number) { return a + b; diff --git a/tests/runtimes/deno/ts/math-npm.ts b/tests/runtimes/deno/ts/math-npm.ts index d1fc05e5e5..9c423f3f86 100644 --- a/tests/runtimes/deno/ts/math-npm.ts +++ b/tests/runtimes/deno/ts/math-npm.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // deno-lint-ignore no-external-import import * as MathJS from "npm:mathjs@11.11.1"; diff --git a/tests/runtimes/deno/ts/math.ts b/tests/runtimes/deno/ts/math.ts index 10871f4243..61ff5ef0f6 100644 --- a/tests/runtimes/deno/ts/math.ts +++ b/tests/runtimes/deno/ts/math.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // deno-lint-ignore no-external-import import * as MathLib from "https://deno.land/x/math@v1.1.0/mod.ts"; diff --git a/tests/runtimes/graphql/graphql_test.ts b/tests/runtimes/graphql/graphql_test.ts index 42fa61f826..81ce8c353f 100644 --- a/tests/runtimes/graphql/graphql_test.ts +++ b/tests/runtimes/graphql/graphql_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { QueryEngine } from "@metatype/typegate/engine/query_engine.ts"; import { removeMigrations } from "../../utils/migrations.ts"; diff --git a/tests/runtimes/graphql/typegraphs/deno/graphql.ts b/tests/runtimes/graphql/typegraphs/deno/graphql.ts index 3a71eb3537..a084eea1c3 100644 --- a/tests/runtimes/graphql/typegraphs/deno/graphql.ts +++ b/tests/runtimes/graphql/typegraphs/deno/graphql.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { GraphQLRuntime } from "@typegraph/sdk/runtimes/graphql.ts"; diff --git a/tests/runtimes/grpc/geography.py b/tests/runtimes/grpc/geography.py index b5d6432bec..b6aa3fcc0d 100644 --- a/tests/runtimes/grpc/geography.py +++ b/tests/runtimes/grpc/geography.py @@ -1,5 +1,5 @@ -# Copyright Metatype OÜ, licensed under the Elastic License 2.0. -# SPDX-License-Identifier: Elastic-2.0 +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import Graph, Policy, typegraph from typegraph.runtimes.grpc import GrpcRuntime diff --git a/tests/runtimes/grpc/grpc_test.ts b/tests/runtimes/grpc/grpc_test.ts index a58c14e5df..c44c4a030b 100644 --- a/tests/runtimes/grpc/grpc_test.ts +++ b/tests/runtimes/grpc/grpc_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { MetaTest } from "../../utils/test.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/grpc/helloworld.py b/tests/runtimes/grpc/helloworld.py index 6888a2c1c1..d6fc480ab4 100644 --- a/tests/runtimes/grpc/helloworld.py +++ b/tests/runtimes/grpc/helloworld.py @@ -1,5 +1,5 @@ -# Copyright Metatype OÜ, licensed under the Elastic License 2.0. -# SPDX-License-Identifier: Elastic-2.0 +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import Graph, Policy, typegraph from typegraph.runtimes.grpc import GrpcRuntime diff --git a/tests/runtimes/grpc/helloworld.ts b/tests/runtimes/grpc/helloworld.ts index 58f2ccd6d1..4766b9f184 100644 --- a/tests/runtimes/grpc/helloworld.ts +++ b/tests/runtimes/grpc/helloworld.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, typegraph } from "@typegraph/sdk/index.ts"; import { GrpcRuntime } from "@typegraph/sdk/runtimes/grpc.ts"; diff --git a/tests/runtimes/grpc/maths.py b/tests/runtimes/grpc/maths.py index 216f185de0..d2e6a4ec53 100644 --- a/tests/runtimes/grpc/maths.py +++ b/tests/runtimes/grpc/maths.py @@ -1,5 +1,5 @@ -# Copyright Metatype OÜ, licensed under the Elastic License 2.0. -# SPDX-License-Identifier: Elastic-2.0 +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import Graph, Policy, typegraph from typegraph.runtimes.grpc import GrpcRuntime diff --git a/tests/runtimes/http/http_content_type_test.ts b/tests/runtimes/http/http_content_type_test.ts index 70dd0b5c77..0379013783 100644 --- a/tests/runtimes/http/http_content_type_test.ts +++ b/tests/runtimes/http/http_content_type_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../../utils/mod.ts"; import * as mf from "test/mock_fetch"; diff --git a/tests/runtimes/http/http_test.ts b/tests/runtimes/http/http_test.ts index b0b0ef2c23..8d6505e7ce 100644 --- a/tests/runtimes/http/http_test.ts +++ b/tests/runtimes/http/http_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../../utils/mod.ts"; import * as mf from "test/mock_fetch"; diff --git a/tests/runtimes/kv/kv.py b/tests/runtimes/kv/kv.py index b93a71ee08..45510c9991 100644 --- a/tests/runtimes/kv/kv.py +++ b/tests/runtimes/kv/kv.py @@ -1,5 +1,5 @@ -# Copyright Metatype OÜ, licensed under the Elastic License 2.0. -# SPDX-License-Identifier: Elastic-2.0 +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import Graph, Policy, typegraph from typegraph.runtimes.kv import KvRuntime diff --git a/tests/runtimes/kv/kv.ts b/tests/runtimes/kv/kv.ts index 5425c363a2..c238cfd098 100644 --- a/tests/runtimes/kv/kv.ts +++ b/tests/runtimes/kv/kv.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, typegraph } from "@typegraph/sdk/index.ts"; import { KvRuntime } from "@typegraph/sdk/runtimes/kv.ts"; diff --git a/tests/runtimes/kv/kv_test.ts b/tests/runtimes/kv/kv_test.ts index 3a1f9b2508..1bf6132a6d 100644 --- a/tests/runtimes/kv/kv_test.ts +++ b/tests/runtimes/kv/kv_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { MetaTest } from "../../utils/test.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/prisma/full_prisma_mapping_test.ts b/tests/runtimes/prisma/full_prisma_mapping_test.ts index 1cbc92e6f5..0fbda9e3bd 100644 --- a/tests/runtimes/prisma/full_prisma_mapping_test.ts +++ b/tests/runtimes/prisma/full_prisma_mapping_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/prisma/graphql_variables_test.ts b/tests/runtimes/prisma/graphql_variables_test.ts index 47a3d20cb0..8036ce1694 100644 --- a/tests/runtimes/prisma/graphql_variables_test.ts +++ b/tests/runtimes/prisma/graphql_variables_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { v4 } from "@std/uuid"; import { assert } from "@std/assert"; diff --git a/tests/runtimes/prisma/mixed_runtime_test.ts b/tests/runtimes/prisma/mixed_runtime_test.ts index 8c1607dd45..6640f09d4b 100644 --- a/tests/runtimes/prisma/mixed_runtime_test.ts +++ b/tests/runtimes/prisma/mixed_runtime_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/prisma/multi_relations_test.ts b/tests/runtimes/prisma/multi_relations_test.ts index 17a8037ede..542adfb3ca 100644 --- a/tests/runtimes/prisma/multi_relations_test.ts +++ b/tests/runtimes/prisma/multi_relations_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/prisma/multiple_runtimes_test.ts b/tests/runtimes/prisma/multiple_runtimes_test.ts index a4f1edc916..1bb3d8676a 100644 --- a/tests/runtimes/prisma/multiple_runtimes_test.ts +++ b/tests/runtimes/prisma/multiple_runtimes_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/prisma/normal_1_1.ts b/tests/runtimes/prisma/normal_1_1.ts index a0524fda84..74cee34d56 100644 --- a/tests/runtimes/prisma/normal_1_1.ts +++ b/tests/runtimes/prisma/normal_1_1.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.ts"; diff --git a/tests/runtimes/prisma/one_to_many_test.ts b/tests/runtimes/prisma/one_to_many_test.ts index 8bb9457063..2e850243dc 100644 --- a/tests/runtimes/prisma/one_to_many_test.ts +++ b/tests/runtimes/prisma/one_to_many_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { randomPGConnStr } from "../../utils/database.ts"; import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; diff --git a/tests/runtimes/prisma/one_to_one_test.ts b/tests/runtimes/prisma/one_to_one_test.ts index d919d6f032..24eac6f4cf 100644 --- a/tests/runtimes/prisma/one_to_one_test.ts +++ b/tests/runtimes/prisma/one_to_one_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { QueryEngine } from "@metatype/typegate/engine/query_engine.ts"; import { randomPGConnStr } from "../../utils/database.ts"; diff --git a/tests/runtimes/prisma/optional_1_n.ts b/tests/runtimes/prisma/optional_1_n.ts index c03321e5d1..e0fbdd0021 100644 --- a/tests/runtimes/prisma/optional_1_n.ts +++ b/tests/runtimes/prisma/optional_1_n.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { PrismaRuntime } from "@typegraph/sdk/providers/prisma.ts"; diff --git a/tests/runtimes/prisma/prisma_edgecases_test.ts b/tests/runtimes/prisma/prisma_edgecases_test.ts index d021316c9e..97bb0e75c1 100644 --- a/tests/runtimes/prisma/prisma_edgecases_test.ts +++ b/tests/runtimes/prisma/prisma_edgecases_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/prisma/prisma_test.ts b/tests/runtimes/prisma/prisma_test.ts index bf2e3b5b49..e774abb407 100644 --- a/tests/runtimes/prisma/prisma_test.ts +++ b/tests/runtimes/prisma/prisma_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { v4 } from "@std/uuid"; import { assert } from "@std/assert"; diff --git a/tests/runtimes/prisma/query_builder_test.ts b/tests/runtimes/prisma/query_builder_test.ts index 52c5115240..3f1b4dd971 100644 --- a/tests/runtimes/prisma/query_builder_test.ts +++ b/tests/runtimes/prisma/query_builder_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertEquals } from "@std/assert"; import { PrismaRuntime } from "@metatype/typegate/runtimes/prisma/prisma.ts"; diff --git a/tests/runtimes/prisma/schema_generation_test.ts b/tests/runtimes/prisma/schema_generation_test.ts index dabbe3ea6e..44e8b3267b 100644 --- a/tests/runtimes/prisma/schema_generation_test.ts +++ b/tests/runtimes/prisma/schema_generation_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "../../utils/mod.ts"; import { serialize } from "../../utils/meta.ts"; diff --git a/tests/runtimes/python/python.ts b/tests/runtimes/python/python.ts index 807352bf34..f1f10930fc 100644 --- a/tests/runtimes/python/python.ts +++ b/tests/runtimes/python/python.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { PythonRuntime } from "@typegraph/sdk/runtimes/python.ts"; diff --git a/tests/runtimes/python/python_dir.ts b/tests/runtimes/python/python_dir.ts index d3780fc927..81bde6d6ee 100644 --- a/tests/runtimes/python/python_dir.ts +++ b/tests/runtimes/python/python_dir.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { PythonRuntime } from "@typegraph/sdk/runtimes/python.ts"; import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; diff --git a/tests/runtimes/python/python_dir_test.ts b/tests/runtimes/python/python_dir_test.ts index 395c3a64e1..1303573e3e 100644 --- a/tests/runtimes/python/python_dir_test.ts +++ b/tests/runtimes/python/python_dir_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/python/python_duplicate_artifact.ts b/tests/runtimes/python/python_duplicate_artifact.ts index 2176fffa22..0e3c25a3de 100644 --- a/tests/runtimes/python/python_duplicate_artifact.ts +++ b/tests/runtimes/python/python_duplicate_artifact.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { PythonRuntime } from "@typegraph/sdk/runtimes/python.ts"; diff --git a/tests/runtimes/python/python_glob_test.ts b/tests/runtimes/python/python_glob_test.ts index ebcf91f0dc..883bb61677 100644 --- a/tests/runtimes/python/python_glob_test.ts +++ b/tests/runtimes/python/python_glob_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/python/python_globs.ts b/tests/runtimes/python/python_globs.ts index c643e72ad3..a75d3c09cf 100644 --- a/tests/runtimes/python/python_globs.ts +++ b/tests/runtimes/python/python_globs.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { PythonRuntime } from "@typegraph/sdk/runtimes/python.ts"; import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; diff --git a/tests/runtimes/python/python_no_artifact.ts b/tests/runtimes/python/python_no_artifact.ts index dd67a90deb..42498207c3 100644 --- a/tests/runtimes/python/python_no_artifact.ts +++ b/tests/runtimes/python/python_no_artifact.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { PythonRuntime } from "@typegraph/sdk/runtimes/python.ts"; diff --git a/tests/runtimes/python/python_sync_test.ts b/tests/runtimes/python/python_sync_test.ts index 0ad6a0c522..159d7c89c4 100644 --- a/tests/runtimes/python/python_sync_test.ts +++ b/tests/runtimes/python/python_sync_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta, sleep } from "../../utils/mod.ts"; import { connect } from "redis"; diff --git a/tests/runtimes/python/python_test.ts b/tests/runtimes/python/python_test.ts index 0e2bdf8c5f..93b378dd62 100644 --- a/tests/runtimes/python/python_test.ts +++ b/tests/runtimes/python/python_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assert, assertEquals } from "@std/assert"; import { gql, Meta } from "test-utils/mod.ts"; diff --git a/tests/runtimes/random/random.ts b/tests/runtimes/random/random.ts index 15be0e5000..1e8be8c5ff 100644 --- a/tests/runtimes/random/random.ts +++ b/tests/runtimes/random/random.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { RandomRuntime } from "@typegraph/sdk/runtimes/random.ts"; diff --git a/tests/runtimes/random/random_test.ts b/tests/runtimes/random/random_test.ts index 4975ca6e0e..b932a2839e 100644 --- a/tests/runtimes/random/random_test.ts +++ b/tests/runtimes/random/random_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; diff --git a/tests/runtimes/s3/s3.ts b/tests/runtimes/s3/s3.ts index 4349502c54..25100ffc32 100644 --- a/tests/runtimes/s3/s3.ts +++ b/tests/runtimes/s3/s3.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { S3Runtime } from "@typegraph/sdk/providers/aws.ts"; diff --git a/tests/runtimes/s3/s3_test.ts b/tests/runtimes/s3/s3_test.ts index 715fa45cdf..77089c9e22 100644 --- a/tests/runtimes/s3/s3_test.ts +++ b/tests/runtimes/s3/s3_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertEquals, assertExists } from "@std/assert"; import { execute, gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/substantial/common.ts b/tests/runtimes/substantial/common.ts index 3cc42b1f5d..5aca8d3dda 100644 --- a/tests/runtimes/substantial/common.ts +++ b/tests/runtimes/substantial/common.ts @@ -47,7 +47,10 @@ export function basicTestTemplate( cleanup && t.addCleanup(cleanup); const e = await t.engine("runtimes/substantial/substantial.py", { - secrets, + secrets: { + MY_SECRET: "Hello", + ...secrets, + }, }); let currentRunId: string | null = null; @@ -173,7 +176,10 @@ export function concurrentWorkflowTestTemplate( cleanup && t.addCleanup(cleanup); const e = await t.engine("runtimes/substantial/substantial.py", { - secrets, + secrets: { + MY_SECRET: "Hello", + ...secrets, + }, }); const emails = [ @@ -349,7 +355,10 @@ export function retrySaveTestTemplate( cleanup && t.addCleanup(cleanup); const e = await t.engine("runtimes/substantial/substantial.py", { - secrets, + secrets: { + MY_SECRET: "Hello", + ...secrets, + }, }); let resolvedId: string, diff --git a/tests/runtimes/substantial/imports/common_types.ts b/tests/runtimes/substantial/imports/common_types.ts index 3e40785083..b3c0130651 100644 --- a/tests/runtimes/substantial/imports/common_types.ts +++ b/tests/runtimes/substantial/imports/common_types.ts @@ -1,7 +1,7 @@ // TODO: include this as part of the metagen generated code -// TODO: -export type Workflow = (ctx: Context) => Promise; +// TODO: merge these +export type Workflow = (ctx: Context, ctx2: TaskCtx) => Promise; export interface SerializableWorkflowHandle { runId?: string; @@ -45,6 +45,21 @@ export interface Context { ): ChildWorkflowHandle; } +export type TaskCtx = { + parent?: Record; + /** + * Request context extracted by auth extractors. + */ + context?: Record; + secrets: Record; + effect: "create" | "update" | "delete" | "read" | undefined | null; + meta: { + url: string; + token: string; + }; + headers: Record; +}; + export interface SaveOption { timeoutMs?: number; retry?: { diff --git a/tests/runtimes/substantial/kv_like_test.ts b/tests/runtimes/substantial/kv_like_test.ts index 33e66b7774..efc3606dc6 100644 --- a/tests/runtimes/substantial/kv_like_test.ts +++ b/tests/runtimes/substantial/kv_like_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { basicTestTemplate, diff --git a/tests/runtimes/substantial/redis_test.ts b/tests/runtimes/substantial/redis_test.ts index 1732898635..daaccc953c 100644 --- a/tests/runtimes/substantial/redis_test.ts +++ b/tests/runtimes/substantial/redis_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { basicTestTemplate, diff --git a/tests/runtimes/substantial/substantial.py b/tests/runtimes/substantial/substantial.py index f079980563..55c2b82a9c 100644 --- a/tests/runtimes/substantial/substantial.py +++ b/tests/runtimes/substantial/substantial.py @@ -19,7 +19,14 @@ def substantial(g: Graph): file = ( WorkflowFile.deno(file="workflow.ts", deps=["imports/common_types.ts"]) - .import_(["saveAndSleepExample", "eventsAndExceptionExample", "retryExample"]) + .import_( + [ + "saveAndSleepExample", + "eventsAndExceptionExample", + "retryExample", + "secretsExample", + ] + ) .build() ) @@ -55,5 +62,9 @@ def substantial(g: Graph): start_retry=sub.start( t.struct({"fail": t.boolean(), "timeout": t.boolean()}) ).reduce({"name": "retryExample"}), + # secret + start_secret=sub.start(t.struct({}), secrets=["MY_SECRET"]).reduce( + {"name": "secretsExample"} + ), **sub.internals(), ) diff --git a/tests/runtimes/substantial/substantial_test.ts b/tests/runtimes/substantial/substantial_test.ts new file mode 100644 index 0000000000..f071401015 --- /dev/null +++ b/tests/runtimes/substantial/substantial_test.ts @@ -0,0 +1,6 @@ +import { basicTestTemplate } from "./common.ts"; + +basicTestTemplate("memory", { + secrets: { MY_SECRET: "Hello" }, + delays: { awaitSleepCompleteSec: 10 }, +}); diff --git a/tests/runtimes/substantial/workflow.ts b/tests/runtimes/substantial/workflow.ts index b4df2cb5f4..59d7a70737 100644 --- a/tests/runtimes/substantial/workflow.ts +++ b/tests/runtimes/substantial/workflow.ts @@ -3,9 +3,12 @@ import { queryThatTakesAWhile, sendSubscriptionEmail, sleep, + Workflow, } from "./imports/common_types.ts"; -export async function eventsAndExceptionExample(ctx: Context) { +export const eventsAndExceptionExample: Workflow = async ( + ctx: Context, +) => { const { to } = ctx.kwargs; const messageDialog = await ctx.save(() => sendSubscriptionEmail(to)); @@ -17,7 +20,7 @@ export async function eventsAndExceptionExample(ctx: Context) { } return `${messageDialog}: confirmed!`; -} +}; export async function saveAndSleepExample(ctx: Context) { const { a, b } = ctx.kwargs; @@ -28,18 +31,18 @@ export async function saveAndSleepExample(ctx: Context) { const sum = await ctx.save(async () => { const remoteAdd = new Date().getTime(); - const { data } = await ctx.gql/**/ `query { remote_add(a: $a, b: $b) }`.run( + const { data } = await ctx.gql /**/`query { remote_add(a: $a, b: $b) }`.run( { a: newA, b: newB, - } + }, ); const remoteAddEnd = new Date().getTime(); console.log( "Remote add:", (remoteAddEnd - remoteAdd) / 1000, ", Response:", - data + data, ); return (data as any)?.remote_add as number; @@ -67,7 +70,7 @@ export async function retryExample(ctx: Context) { maxBackoffMs: 5000, maxRetries: 4, }, - } + }, ); const timeoutRet = await ctx.save( @@ -86,8 +89,19 @@ export async function retryExample(ctx: Context) { maxBackoffMs: 3000, maxRetries: 5, }, - } + }, ); return [timeoutRet, retryRet].join(", "); } + +export const secretsExample: Workflow = (_, { secrets }) => { + const { MY_SECRET, ...rest } = secrets; + if (!MY_SECRET) { + throw new Error("unable to read secret"); + } + if (Object.keys(rest).length > 0) { + throw new Error("unexpected secrets found: ", rest); + } + return Promise.resolve(); +}; diff --git a/tests/runtimes/temporal/temporal.ts b/tests/runtimes/temporal/temporal.ts index ed9a5b15f8..abc7d7b3b5 100644 --- a/tests/runtimes/temporal/temporal.ts +++ b/tests/runtimes/temporal/temporal.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { TemporalRuntime } from "@typegraph/sdk/providers/temporal.ts"; diff --git a/tests/runtimes/temporal/temporal_test.ts b/tests/runtimes/temporal/temporal_test.ts index 1f1937d72f..548f0a945c 100644 --- a/tests/runtimes/temporal/temporal_test.ts +++ b/tests/runtimes/temporal/temporal_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assertExists } from "@std/assert"; import { gql, Meta } from "test-utils/mod.ts"; diff --git a/tests/runtimes/temporal/worker/activities.ts b/tests/runtimes/temporal/worker/activities.ts index aa73554274..55279b5518 100644 --- a/tests/runtimes/temporal/worker/activities.ts +++ b/tests/runtimes/temporal/worker/activities.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export function greet(name: string): Promise { return Promise.resolve(`Hello, ${name}!`); diff --git a/tests/runtimes/temporal/worker/worker.ts b/tests/runtimes/temporal/worker/worker.ts index e00a856049..122bea637a 100644 --- a/tests/runtimes/temporal/worker/worker.ts +++ b/tests/runtimes/temporal/worker/worker.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { NativeConnection, Worker } from "@temporalio/worker"; import * as activities from "./activities.js"; diff --git a/tests/runtimes/temporal/worker/workflows.ts b/tests/runtimes/temporal/worker/workflows.ts index cae07d2d8e..d7a45d3c9c 100644 --- a/tests/runtimes/temporal/worker/workflows.ts +++ b/tests/runtimes/temporal/worker/workflows.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import * as workflow from "@temporalio/workflow"; diff --git a/tests/runtimes/typegate/typegate_prisma_test.ts b/tests/runtimes/typegate/typegate_prisma_test.ts index bd85fff456..9f15a224d6 100644 --- a/tests/runtimes/typegate/typegate_prisma_test.ts +++ b/tests/runtimes/typegate/typegate_prisma_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/typegate/typegate_runtime_test.ts b/tests/runtimes/typegate/typegate_runtime_test.ts index 951661bfae..b6af04bf29 100644 --- a/tests/runtimes/typegate/typegate_runtime_test.ts +++ b/tests/runtimes/typegate/typegate_runtime_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dropSchemas, recreateMigrations } from "../../utils/migrations.ts"; import { gql, Meta } from "../../utils/mod.ts"; diff --git a/tests/runtimes/wasm_reflected/rust/Cargo.toml b/tests/runtimes/wasm_reflected/rust/Cargo.toml index 1a09a8c835..ea6f24c97d 100644 --- a/tests/runtimes/wasm_reflected/rust/Cargo.toml +++ b/tests/runtimes/wasm_reflected/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust" -version = "0.5.0-rc.4" +version = "0.5.0-rc.5" edition = "2021" [lib] diff --git a/tests/runtimes/wasm_reflected/rust/src/lib.rs b/tests/runtimes/wasm_reflected/rust/src/lib.rs index 062dbe9f29..cd55df4bda 100644 --- a/tests/runtimes/wasm_reflected/rust/src/lib.rs +++ b/tests/runtimes/wasm_reflected/rust/src/lib.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 wit_bindgen::generate!({ world: "host" }); diff --git a/tests/runtimes/wasm_reflected/wasm_reflected.ts b/tests/runtimes/wasm_reflected/wasm_reflected.ts index 3666bb28fa..a27601fbe8 100644 --- a/tests/runtimes/wasm_reflected/wasm_reflected.ts +++ b/tests/runtimes/wasm_reflected/wasm_reflected.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { WasmRuntime } from "@typegraph/sdk/runtimes/wasm.ts"; diff --git a/tests/runtimes/wasm_reflected/wasm_reflected_test.ts b/tests/runtimes/wasm_reflected/wasm_reflected_test.ts index 5e4f979c5e..d7b65cedaf 100644 --- a/tests/runtimes/wasm_reflected/wasm_reflected_test.ts +++ b/tests/runtimes/wasm_reflected/wasm_reflected_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; diff --git a/tests/runtimes/wasm_reflected/wasm_sync_test.ts b/tests/runtimes/wasm_reflected/wasm_sync_test.ts index 4e317dea61..d2a72381e3 100644 --- a/tests/runtimes/wasm_reflected/wasm_sync_test.ts +++ b/tests/runtimes/wasm_reflected/wasm_sync_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; import { connect } from "redis"; diff --git a/tests/runtimes/wasm_wire/rust/lib.rs b/tests/runtimes/wasm_wire/rust/lib.rs index 712feac172..2520126106 100644 --- a/tests/runtimes/wasm_wire/rust/lib.rs +++ b/tests/runtimes/wasm_wire/rust/lib.rs @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 mod fdk; use anyhow::Context; diff --git a/tests/runtimes/wasm_wire/wasm_duplicate.ts b/tests/runtimes/wasm_wire/wasm_duplicate.ts index e6df4f8cda..6bc76fe1ae 100644 --- a/tests/runtimes/wasm_wire/wasm_duplicate.ts +++ b/tests/runtimes/wasm_wire/wasm_duplicate.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { WasmRuntime } from "@typegraph/sdk/runtimes/wasm.ts"; diff --git a/tests/runtimes/wasm_wire/wasm_sync_test.ts b/tests/runtimes/wasm_wire/wasm_sync_test.ts index d22f4a9240..14f0414cf9 100644 --- a/tests/runtimes/wasm_wire/wasm_sync_test.ts +++ b/tests/runtimes/wasm_wire/wasm_sync_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; import { connect } from "redis"; diff --git a/tests/runtimes/wasm_wire/wasm_wire.ts b/tests/runtimes/wasm_wire/wasm_wire.ts index ed37fc4362..27bd7a34fe 100644 --- a/tests/runtimes/wasm_wire/wasm_wire.ts +++ b/tests/runtimes/wasm_wire/wasm_wire.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { WasmRuntime } from "@typegraph/sdk/runtimes/wasm.ts"; diff --git a/tests/runtimes/wasm_wire/wasm_wire_test.ts b/tests/runtimes/wasm_wire/wasm_wire_test.ts index 93f4a31436..0a669e5b60 100644 --- a/tests/runtimes/wasm_wire/wasm_wire_test.ts +++ b/tests/runtimes/wasm_wire/wasm_wire_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; import { assert, assertEquals } from "@std/assert"; import { MetaTest } from "../../utils/test.ts"; diff --git a/tests/schema_validation/circular_test.ts b/tests/schema_validation/circular_test.ts index ae2c0abd7e..506f380a81 100644 --- a/tests/schema_validation/circular_test.ts +++ b/tests/schema_validation/circular_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/schema_validation/ts/circular.ts b/tests/schema_validation/ts/circular.ts index e6f3dd77f0..a9d015c440 100644 --- a/tests/schema_validation/ts/circular.ts +++ b/tests/schema_validation/ts/circular.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 type Stars = { count: string }; type Medals = { title: string; count: number }; diff --git a/tests/simple/class_syntax_test.ts b/tests/simple/class_syntax_test.ts index d2ae66f7f4..a9307836ae 100644 --- a/tests/simple/class_syntax_test.ts +++ b/tests/simple/class_syntax_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/simple/error_message_test.ts b/tests/simple/error_message_test.ts index 63aad337bb..5936d91e1a 100644 --- a/tests/simple/error_message_test.ts +++ b/tests/simple/error_message_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/simple/simple_test.ts b/tests/simple/simple_test.ts index fb3519ec26..d4d4358500 100644 --- a/tests/simple/simple_test.ts +++ b/tests/simple/simple_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/sync/sync_config_test.ts b/tests/sync/sync_config_test.ts index 81ab66a516..411654d319 100644 --- a/tests/sync/sync_config_test.ts +++ b/tests/sync/sync_config_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assert, assertEquals } from "@std/assert"; import { diff --git a/tests/sync/typegraph_sync_test.ts.disable b/tests/sync/typegraph_sync_test.ts.disable index f97f39fb73..0005743b4d 100644 --- a/tests/sync/typegraph_sync_test.ts.disable +++ b/tests/sync/typegraph_sync_test.ts.disable @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Meta } from "test-utils/mod.ts"; import { connect } from "redis"; diff --git a/tests/type_nodes/array_of_optional_test.ts b/tests/type_nodes/array_of_optional_test.ts index 3164934d20..45267b3f7c 100644 --- a/tests/type_nodes/array_of_optional_test.ts +++ b/tests/type_nodes/array_of_optional_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/type_nodes/either_test.ts b/tests/type_nodes/either_test.ts index 467aa13807..19fe8a952b 100644 --- a/tests/type_nodes/either_test.ts +++ b/tests/type_nodes/either_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/type_nodes/ts/either/user_register.ts b/tests/type_nodes/ts/either/user_register.ts index b4265890f1..4e8a2a8788 100644 --- a/tests/type_nodes/ts/either/user_register.ts +++ b/tests/type_nodes/ts/either/user_register.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 interface Regist_userInput { user: { diff --git a/tests/type_nodes/ts/union/color_converter.ts b/tests/type_nodes/ts/union/color_converter.ts index c60ca19335..09fa6d256a 100644 --- a/tests/type_nodes/ts/union/color_converter.ts +++ b/tests/type_nodes/ts/union/color_converter.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // deno-lint-ignore no-external-import import { diff --git a/tests/type_nodes/ts/union/phone_register.ts b/tests/type_nodes/ts/union/phone_register.ts index 510d93f25d..6ab15157ec 100644 --- a/tests/type_nodes/ts/union/phone_register.ts +++ b/tests/type_nodes/ts/union/phone_register.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 type OS = "Android" | "iOS"; diff --git a/tests/type_nodes/ts/union/vec_normalizer.ts b/tests/type_nodes/ts/union/vec_normalizer.ts index ab069ca5db..0d5d6633d3 100644 --- a/tests/type_nodes/ts/union/vec_normalizer.ts +++ b/tests/type_nodes/ts/union/vec_normalizer.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 type Color = { R: number; diff --git a/tests/type_nodes/union_node_attr_test.ts b/tests/type_nodes/union_node_attr_test.ts index 59e4f8646a..b1a004bc6d 100644 --- a/tests/type_nodes/union_node_attr_test.ts +++ b/tests/type_nodes/union_node_attr_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/type_nodes/union_node_quantifier_test.ts b/tests/type_nodes/union_node_quantifier_test.ts index 8836ce4e6b..f03f4433ff 100644 --- a/tests/type_nodes/union_node_quantifier_test.ts +++ b/tests/type_nodes/union_node_quantifier_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/type_nodes/union_test.ts b/tests/type_nodes/union_test.ts index e1ec8a5546..300eeeb4b8 100644 --- a/tests/type_nodes/union_test.ts +++ b/tests/type_nodes/union_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { JSONValue } from "@metatype/typegate/utils.ts"; import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/typecheck/input_validator_test.ts b/tests/typecheck/input_validator_test.ts index 54341c1d1a..67dc29b4e0 100644 --- a/tests/typecheck/input_validator_test.ts +++ b/tests/typecheck/input_validator_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/typecheck/reduce.ts b/tests/typecheck/reduce.ts index 735a780b77..5008e61c85 100644 --- a/tests/typecheck/reduce.ts +++ b/tests/typecheck/reduce.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { fx, Policy, t, typegraph } from "@typegraph/sdk/index.ts"; import { DenoRuntime } from "@typegraph/sdk/runtimes/deno.ts"; diff --git a/tests/typecheck/reduce_syntax_test.ts b/tests/typecheck/reduce_syntax_test.ts index 6c63fa1f43..07f7e6f8fd 100644 --- a/tests/typecheck/reduce_syntax_test.ts +++ b/tests/typecheck/reduce_syntax_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/typecheck/type_alias_test.ts b/tests/typecheck/type_alias_test.ts index b0a7691a1d..4233d0cdc8 100644 --- a/tests/typecheck/type_alias_test.ts +++ b/tests/typecheck/type_alias_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "test-utils/mod.ts"; import { dropSchemas, recreateMigrations } from "test-utils/migrations.ts"; diff --git a/tests/typecheck/typecheck.py b/tests/typecheck/typecheck.py index e01195b6da..dd42e8c9a5 100644 --- a/tests/typecheck/typecheck.py +++ b/tests/typecheck/typecheck.py @@ -1,4 +1,5 @@ -# Copyright Metatype under the Elastic License 2.0. +# Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +# SPDX-License-Identifier: MPL-2.0 from typegraph import typegraph, effects, Policy, t, Graph from typegraph.runtimes.deno import DenoRuntime diff --git a/tests/typecheck/typecheck_test.ts b/tests/typecheck/typecheck_test.ts index c351fd5186..653723be1c 100644 --- a/tests/typecheck/typecheck_test.ts +++ b/tests/typecheck/typecheck_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; import { assertThrows } from "@std/assert"; diff --git a/tests/typegraph/version_test.ts b/tests/typegraph/version_test.ts index b5b8530bbd..24e484c5f0 100644 --- a/tests/typegraph/version_test.ts +++ b/tests/typegraph/version_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { expandGlob } from "@std/fs/expand-glob"; import { Meta } from "../utils/mod.ts"; diff --git a/tests/typename/typename_test.ts b/tests/typename/typename_test.ts index 98a3bdc862..18a9912c0e 100644 --- a/tests/typename/typename_test.ts +++ b/tests/typename/typename_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { recreateMigrations } from "../utils/migrations.ts"; import { gql, Meta } from "../utils/mod.ts"; diff --git a/tests/utils/assert.ts b/tests/utils/assert.ts index 98cf7a2291..60a4de1b3e 100644 --- a/tests/utils/assert.ts +++ b/tests/utils/assert.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 export interface LazyAssertOptions { timeoutMs: number; diff --git a/tests/utils/autotest.ts b/tests/utils/autotest.ts index 59486e3b83..2e9538d055 100644 --- a/tests/utils/autotest.ts +++ b/tests/utils/autotest.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dirname, join } from "@std/path"; diff --git a/tests/utils/bindings_test.ts b/tests/utils/bindings_test.ts index 4c9a0477b4..616c906034 100644 --- a/tests/utils/bindings_test.ts +++ b/tests/utils/bindings_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { get_version, diff --git a/tests/utils/database.ts b/tests/utils/database.ts index 74dc7d57d3..cda2649004 100644 --- a/tests/utils/database.ts +++ b/tests/utils/database.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import pg from "pg"; import { removeMigrations } from "test-utils/migrations.ts"; diff --git a/tests/utils/date.ts b/tests/utils/date.ts index 96ab452262..fab3f1241b 100644 --- a/tests/utils/date.ts +++ b/tests/utils/date.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 const OriginalDate = Date; diff --git a/tests/utils/dir.ts b/tests/utils/dir.ts index 2b5381c7b6..c090e54f5c 100644 --- a/tests/utils/dir.ts +++ b/tests/utils/dir.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { fromFileUrl, join } from "@std/path"; diff --git a/tests/utils/hooks.ts b/tests/utils/hooks.ts index 2e226c1b82..6f8c501b8c 100644 --- a/tests/utils/hooks.ts +++ b/tests/utils/hooks.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { SyncConfig } from "@metatype/typegate/config.ts"; import { createBucket, tryDeleteBucket } from "test-utils/s3.ts"; diff --git a/tests/utils/meta.ts b/tests/utils/meta.ts index 59e4c24a58..203371adbc 100644 --- a/tests/utils/meta.ts +++ b/tests/utils/meta.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { shell, ShellOptions, ShellOutput } from "./shell.ts"; diff --git a/tests/utils/migrations.ts b/tests/utils/migrations.ts index f5f42026ae..8d788a050d 100644 --- a/tests/utils/migrations.ts +++ b/tests/utils/migrations.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { QueryEngine } from "@metatype/typegate/engine/query_engine.ts"; import { join } from "@std/path"; diff --git a/tests/utils/mock_fetch.ts b/tests/utils/mock_fetch.ts index 080218b2a8..152464d196 100644 --- a/tests/utils/mock_fetch.ts +++ b/tests/utils/mock_fetch.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /* Lifted from https://github.com/clo4/deno_mock_fetch/blob/1ef9476b43b1b2b4cab0aaa576f713e8339f46b6/mod.ts diff --git a/tests/utils/mod.ts b/tests/utils/mod.ts index 4e6121c0b9..86567aa7e5 100644 --- a/tests/utils/mod.ts +++ b/tests/utils/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // import { SingleRegister } from "test-utils/single_register.ts"; // import { Typegate } from "@metatype/typegate/typegate/mod.ts"; diff --git a/tests/utils/process.ts b/tests/utils/process.ts index 892a9b6df7..7a36add6bf 100644 --- a/tests/utils/process.ts +++ b/tests/utils/process.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { TextLineStream } from "@local/tools/deps.ts"; import { deadline } from "@std/async/deadline"; diff --git a/tests/utils/query/file_extractor.ts b/tests/utils/query/file_extractor.ts index a0c1c65495..30834cb81c 100644 --- a/tests/utils/query/file_extractor.ts +++ b/tests/utils/query/file_extractor.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Variables } from "./mod.ts"; diff --git a/tests/utils/query/graphql_query.ts b/tests/utils/query/graphql_query.ts index e2fea956e0..a47695f8c5 100644 --- a/tests/utils/query/graphql_query.ts +++ b/tests/utils/query/graphql_query.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { QueryEngine } from "@metatype/typegate/engine/query_engine.ts"; import { FileExtractor } from "./file_extractor.ts"; diff --git a/tests/utils/query/mod.ts b/tests/utils/query/mod.ts index 9c198ad0f9..d2ffb92a04 100644 --- a/tests/utils/query/mod.ts +++ b/tests/utils/query/mod.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { assert, diff --git a/tests/utils/query/rest_query.ts b/tests/utils/query/rest_query.ts index d087be46d9..bcc64e7d88 100644 --- a/tests/utils/query/rest_query.ts +++ b/tests/utils/query/rest_query.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { Context, diff --git a/tests/utils/router@0.0.5.ts b/tests/utils/router@0.0.5.ts index 3576698489..b7c2522ba8 100644 --- a/tests/utils/router@0.0.5.ts +++ b/tests/utils/router@0.0.5.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // Copyright 2021 denosaurs. All rights reserved. MIT license. diff --git a/tests/utils/s3.ts b/tests/utils/s3.ts index d9e4747bab..4a6ac61b80 100644 --- a/tests/utils/s3.ts +++ b/tests/utils/s3.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { CreateBucketCommand, diff --git a/tests/utils/shell.ts b/tests/utils/shell.ts index 4d2c82a567..3824090044 100644 --- a/tests/utils/shell.ts +++ b/tests/utils/shell.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { testDir } from "./dir.ts"; diff --git a/tests/utils/single_register.ts b/tests/utils/single_register.ts index 8bb631b806..448fbbc4e3 100644 --- a/tests/utils/single_register.ts +++ b/tests/utils/single_register.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { QueryEngine } from "@metatype/typegate/engine/query_engine.ts"; import { Register } from "@metatype/typegate/typegate/register.ts"; diff --git a/tests/utils/test.ts b/tests/utils/test.ts index 12fef6bb04..78993d9f74 100644 --- a/tests/utils/test.ts +++ b/tests/utils/test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { SystemTypegraph } from "@metatype/typegate/system_typegraphs.ts"; import { dirname, extname, join } from "@std/path"; diff --git a/tests/utils/test_module.ts b/tests/utils/test_module.ts index 99da40cab8..6a7003c758 100644 --- a/tests/utils/test_module.ts +++ b/tests/utils/test_module.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { dirname, fromFileUrl } from "@std/path"; import { shell, ShellOptions, ShellOutput } from "./shell.ts"; diff --git a/tests/utils/tg_deploy_script.ts b/tests/utils/tg_deploy_script.ts index ed4be2fa65..229781d3a8 100644 --- a/tests/utils/tg_deploy_script.ts +++ b/tests/utils/tg_deploy_script.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { BasicAuth, tgDeploy } from "@typegraph/sdk/tg_deploy.ts"; import * as path from "@std/path"; diff --git a/tests/vars/vars_test.ts b/tests/vars/vars_test.ts index 008aa0d8ef..31692567b2 100644 --- a/tests/vars/vars_test.ts +++ b/tests/vars/vars_test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { gql, Meta } from "../utils/mod.ts"; diff --git a/tools/Dockerfile b/tools/Dockerfile index aa99c54dc8..468d2e6fbb 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -53,7 +53,7 @@ RUN set -eux; \ apt clean autoclean; apt autoremove --yes; rm -rf /var/lib/{apt,dpkg,cache,log}/; ARG GHJK_VERSION=v0.2.1 -RUN GHJK_INSTALL_EXE_DIR=/usr/bin GHJK_INSTALL_HOOK_SHELLS=bash \ +RUN GHJK_INSTALL_EXE_DIR=/usr/bin \ deno run -A https://raw.github.com/metatypedev/ghjk/$GHJK_VERSION/install.ts COPY tools/ tools/ @@ -62,33 +62,31 @@ ENV GHJK_ENV=oci ENV GHJK_ACTIVATE=.ghjk/envs/$GHJK_ENV/activate.sh RUN ghjk envs cook +SHELL ["/bin/sh", "-c", ". .ghjk/envs/oci/activate.sh && sh -c \"$*\"", "sh"] + COPY --from=plan /app/recipe.json recipe.json ARG CARGO_PROFILE=release -RUN . "$GHJK_ACTIVATE" \ - && cargo chef cook --recipe-path recipe.json --profile $CARGO_PROFILE --package typegate \ +RUN cargo chef cook --recipe-path recipe.json --profile $CARGO_PROFILE --package typegate \ && rm recipe.json COPY . . -RUN . "$GHJK_ACTIVATE" \ - && cargo build --profile $CARGO_PROFILE --package typegate --locked \ +RUN cargo build --profile $CARGO_PROFILE --package typegate --locked \ && ( \ - [ $CARGO_PROFILE = 'release' ] \ - && cp target/release/typegate typegate-bin \ - || cp target/debug/typegate typegate-bin \ + [ $CARGO_PROFILE = 'release' ] \ + && cp target/release/typegate typegate-bin \ + || cp target/debug/typegate typegate-bin \ ) -RUN . "$GHJK_ACTIVATE" \ - && deno run -A tools/update.ts --cache-only --src-only \ +RUN deno run -A tools/update.ts --cache-only --src-only \ && mkdir -p .metatype # FROM builder AS dev -RUN . "$GHJK_ACTIVATE" \ - && mv target /tmp/target \ +RUN mv target /tmp/target \ && rm -rf * \ && mv /tmp/target . @@ -100,8 +98,7 @@ ARG TARGETARCH ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini -RUN . "$GHJK_ACTIVATE" \ - && chmod +x /tini \ +RUN chmod +x /tini \ && mkdir -p /lib/sym \ && ln -s /lib/aarch64-linux-gnu /lib/sym/arm64 \ && ln -s /lib/x86_64-linux-gnu /lib/sym/amd64 @@ -131,7 +128,7 @@ COPY --from=builder /app/src/typegate/deno.jsonc ./src/typegate/ COPY --from=builder /app/src/typegraph/deno/deno.json ./src/typegraph/deno/ COPY --from=builder /app/tests/deno.jsonc ./tests/ COPY --from=builder /app/examples/deno.jsonc ./examples/ -COPY tools/LICENSE-Elastic-2.0.md LICENSE.md +COPY tools/LICENSE-MPL-2.0.md LICENSE.md # writeable COPY --from=builder --chown=nonroot:nonroot /deno-dir /deno-dir diff --git a/tools/Dockerfile.dockerignore b/tools/Dockerfile.dockerignore index 9f797defd5..009d0d863c 100644 --- a/tools/Dockerfile.dockerignore +++ b/tools/Dockerfile.dockerignore @@ -2,14 +2,16 @@ !tools/*.ts !tools/tasks/ -!tools/LICENSE-Elastic-2.0.md +!tools/LICENSE-MPL-2.0.md !src/common !src/meta-cli/Cargo.toml !src/metagen/Cargo.toml !src/metagen/src/fdk_rust/static/Cargo.toml +!src/metagen/src/client_rs/static/Cargo.toml !src/mt_deno !src/pyrt_wit_wire +!src/substantial/ !src/typegate/ !src/typegraph/core/ !src/wit/ diff --git a/tools/LICENSE-Elastic-2.0.md b/tools/LICENSE-Elastic-2.0.md deleted file mode 100644 index e9e68bb9c3..0000000000 --- a/tools/LICENSE-Elastic-2.0.md +++ /dev/null @@ -1,91 +0,0 @@ -## Elastic License 2.0 (Elastic-2.0) - -### Acceptance - -By using the software, you agree to all of the terms and conditions below. - -### Copyright License - -The licensor grants you a non-exclusive, royalty-free, worldwide, -non-sublicensable, non-transferable license to use, copy, distribute, make -available, and prepare derivative works of the software, in each case subject to -the limitations and conditions below. - -### Limitations - -You may not provide the software to third parties as a hosted or managed -service, where the service provides users with access to any substantial set of -the features or functionality of the software. - -You may not move, change, disable, or circumvent the license key functionality -in the software, and you may not remove or obscure any functionality in the -software that is protected by the license key. - -You may not alter, remove, or obscure any licensing, copyright, or other notices -of the licensor in the software. Any use of the licensor’s trademarks is subject -to applicable law. - -### Patents - -The licensor grants you a license, under any patent claims the licensor can -license, or becomes able to license, to make, have made, use, sell, offer for -sale, import and have imported the software, in each case subject to the -limitations and conditions in this license. This license does not cover any -patent claims that you cause to be infringed by modifications or additions to -the software. If you or your company make any written claim that the software -infringes or contributes to infringement of any patent, your patent license for -the software granted under these terms ends immediately. If your company makes -such a claim, your patent license ends immediately for work on behalf of your -company. - -### Notices - -You must ensure that anyone who gets a copy of any part of the software from you -also gets a copy of these terms. - -If you modify the software, you must include in any modified copies of the -software prominent notices stating that you have modified the software. - -### No Other Rights - -These terms do not imply any licenses other than those expressly granted in -these terms. - -### Termination - -If you use the software in violation of these terms, such use is not licensed, -and your licenses will automatically terminate. If the licensor provides you -with a notice of your violation, and you cease all violation of this license no -later than 30 days after you receive that notice, your licenses will be -reinstated retroactively. However, if you violate these terms after such -reinstatement, any additional violation of these terms will cause your licenses -to terminate automatically and permanently. - -### No Liability - -_As far as the law allows, the software comes as is, without any warranty or -condition, and the licensor will not be liable to you for any damages arising -out of these terms or the use or nature of the software, under any kind of legal -claim._ - -### Definitions - -The **licensor** is the entity offering these terms, and the **software** is the -software the licensor makes available under these terms, including any portion -of it. - -**you** refers to the individual or entity agreeing to these terms. - -**your company** is any legal entity, sole proprietorship, or other kind of -organization that you work for, plus all organizations that have control over, -are under the control of, or are under common control with that organization. -**control** means ownership of substantially all the assets of an entity, or the -power to direct its management and policies by vote, contract, or otherwise. -Control can be direct or indirect. - -**your licenses** are all the licenses granted to you for the software under -these terms. - -**use** means anything you do with the software requiring one of your licenses. - -**trademark** means trademarks, service marks, and similar rights. diff --git a/tools/consts.ts b/tools/consts.ts index e3314d7a97..4c11549171 100644 --- a/tools/consts.ts +++ b/tools/consts.ts @@ -1,8 +1,8 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 -export const METATYPE_VERSION = "0.5.0-rc.4"; -export const PUBLISHED_VERSION = "0.5.0-rc.3"; +export const METATYPE_VERSION = "0.5.0-rc.5"; +export const PUBLISHED_VERSION = "0.5.0-rc.4"; export const GHJK_VERSION = "v0.2.1"; export const GHJK_ACTION_VERSION = "318209a9d215f70716a4ac89dbeb9653a2deb8bc"; export const RUST_VERSION = "1.80.1"; diff --git a/tools/deps.ts b/tools/deps.ts index 172f83626a..219ee58302 100644 --- a/tools/deps.ts +++ b/tools/deps.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 // FIXME: we can't use the import map in ghjk so we must // rely on a deps.ts diff --git a/tools/installs.ts b/tools/installs.ts index 0e99b20525..8fce5111a2 100644 --- a/tools/installs.ts +++ b/tools/installs.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { DENO_VERSION, PYTHON_VERSION, RUST_VERSION } from "./consts.ts"; import { ports } from "./deps.ts"; diff --git a/tools/license-header-Elastic-2.0.txt b/tools/license-header-Elastic-2.0.txt deleted file mode 100644 index cd12e09928..0000000000 --- a/tools/license-header-Elastic-2.0.txt +++ /dev/null @@ -1,2 +0,0 @@ -Copyright Metatype OÜ, licensed under the Elastic License 2.0. -SPDX-License-Identifier: Elastic-2.0 diff --git a/tools/tasks/build.ts b/tools/tasks/build.ts index b285c7918c..c7b02aaa42 100644 --- a/tools/tasks/build.ts +++ b/tools/tasks/build.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { DenoTaskDefArgs } from "../deps.ts"; diff --git a/tools/tasks/dev.ts b/tools/tasks/dev.ts index cdaeadcb5f..3d4c43296f 100644 --- a/tools/tasks/dev.ts +++ b/tools/tasks/dev.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { DenoTaskDefArgs } from "../deps.ts"; diff --git a/tools/tasks/fetch.ts b/tools/tasks/fetch.ts index 72c02c8099..8c625bf182 100644 --- a/tools/tasks/fetch.ts +++ b/tools/tasks/fetch.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { DenoTaskDefArgs } from "../deps.ts"; diff --git a/tools/tasks/gen.ts b/tools/tasks/gen.ts index 79af794885..bab72d4f4b 100644 --- a/tools/tasks/gen.ts +++ b/tools/tasks/gen.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import type { DenoTaskDefArgs } from "../deps.ts"; import { ports } from "../deps.ts"; diff --git a/tools/tasks/install.ts b/tools/tasks/install.ts index 4e39e033b5..584255b0e0 100644 --- a/tools/tasks/install.ts +++ b/tools/tasks/install.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type DenoTaskDefArgs, std_url } from "../deps.ts"; import { WASMTIME_VERSION } from "../consts.ts"; diff --git a/tools/tasks/lint.ts b/tools/tasks/lint.ts index 6837ea2def..7b19c02fdb 100644 --- a/tools/tasks/lint.ts +++ b/tools/tasks/lint.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { type DenoTaskDefArgs, ports } from "../deps.ts"; import installs from "../installs.ts"; diff --git a/tools/tasks/lock.ts b/tools/tasks/lock.ts index 8dc229d72d..c18325210c 100644 --- a/tools/tasks/lock.ts +++ b/tools/tasks/lock.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { copyLock, type DenoTaskDefArgs, parseArgs, sedLock } from "../deps.ts"; import * as consts from "../consts.ts"; diff --git a/tools/tasks/mod.ts b/tools/tasks/mod.ts index dd0274222f..1d5f38e19f 100644 --- a/tools/tasks/mod.ts +++ b/tools/tasks/mod.ts @@ -1,3 +1,6 @@ +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 + import type { DenoTaskDefArgs } from "../deps.ts"; import tasksBuild from "./build.ts"; @@ -10,12 +13,12 @@ import tasksLock from "./lock.ts"; import tasksTest from "./test.ts"; export default { - ...tasksBuild, - ...tasksDev, - ...tasksFetch, - ...tasksGen, - ...tasksInstall, - ...tasksLint, - ...tasksLock, - ...tasksTest, + ...tasksBuild, + ...tasksDev, + ...tasksFetch, + ...tasksGen, + ...tasksInstall, + ...tasksLint, + ...tasksLock, + ...tasksTest, } satisfies Record; diff --git a/tools/tasks/test.ts b/tools/tasks/test.ts index 649c9e4fc3..58e3b103dc 100644 --- a/tools/tasks/test.ts +++ b/tools/tasks/test.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { testE2eCli } from "../test.ts"; import type { DenoTaskDefArgs } from "../deps.ts"; diff --git a/tools/test.ts b/tools/test.ts index 2f616b621f..014ca1c32d 100755 --- a/tools/test.ts +++ b/tools/test.ts @@ -1,7 +1,7 @@ #!/bin/env -S ghjk deno run -A -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /** * A utility script to run tests. diff --git a/tools/tree-view-web.ts b/tools/tree-view-web.ts index e8e036deb6..26b2a2b5fe 100755 --- a/tools/tree-view-web.ts +++ b/tools/tree-view-web.ts @@ -1,7 +1,7 @@ #!/bin/env -S ghjk deno run -A -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /** * Usage: diff --git a/tools/tree-view.ts b/tools/tree-view.ts index 200fc71d10..22ef1b83e3 100755 --- a/tools/tree-view.ts +++ b/tools/tree-view.ts @@ -1,7 +1,7 @@ #!/bin/env -S ghjk deno run -A -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 /** * Usage: diff --git a/tools/typegraph-size.ts b/tools/typegraph-size.ts index 1a153c909f..c730e12a59 100644 --- a/tools/typegraph-size.ts +++ b/tools/typegraph-size.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { projectDir, runOrExit } from "./utils.ts"; import { bytes, formatDuration, resolve } from "./deps.ts"; diff --git a/tools/update.ts b/tools/update.ts index 149e3fbb89..a3718003f1 100755 --- a/tools/update.ts +++ b/tools/update.ts @@ -1,7 +1,7 @@ #!/bin/env -S ghjk deno run -A --config=typegate/deno.jsonc -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { $, diff --git a/tools/utils.ts b/tools/utils.ts index 172c7efda5..96558d1f19 100644 --- a/tools/utils.ts +++ b/tools/utils.ts @@ -1,5 +1,5 @@ -// Copyright Metatype OÜ, licensed under the Elastic License 2.0. -// SPDX-License-Identifier: Elastic-2.0 +// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0. +// SPDX-License-Identifier: MPL-2.0 import { copySync, dirname, fromFileUrl, join, resolve } from "./deps.ts";