diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b64d6bdc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI +on: + pull_request: + types: [opened, synchronize] + branches: [main] + paths: ['src/**', 'tests/**'] + workflow_dispatch: + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Build + run: pnpm run build + - name: Lint + run: | + pnpm run format:check + pnpm run eslint + - name: Test + # NOTE: see jest.config.ts `collectCoverageFrom` + run: pnpm run coverage diff --git a/.github/workflows/concat_cacerts.yml b/.github/workflows/concat_cacerts.yml new file mode 100644 index 00000000..64f41d91 --- /dev/null +++ b/.github/workflows/concat_cacerts.yml @@ -0,0 +1,41 @@ +name: Concatenate CA certificates +on: + push: + branches: [main] + paths: ['cacerts/**'] + workflow_dispatch: + +permissions: + contents: write + +jobs: + concat-cacerts: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Build + run: pnpm run build + - name: Concat CACerts + uses: actions/github-script@v7 + with: + script: | + const {concatCaCerts} = await import("${{ github.workspace }}/dist/ghw_concat_cacerts.js") + + await concatCaCerts(github, core, context) + - name: Commit changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Concatenate CA certificates" || echo 'Nothing to commit' + git push diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index 0d5d0756..00000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow executes several linters on changed files based on languages used in your code base whenever -# you push a code or open a pull request. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/github/super-linter -name: Lint Code Base - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] -jobs: - run-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: Lint Code Base - uses: github/super-linter@v4 - env: - VALIDATE_ALL_CODEBASE: false - FILTER_REGEX_INCLUDE: .*.json - DEFAULT_BRANCH: master - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/overwrite_cache.yml b/.github/workflows/overwrite_cache.yml new file mode 100644 index 00000000..12fa7603 --- /dev/null +++ b/.github/workflows/overwrite_cache.yml @@ -0,0 +1,44 @@ +name: Overwrite cache +on: + workflow_dispatch: + inputs: + manufacturers: + description: 'Only trigger overwrite for given manufacturers (CSV, no space).' + required: false + default: '' + type: string + +permissions: + contents: write + +jobs: + overwrite-cache: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Build + run: pnpm run build + - name: Overwrite cache + uses: actions/github-script@v7 + with: + script: | + const {overwriteCache} = await import("${{ github.workspace }}/dist/gwh_overwrite_cache.js") + + await overwriteCache(github, core, context, "${{ inputs.manufacturers || '' }}") + - name: Commit changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Cache overwrite" || echo 'Nothing to commit' + git push diff --git a/.github/workflows/reprocess_all_images.yml b/.github/workflows/reprocess_all_images.yml new file mode 100644 index 00000000..b241d6b1 --- /dev/null +++ b/.github/workflows/reprocess_all_images.yml @@ -0,0 +1,66 @@ +name: Re-Process All Images +on: + workflow_dispatch: + inputs: + remove_not_in_manifest: + description: 'Remove images not found in manifest (if false, will be moved to separate dir instead).' + required: true + default: false + type: boolean + # TODO: remove this and the logic behind it once the first run has been executed to prevent following accidental executions + skip_download_third_parties: + description: 'Skip the step that downloads firmware with 3rd party URLs in manifest (logic should be removed after first run after 2024-10 revamp).' + required: true + default: true + type: boolean + +permissions: + contents: write + pull-requests: write + +jobs: + reprocess-all-images: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Build + run: pnpm run build + - name: Create and checkout new branch + id: create_branch + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + branch_name="reprocess-$(date +'%Y-%m-%d-%H-%M-%S')" + echo "branch_name=$branch_name" >> $GITHUB_OUTPUT + git checkout -b $branch_name + - name: Reprocess + uses: actions/github-script@v7 + env: + NODE_EXTRA_CA_CERTS: cacerts.pem + with: + script: | + const {reProcessAllImages} = await import("${{ github.workspace }}/dist/ghw_reprocess_all_images.js") + + await reProcessAllImages(github, core, context, ${{ fromJSON(inputs.remove_not_in_manifest) }}, ${{ fromJSON(inputs.skip_download_third_parties) }}) + - name: Commit changes in new branch + run: | + git add . + git commit -m "Re-Processed all images" || echo 'Nothing to commit' + git push -u origin HEAD + - name: Create pull request + uses: actions/github-script@v7 + with: + script: | + const {createPRToDefault} = await import("${{ github.workspace }}/dist/ghw_create_pr_to_default.js") + + await createPRToDefault(github, core, context, "${{steps.create_branch.outputs.branch_name}}", "Re-Processed all images") diff --git a/.github/workflows/run_autodl.yml b/.github/workflows/run_autodl.yml new file mode 100644 index 00000000..3364a3ad --- /dev/null +++ b/.github/workflows/run_autodl.yml @@ -0,0 +1,68 @@ +name: Run auto download +on: + # schedule: + # # * is a special character in YAML, always quote this string + # - cron: '0 1 * * 1' + workflow_dispatch: + inputs: + prev: + description: 'Get previous firmware versions (if available) instead of latest.' + required: false + default: false + type: boolean + manufacturers: + description: 'Only trigger updates for given manufacturers (CSV, no space).' + required: false + default: '' + type: string + ignore_cache: + description: 'Ignore cached data in .cache for this run.' + required: false + default: false + type: boolean + +permissions: + contents: write + +jobs: + run-autodl: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Build + run: pnpm run build + - name: Run Autodl + uses: actions/github-script@v7 + env: + NODE_EXTRA_CA_CERTS: cacerts.pem + PREV: ${{ fromJSON(inputs.prev) && '1' || '' }} + IGNORE_CACHE: ${{ fromJSON(inputs.ignore_cache) && '1' || '' }} + with: + script: | + const {runAutodl} = await import("${{ github.workspace }}/dist/ghw_run_autodl.js") + + await runAutodl(github, core, context, "${{ inputs.manufacturers || '' }}") + - name: Create Autodl release + uses: actions/github-script@v7 + with: + script: | + const {createAutodlRelease} = await import("${{ github.workspace }}/dist/ghw_create_autodl_release.js") + + await createAutodlRelease(github, core, context) + - name: Commit changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Autodl update" || echo 'Nothing to commit' + git push diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 19cd120f..6a90d751 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,16 +1,23 @@ -name: "Close stale issues/pull requests" +name: 'Close stale issues/pull requests' on: - schedule: - - cron: "0 0 * * *" + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + +permissions: + # contents: write # only for delete-branch option + issues: write + pull-requests: write jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days' - stale-pr-message: 'This pull request is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days' - days-before-stale: 180 - days-before-close: 30 + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days' + stale-pr-message: 'This pull request is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days' + exempt-issue-labels: dont-stale + days-before-stale: 180 + days-before-close: 30 diff --git a/.github/workflows/update_ota_pr.yml b/.github/workflows/update_ota_pr.yml new file mode 100644 index 00000000..8da87691 --- /dev/null +++ b/.github/workflows/update_ota_pr.yml @@ -0,0 +1,53 @@ +name: Update OTA PR +on: + pull_request: + types: [opened, synchronize, reopened, edited, closed] + branches: [main] + paths: ['images/**'] + +permissions: + contents: write + pull-requests: write + +jobs: + update-pr: + runs-on: ubuntu-latest + # don't run if PR was closed without merge, or explicitly disabled + if: | + !contains(github.event.pull_request.labels.*.name, 'ignore-ota-workflow') && (github.event.action != 'closed' || github.event.pull_request.merged == true) + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + cache: pnpm + - name: Install dependencies + run: pnpm i --frozen-lockfile + - name: Build + run: pnpm run build + - name: Get changed files + run: | + files=$(gh pr view ${{ github.event.pull_request.number }} --json files -q '.files[].path' | tr '\n' ',') + echo "files=$files" >> $GITHUB_OUTPUT + id: changed_files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Update PR + uses: actions/github-script@v7 + with: + script: | + const {updateOtaPR} = await import("${{ github.workspace }}/dist/ghw_update_ota_pr.js") + + await updateOtaPR(github, core, context, "${{steps.changed_files.outputs.files}}") + - name: Commit changes on push + if: github.event.pull_request.merged == true + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Update after PR with OTA images merged" || echo 'Nothing to commit' + git push diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..df88e58c --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +node_modules/ +coverage/ +dist/ +temp/ +tmp/ +.jest-tmp/ +tsconfig.tsbuildinfo + +# used by tests +images/jest-tmp +images1/jest-tmp +not-in-manifest-images/jest-tmp +not-in-manifest-images1/jest-tmp + +# MacOS indexing files +.DS_Store diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..c31c0759 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,10 @@ +pnpm-lock.yaml +.cache/ +images/ +images1/ +not-in-manifest-images/ +not-in-manifest-images1/ +index.json +index1.json +cacerts/ +cacerts.pem diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..d8de3f26 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,26 @@ +{ + "semi": true, + "trailingComma": "all", + "singleQuote": true, + "printWidth": 150, + "bracketSpacing": false, + "endOfLine": "lf", + "tabWidth": 4, + "importOrder": [ + "", + "^(node:)", + "", + "", + "", + "^[.]", + "", + "", + "", + "", + "", + "^zigbee", + "", + "^[.]" + ], + "plugins": ["@ianvs/prettier-plugin-sort-imports"] +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..e72bfdda --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/README.md b/README.md index 72f82c75..bec0daf3 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,147 @@ # zigbee-OTA -[![Lint Code Base status badge](https://github.com/Koenkk/zigbee-OTA/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/Koenkk/zigbee-OTA/actions/workflows/linter.yml) +A collection of Zigbee OTA files, see the manifest `index.json` for an overview of all available firmware files. +The manifest `index1.json` contains firmware files for downgrade (previous available version, before the one in `index.json`). -A collection of Zigbee OTA files, see `index.json` for an overview of all available firmware files. +> [!IMPORTANT] +> While a downgrade OTA file may be available for a device through automatic archiving in this repository, it does not mean the device will actually allow the downgrade, some will refuse the OTA file. ## Adding new and updating existing OTA files -1. Go to this directory -2. Execute `node scripts/add.js PATH_TO_OTA_FILE_OR_URL`, e.g.: - - `node scripts/add.js ~/Downloads/WhiteLamp-Atmel-Target_0105_5.130.1.30000_0012.sbl-ota` - - `node scripts/add.js http://fds.dc1.philips.com/firmware/ZGB_100B_010D/1107323831/Sensor-ATmega_6.1.1.27575_0012.sbl-ota` -3. Create a PR. Changes will be automatically validated by GitHub. +Create a pull request with the image(s) in their proper subdirectories (manufacturer name) under `images` directory. -## Updating all existing OTA entries (if `add.js` has been changed) +The pull request automation will validate the image. If any error occur, a comment will be posted in the pull request. If the validation succeed, a comment will be posted to inform of the changes that merging the pull request will commit (in a following commit). -1. Go to this directory -2. Execute `node scripts/updateall.js` -3. Create a PR. Changes will be automatically validated by GitHub. +> [!IMPORTANT] +> Do NOT submit images in `images1` directory, the pull request automation will take care of placing the file in the proper folder automatically. + +### Example using Github + +Fork https://github.com/Koenkk/zigbee-OTA/ on Github. + +In your fork, navigate to `images` directory, then to whatever manufacturer is associated with your OTA file(s). + +Click on `Add file` dropdown, then `Upload files`. + +Add the file(s), a good title, and an optional description (if extra metas required, see below), then pick `Create a new branch for this commit and start a pull request.`, then submit with `Propose changes`. + +Then wait for the workflow to validate your file(s). + +### Example using the console + +Fork https://github.com/Koenkk/zigbee-OTA/ on Github. + +```bash +# where `username` is your Github username (to use your fork) +$ git clone --depth 1 https://github.com/username/zigbee-OTA/ +$ cd zigbee-OTA +$ git checkout -b my-new-image +# where `manufacturer` is the name of the manufacturer associated with the image (if it does not already exist) +$ mkdir ./images/manufacturer/ +$ cp ~/Downloads/my-new-ota.ota ./images/manufacturer/ +$ git add . +$ git commit -m "New image for xyz device from abc manufacturer" +$ git push -u origin HEAD +``` + +Then go on Github, create a pull request from the notification in the repository and wait for the workflow to run the validation process. + +### Declaring extra metadata for automatic inclusion in the manifest + +If the image(s) added to the pull request require extra metadata in the manifest (usually to avoid conflicts, or to set restrictions), you can declare them in the body of the pull request (the description field of the first post). + +Example: + +````md +This is the latest OTA file for device XYZ. + +```json +{ + "modelId": "xyzDevice", + "manufacturerName": ["xyzManufacturer"] +} +``` +```` + +The pull request automation will look for any valid JSON in-between ` ```json ` and ` ``` ` and add these fields to the manifest. + +> [!TIP] +> If the validation failed because of something related to the extra metadata, you can edit the pull request body and make the necessary corrections. The automation will re-run when saved. + +> [!IMPORTANT] +> Do NOT use code blocks (` ``` `) for anything else in the body to avoid issues. If necessary, add a new comment below it (only the very first post is used for extra metadata detection). + +#### Allowed fields + +Valid JSON format is expected. +Any field not in this list will be ignored. Any field not matching the required type will result in failure. + +###### To place restrictions + +- "force": boolean _(ignore `fileVersion` and always present as 'available')_ +- "hardwareVersionMax": number +- "hardwareVersionMin": number +- "manufacturerName": array of strings _(target only devices with one of these manufacturer names)_ +- "maxFileVersion": number _(target only devices with this version or below)_ +- "minFileVersion": number _(target only devices with this version or above)_ +- "modelId": string _(target only devices with this model ID)_ + +###### For record purpose + +- "originalUrl": string +- "releaseNotes": string + +If the pull request contains multiple files, the metadata is added for all files. If some files require different metadata, add the matching `fileName` to the JSON using an encompassing array instead. It will be used to assign metadata as directed. + +Example: + +````md +```json +[ + { + "fileName": "myotafile-for-xyzdevice.ota", + "modelId": "xyzDevice", + "manufacturerName": ["xyzManufacturer"] + }, + { + "fileName": "myotafile-for-abcdevice.ota", + "modelId": "abcDevice", + "manufacturerName": ["abcManufacturer"] + } +] +``` +```` + +### Notes for maintainers + +- `images` and `index.json` contain added (PR or auto download) "upgrade" images. +- `images1` and `index1.json` contain automatically archived "downgrade" images (automatically moved from `images`/`index.json` after a merged PR introduced a newer version, or during auto download). + +If a manual modification of the manifests is necessary, it should be done in a PR that does not trigger the `update_ota_pr` workflow (no changes in `images/**` directory). As a last resort, the label `ignore-ota-workflow` can be added to prevent the workflow from running. + +The metadata structure for images is as below (see above for details on extra metas): + +```typescript +interface RepoImageMeta { + //-- automatic from parsed image + imageType: number; + fileVersion: number; + manufacturerCode: number; + fileSize: number; + otaHeaderString: string; + //-- automatic from image file + url: string; + sha512: string; + fileName: string; + //-- extra metas + force?: boolean; + hardwareVersionMin?: number; + hardwareVersionMax?: number; + modelId?: string; + manufacturerName?: string[]; + minFileVersion?: number; + maxFileVersion?: number; + originalUrl?: string; + releaseNotes?: string; +} +``` diff --git a/cacerts.pem b/cacerts.pem index 41ab5ede..732ee348 100644 --- a/cacerts.pem +++ b/cacerts.pem @@ -36,3 +36,48 @@ IQDcGfyXaUl5hjr5YE8m2piXhMcDzHTNbO1RvGgz4r9IswIgFTTw/R85KyfIiW+E clwJRVSsq8EApeFREenCkRM0EIk= -----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICYjCCAemgAwIBAgIUQn+xrKMsCop2IL2YSz/jJpESmuEwCgYIKoZIzj0EAwMw +UDELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2YgU3dlZGVuIEFCMSUwIwYD +VQQDDBxJS0VBIEhvbWUgc21hcnQgT1RBIFRydXN0IENBMB4XDTIzMDQxNzE0MzE0 +M1oXDTI1MDQxNjE0MzE0MlowcjELMAkGA1UEBhMCU0UxEjAQBgNVBAgMCUtyb25v +YmVyZzEQMA4GA1UEBwwHRUxNSFVMVDEaMBgGA1UECgwRSUtFQSBvZiBTd2VkZW4g +QUIxITAfBgNVBAMMGCoub3RhLmhvbWVzbWFydC5pa2VhLmNvbTBZMBMGByqGSM49 +AgEGCCqGSM49AwEHA0IABOCF+5I/df6W0cNp/mbivUmxW/EHjy7VxvMe8542oy2D +L8Wn3BOqXoRZmTckzfz+xNXX+od84xl2teV66O34PPujfzB9MAwGA1UdEwEB/wQC +MAAwHwYDVR0jBBgwFoAUrRAWZaaubKmqMPHU92uXboPJn8cwHQYDVR0lBBYwFAYI +KwYBBQUHAwIGCCsGAQUFBwMBMB0GA1UdDgQWBBT3eAj6s8wxBTycGMrQK12KXc1t +9TAOBgNVHQ8BAf8EBAMCBaAwCgYIKoZIzj0EAwMDZwAwZAIvYqZL8E0i/CqHX1lf +IVMHYmj0O7LBljE/tXgME+eg/l4r25KGjgK1E2SPuq4U27sCMQCv/VB3MQjdtgoB +MXKMfEKdxdZAXfIDwyFvlXnWlWAEOJQxvfUDdyNiGe1AgZ5aHJ4= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICGDCCAZ+gAwIBAgIUdfH0KDnENv/dEcxH8iVqGGGDqrowCgYIKoZIzj0EAwMw +SzELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2YgU3dlZGVuIEFCMSAwHgYD +VQQDDBdJS0VBIEhvbWUgc21hcnQgUm9vdCBDQTAgFw0yMTA1MjYxOTAxMDlaGA8y +MDcxMDUxNDE5MDEwOFowSzELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2Yg +U3dlZGVuIEFCMSAwHgYDVQQDDBdJS0VBIEhvbWUgc21hcnQgUm9vdCBDQTB2MBAG +ByqGSM49AgEGBSuBBAAiA2IABIDRUvKGFMUu2zIhTdgfrfNcPULwMlc0TGSrDLBA +oTr0SMMV4044CRZQbl81N4qiuHGhFzCnXapZogkiVuFu7ZqSslsFuELFjc6ZxBjk +Kmud+pQM6QQdsKTE/cS06dA+P6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQUcdlEnfX0MyZA4zAdY6CLOye9wfwwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49 +BAMDA2cAMGQCMG6mFIeB2GCFch3r0Gre4xRH+f5pn/bwLr9yGKywpeWvnUPsQ1KW +ckMLyxbeNPXdQQIwQc2YZDq/Mz0mOkoheTUWiZxK2a5bk0Uz1XuGshXmQvEg5TGy +2kVHW/Mz9/xwpy4u +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICQTCCAcagAwIBAgIUAr5VleESJnRg+J9oehqJc+MGphIwCgYIKoZIzj0EAwMw +SzELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2YgU3dlZGVuIEFCMSAwHgYD +VQQDDBdJS0VBIEhvbWUgc21hcnQgUm9vdCBDQTAeFw0yMTA1MjYxOTE1NDVaFw00 +NjA1MjAxOTE1NDRaMFAxCzAJBgNVBAYTAlNFMRowGAYDVQQKDBFJS0VBIG9mIFN3 +ZWRlbiBBQjElMCMGA1UEAwwcSUtFQSBIb21lIHNtYXJ0IE9UQSBUcnVzdCBDQTB2 +MBAGByqGSM49AgEGBSuBBAAiA2IABC6Db3/cBpl//CmRX7Ur90ikDbpLtaCcvcJT +p72LY585dsMUA7cjZQlAQdNfI7zSr0Y8O9w0dIoqz8HL8G7E/pYChhvQPUgx1avn +6IEtdWLwI0XPPsFtLO8jRJFIsjkeAaNmMGQwEgYDVR0TAQH/BAgwBgEB/wIBADAf +BgNVHSMEGDAWgBRx2USd9fQzJkDjMB1joIs7J73B/DAdBgNVHQ4EFgQUrRAWZaau +bKmqMPHU92uXboPJn8cwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYC +MQDcIekS7OcwMcLXMtP6rWfZUsJF7iI59t3rEame11vIdY/sFHHWWm07OLJ7gRwg +NpwCMQDhMc3sX2cBD3zZ2zDwCjFBCudhgWLc2eqNy/b5mY+/Ppdp6EX11PZK0Hb9 +dZ2TSWM= +-----END CERTIFICATE----- + diff --git a/cacerts/ikea_new.pem b/cacerts/ikea_new.pem new file mode 100644 index 00000000..d71bfaa4 --- /dev/null +++ b/cacerts/ikea_new.pem @@ -0,0 +1,44 @@ +-----BEGIN CERTIFICATE----- +MIICYjCCAemgAwIBAgIUQn+xrKMsCop2IL2YSz/jJpESmuEwCgYIKoZIzj0EAwMw +UDELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2YgU3dlZGVuIEFCMSUwIwYD +VQQDDBxJS0VBIEhvbWUgc21hcnQgT1RBIFRydXN0IENBMB4XDTIzMDQxNzE0MzE0 +M1oXDTI1MDQxNjE0MzE0MlowcjELMAkGA1UEBhMCU0UxEjAQBgNVBAgMCUtyb25v +YmVyZzEQMA4GA1UEBwwHRUxNSFVMVDEaMBgGA1UECgwRSUtFQSBvZiBTd2VkZW4g +QUIxITAfBgNVBAMMGCoub3RhLmhvbWVzbWFydC5pa2VhLmNvbTBZMBMGByqGSM49 +AgEGCCqGSM49AwEHA0IABOCF+5I/df6W0cNp/mbivUmxW/EHjy7VxvMe8542oy2D +L8Wn3BOqXoRZmTckzfz+xNXX+od84xl2teV66O34PPujfzB9MAwGA1UdEwEB/wQC +MAAwHwYDVR0jBBgwFoAUrRAWZaaubKmqMPHU92uXboPJn8cwHQYDVR0lBBYwFAYI +KwYBBQUHAwIGCCsGAQUFBwMBMB0GA1UdDgQWBBT3eAj6s8wxBTycGMrQK12KXc1t +9TAOBgNVHQ8BAf8EBAMCBaAwCgYIKoZIzj0EAwMDZwAwZAIvYqZL8E0i/CqHX1lf +IVMHYmj0O7LBljE/tXgME+eg/l4r25KGjgK1E2SPuq4U27sCMQCv/VB3MQjdtgoB +MXKMfEKdxdZAXfIDwyFvlXnWlWAEOJQxvfUDdyNiGe1AgZ5aHJ4= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICGDCCAZ+gAwIBAgIUdfH0KDnENv/dEcxH8iVqGGGDqrowCgYIKoZIzj0EAwMw +SzELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2YgU3dlZGVuIEFCMSAwHgYD +VQQDDBdJS0VBIEhvbWUgc21hcnQgUm9vdCBDQTAgFw0yMTA1MjYxOTAxMDlaGA8y +MDcxMDUxNDE5MDEwOFowSzELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2Yg +U3dlZGVuIEFCMSAwHgYDVQQDDBdJS0VBIEhvbWUgc21hcnQgUm9vdCBDQTB2MBAG +ByqGSM49AgEGBSuBBAAiA2IABIDRUvKGFMUu2zIhTdgfrfNcPULwMlc0TGSrDLBA +oTr0SMMV4044CRZQbl81N4qiuHGhFzCnXapZogkiVuFu7ZqSslsFuELFjc6ZxBjk +Kmud+pQM6QQdsKTE/cS06dA+P6NCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E +FgQUcdlEnfX0MyZA4zAdY6CLOye9wfwwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49 +BAMDA2cAMGQCMG6mFIeB2GCFch3r0Gre4xRH+f5pn/bwLr9yGKywpeWvnUPsQ1KW +ckMLyxbeNPXdQQIwQc2YZDq/Mz0mOkoheTUWiZxK2a5bk0Uz1XuGshXmQvEg5TGy +2kVHW/Mz9/xwpy4u +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICQTCCAcagAwIBAgIUAr5VleESJnRg+J9oehqJc+MGphIwCgYIKoZIzj0EAwMw +SzELMAkGA1UEBhMCU0UxGjAYBgNVBAoMEUlLRUEgb2YgU3dlZGVuIEFCMSAwHgYD +VQQDDBdJS0VBIEhvbWUgc21hcnQgUm9vdCBDQTAeFw0yMTA1MjYxOTE1NDVaFw00 +NjA1MjAxOTE1NDRaMFAxCzAJBgNVBAYTAlNFMRowGAYDVQQKDBFJS0VBIG9mIFN3 +ZWRlbiBBQjElMCMGA1UEAwwcSUtFQSBIb21lIHNtYXJ0IE9UQSBUcnVzdCBDQTB2 +MBAGByqGSM49AgEGBSuBBAAiA2IABC6Db3/cBpl//CmRX7Ur90ikDbpLtaCcvcJT +p72LY585dsMUA7cjZQlAQdNfI7zSr0Y8O9w0dIoqz8HL8G7E/pYChhvQPUgx1avn +6IEtdWLwI0XPPsFtLO8jRJFIsjkeAaNmMGQwEgYDVR0TAQH/BAgwBgEB/wIBADAf +BgNVHSMEGDAWgBRx2USd9fQzJkDjMB1joIs7J73B/DAdBgNVHQ4EFgQUrRAWZaau +bKmqMPHU92uXboPJn8cwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYC +MQDcIekS7OcwMcLXMtP6rWfZUsJF7iI59t3rEame11vIdY/sFHHWWm07OLJ7gRwg +NpwCMQDhMc3sX2cBD3zZ2zDwCjFBCudhgWLc2eqNy/b5mY+/Ppdp6EX11PZK0Hb9 +dZ2TSWM= +-----END CERTIFICATE----- diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..6e81d90a --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,33 @@ +import eslint from '@eslint/js'; +import eslintConfigPrettier from 'eslint-config-prettier'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'script', + parserOptions: { + project: true, + }, + }, + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/explicit-function-return-type': 'error', + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-unused-vars': 'error', + 'array-bracket-spacing': ['error', 'never'], + '@typescript-eslint/return-await': ['error', 'always'], + 'object-curly-spacing': ['error', 'never'], + '@typescript-eslint/no-floating-promises': 'error', + }, + }, + { + ignores: ['tmp/', 'dist/', 'eslint.config.mjs'], + }, + eslintConfigPrettier, +); diff --git a/index1.json b/index1.json new file mode 100644 index 00000000..0637a088 --- /dev/null +++ b/index1.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/lib/ota.js b/lib/ota.js deleted file mode 100644 index 42741b53..00000000 --- a/lib/ota.js +++ /dev/null @@ -1,61 +0,0 @@ -const assert = require('assert'); -const upgradeFileIdentifier = Buffer.from([0x1E, 0xF1, 0xEE, 0x0B]); - -function parseSubElement(buffer, position) { - const tagID = buffer.readUInt16LE(position); - const length = buffer.readUInt32LE(position + 2); - const data = buffer.slice(position + 6, position + 6 + length); - return {tagID, length, data}; -} - -function parseImage(rawBuffer) { - const start = rawBuffer.indexOf(upgradeFileIdentifier); - const buffer = rawBuffer.slice(start); - - const header = { - otaUpgradeFileIdentifier: buffer.subarray(0, 4), - otaHeaderVersion: buffer.readUInt16LE(4), - otaHeaderLength: buffer.readUInt16LE(6), - otaHeaderFieldControl: buffer.readUInt16LE(8), - manufacturerCode: buffer.readUInt16LE(10), - imageType: buffer.readUInt16LE(12), - fileVersion: buffer.readUInt32LE(14), - zigbeeStackVersion: buffer.readUInt16LE(18), - otaHeaderString: buffer.toString('utf8', 20, 52), - totalImageSize: buffer.readUInt32LE(52), - }; - let headerPos = 56; - if (header.otaHeaderFieldControl & 1) { - header.securityCredentialVersion = buffer.readUInt8(headerPos); - headerPos += 1; - } - if (header.otaHeaderFieldControl & 2) { - header.upgradeFileDestination = buffer.subarray(headerPos, headerPos + 8); - headerPos += 8; - } - if (header.otaHeaderFieldControl & 4) { - header.minimumHardwareVersion = buffer.readUInt16LE(headerPos); - headerPos += 2; - header.maximumHardwareVersion = buffer.readUInt16LE(headerPos); - headerPos += 2; - } - - const raw = buffer.slice(0, header.totalImageSize); - - assert(Buffer.compare(header.otaUpgradeFileIdentifier, upgradeFileIdentifier) === 0, 'Not an OTA file'); - - let position = header.otaHeaderLength; - const elements = []; - while (position < header.totalImageSize) { - const element = parseSubElement(buffer, position); - elements.push(element); - position += element.data.length + 6; - } - - assert(position === header.totalImageSize, 'Size mismatch'); - return {header, elements, raw}; -} - -module.exports = { - parseImage -}; diff --git a/package.json b/package.json new file mode 100644 index 00000000..f9fd9b7d --- /dev/null +++ b/package.json @@ -0,0 +1,65 @@ +{ + "name": "zigbee-ota", + "version": "1.0.0", + "repository": { + "type": "git", + "url": "git+https://github.com/Koenkk/zigbee-OTA.git" + }, + "engines": { + "node": ">=20.0.0" + }, + "type": "module", + "main": "dist/index.js", + "scripts": { + "build": "tsc", + "start": "node ./dist/index.js", + "format": "prettier --write .", + "format:check": "prettier --check .", + "eslint": "eslint . --max-warnings=0", + "test": "jest test --config=./tests/jest.config.ts --silent --runInBand", + "coverage": "jest test --config=./tests/jest.config.ts --silent --runInBand --coverage" + }, + "keywords": [ + "zigbee", + "OTA", + "over-the-air", + "zigbee-update" + ], + "author": { + "name": "Koen Kanters", + "email": "koenkanters94@gmail.com" + }, + "contributors": [ + { + "name": "Koen Kanters", + "url": "https://github.com/Koenkk" + }, + { + "name": "Nerivec", + "url": "https://github.com/Nerivec" + } + ], + "license": "GPL-3.0-or-later", + "description": "", + "dependencies": { + "tar": "^7.4.3" + }, + "devDependencies": { + "@actions/core": "^1.11.1", + "@actions/github": "^6.0.0", + "@eslint/core": "^0.7.0", + "@eslint/js": "^9.13.0", + "@ianvs/prettier-plugin-sort-imports": "^4.3.1", + "@octokit/rest": "^21.0.2", + "@types/jest": "^29.5.14", + "@types/node": "^22.8.1", + "eslint": "^9.13.0", + "eslint-config-prettier": "^9.1.0", + "jest": "^29.7.0", + "prettier": "^3.3.3", + "ts-jest": "^29.2.5", + "ts-node": "^10.9.2", + "typescript": "^5.6.3", + "typescript-eslint": "^8.12.0" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..28f06e33 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,3966 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + tar: + specifier: ^7.4.3 + version: 7.4.3 + devDependencies: + '@actions/core': + specifier: ^1.11.1 + version: 1.11.1 + '@actions/github': + specifier: ^6.0.0 + version: 6.0.0 + '@eslint/core': + specifier: ^0.7.0 + version: 0.7.0 + '@eslint/js': + specifier: ^9.13.0 + version: 9.13.0 + '@ianvs/prettier-plugin-sort-imports': + specifier: ^4.3.1 + version: 4.3.1(prettier@3.3.3) + '@octokit/rest': + specifier: ^21.0.2 + version: 21.0.2 + '@types/jest': + specifier: ^29.5.14 + version: 29.5.14 + '@types/node': + specifier: ^22.8.1 + version: 22.8.1 + eslint: + specifier: ^9.13.0 + version: 9.13.0 + eslint-config-prettier: + specifier: ^9.1.0 + version: 9.1.0(eslint@9.13.0) + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + prettier: + specifier: ^3.3.3 + version: 3.3.3 + ts-jest: + specifier: ^29.2.5 + version: 29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)))(typescript@5.6.3) + ts-node: + specifier: ^10.9.2 + version: 10.9.2(@types/node@22.8.1)(typescript@5.6.3) + typescript: + specifier: ^5.6.3 + version: 5.6.3 + typescript-eslint: + specifier: ^8.12.0 + version: 8.12.0(eslint@9.13.0)(typescript@5.6.3) + +packages: + + '@actions/core@1.11.1': + resolution: {integrity: sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==} + + '@actions/exec@1.1.1': + resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==} + + '@actions/github@6.0.0': + resolution: {integrity: sha512-alScpSVnYmjNEXboZjarjukQEzgCRmjMv6Xj47fsdnqGS73bjJNDpiiXmp8jr0UZLdUB6d9jW63IcmddUP+l0g==} + + '@actions/http-client@2.2.3': + resolution: {integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==} + + '@actions/io@1.1.3': + resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==} + + '@ampproject/remapping@2.3.0': + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} + engines: {node: '>=6.0.0'} + + '@babel/code-frame@7.26.0': + resolution: {integrity: sha512-INCKxTtbXtcNbUZ3YXutwMpEleqttcswhAdee7dhuoVrD2cnuc3PqtERBtxkX5nziX9vnBL8WXmSGwv8CuPV6g==} + engines: {node: '>=6.9.0'} + + '@babel/compat-data@7.26.0': + resolution: {integrity: sha512-qETICbZSLe7uXv9VE8T/RWOdIE5qqyTucOt4zLYMafj2MRO271VGgLd4RACJMeBO37UPWhXiKMBk7YlJ0fOzQA==} + engines: {node: '>=6.9.0'} + + '@babel/core@7.26.0': + resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==} + engines: {node: '>=6.9.0'} + + '@babel/generator@7.26.0': + resolution: {integrity: sha512-/AIkAmInnWwgEAJGQr9vY0c66Mj6kjkE2ZPB1PurTRaRAh3U+J45sAQMjQDJdh4WbR3l0x5xkimXBKyBXXAu2w==} + engines: {node: '>=6.9.0'} + + '@babel/helper-compilation-targets@7.25.9': + resolution: {integrity: sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-imports@7.25.9': + resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-transforms@7.26.0': + resolution: {integrity: sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-plugin-utils@7.25.9': + resolution: {integrity: sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-string-parser@7.25.9': + resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.25.9': + resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-option@7.25.9': + resolution: {integrity: sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==} + engines: {node: '>=6.9.0'} + + '@babel/helpers@7.26.0': + resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==} + engines: {node: '>=6.9.0'} + + '@babel/parser@7.26.1': + resolution: {integrity: sha512-reoQYNiAJreZNsJzyrDNzFQ+IQ5JFiIzAHJg9bn94S3l+4++J7RsIhNMoB+lgP/9tpmiAQqspv+xfdxTSzREOw==} + engines: {node: '>=6.0.0'} + hasBin: true + + '@babel/plugin-syntax-async-generators@7.8.4': + resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-bigint@7.8.3': + resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-class-properties@7.12.13': + resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-class-static-block@7.14.5': + resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-attributes@7.26.0': + resolution: {integrity: sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-meta@7.10.4': + resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-json-strings@7.8.3': + resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-jsx@7.25.9': + resolution: {integrity: sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-logical-assignment-operators@7.10.4': + resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3': + resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-numeric-separator@7.10.4': + resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-object-rest-spread@7.8.3': + resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-optional-catch-binding@7.8.3': + resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-optional-chaining@7.8.3': + resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-private-property-in-object@7.14.5': + resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-top-level-await@7.14.5': + resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-typescript@7.25.9': + resolution: {integrity: sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/template@7.25.9': + resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==} + engines: {node: '>=6.9.0'} + + '@babel/traverse@7.25.9': + resolution: {integrity: sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==} + engines: {node: '>=6.9.0'} + + '@babel/types@7.26.0': + resolution: {integrity: sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==} + engines: {node: '>=6.9.0'} + + '@bcoe/v8-coverage@0.2.3': + resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + + '@cspotcode/source-map-support@0.8.1': + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} + + '@eslint-community/eslint-utils@4.4.1': + resolution: {integrity: sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + + '@eslint-community/regexpp@4.12.1': + resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + + '@eslint/config-array@0.18.0': + resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/core@0.7.0': + resolution: {integrity: sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/eslintrc@3.1.0': + resolution: {integrity: sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/js@9.13.0': + resolution: {integrity: sha512-IFLyoY4d72Z5y/6o/BazFBezupzI/taV8sGumxTAVw3lXG9A6md1Dc34T9s1FoD/an9pJH8RHbAxsaEbBed9lA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/object-schema@2.1.4': + resolution: {integrity: sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@eslint/plugin-kit@0.2.2': + resolution: {integrity: sha512-CXtq5nR4Su+2I47WPOlWud98Y5Lv8Kyxp2ukhgFx/eW6Blm18VXJO5WuQylPugRo8nbluoi6GvvxBLqHcvqUUw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@fastify/busboy@2.1.1': + resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} + engines: {node: '>=14'} + + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.6': + resolution: {integrity: sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==} + engines: {node: '>=18.18.0'} + + '@humanwhocodes/module-importer@1.0.1': + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} + + '@humanwhocodes/retry@0.3.1': + resolution: {integrity: sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==} + engines: {node: '>=18.18'} + + '@ianvs/prettier-plugin-sort-imports@4.3.1': + resolution: {integrity: sha512-ZHwbyjkANZOjaBm3ZosADD2OUYGFzQGxfy67HmGZU94mHqe7g1LCMA7YYKB1Cq+UTPCBqlAYapY0KXAjKEw8Sg==} + peerDependencies: + '@vue/compiler-sfc': 2.7.x || 3.x + prettier: 2 || 3 + peerDependenciesMeta: + '@vue/compiler-sfc': + optional: true + + '@isaacs/cliui@8.0.2': + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + + '@isaacs/fs-minipass@4.0.1': + resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} + engines: {node: '>=18.0.0'} + + '@istanbuljs/load-nyc-config@1.1.0': + resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} + engines: {node: '>=8'} + + '@istanbuljs/schema@0.1.3': + resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} + engines: {node: '>=8'} + + '@jest/console@29.7.0': + resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/core@29.7.0': + resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/environment@29.7.0': + resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/expect-utils@29.7.0': + resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/expect@29.7.0': + resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/fake-timers@29.7.0': + resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/globals@29.7.0': + resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/reporters@29.7.0': + resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/schemas@29.6.3': + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/source-map@29.6.3': + resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/test-result@29.7.0': + resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/test-sequencer@29.7.0': + resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/transform@29.7.0': + resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/types@29.6.3': + resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jridgewell/gen-mapping@0.3.5': + resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} + engines: {node: '>=6.0.0'} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + + '@jridgewell/trace-mapping@0.3.25': + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + + '@jridgewell/trace-mapping@0.3.9': + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + + '@octokit/auth-token@4.0.0': + resolution: {integrity: sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==} + engines: {node: '>= 18'} + + '@octokit/auth-token@5.1.1': + resolution: {integrity: sha512-rh3G3wDO8J9wSjfI436JUKzHIxq8NaiL0tVeB2aXmG6p/9859aUOAjA9pmSPNGGZxfwmaJ9ozOJImuNVJdpvbA==} + engines: {node: '>= 18'} + + '@octokit/core@5.2.0': + resolution: {integrity: sha512-1LFfa/qnMQvEOAdzlQymH0ulepxbxnCYAKJZfMci/5XJyIHWgEYnDmgnKakbTh7CH2tFQ5O60oYDvns4i9RAIg==} + engines: {node: '>= 18'} + + '@octokit/core@6.1.2': + resolution: {integrity: sha512-hEb7Ma4cGJGEUNOAVmyfdB/3WirWMg5hDuNFVejGEDFqupeOysLc2sG6HJxY2etBp5YQu5Wtxwi020jS9xlUwg==} + engines: {node: '>= 18'} + + '@octokit/endpoint@10.1.1': + resolution: {integrity: sha512-JYjh5rMOwXMJyUpj028cu0Gbp7qe/ihxfJMLc8VZBMMqSwLgOxDI1911gV4Enl1QSavAQNJcwmwBF9M0VvLh6Q==} + engines: {node: '>= 18'} + + '@octokit/endpoint@9.0.5': + resolution: {integrity: sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==} + engines: {node: '>= 18'} + + '@octokit/graphql@7.1.0': + resolution: {integrity: sha512-r+oZUH7aMFui1ypZnAvZmn0KSqAUgE1/tUXIWaqUCa1758ts/Jio84GZuzsvUkme98kv0WFY8//n0J1Z+vsIsQ==} + engines: {node: '>= 18'} + + '@octokit/graphql@8.1.1': + resolution: {integrity: sha512-ukiRmuHTi6ebQx/HFRCXKbDlOh/7xEV6QUXaE7MJEKGNAncGI/STSbOkl12qVXZrfZdpXctx5O9X1AIaebiDBg==} + engines: {node: '>= 18'} + + '@octokit/openapi-types@20.0.0': + resolution: {integrity: sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==} + + '@octokit/openapi-types@22.2.0': + resolution: {integrity: sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==} + + '@octokit/plugin-paginate-rest@11.3.5': + resolution: {integrity: sha512-cgwIRtKrpwhLoBi0CUNuY83DPGRMaWVjqVI/bGKsLJ4PzyWZNaEmhHroI2xlrVXkk6nFv0IsZpOp+ZWSWUS2AQ==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=6' + + '@octokit/plugin-paginate-rest@9.2.1': + resolution: {integrity: sha512-wfGhE/TAkXZRLjksFXuDZdmGnJQHvtU/joFQdweXUgzo1XwvBCD4o4+75NtFfjfLK5IwLf9vHTfSiU3sLRYpRw==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '5' + + '@octokit/plugin-request-log@5.3.1': + resolution: {integrity: sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=6' + + '@octokit/plugin-rest-endpoint-methods@10.4.1': + resolution: {integrity: sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '5' + + '@octokit/plugin-rest-endpoint-methods@13.2.6': + resolution: {integrity: sha512-wMsdyHMjSfKjGINkdGKki06VEkgdEldIGstIEyGX0wbYHGByOwN/KiM+hAAlUwAtPkP3gvXtVQA9L3ITdV2tVw==} + engines: {node: '>= 18'} + peerDependencies: + '@octokit/core': '>=6' + + '@octokit/request-error@5.1.0': + resolution: {integrity: sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==} + engines: {node: '>= 18'} + + '@octokit/request-error@6.1.5': + resolution: {integrity: sha512-IlBTfGX8Yn/oFPMwSfvugfncK2EwRLjzbrpifNaMY8o/HTEAFqCA1FZxjD9cWvSKBHgrIhc4CSBIzMxiLsbzFQ==} + engines: {node: '>= 18'} + + '@octokit/request@8.4.0': + resolution: {integrity: sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==} + engines: {node: '>= 18'} + + '@octokit/request@9.1.3': + resolution: {integrity: sha512-V+TFhu5fdF3K58rs1pGUJIDH5RZLbZm5BI+MNF+6o/ssFNT4vWlCh/tVpF3NxGtP15HUxTTMUbsG5llAuU2CZA==} + engines: {node: '>= 18'} + + '@octokit/rest@21.0.2': + resolution: {integrity: sha512-+CiLisCoyWmYicH25y1cDfCrv41kRSvTq6pPWtRroRJzhsCZWZyCqGyI8foJT5LmScADSwRAnr/xo+eewL04wQ==} + engines: {node: '>= 18'} + + '@octokit/types@12.6.0': + resolution: {integrity: sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==} + + '@octokit/types@13.6.1': + resolution: {integrity: sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==} + + '@pkgjs/parseargs@0.11.0': + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + + '@sinclair/typebox@0.27.8': + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + + '@sinonjs/commons@3.0.1': + resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} + + '@sinonjs/fake-timers@10.3.0': + resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} + + '@tsconfig/node10@1.0.11': + resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} + + '@tsconfig/node12@1.0.11': + resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + + '@tsconfig/node14@1.0.3': + resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + + '@tsconfig/node16@1.0.4': + resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + + '@types/babel__core@7.20.5': + resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} + + '@types/babel__generator@7.6.8': + resolution: {integrity: sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==} + + '@types/babel__template@7.4.4': + resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} + + '@types/babel__traverse@7.20.6': + resolution: {integrity: sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==} + + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + + '@types/graceful-fs@4.1.9': + resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} + + '@types/istanbul-lib-coverage@2.0.6': + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} + + '@types/istanbul-lib-report@3.0.3': + resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} + + '@types/istanbul-reports@3.0.4': + resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} + + '@types/jest@29.5.14': + resolution: {integrity: sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/node@22.8.1': + resolution: {integrity: sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==} + + '@types/stack-utils@2.0.3': + resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} + + '@types/yargs-parser@21.0.3': + resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} + + '@types/yargs@17.0.33': + resolution: {integrity: sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==} + + '@typescript-eslint/eslint-plugin@8.12.0': + resolution: {integrity: sha512-uRqchEKT0/OwDePTwCjSFO2aH4zccdeQ7DgAzM/8fuXc+PAXvpdMRbuo+oCmK1lSfXssk2UUBNiWihobKxQp/g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/parser@8.12.0': + resolution: {integrity: sha512-7U20duDQWAOhCk2VtyY41Vor/CJjiEW063Zel9aoRXq89FQ/jr+0e0m3kxh9Sk5SFW9B1AblVIBtXd+1xQ1NWQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/scope-manager@8.12.0': + resolution: {integrity: sha512-jbuCXK18iEshRFUtlCIMAmOKA6OAsKjo41UcXPqx7ZWh2b4cmg6pV/pNcZSB7oW9mtgF95yizr7Jnwt3IUD2pA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/type-utils@8.12.0': + resolution: {integrity: sha512-cHioAZO/nLgyzTmwv7gWIjEKMHSbioKEZqLCaItTn7RvJP1QipuGVwEjPJa6Kv9u9UiUMVAESY9JH186TjKITw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/types@8.12.0': + resolution: {integrity: sha512-Cc+iNtqBJ492f8KLEmKXe1l6683P0MlFO8Bk1NMphnzVIGH4/Wn9kvandFH+gYR1DDUjH/hgeWRGdO5Tj8gjYg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/typescript-estree@8.12.0': + resolution: {integrity: sha512-a4koVV7HHVOQWcGb6ZcAlunJnAdwo/CITRbleQBSjq5+2WLoAJQCAAiecvrAdSM+n/man6Ghig5YgdGVIC6xqw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/utils@8.12.0': + resolution: {integrity: sha512-5i1tqLwlf0fpX1j05paNKyIzla/a4Y3Xhh6AFzi0do/LDJLvohtZYaisaTB9kq0D4uBocAxWDTGzNMOCCwIgXA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + + '@typescript-eslint/visitor-keys@8.12.0': + resolution: {integrity: sha512-2rXkr+AtZZLuNY18aUjv5wtB9oUiwY1WnNi7VTsdCdy1m958ULeUKoAegldQTjqpbpNJ5cQ4egR8/bh5tbrKKQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + acorn-jsx@5.3.2: + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + + acorn-walk@8.3.4: + resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} + engines: {node: '>=0.4.0'} + + acorn@8.14.0: + resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} + engines: {node: '>=0.4.0'} + hasBin: true + + ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + + ansi-escapes@4.3.2: + resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} + engines: {node: '>=8'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-regex@6.1.0: + resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} + engines: {node: '>=12'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + + ansi-styles@6.2.1: + resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} + engines: {node: '>=12'} + + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + + arg@4.1.3: + resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + + argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + + async@3.2.6: + resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} + + babel-jest@29.7.0: + resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.8.0 + + babel-plugin-istanbul@6.1.1: + resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} + engines: {node: '>=8'} + + babel-plugin-jest-hoist@29.6.3: + resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + babel-preset-current-node-syntax@1.1.0: + resolution: {integrity: sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==} + peerDependencies: + '@babel/core': ^7.0.0 + + babel-preset-jest@29.6.3: + resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.0.0 + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + before-after-hook@2.2.3: + resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} + + before-after-hook@3.0.2: + resolution: {integrity: sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==} + + brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + + brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + browserslist@4.24.2: + resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + bs-logger@0.2.6: + resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} + engines: {node: '>= 6'} + + bser@2.1.1: + resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + + camelcase@5.3.1: + resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} + engines: {node: '>=6'} + + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + + caniuse-lite@1.0.30001673: + resolution: {integrity: sha512-WTrjUCSMp3LYX0nE12ECkV0a+e6LC85E0Auz75555/qr78Oc8YWhEPNfDd6SHdtlCMSzqtuXY0uyEMNRcsKpKw==} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + char-regex@1.0.2: + resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} + engines: {node: '>=10'} + + chownr@3.0.0: + resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==} + engines: {node: '>=18'} + + ci-info@3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + engines: {node: '>=8'} + + cjs-module-lexer@1.4.1: + resolution: {integrity: sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==} + + cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + + co@4.6.0: + resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} + engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} + + collect-v8-coverage@1.0.2: + resolution: {integrity: sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + + convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + + create-jest@29.7.0: + resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + + create-require@1.1.1: + resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + + cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + + debug@4.3.7: + resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + dedent@1.5.3: + resolution: {integrity: sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + + deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + + deprecation@2.3.1: + resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} + + detect-newline@3.1.0: + resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} + engines: {node: '>=8'} + + diff-sequences@29.6.3: + resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + diff@4.0.2: + resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} + engines: {node: '>=0.3.1'} + + eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + + ejs@3.1.10: + resolution: {integrity: sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==} + engines: {node: '>=0.10.0'} + hasBin: true + + electron-to-chromium@1.5.48: + resolution: {integrity: sha512-FXULnNK7ACNI9MTMOVAzUGiz/YrK9Kcb0s/JT4aJgsam7Eh6XYe7Y6q95lPq+VdBe1DpT2eTnfXFtnuPGCks4w==} + + emittery@0.13.1: + resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} + engines: {node: '>=12'} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + + error-ex@1.3.2: + resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + escape-string-regexp@2.0.0: + resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} + engines: {node: '>=8'} + + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + eslint-config-prettier@9.1.0: + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + + eslint-scope@8.1.0: + resolution: {integrity: sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + eslint-visitor-keys@4.1.0: + resolution: {integrity: sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + eslint@9.13.0: + resolution: {integrity: sha512-EYZK6SX6zjFHST/HRytOdA/zE72Cq/bfw45LSyuwrdvcclb/gqV8RRQxywOBEWO2+WDpva6UZa4CcDeJKzUCFA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true + + espree@10.2.0: + resolution: {integrity: sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + esquery@1.6.0: + resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==} + engines: {node: '>=0.10'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + + execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + + exit@0.1.2: + resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} + engines: {node: '>= 0.8.0'} + + expect@29.7.0: + resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} + engines: {node: '>=8.6.0'} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + + fastq@1.17.1: + resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + + fb-watchman@2.0.2: + resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} + + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} + + filelist@1.0.4: + resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + find-up@4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} + + flatted@3.3.1: + resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} + + foreground-child@3.3.0: + resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} + engines: {node: '>=14'} + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-package-type@0.1.0: + resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} + engines: {node: '>=8.0.0'} + + get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + + glob@10.4.5: + resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + hasBin: true + + glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported + + globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + + globals@14.0.0: + resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} + engines: {node: '>=18'} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + + html-escaper@2.0.2: + resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + + human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + import-fresh@3.3.0: + resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} + engines: {node: '>=6'} + + import-local@3.2.0: + resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==} + engines: {node: '>=8'} + hasBin: true + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + + is-core-module@2.15.1: + resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} + engines: {node: '>= 0.4'} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-generator-fn@2.1.0: + resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} + engines: {node: '>=6'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} + engines: {node: '>=8'} + + istanbul-lib-instrument@5.2.1: + resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} + engines: {node: '>=8'} + + istanbul-lib-instrument@6.0.3: + resolution: {integrity: sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==} + engines: {node: '>=10'} + + istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} + + istanbul-lib-source-maps@4.0.1: + resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} + engines: {node: '>=10'} + + istanbul-reports@3.1.7: + resolution: {integrity: sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==} + engines: {node: '>=8'} + + jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + + jake@10.9.2: + resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==} + engines: {node: '>=10'} + hasBin: true + + jest-changed-files@29.7.0: + resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-circus@29.7.0: + resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-cli@29.7.0: + resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + jest-config@29.7.0: + resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@types/node': '*' + ts-node: '>=9.0.0' + peerDependenciesMeta: + '@types/node': + optional: true + ts-node: + optional: true + + jest-diff@29.7.0: + resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-docblock@29.7.0: + resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-each@29.7.0: + resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-environment-node@29.7.0: + resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-get-type@29.6.3: + resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-haste-map@29.7.0: + resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-leak-detector@29.7.0: + resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-matcher-utils@29.7.0: + resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-message-util@29.7.0: + resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-mock@29.7.0: + resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-pnp-resolver@1.2.3: + resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==} + engines: {node: '>=6'} + peerDependencies: + jest-resolve: '*' + peerDependenciesMeta: + jest-resolve: + optional: true + + jest-regex-util@29.6.3: + resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-resolve-dependencies@29.7.0: + resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-resolve@29.7.0: + resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-runner@29.7.0: + resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-runtime@29.7.0: + resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-snapshot@29.7.0: + resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-util@29.7.0: + resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-validate@29.7.0: + resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-watcher@29.7.0: + resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-worker@29.7.0: + resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest@29.7.0: + resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + + js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + + jsesc@3.0.2: + resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} + engines: {node: '>=6'} + hasBin: true + + json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + + json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + + keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + + kleur@3.0.3: + resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} + engines: {node: '>=6'} + + leven@3.1.0: + resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} + engines: {node: '>=6'} + + levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + + lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + + locate-path@5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} + + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + lodash.memoize@4.1.2: + resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} + + lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + + make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} + + make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + + makeerror@1.0.12: + resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + + minimatch@3.1.2: + resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + + minimatch@5.1.6: + resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==} + engines: {node: '>=10'} + + minimatch@9.0.5: + resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} + engines: {node: '>=16 || 14 >=14.17'} + + minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + + minizlib@3.0.1: + resolution: {integrity: sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==} + engines: {node: '>= 18'} + + mkdirp@3.0.1: + resolution: {integrity: sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==} + engines: {node: '>=10'} + hasBin: true + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + + node-int64@0.4.0: + resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} + + node-releases@2.0.18: + resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + + optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} + engines: {node: '>= 0.8.0'} + + p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + + p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + + package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + + parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + + parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + + path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + pirates@4.0.6: + resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} + engines: {node: '>= 6'} + + pkg-dir@4.2.0: + resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} + engines: {node: '>=8'} + + prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + + prettier@3.3.3: + resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==} + engines: {node: '>=14'} + hasBin: true + + pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + prompts@2.4.2: + resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} + engines: {node: '>= 6'} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + pure-rand@6.1.0: + resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==} + + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + + react-is@18.3.1: + resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + resolve-cwd@3.0.0: + resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} + engines: {node: '>=8'} + + resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + + resolve.exports@2.0.2: + resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} + engines: {node: '>=10'} + + resolve@1.22.8: + resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} + hasBin: true + + reusify@1.0.4: + resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + rimraf@5.0.10: + resolution: {integrity: sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==} + hasBin: true + + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + + semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + + semver@7.6.3: + resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} + engines: {node: '>=10'} + hasBin: true + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + + source-map-support@0.5.13: + resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + + stack-utils@2.0.6: + resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} + engines: {node: '>=10'} + + string-length@4.0.2: + resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} + engines: {node: '>=10'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-ansi@7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + + strip-bom@4.0.0: + resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} + engines: {node: '>=8'} + + strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + + tar@7.4.3: + resolution: {integrity: sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==} + engines: {node: '>=18'} + + test-exclude@6.0.0: + resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} + engines: {node: '>=8'} + + text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + + tmpl@1.0.5: + resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + ts-api-utils@1.3.0: + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' + + ts-jest@29.2.5: + resolution: {integrity: sha512-KD8zB2aAZrcKIdGk4OwpJggeLcH1FgrICqDSROWqlnJXGCXK4Mn6FcdK2B6670Xr73lHMG1kHw8R87A0ecZ+vA==} + engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@babel/core': '>=7.0.0-beta.0 <8' + '@jest/transform': ^29.0.0 + '@jest/types': ^29.0.0 + babel-jest: ^29.0.0 + esbuild: '*' + jest: ^29.0.0 + typescript: '>=4.3 <6' + peerDependenciesMeta: + '@babel/core': + optional: true + '@jest/transform': + optional: true + '@jest/types': + optional: true + babel-jest: + optional: true + esbuild: + optional: true + + ts-node@10.9.2: + resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + + tunnel@0.0.6: + resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} + engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} + + type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + + type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + + type-fest@0.21.3: + resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} + engines: {node: '>=10'} + + typescript-eslint@8.12.0: + resolution: {integrity: sha512-m8aQM4pqc17dcD3BsQzUqVXkcclCspuCCv7GhYlwMWNYAXFV8xJkn8vUM8YxoR78BY6S+NX/J7rfNVaGNLgXgQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + typescript@5.6.3: + resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@6.19.8: + resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + + undici@5.28.4: + resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==} + engines: {node: '>=14.0'} + + universal-user-agent@6.0.1: + resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==} + + universal-user-agent@7.0.2: + resolution: {integrity: sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==} + + update-browserslist-db@1.1.1: + resolution: {integrity: sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + v8-compile-cache-lib@3.0.1: + resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + + v8-to-istanbul@9.3.0: + resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} + engines: {node: '>=10.12.0'} + + walker@1.0.8: + resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + write-file-atomic@4.0.2: + resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + + yallist@5.0.0: + resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} + engines: {node: '>=18'} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs@17.7.2: + resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} + engines: {node: '>=12'} + + yn@3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + +snapshots: + + '@actions/core@1.11.1': + dependencies: + '@actions/exec': 1.1.1 + '@actions/http-client': 2.2.3 + + '@actions/exec@1.1.1': + dependencies: + '@actions/io': 1.1.3 + + '@actions/github@6.0.0': + dependencies: + '@actions/http-client': 2.2.3 + '@octokit/core': 5.2.0 + '@octokit/plugin-paginate-rest': 9.2.1(@octokit/core@5.2.0) + '@octokit/plugin-rest-endpoint-methods': 10.4.1(@octokit/core@5.2.0) + + '@actions/http-client@2.2.3': + dependencies: + tunnel: 0.0.6 + undici: 5.28.4 + + '@actions/io@1.1.3': {} + + '@ampproject/remapping@2.3.0': + dependencies: + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + + '@babel/code-frame@7.26.0': + dependencies: + '@babel/helper-validator-identifier': 7.25.9 + js-tokens: 4.0.0 + picocolors: 1.1.1 + + '@babel/compat-data@7.26.0': {} + + '@babel/core@7.26.0': + dependencies: + '@ampproject/remapping': 2.3.0 + '@babel/code-frame': 7.26.0 + '@babel/generator': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helpers': 7.26.0 + '@babel/parser': 7.26.1 + '@babel/template': 7.25.9 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 + convert-source-map: 2.0.0 + debug: 4.3.7 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/generator@7.26.0': + dependencies: + '@babel/parser': 7.26.1 + '@babel/types': 7.26.0 + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + jsesc: 3.0.2 + + '@babel/helper-compilation-targets@7.25.9': + dependencies: + '@babel/compat-data': 7.26.0 + '@babel/helper-validator-option': 7.25.9 + browserslist: 4.24.2 + lru-cache: 5.1.1 + semver: 6.3.1 + + '@babel/helper-module-imports@7.25.9': + dependencies: + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-transforms@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-imports': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + '@babel/traverse': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/helper-plugin-utils@7.25.9': {} + + '@babel/helper-string-parser@7.25.9': {} + + '@babel/helper-validator-identifier@7.25.9': {} + + '@babel/helper-validator-option@7.25.9': {} + + '@babel/helpers@7.26.0': + dependencies: + '@babel/template': 7.25.9 + '@babel/types': 7.26.0 + + '@babel/parser@7.26.1': + dependencies: + '@babel/types': 7.26.0 + + '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-import-attributes@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-jsx@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-typescript@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/template@7.25.9': + dependencies: + '@babel/code-frame': 7.26.0 + '@babel/parser': 7.26.1 + '@babel/types': 7.26.0 + + '@babel/traverse@7.25.9': + dependencies: + '@babel/code-frame': 7.26.0 + '@babel/generator': 7.26.0 + '@babel/parser': 7.26.1 + '@babel/template': 7.25.9 + '@babel/types': 7.26.0 + debug: 4.3.7 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + + '@babel/types@7.26.0': + dependencies: + '@babel/helper-string-parser': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + + '@bcoe/v8-coverage@0.2.3': {} + + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + + '@eslint-community/eslint-utils@4.4.1(eslint@9.13.0)': + dependencies: + eslint: 9.13.0 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.1': {} + + '@eslint/config-array@0.18.0': + dependencies: + '@eslint/object-schema': 2.1.4 + debug: 4.3.7 + minimatch: 3.1.2 + transitivePeerDependencies: + - supports-color + + '@eslint/core@0.7.0': {} + + '@eslint/eslintrc@3.1.0': + dependencies: + ajv: 6.12.6 + debug: 4.3.7 + espree: 10.2.0 + globals: 14.0.0 + ignore: 5.3.2 + import-fresh: 3.3.0 + js-yaml: 4.1.0 + minimatch: 3.1.2 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + + '@eslint/js@9.13.0': {} + + '@eslint/object-schema@2.1.4': {} + + '@eslint/plugin-kit@0.2.2': + dependencies: + levn: 0.4.1 + + '@fastify/busboy@2.1.1': {} + + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.6': + dependencies: + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.3.1 + + '@humanwhocodes/module-importer@1.0.1': {} + + '@humanwhocodes/retry@0.3.1': {} + + '@ianvs/prettier-plugin-sort-imports@4.3.1(prettier@3.3.3)': + dependencies: + '@babel/core': 7.26.0 + '@babel/generator': 7.26.0 + '@babel/parser': 7.26.1 + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 + prettier: 3.3.3 + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + + '@isaacs/cliui@8.0.2': + dependencies: + string-width: 5.1.2 + string-width-cjs: string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: wrap-ansi@7.0.0 + + '@isaacs/fs-minipass@4.0.1': + dependencies: + minipass: 7.1.2 + + '@istanbuljs/load-nyc-config@1.1.0': + dependencies: + camelcase: 5.3.1 + find-up: 4.1.0 + get-package-type: 0.1.0 + js-yaml: 3.14.1 + resolve-from: 5.0.0 + + '@istanbuljs/schema@0.1.3': {} + + '@jest/console@29.7.0': + dependencies: + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + chalk: 4.1.2 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + slash: 3.0.0 + + '@jest/core@29.7.0(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3))': + dependencies: + '@jest/console': 29.7.0 + '@jest/reporters': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + ci-info: 3.9.0 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-changed-files: 29.7.0 + jest-config: 29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-resolve-dependencies: 29.7.0 + jest-runner: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + jest-watcher: 29.7.0 + micromatch: 4.0.8 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-ansi: 6.0.1 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + - ts-node + + '@jest/environment@29.7.0': + dependencies: + '@jest/fake-timers': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + jest-mock: 29.7.0 + + '@jest/expect-utils@29.7.0': + dependencies: + jest-get-type: 29.6.3 + + '@jest/expect@29.7.0': + dependencies: + expect: 29.7.0 + jest-snapshot: 29.7.0 + transitivePeerDependencies: + - supports-color + + '@jest/fake-timers@29.7.0': + dependencies: + '@jest/types': 29.6.3 + '@sinonjs/fake-timers': 10.3.0 + '@types/node': 22.8.1 + jest-message-util: 29.7.0 + jest-mock: 29.7.0 + jest-util: 29.7.0 + + '@jest/globals@29.7.0': + dependencies: + '@jest/environment': 29.7.0 + '@jest/expect': 29.7.0 + '@jest/types': 29.6.3 + jest-mock: 29.7.0 + transitivePeerDependencies: + - supports-color + + '@jest/reporters@29.7.0': + dependencies: + '@bcoe/v8-coverage': 0.2.3 + '@jest/console': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@jridgewell/trace-mapping': 0.3.25 + '@types/node': 22.8.1 + chalk: 4.1.2 + collect-v8-coverage: 1.0.2 + exit: 0.1.2 + glob: 7.2.3 + graceful-fs: 4.2.11 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-instrument: 6.0.3 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 4.0.1 + istanbul-reports: 3.1.7 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + jest-worker: 29.7.0 + slash: 3.0.0 + string-length: 4.0.2 + strip-ansi: 6.0.1 + v8-to-istanbul: 9.3.0 + transitivePeerDependencies: + - supports-color + + '@jest/schemas@29.6.3': + dependencies: + '@sinclair/typebox': 0.27.8 + + '@jest/source-map@29.6.3': + dependencies: + '@jridgewell/trace-mapping': 0.3.25 + callsites: 3.1.0 + graceful-fs: 4.2.11 + + '@jest/test-result@29.7.0': + dependencies: + '@jest/console': 29.7.0 + '@jest/types': 29.6.3 + '@types/istanbul-lib-coverage': 2.0.6 + collect-v8-coverage: 1.0.2 + + '@jest/test-sequencer@29.7.0': + dependencies: + '@jest/test-result': 29.7.0 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + slash: 3.0.0 + + '@jest/transform@29.7.0': + dependencies: + '@babel/core': 7.26.0 + '@jest/types': 29.6.3 + '@jridgewell/trace-mapping': 0.3.25 + babel-plugin-istanbul: 6.1.1 + chalk: 4.1.2 + convert-source-map: 2.0.0 + fast-json-stable-stringify: 2.1.0 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + jest-regex-util: 29.6.3 + jest-util: 29.7.0 + micromatch: 4.0.8 + pirates: 4.0.6 + slash: 3.0.0 + write-file-atomic: 4.0.2 + transitivePeerDependencies: + - supports-color + + '@jest/types@29.6.3': + dependencies: + '@jest/schemas': 29.6.3 + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 3.0.4 + '@types/node': 22.8.1 + '@types/yargs': 17.0.33 + chalk: 4.1.2 + + '@jridgewell/gen-mapping@0.3.5': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/set-array@1.2.1': {} + + '@jridgewell/sourcemap-codec@1.5.0': {} + + '@jridgewell/trace-mapping@0.3.25': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.17.1 + + '@octokit/auth-token@4.0.0': {} + + '@octokit/auth-token@5.1.1': {} + + '@octokit/core@5.2.0': + dependencies: + '@octokit/auth-token': 4.0.0 + '@octokit/graphql': 7.1.0 + '@octokit/request': 8.4.0 + '@octokit/request-error': 5.1.0 + '@octokit/types': 13.6.1 + before-after-hook: 2.2.3 + universal-user-agent: 6.0.1 + + '@octokit/core@6.1.2': + dependencies: + '@octokit/auth-token': 5.1.1 + '@octokit/graphql': 8.1.1 + '@octokit/request': 9.1.3 + '@octokit/request-error': 6.1.5 + '@octokit/types': 13.6.1 + before-after-hook: 3.0.2 + universal-user-agent: 7.0.2 + + '@octokit/endpoint@10.1.1': + dependencies: + '@octokit/types': 13.6.1 + universal-user-agent: 7.0.2 + + '@octokit/endpoint@9.0.5': + dependencies: + '@octokit/types': 13.6.1 + universal-user-agent: 6.0.1 + + '@octokit/graphql@7.1.0': + dependencies: + '@octokit/request': 8.4.0 + '@octokit/types': 13.6.1 + universal-user-agent: 6.0.1 + + '@octokit/graphql@8.1.1': + dependencies: + '@octokit/request': 9.1.3 + '@octokit/types': 13.6.1 + universal-user-agent: 7.0.2 + + '@octokit/openapi-types@20.0.0': {} + + '@octokit/openapi-types@22.2.0': {} + + '@octokit/plugin-paginate-rest@11.3.5(@octokit/core@6.1.2)': + dependencies: + '@octokit/core': 6.1.2 + '@octokit/types': 13.6.1 + + '@octokit/plugin-paginate-rest@9.2.1(@octokit/core@5.2.0)': + dependencies: + '@octokit/core': 5.2.0 + '@octokit/types': 12.6.0 + + '@octokit/plugin-request-log@5.3.1(@octokit/core@6.1.2)': + dependencies: + '@octokit/core': 6.1.2 + + '@octokit/plugin-rest-endpoint-methods@10.4.1(@octokit/core@5.2.0)': + dependencies: + '@octokit/core': 5.2.0 + '@octokit/types': 12.6.0 + + '@octokit/plugin-rest-endpoint-methods@13.2.6(@octokit/core@6.1.2)': + dependencies: + '@octokit/core': 6.1.2 + '@octokit/types': 13.6.1 + + '@octokit/request-error@5.1.0': + dependencies: + '@octokit/types': 13.6.1 + deprecation: 2.3.1 + once: 1.4.0 + + '@octokit/request-error@6.1.5': + dependencies: + '@octokit/types': 13.6.1 + + '@octokit/request@8.4.0': + dependencies: + '@octokit/endpoint': 9.0.5 + '@octokit/request-error': 5.1.0 + '@octokit/types': 13.6.1 + universal-user-agent: 6.0.1 + + '@octokit/request@9.1.3': + dependencies: + '@octokit/endpoint': 10.1.1 + '@octokit/request-error': 6.1.5 + '@octokit/types': 13.6.1 + universal-user-agent: 7.0.2 + + '@octokit/rest@21.0.2': + dependencies: + '@octokit/core': 6.1.2 + '@octokit/plugin-paginate-rest': 11.3.5(@octokit/core@6.1.2) + '@octokit/plugin-request-log': 5.3.1(@octokit/core@6.1.2) + '@octokit/plugin-rest-endpoint-methods': 13.2.6(@octokit/core@6.1.2) + + '@octokit/types@12.6.0': + dependencies: + '@octokit/openapi-types': 20.0.0 + + '@octokit/types@13.6.1': + dependencies: + '@octokit/openapi-types': 22.2.0 + + '@pkgjs/parseargs@0.11.0': + optional: true + + '@sinclair/typebox@0.27.8': {} + + '@sinonjs/commons@3.0.1': + dependencies: + type-detect: 4.0.8 + + '@sinonjs/fake-timers@10.3.0': + dependencies: + '@sinonjs/commons': 3.0.1 + + '@tsconfig/node10@1.0.11': {} + + '@tsconfig/node12@1.0.11': {} + + '@tsconfig/node14@1.0.3': {} + + '@tsconfig/node16@1.0.4': {} + + '@types/babel__core@7.20.5': + dependencies: + '@babel/parser': 7.26.1 + '@babel/types': 7.26.0 + '@types/babel__generator': 7.6.8 + '@types/babel__template': 7.4.4 + '@types/babel__traverse': 7.20.6 + + '@types/babel__generator@7.6.8': + dependencies: + '@babel/types': 7.26.0 + + '@types/babel__template@7.4.4': + dependencies: + '@babel/parser': 7.26.1 + '@babel/types': 7.26.0 + + '@types/babel__traverse@7.20.6': + dependencies: + '@babel/types': 7.26.0 + + '@types/estree@1.0.6': {} + + '@types/graceful-fs@4.1.9': + dependencies: + '@types/node': 22.8.1 + + '@types/istanbul-lib-coverage@2.0.6': {} + + '@types/istanbul-lib-report@3.0.3': + dependencies: + '@types/istanbul-lib-coverage': 2.0.6 + + '@types/istanbul-reports@3.0.4': + dependencies: + '@types/istanbul-lib-report': 3.0.3 + + '@types/jest@29.5.14': + dependencies: + expect: 29.7.0 + pretty-format: 29.7.0 + + '@types/json-schema@7.0.15': {} + + '@types/node@22.8.1': + dependencies: + undici-types: 6.19.8 + + '@types/stack-utils@2.0.3': {} + + '@types/yargs-parser@21.0.3': {} + + '@types/yargs@17.0.33': + dependencies: + '@types/yargs-parser': 21.0.3 + + '@typescript-eslint/eslint-plugin@8.12.0(@typescript-eslint/parser@8.12.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3)': + dependencies: + '@eslint-community/regexpp': 4.12.1 + '@typescript-eslint/parser': 8.12.0(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/scope-manager': 8.12.0 + '@typescript-eslint/type-utils': 8.12.0(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/utils': 8.12.0(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/visitor-keys': 8.12.0 + eslint: 9.13.0 + graphemer: 1.4.0 + ignore: 5.3.2 + natural-compare: 1.4.0 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/parser@8.12.0(eslint@9.13.0)(typescript@5.6.3)': + dependencies: + '@typescript-eslint/scope-manager': 8.12.0 + '@typescript-eslint/types': 8.12.0 + '@typescript-eslint/typescript-estree': 8.12.0(typescript@5.6.3) + '@typescript-eslint/visitor-keys': 8.12.0 + debug: 4.3.7 + eslint: 9.13.0 + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@8.12.0': + dependencies: + '@typescript-eslint/types': 8.12.0 + '@typescript-eslint/visitor-keys': 8.12.0 + + '@typescript-eslint/type-utils@8.12.0(eslint@9.13.0)(typescript@5.6.3)': + dependencies: + '@typescript-eslint/typescript-estree': 8.12.0(typescript@5.6.3) + '@typescript-eslint/utils': 8.12.0(eslint@9.13.0)(typescript@5.6.3) + debug: 4.3.7 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - eslint + - supports-color + + '@typescript-eslint/types@8.12.0': {} + + '@typescript-eslint/typescript-estree@8.12.0(typescript@5.6.3)': + dependencies: + '@typescript-eslint/types': 8.12.0 + '@typescript-eslint/visitor-keys': 8.12.0 + debug: 4.3.7 + fast-glob: 3.3.2 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/utils@8.12.0(eslint@9.13.0)(typescript@5.6.3)': + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@9.13.0) + '@typescript-eslint/scope-manager': 8.12.0 + '@typescript-eslint/types': 8.12.0 + '@typescript-eslint/typescript-estree': 8.12.0(typescript@5.6.3) + eslint: 9.13.0 + transitivePeerDependencies: + - supports-color + - typescript + + '@typescript-eslint/visitor-keys@8.12.0': + dependencies: + '@typescript-eslint/types': 8.12.0 + eslint-visitor-keys: 3.4.3 + + acorn-jsx@5.3.2(acorn@8.14.0): + dependencies: + acorn: 8.14.0 + + acorn-walk@8.3.4: + dependencies: + acorn: 8.14.0 + + acorn@8.14.0: {} + + ajv@6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ansi-escapes@4.3.2: + dependencies: + type-fest: 0.21.3 + + ansi-regex@5.0.1: {} + + ansi-regex@6.1.0: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + ansi-styles@5.2.0: {} + + ansi-styles@6.2.1: {} + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + + arg@4.1.3: {} + + argparse@1.0.10: + dependencies: + sprintf-js: 1.0.3 + + argparse@2.0.1: {} + + async@3.2.6: {} + + babel-jest@29.7.0(@babel/core@7.26.0): + dependencies: + '@babel/core': 7.26.0 + '@jest/transform': 29.7.0 + '@types/babel__core': 7.20.5 + babel-plugin-istanbul: 6.1.1 + babel-preset-jest: 29.6.3(@babel/core@7.26.0) + chalk: 4.1.2 + graceful-fs: 4.2.11 + slash: 3.0.0 + transitivePeerDependencies: + - supports-color + + babel-plugin-istanbul@6.1.1: + dependencies: + '@babel/helper-plugin-utils': 7.25.9 + '@istanbuljs/load-nyc-config': 1.1.0 + '@istanbuljs/schema': 0.1.3 + istanbul-lib-instrument: 5.2.1 + test-exclude: 6.0.0 + transitivePeerDependencies: + - supports-color + + babel-plugin-jest-hoist@29.6.3: + dependencies: + '@babel/template': 7.25.9 + '@babel/types': 7.26.0 + '@types/babel__core': 7.20.5 + '@types/babel__traverse': 7.20.6 + + babel-preset-current-node-syntax@1.1.0(@babel/core@7.26.0): + dependencies: + '@babel/core': 7.26.0 + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.26.0) + '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.26.0) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.26.0) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.26.0) + '@babel/plugin-syntax-import-attributes': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.26.0) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.26.0) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.26.0) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.26.0) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.26.0) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.26.0) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.26.0) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.26.0) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.26.0) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.26.0) + + babel-preset-jest@29.6.3(@babel/core@7.26.0): + dependencies: + '@babel/core': 7.26.0 + babel-plugin-jest-hoist: 29.6.3 + babel-preset-current-node-syntax: 1.1.0(@babel/core@7.26.0) + + balanced-match@1.0.2: {} + + before-after-hook@2.2.3: {} + + before-after-hook@3.0.2: {} + + brace-expansion@1.1.11: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + brace-expansion@2.0.1: + dependencies: + balanced-match: 1.0.2 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + browserslist@4.24.2: + dependencies: + caniuse-lite: 1.0.30001673 + electron-to-chromium: 1.5.48 + node-releases: 2.0.18 + update-browserslist-db: 1.1.1(browserslist@4.24.2) + + bs-logger@0.2.6: + dependencies: + fast-json-stable-stringify: 2.1.0 + + bser@2.1.1: + dependencies: + node-int64: 0.4.0 + + buffer-from@1.1.2: {} + + callsites@3.1.0: {} + + camelcase@5.3.1: {} + + camelcase@6.3.0: {} + + caniuse-lite@1.0.30001673: {} + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + char-regex@1.0.2: {} + + chownr@3.0.0: {} + + ci-info@3.9.0: {} + + cjs-module-lexer@1.4.1: {} + + cliui@8.0.1: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + co@4.6.0: {} + + collect-v8-coverage@1.0.2: {} + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + concat-map@0.0.1: {} + + convert-source-map@2.0.0: {} + + create-jest@29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)): + dependencies: + '@jest/types': 29.6.3 + chalk: 4.1.2 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-config: 29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + jest-util: 29.7.0 + prompts: 2.4.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + + create-require@1.1.1: {} + + cross-spawn@7.0.3: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + debug@4.3.7: + dependencies: + ms: 2.1.3 + + dedent@1.5.3: {} + + deep-is@0.1.4: {} + + deepmerge@4.3.1: {} + + deprecation@2.3.1: {} + + detect-newline@3.1.0: {} + + diff-sequences@29.6.3: {} + + diff@4.0.2: {} + + eastasianwidth@0.2.0: {} + + ejs@3.1.10: + dependencies: + jake: 10.9.2 + + electron-to-chromium@1.5.48: {} + + emittery@0.13.1: {} + + emoji-regex@8.0.0: {} + + emoji-regex@9.2.2: {} + + error-ex@1.3.2: + dependencies: + is-arrayish: 0.2.1 + + escalade@3.2.0: {} + + escape-string-regexp@2.0.0: {} + + escape-string-regexp@4.0.0: {} + + eslint-config-prettier@9.1.0(eslint@9.13.0): + dependencies: + eslint: 9.13.0 + + eslint-scope@8.1.0: + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + + eslint-visitor-keys@3.4.3: {} + + eslint-visitor-keys@4.1.0: {} + + eslint@9.13.0: + dependencies: + '@eslint-community/eslint-utils': 4.4.1(eslint@9.13.0) + '@eslint-community/regexpp': 4.12.1 + '@eslint/config-array': 0.18.0 + '@eslint/core': 0.7.0 + '@eslint/eslintrc': 3.1.0 + '@eslint/js': 9.13.0 + '@eslint/plugin-kit': 0.2.2 + '@humanfs/node': 0.16.6 + '@humanwhocodes/module-importer': 1.0.1 + '@humanwhocodes/retry': 0.3.1 + '@types/estree': 1.0.6 + '@types/json-schema': 7.0.15 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.3 + debug: 4.3.7 + escape-string-regexp: 4.0.0 + eslint-scope: 8.1.0 + eslint-visitor-keys: 4.1.0 + espree: 10.2.0 + esquery: 1.6.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 8.0.0 + find-up: 5.0.0 + glob-parent: 6.0.2 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + json-stable-stringify-without-jsonify: 1.0.1 + lodash.merge: 4.6.2 + minimatch: 3.1.2 + natural-compare: 1.4.0 + optionator: 0.9.4 + text-table: 0.2.0 + transitivePeerDependencies: + - supports-color + + espree@10.2.0: + dependencies: + acorn: 8.14.0 + acorn-jsx: 5.3.2(acorn@8.14.0) + eslint-visitor-keys: 4.1.0 + + esprima@4.0.1: {} + + esquery@1.6.0: + dependencies: + estraverse: 5.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@5.3.0: {} + + esutils@2.0.3: {} + + execa@5.1.1: + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + + exit@0.1.2: {} + + expect@29.7.0: + dependencies: + '@jest/expect-utils': 29.7.0 + jest-get-type: 29.6.3 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + + fast-deep-equal@3.1.3: {} + + fast-glob@3.3.2: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fast-json-stable-stringify@2.1.0: {} + + fast-levenshtein@2.0.6: {} + + fastq@1.17.1: + dependencies: + reusify: 1.0.4 + + fb-watchman@2.0.2: + dependencies: + bser: 2.1.1 + + file-entry-cache@8.0.0: + dependencies: + flat-cache: 4.0.1 + + filelist@1.0.4: + dependencies: + minimatch: 5.1.6 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + find-up@4.1.0: + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + + flat-cache@4.0.1: + dependencies: + flatted: 3.3.1 + keyv: 4.5.4 + + flatted@3.3.1: {} + + foreground-child@3.3.0: + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + + fs.realpath@1.0.0: {} + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + gensync@1.0.0-beta.2: {} + + get-caller-file@2.0.5: {} + + get-package-type@0.1.0: {} + + get-stream@6.0.1: {} + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob-parent@6.0.2: + dependencies: + is-glob: 4.0.3 + + glob@10.4.5: + dependencies: + foreground-child: 3.3.0 + jackspeak: 3.4.3 + minimatch: 9.0.5 + minipass: 7.1.2 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + + glob@7.2.3: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + + globals@11.12.0: {} + + globals@14.0.0: {} + + graceful-fs@4.2.11: {} + + graphemer@1.4.0: {} + + has-flag@4.0.0: {} + + hasown@2.0.2: + dependencies: + function-bind: 1.1.2 + + html-escaper@2.0.2: {} + + human-signals@2.1.0: {} + + ignore@5.3.2: {} + + import-fresh@3.3.0: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + + import-local@3.2.0: + dependencies: + pkg-dir: 4.2.0 + resolve-cwd: 3.0.0 + + imurmurhash@0.1.4: {} + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + + inherits@2.0.4: {} + + is-arrayish@0.2.1: {} + + is-core-module@2.15.1: + dependencies: + hasown: 2.0.2 + + is-extglob@2.1.1: {} + + is-fullwidth-code-point@3.0.0: {} + + is-generator-fn@2.1.0: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-number@7.0.0: {} + + is-stream@2.0.1: {} + + isexe@2.0.0: {} + + istanbul-lib-coverage@3.2.2: {} + + istanbul-lib-instrument@5.2.1: + dependencies: + '@babel/core': 7.26.0 + '@babel/parser': 7.26.1 + '@istanbuljs/schema': 0.1.3 + istanbul-lib-coverage: 3.2.2 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + istanbul-lib-instrument@6.0.3: + dependencies: + '@babel/core': 7.26.0 + '@babel/parser': 7.26.1 + '@istanbuljs/schema': 0.1.3 + istanbul-lib-coverage: 3.2.2 + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + + istanbul-lib-report@3.0.1: + dependencies: + istanbul-lib-coverage: 3.2.2 + make-dir: 4.0.0 + supports-color: 7.2.0 + + istanbul-lib-source-maps@4.0.1: + dependencies: + debug: 4.3.7 + istanbul-lib-coverage: 3.2.2 + source-map: 0.6.1 + transitivePeerDependencies: + - supports-color + + istanbul-reports@3.1.7: + dependencies: + html-escaper: 2.0.2 + istanbul-lib-report: 3.0.1 + + jackspeak@3.4.3: + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + + jake@10.9.2: + dependencies: + async: 3.2.6 + chalk: 4.1.2 + filelist: 1.0.4 + minimatch: 3.1.2 + + jest-changed-files@29.7.0: + dependencies: + execa: 5.1.1 + jest-util: 29.7.0 + p-limit: 3.1.0 + + jest-circus@29.7.0: + dependencies: + '@jest/environment': 29.7.0 + '@jest/expect': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + chalk: 4.1.2 + co: 4.6.0 + dedent: 1.5.3 + is-generator-fn: 2.1.0 + jest-each: 29.7.0 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + p-limit: 3.1.0 + pretty-format: 29.7.0 + pure-rand: 6.1.0 + slash: 3.0.0 + stack-utils: 2.0.6 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-cli@29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)): + dependencies: + '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + chalk: 4.1.2 + create-jest: 29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + exit: 0.1.2 + import-local: 3.2.0 + jest-config: 29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + jest-util: 29.7.0 + jest-validate: 29.7.0 + yargs: 17.7.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + + jest-config@29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)): + dependencies: + '@babel/core': 7.26.0 + '@jest/test-sequencer': 29.7.0 + '@jest/types': 29.6.3 + babel-jest: 29.7.0(@babel/core@7.26.0) + chalk: 4.1.2 + ci-info: 3.9.0 + deepmerge: 4.3.1 + glob: 7.2.3 + graceful-fs: 4.2.11 + jest-circus: 29.7.0 + jest-environment-node: 29.7.0 + jest-get-type: 29.6.3 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-runner: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + micromatch: 4.0.8 + parse-json: 5.2.0 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-json-comments: 3.1.1 + optionalDependencies: + '@types/node': 22.8.1 + ts-node: 10.9.2(@types/node@22.8.1)(typescript@5.6.3) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-diff@29.7.0: + dependencies: + chalk: 4.1.2 + diff-sequences: 29.6.3 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + + jest-docblock@29.7.0: + dependencies: + detect-newline: 3.1.0 + + jest-each@29.7.0: + dependencies: + '@jest/types': 29.6.3 + chalk: 4.1.2 + jest-get-type: 29.6.3 + jest-util: 29.7.0 + pretty-format: 29.7.0 + + jest-environment-node@29.7.0: + dependencies: + '@jest/environment': 29.7.0 + '@jest/fake-timers': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + jest-mock: 29.7.0 + jest-util: 29.7.0 + + jest-get-type@29.6.3: {} + + jest-haste-map@29.7.0: + dependencies: + '@jest/types': 29.6.3 + '@types/graceful-fs': 4.1.9 + '@types/node': 22.8.1 + anymatch: 3.1.3 + fb-watchman: 2.0.2 + graceful-fs: 4.2.11 + jest-regex-util: 29.6.3 + jest-util: 29.7.0 + jest-worker: 29.7.0 + micromatch: 4.0.8 + walker: 1.0.8 + optionalDependencies: + fsevents: 2.3.3 + + jest-leak-detector@29.7.0: + dependencies: + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + + jest-matcher-utils@29.7.0: + dependencies: + chalk: 4.1.2 + jest-diff: 29.7.0 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + + jest-message-util@29.7.0: + dependencies: + '@babel/code-frame': 7.26.0 + '@jest/types': 29.6.3 + '@types/stack-utils': 2.0.3 + chalk: 4.1.2 + graceful-fs: 4.2.11 + micromatch: 4.0.8 + pretty-format: 29.7.0 + slash: 3.0.0 + stack-utils: 2.0.6 + + jest-mock@29.7.0: + dependencies: + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + jest-util: 29.7.0 + + jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): + optionalDependencies: + jest-resolve: 29.7.0 + + jest-regex-util@29.6.3: {} + + jest-resolve-dependencies@29.7.0: + dependencies: + jest-regex-util: 29.6.3 + jest-snapshot: 29.7.0 + transitivePeerDependencies: + - supports-color + + jest-resolve@29.7.0: + dependencies: + chalk: 4.1.2 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + jest-pnp-resolver: 1.2.3(jest-resolve@29.7.0) + jest-util: 29.7.0 + jest-validate: 29.7.0 + resolve: 1.22.8 + resolve.exports: 2.0.2 + slash: 3.0.0 + + jest-runner@29.7.0: + dependencies: + '@jest/console': 29.7.0 + '@jest/environment': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + chalk: 4.1.2 + emittery: 0.13.1 + graceful-fs: 4.2.11 + jest-docblock: 29.7.0 + jest-environment-node: 29.7.0 + jest-haste-map: 29.7.0 + jest-leak-detector: 29.7.0 + jest-message-util: 29.7.0 + jest-resolve: 29.7.0 + jest-runtime: 29.7.0 + jest-util: 29.7.0 + jest-watcher: 29.7.0 + jest-worker: 29.7.0 + p-limit: 3.1.0 + source-map-support: 0.5.13 + transitivePeerDependencies: + - supports-color + + jest-runtime@29.7.0: + dependencies: + '@jest/environment': 29.7.0 + '@jest/fake-timers': 29.7.0 + '@jest/globals': 29.7.0 + '@jest/source-map': 29.6.3 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + chalk: 4.1.2 + cjs-module-lexer: 1.4.1 + collect-v8-coverage: 1.0.2 + glob: 7.2.3 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-mock: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + slash: 3.0.0 + strip-bom: 4.0.0 + transitivePeerDependencies: + - supports-color + + jest-snapshot@29.7.0: + dependencies: + '@babel/core': 7.26.0 + '@babel/generator': 7.26.0 + '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-syntax-typescript': 7.25.9(@babel/core@7.26.0) + '@babel/types': 7.26.0 + '@jest/expect-utils': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + babel-preset-current-node-syntax: 1.1.0(@babel/core@7.26.0) + chalk: 4.1.2 + expect: 29.7.0 + graceful-fs: 4.2.11 + jest-diff: 29.7.0 + jest-get-type: 29.6.3 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + natural-compare: 1.4.0 + pretty-format: 29.7.0 + semver: 7.6.3 + transitivePeerDependencies: + - supports-color + + jest-util@29.7.0: + dependencies: + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + chalk: 4.1.2 + ci-info: 3.9.0 + graceful-fs: 4.2.11 + picomatch: 2.3.1 + + jest-validate@29.7.0: + dependencies: + '@jest/types': 29.6.3 + camelcase: 6.3.0 + chalk: 4.1.2 + jest-get-type: 29.6.3 + leven: 3.1.0 + pretty-format: 29.7.0 + + jest-watcher@29.7.0: + dependencies: + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 22.8.1 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + emittery: 0.13.1 + jest-util: 29.7.0 + string-length: 4.0.2 + + jest-worker@29.7.0: + dependencies: + '@types/node': 22.8.1 + jest-util: 29.7.0 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + jest@29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)): + dependencies: + '@jest/core': 29.7.0(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + '@jest/types': 29.6.3 + import-local: 3.2.0 + jest-cli: 29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + + js-tokens@4.0.0: {} + + js-yaml@3.14.1: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + + js-yaml@4.1.0: + dependencies: + argparse: 2.0.1 + + jsesc@3.0.2: {} + + json-buffer@3.0.1: {} + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@0.4.1: {} + + json-stable-stringify-without-jsonify@1.0.1: {} + + json5@2.2.3: {} + + keyv@4.5.4: + dependencies: + json-buffer: 3.0.1 + + kleur@3.0.3: {} + + leven@3.1.0: {} + + levn@0.4.1: + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + + lines-and-columns@1.2.4: {} + + locate-path@5.0.0: + dependencies: + p-locate: 4.1.0 + + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + + lodash.memoize@4.1.2: {} + + lodash.merge@4.6.2: {} + + lru-cache@10.4.3: {} + + lru-cache@5.1.1: + dependencies: + yallist: 3.1.1 + + make-dir@4.0.0: + dependencies: + semver: 7.6.3 + + make-error@1.3.6: {} + + makeerror@1.0.12: + dependencies: + tmpl: 1.0.5 + + merge-stream@2.0.0: {} + + merge2@1.4.1: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.1 + + mimic-fn@2.1.0: {} + + minimatch@3.1.2: + dependencies: + brace-expansion: 1.1.11 + + minimatch@5.1.6: + dependencies: + brace-expansion: 2.0.1 + + minimatch@9.0.5: + dependencies: + brace-expansion: 2.0.1 + + minipass@7.1.2: {} + + minizlib@3.0.1: + dependencies: + minipass: 7.1.2 + rimraf: 5.0.10 + + mkdirp@3.0.1: {} + + ms@2.1.3: {} + + natural-compare@1.4.0: {} + + node-int64@0.4.0: {} + + node-releases@2.0.18: {} + + normalize-path@3.0.0: {} + + npm-run-path@4.0.1: + dependencies: + path-key: 3.1.1 + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + + optionator@0.9.4: + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.5 + + p-limit@2.3.0: + dependencies: + p-try: 2.2.0 + + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@4.1.0: + dependencies: + p-limit: 2.3.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + + p-try@2.2.0: {} + + package-json-from-dist@1.0.1: {} + + parent-module@1.0.1: + dependencies: + callsites: 3.1.0 + + parse-json@5.2.0: + dependencies: + '@babel/code-frame': 7.26.0 + error-ex: 1.3.2 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + + path-exists@4.0.0: {} + + path-is-absolute@1.0.1: {} + + path-key@3.1.1: {} + + path-parse@1.0.7: {} + + path-scurry@1.11.1: + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.2 + + picocolors@1.1.1: {} + + picomatch@2.3.1: {} + + pirates@4.0.6: {} + + pkg-dir@4.2.0: + dependencies: + find-up: 4.1.0 + + prelude-ls@1.2.1: {} + + prettier@3.3.3: {} + + pretty-format@29.7.0: + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.3.1 + + prompts@2.4.2: + dependencies: + kleur: 3.0.3 + sisteransi: 1.0.5 + + punycode@2.3.1: {} + + pure-rand@6.1.0: {} + + queue-microtask@1.2.3: {} + + react-is@18.3.1: {} + + require-directory@2.1.1: {} + + resolve-cwd@3.0.0: + dependencies: + resolve-from: 5.0.0 + + resolve-from@4.0.0: {} + + resolve-from@5.0.0: {} + + resolve.exports@2.0.2: {} + + resolve@1.22.8: + dependencies: + is-core-module: 2.15.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + + reusify@1.0.4: {} + + rimraf@5.0.10: + dependencies: + glob: 10.4.5 + + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + + semver@6.3.1: {} + + semver@7.6.3: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + signal-exit@3.0.7: {} + + signal-exit@4.1.0: {} + + sisteransi@1.0.5: {} + + slash@3.0.0: {} + + source-map-support@0.5.13: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + sprintf-js@1.0.3: {} + + stack-utils@2.0.6: + dependencies: + escape-string-regexp: 2.0.0 + + string-length@4.0.2: + dependencies: + char-regex: 1.0.2 + strip-ansi: 6.0.1 + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string-width@5.1.2: + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.1.0 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-ansi@7.1.0: + dependencies: + ansi-regex: 6.1.0 + + strip-bom@4.0.0: {} + + strip-final-newline@2.0.0: {} + + strip-json-comments@3.1.1: {} + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + supports-preserve-symlinks-flag@1.0.0: {} + + tar@7.4.3: + dependencies: + '@isaacs/fs-minipass': 4.0.1 + chownr: 3.0.0 + minipass: 7.1.2 + minizlib: 3.0.1 + mkdirp: 3.0.1 + yallist: 5.0.0 + + test-exclude@6.0.0: + dependencies: + '@istanbuljs/schema': 0.1.3 + glob: 7.2.3 + minimatch: 3.1.2 + + text-table@0.2.0: {} + + tmpl@1.0.5: {} + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + ts-api-utils@1.3.0(typescript@5.6.3): + dependencies: + typescript: 5.6.3 + + ts-jest@29.2.5(@babel/core@7.26.0)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.0))(jest@29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)))(typescript@5.6.3): + dependencies: + bs-logger: 0.2.6 + ejs: 3.1.10 + fast-json-stable-stringify: 2.1.0 + jest: 29.7.0(@types/node@22.8.1)(ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3)) + jest-util: 29.7.0 + json5: 2.2.3 + lodash.memoize: 4.1.2 + make-error: 1.3.6 + semver: 7.6.3 + typescript: 5.6.3 + yargs-parser: 21.1.1 + optionalDependencies: + '@babel/core': 7.26.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + babel-jest: 29.7.0(@babel/core@7.26.0) + + ts-node@10.9.2(@types/node@22.8.1)(typescript@5.6.3): + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.11 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 22.8.1 + acorn: 8.14.0 + acorn-walk: 8.3.4 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.6.3 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + + tunnel@0.0.6: {} + + type-check@0.4.0: + dependencies: + prelude-ls: 1.2.1 + + type-detect@4.0.8: {} + + type-fest@0.21.3: {} + + typescript-eslint@8.12.0(eslint@9.13.0)(typescript@5.6.3): + dependencies: + '@typescript-eslint/eslint-plugin': 8.12.0(@typescript-eslint/parser@8.12.0(eslint@9.13.0)(typescript@5.6.3))(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/parser': 8.12.0(eslint@9.13.0)(typescript@5.6.3) + '@typescript-eslint/utils': 8.12.0(eslint@9.13.0)(typescript@5.6.3) + optionalDependencies: + typescript: 5.6.3 + transitivePeerDependencies: + - eslint + - supports-color + + typescript@5.6.3: {} + + undici-types@6.19.8: {} + + undici@5.28.4: + dependencies: + '@fastify/busboy': 2.1.1 + + universal-user-agent@6.0.1: {} + + universal-user-agent@7.0.2: {} + + update-browserslist-db@1.1.1(browserslist@4.24.2): + dependencies: + browserslist: 4.24.2 + escalade: 3.2.0 + picocolors: 1.1.1 + + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + + v8-compile-cache-lib@3.0.1: {} + + v8-to-istanbul@9.3.0: + dependencies: + '@jridgewell/trace-mapping': 0.3.25 + '@types/istanbul-lib-coverage': 2.0.6 + convert-source-map: 2.0.0 + + walker@1.0.8: + dependencies: + makeerror: 1.0.12 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + word-wrap@1.2.5: {} + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@8.1.0: + dependencies: + ansi-styles: 6.2.1 + string-width: 5.1.2 + strip-ansi: 7.1.0 + + wrappy@1.0.2: {} + + write-file-atomic@4.0.2: + dependencies: + imurmurhash: 0.1.4 + signal-exit: 3.0.7 + + y18n@5.0.8: {} + + yallist@3.1.1: {} + + yallist@5.0.0: {} + + yargs-parser@21.1.1: {} + + yargs@17.7.2: + dependencies: + cliui: 8.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + + yn@3.1.1: {} + + yocto-queue@0.1.0: {} diff --git a/scripts/add.js b/scripts/add.js deleted file mode 100644 index 0c4fc2b6..00000000 --- a/scripts/add.js +++ /dev/null @@ -1,179 +0,0 @@ -const path = require('path'); -const fs = require('fs'); -const crypto = require('crypto'); -const tls = require('tls'); -const ota = require('../lib/ota'); -const filenameOrURL = process.argv[2]; -const modelId = process.argv[3]; -const baseURL = 'https://github.com/Koenkk/zigbee-OTA/raw/master'; -const caCerts = './cacerts.pem'; - -const manufacturerNameLookup = { - 123: 'UHome', - 4098: 'Tuya', - 4107: 'Hue', - 4117: 'Develco', - 4129: 'Legrand', - 4151: 'Jennic', - 4190: 'SchneiderElectric', - 4364: 'Osram', - 4405: 'DresdenElektronik', - 4417: 'Telink', - 4420: 'Lutron', - 4444: 'Danalock', - 4447: 'Lumi', - 4448: 'Sengled', - 4454: 'Innr', - 4456: 'Perenio', - 4474: 'Insta', - 4476: 'IKEA', - 4489: 'Ledvance', - 4617: 'Bosch', - 4644: 'Namron', - 4648: 'Terncy', - 4655: 'Inovelli', - 4659: 'ThirdReality', - 4678: 'Danfoss', - 4687: 'Gledopto', - 4714: 'EcoDim', - 4742: 'Sonoff', - 4747: 'NodOn', - 4919: 'Datek', - 10132: 'ClimaxTechnology', - 26214: 'Sprut.device', - 4877: 'thirdreality', - 4636: 'Aurora', - 56085: 'DIY', - 5127: '3R', - 13379: 'xyzroe', -}; - -const main = async () => { - if (!filenameOrURL) { - throw new Error('Please provide a filename or URL'); - } - - const isURL = filenameOrURL.toLowerCase().startsWith("http"); - const files = []; - - if (isURL) { - const downloadFile = async (url, path) => { - const lib = url.toLowerCase().startsWith("https") ? require('https') : require('http'); - const file = fs.createWriteStream(path); - - return new Promise((resolve, reject) => { - const ca = [...tls.rootCertificates]; - if(fs.existsSync(caCerts)) { - ca.push(fs.readFileSync(caCerts)); - } - const request = lib.get(url, { ca }, function(response) { - if (response.statusCode >= 200 && response.statusCode < 300) { - response.pipe(file); - file.on('finish', function() { - file.close(function() { - resolve(); - }); - }); - } else if (response.headers.location) { - resolve(downloadFile(response.headers.location, path)); - } else { - reject(new Error(response.statusCode + ' ' + response.statusMessage)); - } - }); - }); - } - - const file = path.resolve("temp"); - await downloadFile(filenameOrURL, file); - files.push(file); - } else { - const file = path.resolve(filenameOrURL); - if (fs.lstatSync(file).isFile()) { - if (!fs.existsSync(file)) { - throw new Error(`${file} does not exist`); - } - files.push(file); - } else { - const otaExtension = ['.ota', '.zigbee']; - const otasInDirectory = fs.readdirSync(file) - .filter((f) => otaExtension.includes(path.extname(f).toLowerCase())) - .map((f) => path.join(file, f)); - files.push(...otasInDirectory); - } - } - - for (const file of files) { - const buffer = fs.readFileSync(file); - const parsed = ota.parseImage(buffer); - - if (!manufacturerNameLookup[parsed.header.manufacturerCode]) { - throw new Error(`${parsed.header.manufacturerCode} not in manufacturerNameLookup (please add it)`); - } - - const manufacturerName = manufacturerNameLookup[parsed.header.manufacturerCode]; - const indexJSON = JSON.parse(fs.readFileSync('index.json')); - const destination = path.join('images', manufacturerName, path.basename(file)); - - const hash = crypto.createHash('sha512'); - hash.update(buffer); - - const entry = { - fileVersion: parsed.header.fileVersion, - fileSize: parsed.header.totalImageSize, - manufacturerCode: parsed.header.manufacturerCode, - imageType: parsed.header.imageType, - sha512: hash.digest('hex'), - }; - - if (modelId) { - entry.modelId = modelId; - } - - if (isURL) { - entry.url = filenameOrURL; - } else { - const destinationPosix = destination.replace(/\\/g, '/'); - entry.url = `${baseURL}/${escape(destinationPosix)}`; - entry.path = destinationPosix; - } - - const index = indexJSON.findIndex((i) => { - return i.manufacturerCode === entry.manufacturerCode && i.imageType === entry.imageType && (!i.modelId || i.modelId === entry.modelId) - }); - - if (index !== -1) { - console.log(`Updated existing entry (${JSON.stringify(entry)})`); - indexJSON[index] = {...indexJSON[index], ...entry}; - - if (entry.path && entry.path !== destination) { - try { - fs.unlinkSync(path.resolve(entry.path)); - } catch (err) { - if (err && err.code != 'ENOENT') { - console.error("Error in call to fs.unlink", err); - throw err; - } - } - } - } else { - console.log(`Added new entry (${JSON.stringify(entry)})`); - indexJSON.push(entry); - } - - if (!isURL && file !== path.resolve(destination)) { - if (!fs.existsSync(path.dirname(destination))) { - fs.mkdirSync(path.dirname(destination)); - } - - fs.copyFileSync(file, destination); - } - - fs.writeFileSync('index.json', JSON.stringify(indexJSON, null, ' ')); - - if (isURL) { - fs.unlinkSync(file); - } - } -} - -main(); diff --git a/scripts/updateall.js b/scripts/updateall.js deleted file mode 100644 index 76718206..00000000 --- a/scripts/updateall.js +++ /dev/null @@ -1,29 +0,0 @@ -const child_process = require('child_process'); -const fs = require('fs'); -const path = require('path'); - -const concatCaCerts = (folder = 'cacerts', outputFilename = 'cacerts.pem') => { - const files = fs.readdirSync(folder); - - const caCertFiles = files.filter((file) => path.extname(file) === '.pem'); - const outputFile = fs.openSync(outputFilename, 'w'); - - caCertFiles.forEach((caCert) => { - const filePath = path.join(folder, caCert); - const fileContent = fs.readFileSync(filePath, 'utf8'); - fs.appendFileSync(outputFile, fileContent + '\n'); - }); -}; - -const main = async () => { - concatCaCerts(); - const indexJSON = JSON.parse(fs.readFileSync('index.json')); - indexJSON.forEach(entry => { - const result = child_process.execSync(`node ./scripts/add.js "${entry.path || entry.url}" "${entry.modelId || ''}"`, { - cwd: path.dirname(__dirname) - }) - console.log(result.toString()) - }) -} - -return main(); diff --git a/src/autodl/github.ts b/src/autodl/github.ts new file mode 100644 index 00000000..1485ea14 --- /dev/null +++ b/src/autodl/github.ts @@ -0,0 +1,95 @@ +import {getJson, getLatestImage, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; + +type ReleaseAssetJson = { + url: string; + id: number; + node_id: string; + name: string; + label: null; + uploader: Record; + content_type: string; + state: string; + size: number; + download_count: number; + created_at: string; + updated_at: string; + browser_download_url: string; +}; +type ReleaseJson = { + url: string; + assets_url: string; + upload_url: string; + html_url: string; + id: number; + author: Record; + node_id: string; + tag_name: string; + target_commitish: string; + name: string; + draft: false; + prerelease: false; + created_at: string; + published_at: string; + assets: ReleaseAssetJson[]; + tarball_url: string; + zipball_url: string; + body: string; + reactions: Record; +}; +type ReleasesJson = ReleaseJson[]; +type AssetFindPredicate = (value: ReleaseAssetJson, index: number, obj: ReleaseAssetJson[]) => unknown; + +function sortByPublishedAt(a: ReleaseJson, b: ReleaseJson): number { + return a.published_at < b.published_at ? -1 : a.published_at > b.published_at ? 1 : 0; +} + +function isDifferent(newData: ReleaseAssetJson, cachedData?: ReleaseAssetJson): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.updated_at !== newData.updated_at; +} + +export async function writeCache(manufacturer: string, releasesUrl: string): Promise { + const releases = await getJson(manufacturer, releasesUrl); + + if (releases?.length) { + writeCacheJson(manufacturer, releases); + } +} + +export async function download(manufacturer: string, releasesUrl: string, assetFinders: AssetFindPredicate[]): Promise { + const logPrefix = `[${manufacturer}]`; + const releases = await getJson(manufacturer, releasesUrl); + + if (releases?.length) { + const release = getLatestImage(releases, sortByPublishedAt); + + if (release) { + const cachedData = readCacheJson(manufacturer); + const cached = cachedData?.length ? getLatestImage(cachedData, sortByPublishedAt) : undefined; + + for (const assetFinder of assetFinders) { + const asset = release.assets.find(assetFinder); + + if (asset) { + const cachedAsset = cached?.assets.find(assetFinder); + + if (!isDifferent(asset, cachedAsset)) { + console.log(`[${manufacturer}:${asset.name}] No change from last run.`); + continue; + } + + await processFirmwareImage(manufacturer, asset.name, asset.browser_download_url, { + manufacturerName: [manufacturer], + releaseNotes: release.html_url, + }); + } else { + console.error(`${logPrefix} No image found.`); + } + } + } else { + console.error(`${logPrefix} No release found.`); + } + + writeCacheJson(manufacturer, releases); + } +} diff --git a/src/autodl/gmmts.ts b/src/autodl/gmmts.ts new file mode 100644 index 00000000..c56809c8 --- /dev/null +++ b/src/autodl/gmmts.ts @@ -0,0 +1,76 @@ +import {getJson, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; + +type ImagesJsonBuildPart = { + path: string; // .bin + offset: number; + type?: 'app' | 'storage'; + ota?: string; // .ota +}; +type ImagesJsonBuild = { + chipFamily: string; + target: string; + parts: ImagesJsonBuildPart[]; +}; +type ImagesJson = { + name: string; + version: string; + home_assistant_domain: string; + funding_url: string; + new_install_prompt_erase: boolean; + builds: ImagesJsonBuild[]; +}; + +const NAME = 'Gmmts'; +// const LOG_PREFIX = `[${NAME}]`; +const BASE_URL = 'https://update.gammatroniques.fr/'; +const MANIFEST_URL_PATH = `/manifest.json`; +const MODEL_IDS = ['ticmeter']; + +function isDifferent(newData: ImagesJson, cachedData?: ImagesJson): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.version !== newData.version; +} + +export async function writeCache(): Promise { + for (const modelId of MODEL_IDS) { + const url = `${BASE_URL}${modelId}${MANIFEST_URL_PATH}`; + const page = await getJson(NAME, url); + + if (page?.builds?.length) { + writeCacheJson(`${NAME}_${modelId}`, page); + } + } +} + +export async function download(): Promise { + for (const modelId of MODEL_IDS) { + const logPrefix = `[${NAME}:${modelId}]`; + const url = `${BASE_URL}${modelId}${MANIFEST_URL_PATH}`; + const page = await getJson(NAME, url); + + if (!page?.builds?.length) { + console.error(`${logPrefix} No image data.`); + continue; + } + + const cacheFileName = `${NAME}_${modelId}`; + + if (!isDifferent(page, readCacheJson(cacheFileName))) { + console.log(`${logPrefix} No change from last run.`); + continue; + } + + writeCacheJson(cacheFileName, page); + + const appUrl: ImagesJsonBuildPart | undefined = page.builds[0].parts.find((part) => part.type === 'app'); + + if (!appUrl || !appUrl.ota) { + console.error(`${logPrefix} No image found.`); + continue; + } + + const firmwareFileName = appUrl.ota.split('/').pop()!; + + await processFirmwareImage(NAME, firmwareFileName, appUrl.ota, {manufacturerName: [NAME]}); + } +} diff --git a/src/autodl/ikea.ts b/src/autodl/ikea.ts new file mode 100644 index 00000000..ba129258 --- /dev/null +++ b/src/autodl/ikea.ts @@ -0,0 +1,84 @@ +import {getJson, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; + +type GatewayImageJson = { + fw_binary_url: string; + fw_filesize: number; + fw_hotfix_version: number; + fw_major_version: number; + fw_minor_version: number; + fw_req_hotfix_version: number; + fw_req_major_version: number; + fw_req_minor_version: number; + fw_type: 0; + fw_update_prio: number; + fw_weblink_relnote: string; +}; +type DeviceImageJson = { + fw_binary_url: string; + fw_file_version_LSB: number; + fw_file_version_MSB: number; + fw_filesize: number; + fw_image_type: number; + fw_manufacturer_id: number; + fw_type: 2; +}; +type ImagesJson = (GatewayImageJson | DeviceImageJson)[]; + +const NAME = 'IKEA'; +const LOG_PREFIX = `[${NAME}]`; +const PRODUCTION_FIRMWARE_URL = 'http://fw.ota.homesmart.ikea.net/feed/version_info.json'; +// const TEST_FIRMWARE_URL = 'http://fw.test.ota.homesmart.ikea.net/feed/version_info.json'; +export const RELEASE_NOTES_URL = 'https://ww8.ikea.com/ikeahomesmart/releasenotes/releasenotes.html'; + +function findInCache(image: DeviceImageJson, cachedData?: ImagesJson): DeviceImageJson | undefined { + // `fw_type` compare ensures always `DeviceImagesJson` + return cachedData?.find( + (d) => d.fw_type == image.fw_type && d.fw_image_type == image.fw_image_type && d.fw_manufacturer_id == image.fw_manufacturer_id, + ) as DeviceImageJson | undefined; +} + +function isDifferent(newData: DeviceImageJson, cachedData?: DeviceImageJson): boolean { + return ( + Boolean(process.env.IGNORE_CACHE) || + !cachedData || + cachedData.fw_file_version_LSB !== newData.fw_file_version_LSB || + cachedData.fw_file_version_MSB !== newData.fw_file_version_MSB + ); +} + +export async function writeCache(): Promise { + const images = await getJson(NAME, PRODUCTION_FIRMWARE_URL); + + if (images?.length) { + writeCacheJson(NAME, images); + } +} + +export async function download(): Promise { + const images = await getJson(NAME, PRODUCTION_FIRMWARE_URL); + + if (images?.length) { + const cachedData = readCacheJson(NAME); + + for (const image of images) { + if (image.fw_type !== 2) { + // ignore gateway firmware + continue; + } + + const firmwareFileName = image.fw_binary_url.split('/').pop()!; + + if (!isDifferent(image, findInCache(image, cachedData))) { + console.log(`[${NAME}:${firmwareFileName}] No change from last run.`); + continue; + } + + await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, {manufacturerName: [NAME], releaseNotes: RELEASE_NOTES_URL}); + } + + writeCacheJson(NAME, images); + } else { + console.error(`${LOG_PREFIX} No image data.`); + } +} diff --git a/src/autodl/ikea_new.ts b/src/autodl/ikea_new.ts new file mode 100644 index 00000000..f08cb78f --- /dev/null +++ b/src/autodl/ikea_new.ts @@ -0,0 +1,75 @@ +import {getJson, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; +import {RELEASE_NOTES_URL} from './ikea.js'; + +type GatewayImageJson = { + fw_type: 3; + fw_sha3_256: string; + fw_binary_url: string; + fw_update_prio: number; + fw_filesize: number; + fw_minor_version: number; + fw_major_version: number; + fw_hotfix_version: number; + fw_binary_checksum: string; +}; +type DeviceImageJson = { + fw_image_type: number; + fw_type: 2; + fw_sha3_256: string; + fw_binary_url: string; +}; + +type ImagesJson = (GatewayImageJson | DeviceImageJson)[]; + +// same name as `ikea.ts` to keep everything in same folder +const NAME = 'IKEA'; +const CACHE_FILENAME = `${NAME}_new`; +const LOG_PREFIX = `[${NAME}_new]`; +// requires cacerts/ikea_new.pem +const FIRMWARE_URL = 'https://fw.ota.homesmart.ikea.com/check/update/prod'; + +function findInCache(image: DeviceImageJson, cachedData?: ImagesJson): DeviceImageJson | undefined { + // `fw_type` compare ensures always `DeviceImagesJson` + return cachedData?.find((d) => d.fw_type == image.fw_type && d.fw_image_type == image.fw_image_type) as DeviceImageJson | undefined; +} + +function isDifferent(newData: DeviceImageJson, cachedData?: DeviceImageJson): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.fw_sha3_256 !== newData.fw_sha3_256; +} + +export async function writeCache(): Promise { + const images = await getJson(NAME, FIRMWARE_URL); + + if (images?.length) { + writeCacheJson(CACHE_FILENAME, images); + } +} + +export async function download(): Promise { + const images = await getJson(NAME, FIRMWARE_URL); + + if (images?.length) { + const cachedData = readCacheJson(CACHE_FILENAME); + + for (const image of images) { + if (image.fw_type !== 2) { + // ignore gateway firmware + continue; + } + + const firmwareFileName = image.fw_binary_url.split('/').pop()!; + + if (!isDifferent(image, findInCache(image, cachedData))) { + console.log(`[${NAME}:${firmwareFileName}] No change from last run.`); + continue; + } + + await processFirmwareImage(NAME, firmwareFileName, image.fw_binary_url, {manufacturerName: [NAME], releaseNotes: RELEASE_NOTES_URL}); + } + + writeCacheJson(CACHE_FILENAME, images); + } else { + console.error(`${LOG_PREFIX} No image data.`); + } +} diff --git a/src/autodl/inovelli.ts b/src/autodl/inovelli.ts new file mode 100644 index 00000000..ccff2571 --- /dev/null +++ b/src/autodl/inovelli.ts @@ -0,0 +1,72 @@ +import {getJson, getLatestImage, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; + +type DeviceImageJson = { + version: string; + channel: 'beta' | 'production'; + firmware: string; + manufacturer_id: number; + image_type: number; +}; +type ModelsJson = { + [k: string]: DeviceImageJson[]; +}; + +const NAME = 'Inovelli'; +const LOG_PREFIX = `[${NAME}]`; +const FIRMWARE_URL = 'https://files.inovelli.com/firmware/firmware.json'; + +function sortByVersion(a: DeviceImageJson, b: DeviceImageJson): number { + const aRadix = a.version.match(/[a-fA-F]/) ? 16 : 10; + const bRadix = b.version.match(/[a-fA-F]/) ? 16 : 10; + const aVersion = parseInt(a.version, aRadix); + const bVersion = parseInt(b.version, bRadix); + + return aVersion < bVersion ? -1 : aVersion > bVersion ? 1 : 0; +} + +function isDifferent(newData: DeviceImageJson, cachedData?: DeviceImageJson): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.version !== newData.version; +} + +export async function writeCache(): Promise { + const models = await getJson(NAME, FIRMWARE_URL); + + if (models) { + writeCacheJson(NAME, models); + } +} + +export async function download(): Promise { + const models = await getJson(NAME, FIRMWARE_URL); + + if (models) { + const cachedData = readCacheJson(NAME); + + for (const model in models) { + if (model == '') { + // ignore empty key (bug) + continue; + } + + const image = getLatestImage(models[model], sortByVersion); + + if (!image) { + continue; + } + + const firmwareFileName = image.firmware.split('/').pop()!; + + if (cachedData && !isDifferent(image, getLatestImage(cachedData[model], sortByVersion))) { + console.log(`[${NAME}:${firmwareFileName}] No change from last run.`); + continue; + } + + await processFirmwareImage(NAME, firmwareFileName, image.firmware, {manufacturerName: [NAME]}); + } + + writeCacheJson(NAME, models); + } else { + console.error(`${LOG_PREFIX} No image data.`); + } +} diff --git a/src/autodl/jethome.ts b/src/autodl/jethome.ts new file mode 100644 index 00000000..b0643d45 --- /dev/null +++ b/src/autodl/jethome.ts @@ -0,0 +1,91 @@ +import {getJson, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; + +type ImageJson = { + vendor: string; + vendor_name: string; + device: string; + device_name: string; + platform: string; + platform_name: string; + latest_firmware: { + release: { + version: string; + date: string; + images: { + 'zigbee.ota': { + url: string; + hash: string; + filesize: number; + }; + 'zigbee.bin': { + url: string; + hash: string; + filesize: number; + }; + }; + changelog: string; + }; + }; +}; + +const NAME = 'Jethome'; +const LOG_PREFIX = `[${NAME}]`; +const BASE_URL = 'https://fw.jethome.ru'; +const DEVICE_URL = `${BASE_URL}/api/devices/`; + +const MODEL_IDS = ['WS7']; + +function getCacheFileName(modelId: string): string { + return `${NAME}_${modelId}`; +} + +function isDifferent(newData: ImageJson, cachedData?: ImageJson): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.latest_firmware.release.version !== newData.latest_firmware.release.version; +} + +export async function writeCache(): Promise { + for (const modelId of MODEL_IDS) { + const url = `${DEVICE_URL}${modelId}/info`; + const image = await getJson(NAME, url); + + if (image?.latest_firmware?.release?.images) { + writeCacheJson(getCacheFileName(modelId), image); + } + } +} + +export async function download(): Promise { + for (const modelId of MODEL_IDS) { + const url = `${DEVICE_URL}${modelId}/info`; + const image = await getJson(NAME, url); + + // XXX: this is assumed to always be present even for devices that support OTA but without images yet available? + if (image?.latest_firmware?.release?.images) { + const firmware = image.latest_firmware.release.images['zigbee.ota']; + + if (!firmware) { + continue; + } + + const firmwareUrl = BASE_URL + firmware.url; + const firmwareFileName = firmwareUrl.split('/').pop()!; + const cacheFileName = getCacheFileName(modelId); + + if (!isDifferent(image, readCacheJson(cacheFileName))) { + console.log(`[${NAME}:${firmwareFileName}] No change from last run.`); + continue; + } + + writeCacheJson(cacheFileName, image); + + await processFirmwareImage(NAME, firmwareFileName, firmwareUrl, { + manufacturerName: [NAME], + releaseNotes: BASE_URL + image.latest_firmware.release.changelog, + }); + } else { + console.error(`${LOG_PREFIX} No image data for ${modelId}.`); + continue; + } + } +} diff --git a/src/autodl/ledvance.ts b/src/autodl/ledvance.ts new file mode 100644 index 00000000..68cc47e2 --- /dev/null +++ b/src/autodl/ledvance.ts @@ -0,0 +1,128 @@ +import {getJson, getLatestImage, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage, ProcessFirmwareImageStatus} from '../process_firmware_image.js'; + +type FirmwareJson = { + blob: null; + identity: { + company: number; + product: number; + version: { + major: number; + minor: number; + build: number; + revision: number; + }; + }; + releaseNotes: string; + /** Ledvance's API docs state the checksum should be `sha_256` but it is actually `shA256` */ + shA256: string; + name: string; + productName: string; + /** + * The fileVersion in hex is included in the fullName between the `/`, e.g.: + * - PLUG COMPACT EU T/032b3674/PLUG_COMPACT_EU_T-0x00D6-0x032B3674-MF_DIS.OTA + * - A19 RGBW/00102428/A19_RGBW_IMG0019_00102428-encrypted.ota + */ + fullName: string; + extension: string; + released: string; + salesRegion: string; + length: number; +}; +type ImagesJson = { + firmwares: FirmwareJson[]; +}; +type GroupedImagesJson = Record; + +const NAME = 'Ledvance'; +const LOG_PREFIX = `[${NAME}]`; +const FIRMWARE_URL = 'https://api.update.ledvance.com/v1/zigbee/firmwares/'; +// const UPDATE_CHECK_URL = 'https://api.update.ledvance.com/v1/zigbee/firmwares/newer'; +// const UPDATE_CHECK_PARAMS = `?company=${manufCode}&product=${imageType}&version=0.0.0`; +const UPDATE_DOWNLOAD_URL = 'https://api.update.ledvance.com/v1/zigbee/firmwares/download'; +/** XXX: getting 429 after a few downloads, force more throttling. Seems to trigger after around ~20 requests. */ +const FETCH_FAILED_THROTTLE_MS = 60000; +const FETCH_FAILED_RETRIES = 3; + +function groupByProduct(arr: FirmwareJson[]): GroupedImagesJson { + return arr.reduce((acc, cur) => { + acc[cur.identity.product] = [...(acc[cur.identity.product] || []), cur]; + return acc; + }, {}); +} + +function sortByReleased(a: FirmwareJson, b: FirmwareJson): number { + return a.released < b.released ? -1 : a.released > b.released ? 1 : 0; +} + +function getVersionString(firmware: FirmwareJson): string { + const {major, minor, build, revision} = firmware.identity.version; + + return `${major}.${minor}.${build}.${revision}`; +} + +function isDifferent(newData: FirmwareJson, cachedData?: FirmwareJson): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || getVersionString(cachedData) !== getVersionString(newData); +} + +export async function writeCache(): Promise { + const images = await getJson(NAME, FIRMWARE_URL); + + if (images?.firmwares?.length) { + writeCacheJson(NAME, images); + } +} + +export async function download(): Promise { + const images = await getJson(NAME, FIRMWARE_URL); + + if (images?.firmwares?.length) { + const cachedData = readCacheJson(NAME); + const cachedDataByProduct = cachedData?.firmwares?.length ? groupByProduct(cachedData.firmwares) : undefined; + const firmwareByProduct = groupByProduct(images.firmwares); + + for (const product in firmwareByProduct) { + const firmware = getLatestImage(firmwareByProduct[product], sortByReleased); + + if (!firmware) { + console.error(`${LOG_PREFIX} No image found for ${product}.`); + continue; + } + + const fileVersionMatch = /\/(\d|\w+)\//.exec(firmware.fullName); + + if (fileVersionMatch == null) { + // ignore possible unsupported patterns + continue; + } + + // const fileVersion = parseInt(fileVersionMatch[1], 16); + const firmwareUrl = `${UPDATE_DOWNLOAD_URL}?company=${firmware.identity.company}&product=${firmware.identity.product}&version=${getVersionString(firmware)}`; + const firmwareFileName = firmware.fullName.split('/').pop()!; + + if (cachedDataByProduct && !isDifferent(firmware, getLatestImage(cachedDataByProduct[product], sortByReleased))) { + console.log(`[${NAME}:${firmwareFileName}] No change from last run.`); + continue; + } + + for (let i = 0; i < FETCH_FAILED_RETRIES; i++) { + const status = await processFirmwareImage(NAME, firmwareFileName, firmwareUrl, { + manufacturerName: [NAME], + // workflow automatically computes sha512 + // sha256: firmware.shA256, + releaseNotes: firmware.releaseNotes, + }); + + if (status === ProcessFirmwareImageStatus.REQUEST_FAILED) { + await new Promise((resolve) => setTimeout(resolve, FETCH_FAILED_THROTTLE_MS)); + } else { + break; + } + } + } + + writeCacheJson(NAME, images); + } else { + console.error(`${LOG_PREFIX} No image data.`); + } +} diff --git a/src/autodl/lixee.ts b/src/autodl/lixee.ts new file mode 100644 index 00000000..c52cdff6 --- /dev/null +++ b/src/autodl/lixee.ts @@ -0,0 +1,15 @@ +import * as github from './github.js'; + +const NAME = 'Lixee'; +const FIRMWARE_URL = 'https://api.github.com/repos/fairecasoimeme/Zlinky_TIC/releases'; +/** @see https://github.com/fairecasoimeme/Zlinky_TIC?tab=readme-ov-file#route-or-limited-route-from-v7 */ +const FIRMWARE_EXT = '.ota'; +const FIRMWARE_LIMITED = `limited${FIRMWARE_EXT}`; + +export async function writeCache(): Promise { + await github.writeCache(NAME, FIRMWARE_URL); +} + +export async function download(): Promise { + await github.download(NAME, FIRMWARE_URL, [(a): boolean => a.name.endsWith(FIRMWARE_EXT), (a): boolean => a.name.endsWith(FIRMWARE_LIMITED)]); +} diff --git a/src/autodl/salus.ts b/src/autodl/salus.ts new file mode 100644 index 00000000..be0a8007 --- /dev/null +++ b/src/autodl/salus.ts @@ -0,0 +1,55 @@ +import {getJson, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; + +type ImageJson = { + model: string; + version: string; + url: string; +}; +type ImagesJson = { + versions: ImageJson[]; +}; + +const NAME = 'Salus'; +const LOG_PREFIX = `[${NAME}]`; +const FIRMWARE_URL = 'https://eu.salusconnect.io/demo/default/status/firmware?timestamp=0'; + +function findInCache(image: ImageJson, cachedData?: ImagesJson): ImageJson | undefined { + return cachedData?.versions?.find((d) => d.model == image.model); +} + +function isDifferent(newData: ImageJson, cachedData?: ImageJson): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.version !== newData.version; +} + +export async function writeCache(): Promise { + const images = await getJson(NAME, FIRMWARE_URL); + + if (images?.versions?.length) { + writeCacheJson(NAME, images); + } +} + +export async function download(): Promise { + const images = await getJson(NAME, FIRMWARE_URL); + + if (images?.versions?.length) { + const cachedData = readCacheJson(NAME); + + for (const image of images.versions) { + const archiveUrl = image.url; //.replace(/^http:\/\//, 'https://'); + const archiveFileName = archiveUrl.split('/').pop()!; + + if (!isDifferent(image, findInCache(image, cachedData))) { + console.log(`[${NAME}:${archiveFileName}] No change from last run.`); + continue; + } + + await processFirmwareImage(NAME, archiveFileName, archiveUrl, {manufacturerName: [NAME]}, true, (fileName) => fileName.endsWith('.ota')); + } + + writeCacheJson(NAME, images); + } else { + console.error(`${LOG_PREFIX} No image data.`); + } +} diff --git a/src/autodl/ubisys.ts b/src/autodl/ubisys.ts new file mode 100644 index 00000000..b1b3d8d4 --- /dev/null +++ b/src/autodl/ubisys.ts @@ -0,0 +1,104 @@ +import url from 'url'; + +import {getLatestImage, getText, readCacheJson, writeCacheJson} from '../common.js'; +import {processFirmwareImage} from '../process_firmware_image.js'; + +type Image = { + fileName: string; + imageType: string; + hardwareVersionMin: number; + hardwareVersionMax: number; + fileVersion: number; +}; +type GroupedImages = { + [k: string]: Image[]; +}; + +const NAME = 'Ubisys'; +const LOG_PREFIX = `[${NAME}]`; +const FIRMWARE_HTML_URL = 'http://fwu.ubisys.de/smarthome/OTA/release/index'; + +function groupByImageType(arr: Image[]): GroupedImages { + return arr.reduce((acc, cur) => { + acc[cur.imageType] = [...(acc[cur.imageType] || []), cur]; + return acc; + }, {}); +} + +function sortByFileVersion(a: Image, b: Image): number { + return a.fileVersion < b.fileVersion ? -1 : a.fileVersion > b.fileVersion ? 1 : 0; +} + +function isDifferent(newData: Image, cachedData?: Image): boolean { + return Boolean(process.env.IGNORE_CACHE) || !cachedData || cachedData.fileVersion !== newData.fileVersion; +} + +function parseText(pageText: string): Image[] { + const lines = pageText.split('\n'); + const images: Image[] = []; + + for (const line of lines) { + // XXX: there are other images on the page that do not match this pattern + const imageMatch = /10F2-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{8})\S*ota1?\.zigbee/gi.exec(line); + + if (imageMatch != null) { + images.push({ + fileName: imageMatch[0], + imageType: imageMatch[1], + hardwareVersionMin: parseInt(imageMatch[2], 16), + hardwareVersionMax: parseInt(imageMatch[3], 16), + fileVersion: parseInt(imageMatch[4], 16), + }); + } + } + + return images; +} + +export async function writeCache(): Promise { + const pageText = await getText(NAME, FIRMWARE_HTML_URL); + + if (pageText?.length) { + const images = parseText(pageText); + + writeCacheJson(NAME, images); + } +} + +export async function download(): Promise { + const pageText = await getText(NAME, FIRMWARE_HTML_URL); + + if (pageText?.length) { + const images = parseText(pageText); + const imagesByType = groupByImageType(images); + const cachedData = readCacheJson(NAME); + const cachedDataByType = cachedData ? groupByImageType(cachedData) : undefined; + + for (const imageType in imagesByType) { + const image = getLatestImage(imagesByType[imageType], sortByFileVersion); + + if (!image) { + console.error(`${LOG_PREFIX} No image found for ${imageType}.`); + continue; + } + + if (cachedDataByType && !isDifferent(image, getLatestImage(cachedDataByType[imageType], sortByFileVersion))) { + console.log(`[${NAME}:${image.fileName}] No change from last run.`); + continue; + } + + // NOTE: removes `index` from url + const firmwareUrl = url.resolve(FIRMWARE_HTML_URL, image.fileName); + + await processFirmwareImage(NAME, image.fileName, firmwareUrl, { + manufacturerName: [NAME], + hardwareVersionMin: image.hardwareVersionMin, + hardwareVersionMax: image.hardwareVersionMax, + }); + } + + writeCacheJson(NAME, images); + } else { + console.error(`${LOG_PREFIX} No image data.`); + } +} diff --git a/src/autodl/xyzroe.ts b/src/autodl/xyzroe.ts new file mode 100644 index 00000000..37b719d5 --- /dev/null +++ b/src/autodl/xyzroe.ts @@ -0,0 +1,13 @@ +import * as github from './github.js'; + +const NAME = 'Xyzroe'; +const FIRMWARE_URL = 'https://api.github.com/repos/xyzroe/ZigUSB_C6/releases'; +const FIRMWARE_EXT = '.ota'; + +export async function writeCache(): Promise { + await github.writeCache(NAME, FIRMWARE_URL); +} + +export async function download(): Promise { + await github.download(NAME, FIRMWARE_URL, [(a): boolean => a.name.endsWith(FIRMWARE_EXT)]); +} diff --git a/src/common.ts b/src/common.ts new file mode 100644 index 00000000..ff97cf4c --- /dev/null +++ b/src/common.ts @@ -0,0 +1,406 @@ +import type {ExtraMetas, ExtraMetasWithFileName, ImageHeader, RepoImageMeta} from './types'; + +import assert from 'assert'; +import {exec} from 'child_process'; +import {createHash} from 'crypto'; +import {existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync} from 'fs'; +import path from 'path'; + +export const UPGRADE_FILE_IDENTIFIER = Buffer.from([0x1e, 0xf1, 0xee, 0x0b]); +export const BASE_REPO_URL = `https://github.com/Koenkk/zigbee-OTA/raw/`; +export const REPO_BRANCH = 'master'; +/** Images used by OTA upgrade process */ +export const BASE_IMAGES_DIR = 'images'; +/** Images used by OTA downgrade process */ +export const PREV_IMAGES_DIR = 'images1'; +/** Manifest used by OTA upgrade process */ +export const BASE_INDEX_MANIFEST_FILENAME = 'index.json'; +/** Manifest used by OTA downgrade process */ +export const PREV_INDEX_MANIFEST_FILENAME = 'index1.json'; +export const CACHE_DIR = '.cache'; +export const TMP_DIR = 'tmp'; +/** + * 'ikea_new' first, to prioritize downloads from new URL + */ +export const ALL_AUTODL_MANUFACTURERS = ['gmmts', 'ikea_new', 'ikea', 'inovelli', 'jethome', 'ledvance', 'lixee', 'salus', 'ubisys', 'xyzroe']; + +export async function execute(command: string): Promise { + return await new Promise((resolve, reject) => { + exec(command, (error, stdout) => { + if (error) { + reject(error); + } else { + resolve(stdout); + } + }); + }); +} + +export function primitivesArrayEquals(a: (string | number | boolean)[], b: (string | number | boolean)[]): boolean { + return a.length === b.length && a.every((val, index) => val === b[index]); +} + +export function computeSHA512(buffer: Buffer): string { + const hash = createHash('sha512'); + + hash.update(buffer); + + return hash.digest('hex'); +} + +export function getOutDir(folderName: string, basePath: string = BASE_IMAGES_DIR): string { + const outDir = path.join(basePath, folderName); + + if (!existsSync(outDir)) { + mkdirSync(outDir, {recursive: true}); + } + + return outDir; +} + +export function getRepoFirmwareFileUrl(folderName: string, fileName: string, basePath: string = BASE_IMAGES_DIR): string { + return BASE_REPO_URL + path.posix.join(REPO_BRANCH, basePath, folderName, fileName); +} + +export function writeManifest(fileName: string, firmwareList: RepoImageMeta[]): void { + writeFileSync(fileName, JSON.stringify(firmwareList, undefined, 2), 'utf8'); +} + +export function readManifest(fileName: string): RepoImageMeta[] { + return JSON.parse(readFileSync(fileName, 'utf8')); +} + +export function writeCacheJson(fileName: string, contents: T, basePath: string = CACHE_DIR): void { + writeFileSync(path.join(basePath, `${fileName}.json`), JSON.stringify(contents), 'utf8'); +} + +export function readCacheJson(fileName: string, basePath: string = CACHE_DIR): T { + const filePath = path.join(basePath, `${fileName}.json`); + + return existsSync(filePath) ? JSON.parse(readFileSync(filePath, 'utf8')) : undefined; +} + +export function parseImageHeader(buffer: Buffer): ImageHeader { + try { + const header: ImageHeader = { + otaUpgradeFileIdentifier: buffer.subarray(0, 4), + otaHeaderVersion: buffer.readUInt16LE(4), + otaHeaderLength: buffer.readUInt16LE(6), + otaHeaderFieldControl: buffer.readUInt16LE(8), + manufacturerCode: buffer.readUInt16LE(10), + imageType: buffer.readUInt16LE(12), + fileVersion: buffer.readUInt32LE(14), + zigbeeStackVersion: buffer.readUInt16LE(18), + otaHeaderString: buffer.toString('utf8', 20, 52), + totalImageSize: buffer.readUInt32LE(52), + }; + let headerPos = 56; + + if (header.otaHeaderFieldControl & 1) { + header.securityCredentialVersion = buffer.readUInt8(headerPos); + headerPos += 1; + } + + if (header.otaHeaderFieldControl & 2) { + header.upgradeFileDestination = buffer.subarray(headerPos, headerPos + 8); + headerPos += 8; + } + + if (header.otaHeaderFieldControl & 4) { + header.minimumHardwareVersion = buffer.readUInt16LE(headerPos); + headerPos += 2; + header.maximumHardwareVersion = buffer.readUInt16LE(headerPos); + headerPos += 2; + } + + assert(UPGRADE_FILE_IDENTIFIER.equals(header.otaUpgradeFileIdentifier), `Invalid upgrade file identifier`); + + return header; + } catch (error) { + throw new Error(`Not a valid OTA file (${(error as Error).message}).`); + } +} + +/** + * Adapted from zigbee-herdsman-converters logic + */ +export function findMatchImage( + image: ImageHeader, + imageList: RepoImageMeta[], + extraMetas: ExtraMetas, +): [index: number, image: RepoImageMeta | undefined] { + const imageIndex = imageList.findIndex( + (i) => + i.imageType === image.imageType && + i.manufacturerCode === image.manufacturerCode && + (!i.minFileVersion || image.fileVersion >= i.minFileVersion) && + (!i.maxFileVersion || image.fileVersion <= i.maxFileVersion) && + i.modelId === extraMetas.modelId && + (!(i.manufacturerName && extraMetas.manufacturerName) || primitivesArrayEquals(i.manufacturerName, extraMetas.manufacturerName)), + ); + + return [imageIndex, imageIndex === -1 ? undefined : imageList[imageIndex]]; +} + +export function changeRepoUrl(repoUrl: string, fromDir: string, toDir: string): string { + return repoUrl.replace(path.posix.join(REPO_BRANCH, fromDir), path.posix.join(REPO_BRANCH, toDir)); +} + +export async function getJson(manufacturer: string, pageUrl: string): Promise { + const response = await fetch(pageUrl); + + if (!response.ok || !response.body) { + console.error(`[${manufacturer}] Invalid response from ${pageUrl} status=${response.status}.`); + return; + } + + return (await response.json()) as T; +} + +export async function getText(manufacturer: string, pageUrl: string): Promise { + const response = await fetch(pageUrl); + + if (!response.ok || !response.body) { + console.error(`[${manufacturer}] Invalid response from ${pageUrl} status=${response.status}.`); + return; + } + + return await response.text(); +} + +export function getLatestImage(list: T[], compareFn: (a: T, b: T) => number): T | undefined { + const sortedList = list.sort(compareFn); + + return sortedList.slice(0, sortedList.length > 1 && process.env.PREV ? -1 : undefined).pop(); +} + +export const enum ParsedImageStatus { + NEW = 0, + NEWER = 1, + OLDER = 2, + IDENTICAL = 3, +} + +export function getParsedImageStatus(parsedImage: ImageHeader, match?: RepoImageMeta): ParsedImageStatus { + if (match) { + if (match.fileVersion > parsedImage.fileVersion) { + return ParsedImageStatus.OLDER; + } else if (match.fileVersion < parsedImage.fileVersion) { + return ParsedImageStatus.NEWER; + } else { + return ParsedImageStatus.IDENTICAL; + } + } else { + return ParsedImageStatus.NEW; + } +} + +/** + * Prevent irrelevant metas from being added to manifest. + * + * NOTE: fileName should be deleted before adding to manifest for consistency (always use original file name). + * @param metas + * @returns + */ +export function getValidMetas(metas: Partial, ignoreFileName: boolean): ExtraMetasWithFileName { + const validMetas: ExtraMetasWithFileName = {}; + + if (!ignoreFileName) { + if (metas.fileName != undefined) { + if (typeof metas.fileName != 'string') { + throw new Error(`Invalid format for 'fileName', expected 'string' type.`); + } + + validMetas.fileName = metas.fileName; + } + } + + if (metas.originalUrl != undefined) { + if (typeof metas.originalUrl != 'string') { + throw new Error(`Invalid format for 'originalUrl', expected 'string' type.`); + } + + validMetas.originalUrl = metas.originalUrl; + } + + if (metas.force != undefined) { + if (typeof metas.force != 'boolean') { + throw new Error(`Invalid format for 'force', expected 'boolean' type.`); + } + + validMetas.force = metas.force; + } + + if (metas.hardwareVersionMax != undefined) { + if (typeof metas.hardwareVersionMax != 'number') { + throw new Error(`Invalid format for 'hardwareVersionMax', expected 'number' type.`); + } + + validMetas.hardwareVersionMax = metas.hardwareVersionMax; + } + + if (metas.hardwareVersionMin != undefined) { + if (typeof metas.hardwareVersionMin != 'number') { + throw new Error(`Invalid format for 'hardwareVersionMin', expected 'number' type.`); + } + + validMetas.hardwareVersionMin = metas.hardwareVersionMin; + } + + if (metas.manufacturerName != undefined) { + if (!Array.isArray(metas.manufacturerName) || metas.manufacturerName.length < 1 || metas.manufacturerName.some((m) => typeof m != 'string')) { + throw new Error(`Invalid format for 'manufacturerName', expected 'array of string' type.`); + } + + validMetas.manufacturerName = metas.manufacturerName; + } + + if (metas.maxFileVersion != undefined) { + if (typeof metas.maxFileVersion != 'number') { + throw new Error(`Invalid format for 'maxFileVersion', expected 'number' type.`); + } + + validMetas.maxFileVersion = metas.maxFileVersion; + } + + if (metas.minFileVersion != undefined) { + if (typeof metas.minFileVersion != 'number') { + throw new Error(`Invalid format for 'minFileVersion', expected 'number' type.`); + } + + validMetas.minFileVersion = metas.minFileVersion; + } + + if (metas.modelId != undefined) { + if (typeof metas.modelId != 'string') { + throw new Error(`Invalid format for 'modelId', expected 'string' type.`); + } + + validMetas.modelId = metas.modelId; + } + + if (metas.releaseNotes != undefined) { + if (typeof metas.releaseNotes != 'string') { + throw new Error(`Invalid format for 'releaseNotes', expected 'string' type.`); + } + + validMetas.releaseNotes = metas.releaseNotes; + } + + return validMetas; +} + +export function addImageToPrev( + logPrefix: string, + isNewer: boolean, + prevManifest: RepoImageMeta[], + prevMatchIndex: number, + prevMatch: RepoImageMeta, + prevOutDir: string, + firmwareFileName: string, + manufacturer: string, + parsedImage: ImageHeader, + firmwareBuffer: Buffer, + originalUrl: string | undefined, + extraMetas: ExtraMetas, + onBeforeManifestPush: () => void, +): void { + console.log(`${logPrefix} Base manifest has higher version. Adding to prev instead.`); + + if (isNewer) { + console.log(`${logPrefix} Removing prev image.`); + prevManifest.splice(prevMatchIndex, 1); + + // make sure fileName exists for migration from old system + const prevFileName = prevMatch.fileName ? prevMatch.fileName : prevMatch.url.split('/').pop()!; + + rmSync(path.join(prevOutDir, prevFileName), {force: true}); + } + + onBeforeManifestPush(); + prevManifest.push({ + fileName: firmwareFileName, + fileVersion: parsedImage.fileVersion, + fileSize: parsedImage.totalImageSize, + originalUrl, + url: getRepoFirmwareFileUrl(manufacturer, firmwareFileName, PREV_IMAGES_DIR), + imageType: parsedImage.imageType, + manufacturerCode: parsedImage.manufacturerCode, + sha512: computeSHA512(firmwareBuffer), + otaHeaderString: parsedImage.otaHeaderString, + ...extraMetas, + }); +} + +export function addImageToBase( + logPrefix: string, + isNewer: boolean, + prevManifest: RepoImageMeta[], + prevOutDir: string, + baseManifest: RepoImageMeta[], + baseMatchIndex: number, + baseMatch: RepoImageMeta, + baseOutDir: string, + firmwareFileName: string, + manufacturer: string, + parsedImage: ImageHeader, + firmwareBuffer: Buffer, + originalUrl: string | undefined, + extraMetas: ExtraMetas, + onBeforeManifestPush: () => void, +): void { + if (isNewer) { + console.log(`${logPrefix} Base manifest has older version ${baseMatch.fileVersion}. Replacing with ${parsedImage.fileVersion}.`); + + const [prevMatchIndex, prevMatch] = findMatchImage(parsedImage, prevManifest, extraMetas); + const prevStatus = getParsedImageStatus(parsedImage, prevMatch); + + if (prevStatus !== ParsedImageStatus.OLDER && prevStatus !== ParsedImageStatus.NEW) { + console.warn(`${logPrefix} Base image is new/newer but prev image is not older/non-existing.`); + } + + if (prevStatus !== ParsedImageStatus.NEW) { + console.log(`${logPrefix} Removing prev image.`); + prevManifest.splice(prevMatchIndex, 1); + + // make sure fileName exists for migration from old system + const prevFileName = prevMatch!.fileName ? prevMatch!.fileName : prevMatch!.url.split('/').pop()!; + + rmSync(path.join(prevOutDir, prevFileName), {force: true}); + } + + // relocate base to prev + // make sure fileName exists for migration from old system + const baseFileName = baseMatch.fileName ? baseMatch.fileName : baseMatch.url.split('/').pop()!; + const baseFilePath = path.join(baseOutDir, baseFileName); + + // if for some reason the file is no longer present (should not happen), don't add it to prev since link is broken + if (existsSync(baseFilePath)) { + renameSync(baseFilePath, path.join(prevOutDir, baseFileName)); + + baseMatch!.url = changeRepoUrl(baseMatch.url, BASE_IMAGES_DIR, PREV_IMAGES_DIR); + + prevManifest.push(baseMatch); + } else { + console.error(`${logPrefix} Image file '${baseFilePath}' does not exist. Not moving to prev.`); + } + + baseManifest.splice(baseMatchIndex, 1); + } else { + console.log(`${logPrefix} Base manifest does not have version ${parsedImage.fileVersion}. Adding.`); + } + + onBeforeManifestPush(); + baseManifest.push({ + fileName: firmwareFileName, + fileVersion: parsedImage.fileVersion, + fileSize: parsedImage.totalImageSize, + originalUrl, + url: getRepoFirmwareFileUrl(manufacturer, firmwareFileName, BASE_IMAGES_DIR), + imageType: parsedImage.imageType, + manufacturerCode: parsedImage.manufacturerCode, + sha512: computeSHA512(firmwareBuffer), + otaHeaderString: parsedImage.otaHeaderString, + ...extraMetas, + }); +} diff --git a/src/ghw_concat_cacerts.ts b/src/ghw_concat_cacerts.ts new file mode 100644 index 00000000..515904b2 --- /dev/null +++ b/src/ghw_concat_cacerts.ts @@ -0,0 +1,29 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import {readdirSync, readFileSync, writeFileSync} from 'fs'; +import path from 'path'; + +export const CACERTS_DIR = 'cacerts'; +export const CACERTS_CONCAT_FILEPATH = 'cacerts.pem'; + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +export async function concatCaCerts(github: Octokit, core: typeof CoreApi, context: Context): Promise { + let pemContents: string = ''; + + for (const pem of readdirSync(CACERTS_DIR)) { + if (!pem.endsWith('.pem')) { + continue; + } + + core.startGroup(pem); + + pemContents += readFileSync(path.join(CACERTS_DIR, pem), 'utf8'); + pemContents += '\n'; + + core.endGroup(); + } + + writeFileSync(CACERTS_CONCAT_FILEPATH, pemContents, 'utf8'); +} diff --git a/src/ghw_create_autodl_release.ts b/src/ghw_create_autodl_release.ts new file mode 100644 index 00000000..fb49c158 --- /dev/null +++ b/src/ghw_create_autodl_release.ts @@ -0,0 +1,89 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import {BASE_IMAGES_DIR, BASE_INDEX_MANIFEST_FILENAME, execute, PREV_IMAGES_DIR, PREV_INDEX_MANIFEST_FILENAME, readManifest} from './common.js'; +import {RepoImageMeta} from './types.js'; + +// about 3 lines +const MAX_RELEASE_NOTES_LENGTH = 380; + +function findReleaseNotes(imagePath: string, manifest: RepoImageMeta[]): string | undefined { + const metas = manifest.find((m) => m.url.endsWith(imagePath)); + + return metas?.releaseNotes; +} + +function listItemWithReleaseNotes(imagePath: string, releaseNotes?: string): string { + let listItem = `* ${imagePath}`; + + if (releaseNotes) { + let notes = releaseNotes.replace(/[#*\r\n]+/g, '').replaceAll('-', '|'); + + if (notes.length > MAX_RELEASE_NOTES_LENGTH) { + notes = `${notes.slice(0, MAX_RELEASE_NOTES_LENGTH)}...`; + } + + listItem += ` + - ${notes}`; + } + + return listItem; +} + +export async function createAutodlRelease(github: Octokit, core: typeof CoreApi, context: Context): Promise { + const tagName = new Date().toISOString().replace(/[:.]/g, ''); + // --exclude-standard => Add the standard Git exclusions: .git/info/exclude, .gitignore in each directory, and the user’s global exclusion file. + // --others => Show other (i.e. untracked) files in the output. + // -z => \0 line termination on output and do not quote filenames. + const upgradeImagesStr = await execute(`git ls-files --others --exclude-standard --modified -z ${BASE_IMAGES_DIR}`); + const downgradeImagesStr = await execute(`git ls-files --others --exclude-standard --modified -z ${PREV_IMAGES_DIR}`); + + core.debug(`git ls-files for ${BASE_IMAGES_DIR}: ${upgradeImagesStr}`); + core.debug(`git ls-files for ${PREV_IMAGES_DIR}: ${downgradeImagesStr}`); + + // -1 to remove empty string at end due to \0 termination + const upgradeImages = upgradeImagesStr.split('\0').slice(0, -1); + const downgradeImages = downgradeImagesStr.split('\0').slice(0, -1); + + core.info(`Upgrade Images List: ${upgradeImages}`); + core.info(`Downgrade Images List: ${downgradeImages}`); + + const baseManifest = readManifest(BASE_INDEX_MANIFEST_FILENAME); + const prevManifest = readManifest(PREV_INDEX_MANIFEST_FILENAME); + + let body: string | undefined; + + if (upgradeImages.length > 0 || downgradeImages.length > 0) { + body = ''; + + if (upgradeImages.length > 0) { + const listWithReleaseNotes = upgradeImages.map((v) => listItemWithReleaseNotes(v, findReleaseNotes(v, baseManifest))); + body += `## New upgrade images from automatic download: +${listWithReleaseNotes.join('\n')} + +`; + } + + if (downgradeImages.length > 0) { + const listWithReleaseNotes = downgradeImages.map((v) => listItemWithReleaseNotes(v, findReleaseNotes(v, prevManifest))); + body += `## New downgrade images from automatic download: +${listWithReleaseNotes.join('\n')} + +`; + } + } + + await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: tagName, + name: tagName, + body, + draft: false, + prerelease: false, + // get changes from PRs + generate_release_notes: true, + make_latest: 'true', + }); +} diff --git a/src/ghw_create_pr_to_default.ts b/src/ghw_create_pr_to_default.ts new file mode 100644 index 00000000..280d422e --- /dev/null +++ b/src/ghw_create_pr_to_default.ts @@ -0,0 +1,57 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import assert from 'assert'; + +const IGNORE_OTA_WORKFLOW_LABEL = 'ignore-ota-workflow'; + +export async function createPRToDefault( + github: Octokit, + core: typeof CoreApi, + context: Context, + fromBranchName: string, + title: string, +): Promise { + assert(context.payload.repository); + assert(fromBranchName); + assert(title); + + const base = context.payload.repository.default_branch; + + try { + const createdPRResult = await github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + head: fromBranchName, + base, + title, + }); + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: createdPRResult.data.number, + labels: [IGNORE_OTA_WORKFLOW_LABEL], + }); + + core.notice(`Created pull request #${createdPRResult.data.number} from branch ${fromBranchName}.`); + } catch (error) { + if (error instanceof Error) { + if (error.message.includes(`No commits between ${base} and ${fromBranchName}`)) { + await github.rest.git.deleteRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `heads/${fromBranchName}`, + }); + + core.notice(`Nothing needed re-processing.`); + + // don't fail if no commits + return; + } + } + + throw error; + } +} diff --git a/src/ghw_overwrite_cache.ts b/src/ghw_overwrite_cache.ts new file mode 100644 index 00000000..dbdc09cf --- /dev/null +++ b/src/ghw_overwrite_cache.ts @@ -0,0 +1,41 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import {existsSync, mkdirSync} from 'fs'; + +import {ALL_AUTODL_MANUFACTURERS, CACHE_DIR} from './common.js'; + +export async function overwriteCache(github: Octokit, core: typeof CoreApi, context: Context, manufacturersCSV?: string): Promise { + if (!existsSync(CACHE_DIR)) { + mkdirSync(CACHE_DIR, {recursive: true}); + } + + const manufacturers = manufacturersCSV ? manufacturersCSV.trim().split(',') : ALL_AUTODL_MANUFACTURERS; + + for (const manufacturer of manufacturers) { + // ignore empty strings + if (!manufacturer) { + continue; + } + + if (!ALL_AUTODL_MANUFACTURERS.includes(manufacturer)) { + core.error(`Ignoring invalid manufacturer '${manufacturer}'. Expected any of: ${ALL_AUTODL_MANUFACTURERS}.`); + continue; + } + + const {writeCache} = await import(`./${manufacturer}.js`); + + core.startGroup(manufacturer); + core.info(`[${manufacturer}] Writing cache...`); + + try { + await writeCache(); + } catch (error) { + core.error((error as Error).message); + core.debug((error as Error).stack!); + } + + core.endGroup(); + } +} diff --git a/src/ghw_reprocess_all_images.ts b/src/ghw_reprocess_all_images.ts new file mode 100644 index 00000000..3e1def77 --- /dev/null +++ b/src/ghw_reprocess_all_images.ts @@ -0,0 +1,398 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import type {RepoImageMeta} from './types'; + +import {existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync} from 'fs'; +import path from 'path'; + +import { + addImageToBase, + addImageToPrev, + BASE_IMAGES_DIR, + BASE_INDEX_MANIFEST_FILENAME, + BASE_REPO_URL, + computeSHA512, + findMatchImage, + getOutDir, + getParsedImageStatus, + getRepoFirmwareFileUrl, + getValidMetas, + ParsedImageStatus, + parseImageHeader, + PREV_IMAGES_DIR, + PREV_INDEX_MANIFEST_FILENAME, + readManifest, + REPO_BRANCH, + UPGRADE_FILE_IDENTIFIER, + writeManifest, +} from './common.js'; + +/** These are now handled by autodl */ +const IGNORE_3RD_PARTIES = ['https://github.com/fairecasoimeme/', 'https://github.com/xyzroe/']; + +const DIR_3RD_PARTIES = { + 'https://otau.meethue.com/': 'Hue', + 'https://images.tuyaeu.com/': 'Tuya', + 'https://tr-zha.s3.amazonaws.com/': 'ThirdReality', + // NOTE: no longer valid / unable to access via script + // 'https://www.elektroimportoren.no/docs/lib/4512772-Firmware-35.ota': 'Namron', + // 'https://deconz.dresden-elektronik.de/': 'DresdenElektronik', +}; + +export const NOT_IN_BASE_MANIFEST_IMAGES_DIR = 'not-in-manifest-images'; +export const NOT_IN_PREV_MANIFEST_IMAGES_DIR = 'not-in-manifest-images1'; +export const NOT_IN_MANIFEST_FILENAME = 'not-in-manifest.json'; + +function ignore3rdParty(meta: RepoImageMeta): boolean { + for (const ignore of IGNORE_3RD_PARTIES) { + if (meta.url.startsWith(ignore)) { + return true; + } + } + + return false; +} + +function get3rdPartyDir(meta: RepoImageMeta): string | undefined { + for (const key in DIR_3RD_PARTIES) { + if (meta.url.startsWith(key)) { + return DIR_3RD_PARTIES[key as keyof typeof DIR_3RD_PARTIES]; + } + } +} + +async function download3rdParties( + github: Octokit, + core: typeof CoreApi, + context: Context, + /* istanbul ignore next */ + outDirFinder = get3rdPartyDir, +): Promise { + if (!process.env.NODE_EXTRA_CA_CERTS) { + throw new Error(`Download 3rd Parties requires \`NODE_EXTRA_CA_CERTS=cacerts.pem\`.`); + } + + const baseManifest = readManifest(BASE_INDEX_MANIFEST_FILENAME); + const baseManifestCopy = baseManifest.slice(); + const prevManifest = readManifest(PREV_INDEX_MANIFEST_FILENAME); + let baseImagesAddCount = 0; + let prevImagesAddCount = 0; + + for (const meta of baseManifestCopy) { + // just in case + if (!meta.url) { + core.error(`Ignoring malformed ${JSON.stringify(meta)}.`); + baseManifest.splice(baseManifest.indexOf(meta), 1); + continue; + } + + if (meta.url.startsWith(BASE_REPO_URL + REPO_BRANCH)) { + core.debug(`Ignoring local URL: ${meta.url}`); + continue; + } + + // remove itself from base manifest + baseManifest.splice(baseManifest.indexOf(meta), 1); + + if (ignore3rdParty(meta)) { + core.warning(`Removing ignored '${meta.url}'.`); + continue; + } + + // reverse add.js logic + const fileName = unescape(meta.url.split('/').pop()!); + const outDirName = outDirFinder(meta); + + if (outDirName) { + core.info(`Downloading 3rd party '${fileName}' into '${outDirName}'`); + + let firmwareFilePath: string | undefined; + + try { + const baseOutDir = getOutDir(outDirName, BASE_IMAGES_DIR); + const prevOutDir = getOutDir(outDirName, PREV_IMAGES_DIR); + const extraMetas = getValidMetas(meta, true); + + core.info(`Extra metas for ${fileName}: ${JSON.stringify(extraMetas)}.`); + + const firmwareFile = await fetch(meta.url); + + if (!firmwareFile.ok || !firmwareFile.body) { + core.error(`Invalid response from ${meta.url} status=${firmwareFile.status}.`); + continue; + } + + const firmwareBuffer = Buffer.from(await firmwareFile.arrayBuffer()); + // make sure to parse from the actual start of the "spec OTA" portion of the file (e.g. Ikea has non-spec meta before) + const parsedImage = parseImageHeader(firmwareBuffer.subarray(firmwareBuffer.indexOf(UPGRADE_FILE_IDENTIFIER))); + const [baseMatchIndex, baseMatch] = findMatchImage(parsedImage, baseManifest, extraMetas); + const statusToBase = getParsedImageStatus(parsedImage, baseMatch); + + switch (statusToBase) { + case ParsedImageStatus.OLDER: { + addImageToPrev( + `[${fileName}]`, + false, // no prev existed before + prevManifest, + -1, + // @ts-expect-error false above prevents issue + undefined, + prevOutDir, + fileName, + outDirName, + parsedImage, + firmwareBuffer, + meta.url, + extraMetas, + () => { + firmwareFilePath = path.join(prevOutDir, fileName); + + // write before adding to manifest, in case of failure (throw), manifest won't have a broken link + writeFileSync(firmwareFilePath, firmwareBuffer); + }, + ); + + prevImagesAddCount++; + + break; + } + + case ParsedImageStatus.IDENTICAL: { + core.warning(`Conflict with image at index \`${baseMatchIndex}\`: ${JSON.stringify(baseMatch)}`); + continue; + } + + case ParsedImageStatus.NEWER: + case ParsedImageStatus.NEW: { + addImageToBase( + `[${fileName}]`, + statusToBase === ParsedImageStatus.NEWER, + prevManifest, + prevOutDir, + baseManifest, + baseMatchIndex, + baseMatch!, + baseOutDir, + fileName, + outDirName, + parsedImage, + firmwareBuffer, + meta.url, + extraMetas, + () => { + firmwareFilePath = path.join(baseOutDir, fileName); + + // write before adding to manifest, in case of failure (throw), manifest won't have a broken link + writeFileSync(firmwareFilePath, firmwareBuffer); + }, + ); + + baseImagesAddCount++; + + break; + } + } + } catch (error) { + core.error(`Ignoring ${fileName}: ${error}`); + + /* istanbul ignore next */ + if (firmwareFilePath) { + rmSync(firmwareFilePath, {force: true}); + } + + continue; + } + } else { + core.warning(`Ignoring '${fileName}' with no out dir specified.`); + } + } + + writeManifest(PREV_INDEX_MANIFEST_FILENAME, prevManifest); + writeManifest(BASE_INDEX_MANIFEST_FILENAME, baseManifest); + + core.info(`Downloaded ${prevImagesAddCount} prev images.`); + core.info(`Downloaded ${baseImagesAddCount} base images.`); + + core.info(`Base manifest now contains ${baseManifest.length} images.`); + core.info(`Prev manifest now contains ${prevManifest.length} images.`); +} + +function checkImagesAgainstManifests(github: Octokit, core: typeof CoreApi, context: Context, removeNotInManifest: boolean): void { + for (const [manifestName, imagesDir, moveDir] of [ + [PREV_INDEX_MANIFEST_FILENAME, PREV_IMAGES_DIR, NOT_IN_PREV_MANIFEST_IMAGES_DIR], + [BASE_INDEX_MANIFEST_FILENAME, BASE_IMAGES_DIR, NOT_IN_BASE_MANIFEST_IMAGES_DIR], + ]) { + const manifest = readManifest(manifestName); + const rewriteManifest: RepoImageMeta[] = []; + const missingManifest: RepoImageMeta[] = []; + + core.info(`Checking ${manifestName} (currently ${manifest.length} images)...`); + + for (const subfolderName of readdirSync(imagesDir)) { + // skip removal of anything not desired while running jest tests + // compare should match data.test.ts > IMAGES_TEST_DIR + /* istanbul ignore if */ + if (process.env.JEST_WORKER_ID && subfolderName !== 'jest-tmp') { + continue; + } + + const subfolderPath = path.join(imagesDir, subfolderName); + + if (lstatSync(subfolderPath).isDirectory()) { + core.startGroup(subfolderPath); + + for (const fileName of readdirSync(subfolderPath)) { + const firmwareFilePath = path.join(subfolderPath, fileName); + const fileRelUrl = path.posix.join(imagesDir, subfolderName, fileName); + // previous add.js used escape() for url property + const escFileRelUrl = escape(fileRelUrl); + // take local images only + const inManifest = manifest.filter( + (m) => m.url.startsWith(BASE_REPO_URL + REPO_BRANCH) && (m.url.endsWith(fileRelUrl) || m.url.endsWith(escFileRelUrl)), + ); + + if (inManifest.length === 0) { + core.warning(`Not found in base manifest: ${firmwareFilePath}.`); + + if (removeNotInManifest) { + core.error(`Removing ${firmwareFilePath}.`); + rmSync(firmwareFilePath, {force: true}); + } else { + const destDirPath = path.join(moveDir, subfolderName); + + if (!existsSync(destDirPath)) { + mkdirSync(destDirPath, {recursive: true}); + } + + try { + const firmwareBuffer = Buffer.from(readFileSync(firmwareFilePath)); + // make sure to parse from the actual start of the "spec OTA" portion of the file (e.g. Ikea has non-spec meta before) + const parsedImage = parseImageHeader(firmwareBuffer.subarray(firmwareBuffer.indexOf(UPGRADE_FILE_IDENTIFIER))); + + renameSync(firmwareFilePath, path.join(destDirPath, fileName)); + missingManifest.push({ + fileName, + fileVersion: parsedImage.fileVersion, + fileSize: parsedImage.totalImageSize, + // originalUrl: meta.url, + url: getRepoFirmwareFileUrl(subfolderName, fileName, imagesDir), + imageType: parsedImage.imageType, + manufacturerCode: parsedImage.manufacturerCode, + sha512: computeSHA512(firmwareBuffer), + otaHeaderString: parsedImage.otaHeaderString, + }); + } catch (error) { + core.error(`Removing ${firmwareFilePath}: ${error}`); + rmSync(firmwareFilePath, {force: true}); + } + } + } else { + if (inManifest.length !== 1) { + core.warning(`[${fileRelUrl}] found multiple times in ${manifestName} manifest:`); + core.warning(JSON.stringify(inManifest, undefined, 2)); + } + + for (const meta of inManifest) { + try { + const firmwareBuffer = Buffer.from(readFileSync(firmwareFilePath)); + const extraMetas = getValidMetas(meta, true); + // make sure to parse from the actual start of the "spec OTA" portion of the file (e.g. Ikea has non-spec meta before) + const parsedImage = parseImageHeader(firmwareBuffer.subarray(firmwareBuffer.indexOf(UPGRADE_FILE_IDENTIFIER))); + const [, rewriteMatch] = findMatchImage(parsedImage, rewriteManifest, extraMetas); + + // only add if not already present + if (!rewriteMatch) { + rewriteManifest.push({ + fileName, + fileVersion: parsedImage.fileVersion, + fileSize: parsedImage.totalImageSize, + // originalUrl: meta.url, + url: getRepoFirmwareFileUrl(subfolderName, fileName, imagesDir), + imageType: parsedImage.imageType, + manufacturerCode: parsedImage.manufacturerCode, + sha512: computeSHA512(firmwareBuffer), + otaHeaderString: parsedImage.otaHeaderString, + ...extraMetas, + }); + } + } catch (error) { + core.error(`Removing ${firmwareFilePath}: ${error}`); + rmSync(firmwareFilePath, {force: true}); + } + } + } + } + + core.endGroup(); + } else { + // subfolderName here would actually be the file name + throw new Error(`Detected file in ${imagesDir} not in subdirectory: ${subfolderName}.`); + } + } + + // will not run in case removeNotInManifest is true, since nothing added, `moveDir` will also already have been created + if (missingManifest.length > 0) { + writeManifest(path.join(moveDir, NOT_IN_MANIFEST_FILENAME), missingManifest); + + core.error(`${missingManifest.length} images not in ${manifestName} manifest.`); + } + + writeManifest(manifestName, rewriteManifest); + + core.info(`Rewritten ${manifestName} manifest has ${rewriteManifest.length} images.`); + } +} + +/** + * + * @param github + * @param core + * @param context + * @param removeNotInManifest If false, move images to separate directories + * @param skipDownload3rdParties Do not execute the download step + * @param downloadOutDirFinder Used mainly for jest tests + */ +export async function reProcessAllImages( + github: Octokit, + core: typeof CoreApi, + context: Context, + removeNotInManifest: boolean, + skipDownload3rdParties: boolean, + downloadOutDirFinder = get3rdPartyDir, +): Promise { + if (!removeNotInManifest && existsSync(NOT_IN_BASE_MANIFEST_IMAGES_DIR) && readdirSync(NOT_IN_BASE_MANIFEST_IMAGES_DIR).length > 0) { + throw new Error(`${NOT_IN_BASE_MANIFEST_IMAGES_DIR} is not empty. Cannot run.`); + } + + if (!removeNotInManifest && existsSync(NOT_IN_PREV_MANIFEST_IMAGES_DIR) && readdirSync(NOT_IN_PREV_MANIFEST_IMAGES_DIR).length > 0) { + throw new Error(`${NOT_IN_PREV_MANIFEST_IMAGES_DIR} is not empty. Cannot run.`); + } + + /* istanbul ignore if */ + if (!existsSync(BASE_IMAGES_DIR)) { + mkdirSync(BASE_IMAGES_DIR, {recursive: true}); + } + + /* istanbul ignore if */ + if (!existsSync(PREV_IMAGES_DIR)) { + mkdirSync(PREV_IMAGES_DIR, {recursive: true}); + } + + /* istanbul ignore if */ + if (!existsSync(BASE_INDEX_MANIFEST_FILENAME)) { + writeManifest(BASE_INDEX_MANIFEST_FILENAME, []); + } + + /* istanbul ignore if */ + if (!existsSync(PREV_INDEX_MANIFEST_FILENAME)) { + writeManifest(PREV_INDEX_MANIFEST_FILENAME, []); + } + + if (!skipDownload3rdParties) { + await download3rdParties(github, core, context, downloadOutDirFinder); + } + + checkImagesAgainstManifests(github, core, context, removeNotInManifest); +} diff --git a/src/ghw_run_autodl.ts b/src/ghw_run_autodl.ts new file mode 100644 index 00000000..2c4f91b3 --- /dev/null +++ b/src/ghw_run_autodl.ts @@ -0,0 +1,58 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import {existsSync, mkdirSync, rmSync} from 'fs'; + +import {ALL_AUTODL_MANUFACTURERS, BASE_INDEX_MANIFEST_FILENAME, CACHE_DIR, PREV_INDEX_MANIFEST_FILENAME, TMP_DIR, writeManifest} from './common.js'; + +export async function runAutodl(github: Octokit, core: typeof CoreApi, context: Context, manufacturersCSV?: string): Promise { + const manufacturers = manufacturersCSV ? manufacturersCSV.trim().split(',') : ALL_AUTODL_MANUFACTURERS; + + core.info(`Setup...`); + + if (!existsSync(CACHE_DIR)) { + mkdirSync(CACHE_DIR, {recursive: true}); + } + + if (!existsSync(TMP_DIR)) { + mkdirSync(TMP_DIR, {recursive: true}); + } + + if (!existsSync(BASE_INDEX_MANIFEST_FILENAME)) { + writeManifest(BASE_INDEX_MANIFEST_FILENAME, []); + } + + if (!existsSync(PREV_INDEX_MANIFEST_FILENAME)) { + writeManifest(PREV_INDEX_MANIFEST_FILENAME, []); + } + + for (const manufacturer of manufacturers) { + // ignore empty strings + if (!manufacturer) { + continue; + } + + if (!ALL_AUTODL_MANUFACTURERS.includes(manufacturer)) { + core.error(`Ignoring invalid manufacturer '${manufacturer}'. Expected any of: ${ALL_AUTODL_MANUFACTURERS}.`); + continue; + } + + const {download} = await import(`./autodl/${manufacturer}.js`); + + core.startGroup(manufacturer); + + try { + await download(); + } catch (error) { + core.error((error as Error).message); + core.debug((error as Error).stack!); + } + + core.endGroup(); + } + + core.info(`Teardown...`); + + rmSync(TMP_DIR, {recursive: true, force: true}); +} diff --git a/src/ghw_update_ota_pr.ts b/src/ghw_update_ota_pr.ts new file mode 100644 index 00000000..efe1fc17 --- /dev/null +++ b/src/ghw_update_ota_pr.ts @@ -0,0 +1,307 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import type {ExtraMetas, GHExtraMetas} from './types'; + +import assert from 'assert'; +import {readFileSync, renameSync} from 'fs'; +import path from 'path'; + +import { + addImageToBase, + addImageToPrev, + BASE_IMAGES_DIR, + BASE_INDEX_MANIFEST_FILENAME, + execute, + findMatchImage, + getOutDir, + getParsedImageStatus, + getValidMetas, + ParsedImageStatus, + parseImageHeader, + PREV_IMAGES_DIR, + PREV_INDEX_MANIFEST_FILENAME, + readManifest, + UPGRADE_FILE_IDENTIFIER, + writeManifest, +} from './common.js'; + +const EXTRA_METAS_PR_BODY_START_TAG = '```json'; +const EXTRA_METAS_PR_BODY_END_TAG = '```'; + +function getFileExtraMetas(extraMetas: GHExtraMetas, fileName: string): ExtraMetas { + if (Array.isArray(extraMetas)) { + const fileExtraMetas = extraMetas.find((m) => m.fileName === fileName) ?? {}; + /** @see getValidMetas */ + delete fileExtraMetas.fileName; + + return fileExtraMetas; + } + + // not an array, use same metas for all files + return extraMetas; +} + +async function parsePRBodyExtraMetas(github: Octokit, core: typeof CoreApi, context: Context): Promise { + let extraMetas: GHExtraMetas = {}; + + if (context.payload.pull_request?.body) { + try { + const prBody = context.payload.pull_request.body; + const metasStart = prBody.indexOf(EXTRA_METAS_PR_BODY_START_TAG); + const metasEnd = prBody.lastIndexOf(EXTRA_METAS_PR_BODY_END_TAG); + + if (metasStart !== -1 && metasEnd > metasStart) { + const metas = JSON.parse(prBody.slice(metasStart + EXTRA_METAS_PR_BODY_START_TAG.length, metasEnd)) as GHExtraMetas; + + core.info(`Extra metas from PR body:`); + core.info(JSON.stringify(metas, undefined, 2)); + + if (Array.isArray(metas)) { + extraMetas = []; + + for (const meta of metas) { + if (!meta.fileName || typeof meta.fileName != 'string') { + core.info(`Ignoring meta in array with missing/invalid fileName:`); + core.info(JSON.stringify(meta, undefined, 2)); + continue; + } + + extraMetas.push(getValidMetas(meta, false)); + } + } else { + extraMetas = getValidMetas(metas, false); + } + } + } catch (error) { + const failureComment = `Invalid extra metas in pull request body: ` + (error as Error).message; + + core.error(failureComment); + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: failureComment, + }); + + throw new Error(failureComment); + } + } + + return extraMetas; +} + +export async function updateOtaPR(github: Octokit, core: typeof CoreApi, context: Context, fileParam: string): Promise { + assert(fileParam, 'No file found in pull request.'); + assert(context.payload.pull_request, 'Not a pull request'); + + const fileParamArr = fileParam.trim().split(','); + // take care of empty strings (GH workflow adds a comma at end), ignore files not stored in images dir + const fileList = fileParamArr.filter((f) => f.startsWith(`${BASE_IMAGES_DIR}/`)); + + assert(fileList.length > 0, 'No image found in pull request.'); + core.info(`Images in pull request: ${fileList}.`); + + const fileListWrongDir = fileParamArr.filter((f) => f.startsWith(`${PREV_IMAGES_DIR}/`)); + + if (fileListWrongDir.length > 0) { + const failureComment = `Detected files in 'images1': +\`\`\` +${fileListWrongDir.join('\n')} +\`\`\` +Please move all files to 'images' (in appropriate subfolders). The pull request will automatically determine the proper location on merge.`; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: failureComment, + }); + + throw new Error(failureComment); + } + + const fileListNoIndex = fileParamArr.filter((f) => f.startsWith(BASE_INDEX_MANIFEST_FILENAME) || f.startsWith(PREV_INDEX_MANIFEST_FILENAME)); + + if (fileListNoIndex.length > 0) { + const failureComment = `Detected manual changes in ${fileListNoIndex.join(', ')}. Please remove these changes. The pull request will automatically determine the manifests on merge.`; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: failureComment, + }); + + throw new Error(failureComment); + } + + // called at the top, fail early if invalid PR body metas + const extraMetas = await parsePRBodyExtraMetas(github, core, context); + const baseManifest = readManifest(BASE_INDEX_MANIFEST_FILENAME); + const prevManifest = readManifest(PREV_INDEX_MANIFEST_FILENAME); + + for (const file of fileList) { + core.startGroup(file); + core.info(`Processing '${file}'...`); + + let failureComment: string = ''; + + try { + const firmwareFileName = path.basename(file); + const manufacturer = file.replace(BASE_IMAGES_DIR, '').replace(firmwareFileName, '').replaceAll('/', '').trim(); + + if (!manufacturer) { + throw new Error(`\`${file}\` should be in its associated manufacturer subfolder.`); + } + + const firmwareBuffer = Buffer.from(readFileSync(file)); + const parsedImage = parseImageHeader(firmwareBuffer.subarray(firmwareBuffer.indexOf(UPGRADE_FILE_IDENTIFIER))); + + core.info(`[${file}] Parsed image header:`); + core.info(JSON.stringify(parsedImage, undefined, 2)); + + const fileExtraMetas = getFileExtraMetas(extraMetas, firmwareFileName); + + core.info(`[${file}] Extra metas:`); + core.info(JSON.stringify(fileExtraMetas, undefined, 2)); + + const baseOutDir = getOutDir(manufacturer, BASE_IMAGES_DIR); + const prevOutDir = getOutDir(manufacturer, PREV_IMAGES_DIR); + const [baseMatchIndex, baseMatch] = findMatchImage(parsedImage, baseManifest, fileExtraMetas); + const statusToBase = getParsedImageStatus(parsedImage, baseMatch); + + switch (statusToBase) { + case ParsedImageStatus.OLDER: { + // if prev doesn't have a match, move to prev + const [prevMatchIndex, prevMatch] = findMatchImage(parsedImage, prevManifest, fileExtraMetas); + const statusToPrev = getParsedImageStatus(parsedImage, prevMatch); + + switch (statusToPrev) { + case ParsedImageStatus.OLDER: + case ParsedImageStatus.IDENTICAL: { + failureComment = `Base manifest has higher version: +\`\`\`json +${JSON.stringify(baseMatch, undefined, 2)} +\`\`\` +and an equal or better match is already present in prev manifest: +\`\`\`json +${JSON.stringify(prevMatch, undefined, 2)} +\`\`\` +Parsed image header: +\`\`\`json +${JSON.stringify(parsedImage, undefined, 2)} +\`\`\``; + break; + } + + case ParsedImageStatus.NEWER: + case ParsedImageStatus.NEW: { + addImageToPrev( + `[${file}]`, + statusToPrev === ParsedImageStatus.NEWER, + prevManifest, + prevMatchIndex, + prevMatch!, + prevOutDir, + firmwareFileName, + manufacturer, + parsedImage, + firmwareBuffer, + undefined, + fileExtraMetas, + () => { + // relocate file to prev + renameSync(file, file.replace(`${BASE_IMAGES_DIR}/`, `${PREV_IMAGES_DIR}/`)); + }, + ); + + break; + } + } + + break; + } + + case ParsedImageStatus.IDENTICAL: { + failureComment = `Conflict with image at index \`${baseMatchIndex}\`: +\`\`\`json +${JSON.stringify(baseMatch, undefined, 2)} +\`\`\` +Parsed image header: +\`\`\`json +${JSON.stringify(parsedImage, undefined, 2)} +\`\`\``; + break; + } + + case ParsedImageStatus.NEWER: + case ParsedImageStatus.NEW: { + addImageToBase( + `[${file}]`, + statusToBase === ParsedImageStatus.NEWER, + prevManifest, + prevOutDir, + baseManifest, + baseMatchIndex, + baseMatch!, + baseOutDir, + firmwareFileName, + manufacturer, + parsedImage, + firmwareBuffer, + undefined, + fileExtraMetas, + () => { + /* noop */ + }, + ); + + break; + } + } + } catch (error) { + failureComment = (error as Error).message; + } + + if (failureComment) { + core.error(`[${file}] ` + failureComment); + await github.rest.pulls.createReviewComment({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + body: failureComment, + commit_id: context.payload.pull_request.head.sha, + path: file, + subject_type: 'file', + }); + + throw new Error(failureComment); + } + + core.endGroup(); + } + + writeManifest(PREV_INDEX_MANIFEST_FILENAME, prevManifest); + writeManifest(BASE_INDEX_MANIFEST_FILENAME, baseManifest); + + core.info(`Prev manifest has ${prevManifest.length} images.`); + core.info(`Base manifest has ${baseManifest.length} images.`); + + if (!context.payload.pull_request.merged) { + const diff = await execute(`git diff`); + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: `Merging this pull request will add these changes in a following commit: +\`\`\`diff +${diff} +\`\`\` +`, + }); + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..1ff5d22c --- /dev/null +++ b/src/index.ts @@ -0,0 +1,9 @@ +export * as common from './common.js'; +export {concatCaCerts} from './ghw_concat_cacerts.js'; +export {createAutodlRelease} from './ghw_create_autodl_release.js'; +export {createPRToDefault} from './ghw_create_pr_to_default.js'; +export {overwriteCache} from './ghw_overwrite_cache.js'; +export {reProcessAllImages} from './ghw_reprocess_all_images.js'; +export {runAutodl} from './ghw_run_autodl.js'; +export {updateOtaPR} from './ghw_update_ota_pr.js'; +export {processFirmwareImage} from './process_firmware_image.js'; diff --git a/src/print_ota_image_header.ts b/src/print_ota_image_header.ts new file mode 100644 index 00000000..d1053a5a --- /dev/null +++ b/src/print_ota_image_header.ts @@ -0,0 +1,5 @@ +import {readFileSync} from 'fs'; + +import {parseImageHeader} from './common.js'; + +console.log(parseImageHeader(readFileSync(process.argv[2]))); diff --git a/src/process_firmware_image.ts b/src/process_firmware_image.ts new file mode 100644 index 00000000..6710ee95 --- /dev/null +++ b/src/process_firmware_image.ts @@ -0,0 +1,221 @@ +import type {ExtraMetas} from './types'; + +import assert from 'assert'; +import {readdirSync, readFileSync, renameSync, rmSync, writeFileSync} from 'fs'; +import path from 'path'; + +import {extract} from 'tar'; + +import { + addImageToBase, + addImageToPrev, + BASE_IMAGES_DIR, + BASE_INDEX_MANIFEST_FILENAME, + findMatchImage, + getOutDir, + getParsedImageStatus, + ParsedImageStatus, + parseImageHeader, + PREV_IMAGES_DIR, + PREV_INDEX_MANIFEST_FILENAME, + readManifest, + TMP_DIR, + UPGRADE_FILE_IDENTIFIER, + writeManifest, +} from './common.js'; + +export const enum ProcessFirmwareImageStatus { + ERROR = -1, + SUCCESS = 0, + REQUEST_FAILED = 1, + TAR_NO_IMAGE = 2, +} + +async function tarExtract(filePath: string, outDir: string, tarImageFinder: (fileName: string) => boolean): Promise { + let outFileName: string | undefined; + + try { + console.log(`[${filePath}] Extracting TAR...`); + + await extract({file: filePath, cwd: TMP_DIR}); + + for (const file of readdirSync(TMP_DIR)) { + const archiveFilePath = path.join(TMP_DIR, file); + + if (tarImageFinder(file)) { + outFileName = file; + renameSync(archiveFilePath, path.join(outDir, outFileName)); + } else { + rmSync(archiveFilePath, {force: true}); + } + } + } catch (error) { + console.error(error); + + // force throw below, just in case something crashed in-between this being assigned and the end of the try block + outFileName = undefined; + } + + // always remove archive file once done + rmSync(filePath, {force: true}); + + if (!outFileName) { + throw new Error(`No image found in ${filePath}.`); + } + + return outFileName; +} + +export async function processFirmwareImage( + manufacturer: string, + firmwareFileName: string, + firmwareFileUrl: string, + extraMetas: ExtraMetas = {}, + tar: boolean = false, + tarImageFinder?: (fileName: string) => boolean, +): Promise { + // throttle requests (this is done at the top to ensure always executed) + await new Promise((resolve) => setTimeout(resolve, 300)); + + let firmwareFilePath: string | undefined; + const logPrefix = `[${manufacturer}:${firmwareFileName}]`; + + if (tar && !firmwareFileName.endsWith('.tar.gz')) { + // ignore non-archive + return ProcessFirmwareImageStatus.TAR_NO_IMAGE; + } + + const prevManifest = readManifest(PREV_INDEX_MANIFEST_FILENAME); + const baseManifest = readManifest(BASE_INDEX_MANIFEST_FILENAME); + const baseOutDir = getOutDir(manufacturer, BASE_IMAGES_DIR); + const prevOutDir = getOutDir(manufacturer, PREV_IMAGES_DIR); + + try { + const firmwareFile = await fetch(firmwareFileUrl); + + if (!firmwareFile.ok || !firmwareFile.body) { + console.error(`${logPrefix} Invalid response from ${firmwareFileUrl} status=${firmwareFile.status}.`); + return ProcessFirmwareImageStatus.REQUEST_FAILED; + } + + if (tar) { + assert(tarImageFinder, `No image finder function supplied for tar.`); + + const archiveBuffer = Buffer.from(await firmwareFile.arrayBuffer()); + const archiveFilePath = path.join(baseOutDir, firmwareFileName); + + writeFileSync(archiveFilePath, archiveBuffer); + + try { + firmwareFileName = await tarExtract(archiveFilePath, baseOutDir, tarImageFinder); + } catch { + console.error(`${logPrefix} No image found for ${firmwareFileUrl}.`); + return ProcessFirmwareImageStatus.TAR_NO_IMAGE; + } + } + + const firmwareBuffer = tar ? readFileSync(path.join(baseOutDir, firmwareFileName)) : Buffer.from(await firmwareFile.arrayBuffer()); + // make sure to parse from the actual start of the "spec OTA" portion of the file (e.g. Ikea has non-spec meta before) + const parsedImage = parseImageHeader(firmwareBuffer.subarray(firmwareBuffer.indexOf(UPGRADE_FILE_IDENTIFIER))); + const [baseMatchIndex, baseMatch] = findMatchImage(parsedImage, baseManifest, extraMetas); + const statusToBase = getParsedImageStatus(parsedImage, baseMatch); + + switch (statusToBase) { + case ParsedImageStatus.OLDER: { + // if prev doesn't have a match, move to prev + const [prevMatchIndex, prevMatch] = findMatchImage(parsedImage, prevManifest, extraMetas); + const statusToPrev = getParsedImageStatus(parsedImage, prevMatch); + + switch (statusToPrev) { + case ParsedImageStatus.OLDER: + case ParsedImageStatus.IDENTICAL: { + console.log( + `${logPrefix} Base manifest has higher version and an equal or better match is already present in prev manifest. Ignoring.`, + ); + + break; + } + + case ParsedImageStatus.NEWER: + case ParsedImageStatus.NEW: { + addImageToPrev( + logPrefix, + statusToPrev === ParsedImageStatus.NEWER, + prevManifest, + prevMatchIndex, + prevMatch!, + prevOutDir, + firmwareFileName, + manufacturer, + parsedImage, + firmwareBuffer, + firmwareFileUrl, + extraMetas, + () => { + firmwareFilePath = path.join(prevOutDir, firmwareFileName); + + // write before adding to manifest, in case of failure (throw), manifest won't have a broken link + writeFileSync(firmwareFilePath, firmwareBuffer); + }, + ); + + break; + } + } + + break; + } + + case ParsedImageStatus.IDENTICAL: { + console.log(`${logPrefix} Base manifest already has version ${parsedImage.fileVersion}. Ignoring.`); + + break; + } + + case ParsedImageStatus.NEWER: + case ParsedImageStatus.NEW: { + addImageToBase( + logPrefix, + statusToBase === ParsedImageStatus.NEWER, + prevManifest, + prevOutDir, + baseManifest, + baseMatchIndex, + baseMatch!, + baseOutDir, + firmwareFileName, + manufacturer, + parsedImage, + firmwareBuffer, + firmwareFileUrl, + extraMetas, + () => { + firmwareFilePath = path.join(baseOutDir, firmwareFileName); + + // write before adding to manifest, in case of failure (throw), manifest won't have a broken link + writeFileSync(firmwareFilePath, firmwareBuffer); + }, + ); + + break; + } + } + } catch (error) { + console.error(`${logPrefix} Failed to save firmware file ${firmwareFileName}: ${(error as Error).stack!}.`); + + /* istanbul ignore if */ + if (firmwareFilePath) { + rmSync(firmwareFilePath, {force: true}); + } + + return ProcessFirmwareImageStatus.ERROR; + } + + writeManifest(PREV_INDEX_MANIFEST_FILENAME, prevManifest); + writeManifest(BASE_INDEX_MANIFEST_FILENAME, baseManifest); + + console.log(`Prev manifest has ${prevManifest.length} images.`); + console.log(`Base manifest has ${baseManifest.length} images.`); + + return ProcessFirmwareImageStatus.SUCCESS; +} diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 00000000..dd02d283 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,74 @@ +//-- Copied from ZHC +export interface Version { + imageType: number; + manufacturerCode: number; + fileVersion: number; +} + +export interface ImageHeader { + otaUpgradeFileIdentifier: Buffer; + otaHeaderVersion: number; + otaHeaderLength: number; + otaHeaderFieldControl: number; + manufacturerCode: number; + imageType: number; + fileVersion: number; + zigbeeStackVersion: number; + otaHeaderString: string; + totalImageSize: number; + securityCredentialVersion?: number; + upgradeFileDestination?: Buffer; + minimumHardwareVersion?: number; + maximumHardwareVersion?: number; +} + +export interface ImageElement { + tagID: number; + length: number; + data: Buffer; +} + +export interface Image { + header: ImageHeader; + elements: ImageElement[]; + raw: Buffer; +} + +export interface ImageInfo { + imageType: number; + fileVersion: number; + manufacturerCode: number; +} + +// XXX: adjusted from ZHC +export interface ImageMeta { + fileVersion: number; + fileSize: number; + url: string; + force?: boolean; + sha512: string; + otaHeaderString: string; + hardwareVersionMin?: number; + hardwareVersionMax?: number; +} +//-- Copied from ZHC + +export interface RepoImageMeta extends ImageInfo, ImageMeta { + fileName: string; + modelId?: string; + manufacturerName?: string[]; + minFileVersion?: number; + maxFileVersion?: number; + originalUrl?: string; + releaseNotes?: string; +} + +export type ExtraMetas = Omit< + RepoImageMeta, + 'fileName' | 'fileVersion' | 'fileSize' | 'url' | 'imageType' | 'manufacturerCode' | 'sha512' | 'otaHeaderString' +>; +export type ExtraMetasWithFileName = Omit< + RepoImageMeta, + 'fileName' | 'fileVersion' | 'fileSize' | 'url' | 'imageType' | 'manufacturerCode' | 'sha512' | 'otaHeaderString' +> & {fileName?: string}; +export type GHExtraMetas = ExtraMetas | ExtraMetasWithFileName[]; diff --git a/tests/data.test.ts b/tests/data.test.ts new file mode 100644 index 00000000..ddec426b --- /dev/null +++ b/tests/data.test.ts @@ -0,0 +1,241 @@ +/** + * Notes: + * + * - URLs are initially set to 'wherever the file should end up based on version'. For tests requiring special moves, they will need to be swapped. + * + */ + +import type {ExtraMetas, RepoImageMeta} from '../src/types'; + +import {copyFileSync, existsSync, mkdirSync} from 'fs'; +import path from 'path'; + +import * as common from '../src/common'; + +export const IMAGE_V14_1 = 'ZLinky_router_v14.ota'; +export const IMAGE_V14_2 = 'ZLinky_router_v14_limited.ota'; +export const IMAGE_V13_1 = 'ZLinky_router_v13.ota'; +export const IMAGE_V13_2 = 'ZLinky_router_v13_limited.ota'; +export const IMAGE_V12_1 = 'ZLinky_router_v12.ota'; +export const IMAGE_V12_2 = 'ZLinky_router_v12_limited.ota'; +export const IMAGE_INVALID = 'not-a-valid-file.ota'; +export const IMAGE_TAR = '45856_00000006.tar.gz'; +export const IMAGE_TAR_OTA = 'Jasco_5_0_1_OnOff_45856_v6.ota'; +export const IMAGES_TEST_DIR = 'jest-tmp'; +export const BASE_IMAGES_TEST_DIR_PATH = path.join(common.BASE_IMAGES_DIR, IMAGES_TEST_DIR); +export const PREV_IMAGES_TEST_DIR_PATH = path.join(common.PREV_IMAGES_DIR, IMAGES_TEST_DIR); +/** + * - otaUpgradeFileIdentifier: , + * - otaHeaderVersion: 256, + * - otaHeaderLength: 56, + * - otaHeaderFieldControl: 0, + * - manufacturerCode: 4151, + * - imageType: 1, + * - fileVersion: 14, + * - zigbeeStackVersion: 2, + * - otaHeaderString: 'OM15081-RTR-JN5189-0000000000000', + * - totalImageSize: 249694 + */ +export const IMAGE_V14_1_METAS = { + fileName: IMAGE_V14_1, + fileVersion: 14, + fileSize: 249694, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images/${IMAGES_TEST_DIR}/${IMAGE_V14_1}`, + imageType: 1, + manufacturerCode: 4151, + sha512: 'cc69b0745c72daf8deda935ba47aa7abd34dfcaaa4bc35bfa0605cd7937b0ecd8582ba0c08110df4f620c8aa87798d201f407d3d7e17198cfef1a4aa13c5013d', + otaHeaderString: 'OM15081-RTR-JN5189-0000000000000', +}; +/** + * - otaUpgradeFileIdentifier: , + * - otaHeaderVersion: 256, + * - otaHeaderLength: 56, + * - otaHeaderFieldControl: 0, + * - manufacturerCode: 4151, + * - imageType: 2, + * - fileVersion: 14, + * - zigbeeStackVersion: 2, + * - otaHeaderString: 'OM15081-RTR-LIMITED-JN5189-00000', + * - totalImageSize: 249694 + */ +export const IMAGE_V14_2_METAS = { + fileName: IMAGE_V14_2, + fileVersion: 14, + fileSize: 249694, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images/${IMAGES_TEST_DIR}/${IMAGE_V14_2}`, + imageType: 2, + manufacturerCode: 4151, + sha512: 'f851cbff7297ba6223a969ba8da5182f9ef199cf9c8459c8408432e48485c1a8f018f6e1703a42f40143cccd3bf460c0acd92117d899e507a36845f24e970595', + otaHeaderString: 'OM15081-RTR-LIMITED-JN5189-00000', +}; +/** + * - otaUpgradeFileIdentifier: , + * - otaHeaderVersion: 256, + * - otaHeaderLength: 56, + * - otaHeaderFieldControl: 0, + * - manufacturerCode: 4151, + * - imageType: 1, + * - fileVersion: 13, + * - zigbeeStackVersion: 2, + * - otaHeaderString: 'OM15081-RTR-JN5189-0000000000000', + * - totalImageSize: 245406 + */ +export const IMAGE_V13_1_METAS = { + fileName: IMAGE_V13_1, + fileVersion: 13, + fileSize: 245406, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images1/${IMAGES_TEST_DIR}/${IMAGE_V13_1}`, + imageType: 1, + manufacturerCode: 4151, + sha512: '4d7ab47dcb24e478e0abb35e691222b7691e77ed5a56de3f9c82e8682730649b1a154110b7207d4391c32eae53a869e20878e880fc153dbe046690b870be8486', + otaHeaderString: 'OM15081-RTR-JN5189-0000000000000', +}; +/** + * - otaUpgradeFileIdentifier: , + * - otaHeaderVersion: 256, + * - otaHeaderLength: 56, + * - otaHeaderFieldControl: 0, + * - manufacturerCode: 4151, + * - imageType: 2, + * - fileVersion: 13, + * - zigbeeStackVersion: 2, + * - otaHeaderString: 'OM15081-RTR-LIMITED-JN5189-00000', + * - totalImageSize: 245406 + */ +export const IMAGE_V13_2_METAS = { + fileName: IMAGE_V13_2, + fileVersion: 13, + fileSize: 245406, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images1/${IMAGES_TEST_DIR}/${IMAGE_V13_2}`, + imageType: 2, + manufacturerCode: 4151, + sha512: 'dd77b28a3b4664e7ad944fcffaa9eca9f3adb0bbe598e12bdd6eece8070a8cdda6792bed378d173dd5b4532b4cdb88cebda0ef0c432c4c4d6581aa9f2bbba54d', + otaHeaderString: 'OM15081-RTR-LIMITED-JN5189-00000', +}; +/** + * - otaUpgradeFileIdentifier: , + * - otaHeaderVersion: 256, + * - otaHeaderLength: 56, + * - otaHeaderFieldControl: 0, + * - manufacturerCode: 4151, + * - imageType: 1, + * - fileVersion: 12, + * - zigbeeStackVersion: 2, + * - otaHeaderString: 'OM15081-RTR-JN5189-0000000000000', + * - totalImageSize: 245710 + */ +export const IMAGE_V12_1_METAS = { + fileName: IMAGE_V12_1, + fileVersion: 12, + fileSize: 245710, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images1/${IMAGES_TEST_DIR}/${IMAGE_V12_1}`, + imageType: 1, + manufacturerCode: 4151, + sha512: '5d7e0a20141b78b85b4b046e623bc2bba24b28563464fe70227e79d0acdd5c0bde2adbd9d2557bd6cdfef2036d964c35c9e1746a8f1356af3325dd96f7a80e56', + otaHeaderString: 'OM15081-RTR-JN5189-0000000000000', +}; +/** + * - otaUpgradeFileIdentifier: , + * - otaHeaderVersion: 256, + * - otaHeaderLength: 56, + * - otaHeaderFieldControl: 0, + * - manufacturerCode: 4151, + * - imageType: 2, + * - fileVersion: 12, + * - zigbeeStackVersion: 2, + * - otaHeaderString: 'OM15081-RTR-LIMITED-JN5189-00000', + * - totalImageSize: 245710 + */ +export const IMAGE_V12_2_METAS = { + fileName: IMAGE_V12_2, + fileVersion: 12, + fileSize: 245710, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images1/${IMAGES_TEST_DIR}/${IMAGE_V12_2}`, + imageType: 2, + manufacturerCode: 4151, + sha512: '4e178e56c1559e11734c07abbb95110675df7738f3ca3e5dbc99393325295ff6c66bd63ba55c0ef6043a80608dbec2be7a1e845f31ffd94f1cb63f32f0d48c6e', + otaHeaderString: 'OM15081-RTR-LIMITED-JN5189-00000', +}; +/** obviously bogus, just for mocking */ +export const IMAGE_INVALID_METAS = { + fileName: IMAGE_INVALID, + fileVersion: 0, + fileSize: 0, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images/${IMAGES_TEST_DIR}/${IMAGE_INVALID}`, + imageType: 1, + manufacturerCode: 65535, + sha512: 'abcd', + otaHeaderString: 'nothing', +}; +/** + * - otaUpgradeFileIdentifier: , + * - otaHeaderVersion: 256, + * - otaHeaderLength: 56, + * - otaHeaderFieldControl: 0, + * - manufacturerCode: 4388, + * - imageType: 2, + * - fileVersion: 6, + * - zigbeeStackVersion: 2, + * - otaHeaderString: 'Jasco 45856 image\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', + * - totalImageSize: 162302 + */ +export const IMAGE_TAR_METAS = { + fileName: IMAGE_TAR_OTA, + fileVersion: 6, + fileSize: 162302, + originalUrl: undefined, + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/images/${IMAGES_TEST_DIR}/${IMAGE_TAR_OTA}`, + imageType: 2, + manufacturerCode: 4388, + sha512: '3306332e001eab9d71c9360089d450ea21e2c08bac957b523643c042707887e85db0c510f3480bdbcfcfe2398eeaad88d455f346f1e07841e1d690d8c16dc211', + otaHeaderString: 'Jasco 45856 image\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', +}; + +export const getImageOriginalDirPath = (imageName: string): string => { + return path.join('tests', common.BASE_IMAGES_DIR, imageName); +}; + +export const useImage = (imageName: string, outDir: string = BASE_IMAGES_TEST_DIR_PATH): string => { + const realPath = path.join(outDir, imageName); + + if (!existsSync(outDir)) { + mkdirSync(outDir, {recursive: true}); + } + + copyFileSync(getImageOriginalDirPath(imageName), realPath); + + // return as posix for github match + return path.posix.join(BASE_IMAGES_TEST_DIR_PATH.replaceAll('\\', '/'), imageName); +}; + +export const withExtraMetas = (meta: RepoImageMeta, extraMetas: ExtraMetas): RepoImageMeta => { + return Object.assign({}, structuredClone(meta), extraMetas); +}; + +export const getAdjustedContent = (fileName: string, content: RepoImageMeta[]): RepoImageMeta[] => { + return content.map((c) => { + if (fileName === common.BASE_INDEX_MANIFEST_FILENAME && c.url.includes(`/${common.PREV_IMAGES_DIR}/`)) { + return withExtraMetas(c, { + // @ts-expect-error override + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/${common.BASE_IMAGES_DIR}/${IMAGES_TEST_DIR}/${c.fileName}`, + }); + } else if (fileName === common.PREV_INDEX_MANIFEST_FILENAME && c.url.includes(`${common.BASE_IMAGES_DIR}`)) { + return withExtraMetas(c, { + // @ts-expect-error override + url: `https://github.com/Koenkk/zigbee-OTA/raw/master/${common.PREV_IMAGES_DIR}/${IMAGES_TEST_DIR}/${c.fileName}`, + }); + } + + return c; + }); +}; + +// required to consider as a 'test suite' +it('passes', () => {}); diff --git a/tests/ghw_reprocess_all_images.test.ts b/tests/ghw_reprocess_all_images.test.ts new file mode 100644 index 00000000..2f3f1f75 --- /dev/null +++ b/tests/ghw_reprocess_all_images.test.ts @@ -0,0 +1,786 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; + +import type {RepoImageMeta} from '../src/types'; + +import {copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync} from 'fs'; +import path from 'path'; + +import * as common from '../src/common'; +import { + NOT_IN_BASE_MANIFEST_IMAGES_DIR, + NOT_IN_MANIFEST_FILENAME, + NOT_IN_PREV_MANIFEST_IMAGES_DIR, + reProcessAllImages, +} from '../src/ghw_reprocess_all_images'; +import { + BASE_IMAGES_TEST_DIR_PATH, + getAdjustedContent, + getImageOriginalDirPath, + IMAGE_INVALID, + IMAGE_INVALID_METAS, + IMAGE_V12_1, + IMAGE_V13_1, + IMAGE_V13_1_METAS, + IMAGE_V14_1, + IMAGE_V14_1_METAS, + IMAGES_TEST_DIR, + PREV_IMAGES_TEST_DIR_PATH, + useImage, + withExtraMetas, +} from './data.test'; + +/** not used */ +const github = {}; +const core: Partial = { + debug: console.debug, + info: console.log, + warning: console.warn, + error: console.error, + notice: console.log, + startGroup: jest.fn(), + endGroup: jest.fn(), +}; +const context: Partial = { + payload: {}, + repo: { + owner: 'Koenkk', + repo: 'zigbee-OTA', + }, +}; + +const OLD_META_3RD_PARTY_1_REAL_IMAGE = IMAGE_V13_1; +const OLD_META_3RD_PARTY_1_REAL_METAS = IMAGE_V13_1_METAS; +const OLD_META_3RD_PARTY_1_METAS = { + fileVersion: 1124103171, + fileSize: 258104, + manufacturerCode: 4107, + imageType: 256, + sha512: 'c63a1eb02ac030f3a76d9e81a4d48695796457d263bb1dae483688134e550d9846c37a3fd0eab2d4670f12f11b79691a5cf2789af0dbd90d703512496190a0a5', + // mock fileName to trigger mocked fetch properly + url: `https://otau.meethue.com/storage/ZGB_100B_0100/2dcfe6e6-0177-4c81-a1d9-4d2bd2ea1fb7/${OLD_META_3RD_PARTY_1_REAL_IMAGE}`, +}; +const OLD_META_3RD_PARTY_2_REAL_IMAGE = IMAGE_V14_1; +const OLD_META_3RD_PARTY_2_REAL_METAS = IMAGE_V14_1_METAS; +const OLD_META_3RD_PARTY_2_METAS = { + fileVersion: 192, + fileSize: 307682, + manufacturerCode: 4417, + imageType: 54179, + modelId: 'TS011F', + sha512: '01939ca4fc790432d2c233e19b2440c1e0248d2ce85c9299e0b88928cb2341de675350ac7b78187a25f06a2768f93db0a17c4ba950b60c82c072e0c0833cfcfb', + // mock fileName to trigger mocked fetch properly + url: `https://images.tuyaeu.com/smart/firmware/upgrade/20220907/${OLD_META_3RD_PARTY_2_REAL_IMAGE}`, +}; +const OLD_META_3RD_PARTY_IGNORED_METAS = { + fileVersion: 317, + fileSize: 693230, + manufacturerCode: 13379, + imageType: 4113, + sha512: '66040fb2b2787bf8ebfc75bc3c7356c7d8b966b4c82282bd7393783b8dc453ec2c8dcb4d7c9fe7c0a83d87739bd3677f205d79edddfa4fa2749305ca987887b1', + url: 'https://github.com/xyzroe/ZigUSB_C6/releases/download/317/ZigUSB_C6.ota', +}; +const NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH = path.join(NOT_IN_BASE_MANIFEST_IMAGES_DIR, IMAGES_TEST_DIR); +const NOT_IN_PREV_MANIFEST_IMAGE_DIR_PATH = path.join(NOT_IN_PREV_MANIFEST_IMAGES_DIR, IMAGES_TEST_DIR); +const NOT_IN_BASE_MANIFEST_FILEPATH = path.join(NOT_IN_BASE_MANIFEST_IMAGES_DIR, NOT_IN_MANIFEST_FILENAME); +const NOT_IN_PREV_MANIFEST_FILEPATH = path.join(NOT_IN_PREV_MANIFEST_IMAGES_DIR, NOT_IN_MANIFEST_FILENAME); +// move to tmp dirs in `beforeAll` to allow tests to run (reverted in `afterAll`) +const NOT_IN_PREV_MANIFEST_IMAGES_DIR_TMP = `${NOT_IN_PREV_MANIFEST_IMAGES_DIR}-moved-by-jest`; +const NOT_IN_BASE_MANIFEST_IMAGES_DIR_TMP = `${NOT_IN_BASE_MANIFEST_IMAGES_DIR}-moved-by-jest`; + +describe('Github Workflow: Re-Process All Images', () => { + let baseManifest: RepoImageMeta[]; + let prevManifest: RepoImageMeta[]; + let notInBaseManifest: RepoImageMeta[]; + let notInPrevManifest: RepoImageMeta[]; + let readManifestSpy: jest.SpyInstance; + let writeManifestSpy: jest.SpyInstance; + let addImageToBaseSpy: jest.SpyInstance; + let addImageToPrevSpy: jest.SpyInstance; + let coreWarningSpy: jest.SpyInstance; + let coreErrorSpy: jest.SpyInstance; + + const getManifest = (fileName: string): RepoImageMeta[] => { + if (fileName === common.BASE_INDEX_MANIFEST_FILENAME) { + return baseManifest; + } else if (fileName === common.PREV_INDEX_MANIFEST_FILENAME) { + return prevManifest; + } else if (fileName === path.join(NOT_IN_BASE_MANIFEST_IMAGES_DIR, NOT_IN_MANIFEST_FILENAME)) { + return notInBaseManifest; + } else if (fileName === path.join(NOT_IN_PREV_MANIFEST_IMAGES_DIR, NOT_IN_MANIFEST_FILENAME)) { + return notInPrevManifest; + } else { + throw new Error(`${fileName} not supported`); + } + }; + + const setManifest = (fileName: string, content: RepoImageMeta[]): void => { + const adjustedContent = getAdjustedContent(fileName, content); + + if (fileName === common.BASE_INDEX_MANIFEST_FILENAME) { + baseManifest = adjustedContent; + } else if (fileName === common.PREV_INDEX_MANIFEST_FILENAME) { + prevManifest = adjustedContent; + } else if (fileName === path.join(NOT_IN_BASE_MANIFEST_IMAGES_DIR, NOT_IN_MANIFEST_FILENAME)) { + notInBaseManifest = adjustedContent; + } else if (fileName === path.join(NOT_IN_PREV_MANIFEST_IMAGES_DIR, NOT_IN_MANIFEST_FILENAME)) { + notInPrevManifest = adjustedContent; + } else { + throw new Error(`${fileName} not supported`); + } + }; + + const resetManifests = (): void => { + baseManifest = []; + prevManifest = []; + }; + + const withOldMetas = (metas: RepoImageMeta): RepoImageMeta => { + const oldMetas = structuredClone(metas); + delete oldMetas.originalUrl; + // @ts-expect-error mock + delete oldMetas.sha512; + + return oldMetas; + }; + + const expectWriteNoChange = (nth: number, fileName: string): void => { + expect(writeManifestSpy).toHaveBeenNthCalledWith(nth, fileName, getManifest(fileName)); + }; + + beforeAll(() => { + if (existsSync(NOT_IN_PREV_MANIFEST_IMAGES_DIR)) { + renameSync(NOT_IN_PREV_MANIFEST_IMAGES_DIR, NOT_IN_PREV_MANIFEST_IMAGES_DIR_TMP); + } + + if (existsSync(NOT_IN_BASE_MANIFEST_IMAGES_DIR)) { + renameSync(NOT_IN_BASE_MANIFEST_IMAGES_DIR, NOT_IN_BASE_MANIFEST_IMAGES_DIR_TMP); + } + }); + + afterAll(() => { + readManifestSpy.mockRestore(); + writeManifestSpy.mockRestore(); + addImageToBaseSpy.mockRestore(); + addImageToPrevSpy.mockRestore(); + coreWarningSpy.mockRestore(); + coreErrorSpy.mockRestore(); + rmSync(BASE_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(PREV_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH, {recursive: true, force: true}); + rmSync(NOT_IN_PREV_MANIFEST_IMAGE_DIR_PATH, {recursive: true, force: true}); + + if (existsSync(NOT_IN_PREV_MANIFEST_IMAGES_DIR_TMP)) { + rmSync(NOT_IN_PREV_MANIFEST_IMAGES_DIR, {recursive: true, force: true}); + renameSync(NOT_IN_PREV_MANIFEST_IMAGES_DIR_TMP, NOT_IN_PREV_MANIFEST_IMAGES_DIR); + } + + if (existsSync(NOT_IN_BASE_MANIFEST_IMAGES_DIR_TMP)) { + rmSync(NOT_IN_BASE_MANIFEST_IMAGES_DIR, {recursive: true, force: true}); + renameSync(NOT_IN_BASE_MANIFEST_IMAGES_DIR_TMP, NOT_IN_BASE_MANIFEST_IMAGES_DIR); + } + }); + + beforeEach(() => { + resetManifests(); + + readManifestSpy = jest.spyOn(common, 'readManifest').mockImplementation(getManifest); + writeManifestSpy = jest.spyOn(common, 'writeManifest').mockImplementation(setManifest); + addImageToBaseSpy = jest.spyOn(common, 'addImageToBase'); + addImageToPrevSpy = jest.spyOn(common, 'addImageToPrev'); + coreWarningSpy = jest.spyOn(core, 'warning'); + coreErrorSpy = jest.spyOn(core, 'error'); + }); + + afterEach(() => { + rmSync(BASE_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(PREV_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH, {recursive: true, force: true}); + rmSync(NOT_IN_PREV_MANIFEST_IMAGE_DIR_PATH, {recursive: true, force: true}); + }); + + it('failure when moving not in manifest if base out directory is not empty', async () => { + mkdirSync(NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH, {recursive: true}); + copyFileSync(getImageOriginalDirPath(IMAGE_V12_1), path.join(NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH, IMAGE_V12_1)); + + await expect(async () => { + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, false, true); + }).rejects.toThrow(expect.objectContaining({message: expect.stringContaining('is not empty')})); + }); + + it('failure when moving not in manifest if prev out directory is not empty', async () => { + mkdirSync(NOT_IN_PREV_MANIFEST_IMAGE_DIR_PATH, {recursive: true}); + copyFileSync(getImageOriginalDirPath(IMAGE_V12_1), path.join(NOT_IN_PREV_MANIFEST_IMAGE_DIR_PATH, IMAGE_V12_1)); + + await expect(async () => { + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, false, true); + }).rejects.toThrow(expect.objectContaining({message: expect.stringContaining('is not empty')})); + }); + + it('failure when image not in subdirectory', async () => { + // this is renaming the image to the same as the test dir name for simplicity in code exclusion + const outPath = path.join(common.PREV_IMAGES_DIR, IMAGES_TEST_DIR); + + if (!existsSync(common.PREV_IMAGES_DIR)) { + mkdirSync(common.PREV_IMAGES_DIR, {recursive: true}); + } + + copyFileSync(getImageOriginalDirPath(IMAGE_V12_1), outPath); + + await expect(async () => { + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, false, true); + }).rejects.toThrow( + expect.objectContaining({message: expect.stringContaining(`Detected file in ${common.PREV_IMAGES_DIR} not in subdirectory`)}), + ); + + rmSync(outPath, {force: true}); + }); + + it('removes image not in manifest', async () => { + const imagePath = useImage(IMAGE_V12_1, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, true); + + expect(existsSync(imagePath)).toStrictEqual(false); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(2, common.BASE_INDEX_MANIFEST_FILENAME); + expect(coreWarningSpy).toHaveBeenCalledWith(expect.stringContaining(`Not found in base manifest:`)); + }); + + it('removes multiple images not in manifest', async () => { + const image1Path = useImage(IMAGE_V13_1, BASE_IMAGES_TEST_DIR_PATH); + const image2Path = useImage(IMAGE_V12_1, BASE_IMAGES_TEST_DIR_PATH); + const image3Path = useImage(IMAGE_V12_1, PREV_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, true); + + expect(existsSync(image1Path)).toStrictEqual(false); + expect(existsSync(image2Path)).toStrictEqual(false); + expect(existsSync(image3Path)).toStrictEqual(false); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(2, common.BASE_INDEX_MANIFEST_FILENAME); + // prev first, then alphabetical + expect(coreWarningSpy).toHaveBeenNthCalledWith(1, expect.stringContaining(`Not found in base manifest:`)); + expect(coreWarningSpy).toHaveBeenNthCalledWith(2, expect.stringContaining(`Not found in base manifest:`)); + expect(coreWarningSpy).toHaveBeenNthCalledWith(3, expect.stringContaining(`Not found in base manifest:`)); + }); + + it('moves image not in manifest', async () => { + const oldPath = useImage(IMAGE_V12_1, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, false, true); + + const newPath = path.join(NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH, IMAGE_V12_1); + expect(existsSync(oldPath)).toStrictEqual(false); + expect(existsSync(newPath)).toStrictEqual(true); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(3); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, NOT_IN_BASE_MANIFEST_FILEPATH, expect.any(Array)); + expectWriteNoChange(3, common.BASE_INDEX_MANIFEST_FILENAME); + }); + + it('moves multiple images not in manifest', async () => { + const oldPath1 = useImage(IMAGE_V13_1, BASE_IMAGES_TEST_DIR_PATH); + const oldPath2 = useImage(IMAGE_V12_1, BASE_IMAGES_TEST_DIR_PATH); + const oldPath3 = useImage(IMAGE_V12_1, PREV_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, false, true); + + const newPath1 = path.join(NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH, IMAGE_V13_1); + const newPath2 = path.join(NOT_IN_BASE_MANIFEST_IMAGE_DIR_PATH, IMAGE_V12_1); + const newPath3 = path.join(NOT_IN_PREV_MANIFEST_IMAGE_DIR_PATH, IMAGE_V12_1); + expect(existsSync(newPath1)).toStrictEqual(true); + expect(existsSync(oldPath1)).toStrictEqual(false); + expect(existsSync(newPath2)).toStrictEqual(true); + expect(existsSync(oldPath2)).toStrictEqual(false); + expect(existsSync(newPath3)).toStrictEqual(true); + expect(existsSync(oldPath3)).toStrictEqual(false); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, NOT_IN_PREV_MANIFEST_FILEPATH, expect.any(Array)); + expectWriteNoChange(2, common.PREV_INDEX_MANIFEST_FILENAME); + expect(writeManifestSpy).toHaveBeenNthCalledWith(3, NOT_IN_BASE_MANIFEST_FILEPATH, expect.any(Array)); + expectWriteNoChange(4, common.BASE_INDEX_MANIFEST_FILENAME); + }); + + it('removes invalid not in manifest even if remove disabled', async () => { + const oldPath = useImage(IMAGE_INVALID, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, false, true); + + expect(existsSync(oldPath)).toStrictEqual(false); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, []); + expect(coreErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Removing`)); + expect(coreErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Not a valid OTA file`)); + expect(coreWarningSpy).toHaveBeenCalledWith(expect.stringContaining(`Not found in base manifest`)); + }); + + it('removes invalid in manifest', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_INVALID_METAS]); + const oldPath = useImage(IMAGE_INVALID, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, true); + + expect(existsSync(oldPath)).toStrictEqual(false); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, []); + expect(coreErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Removing`)); + expect(coreErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Not a valid OTA file`)); + }); + + it('keeps image and rewrites manifest', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [withOldMetas(IMAGE_V14_1_METAS)]); + const imagePath = useImage(IMAGE_V14_1, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, true); + + expect(existsSync(imagePath)).toStrictEqual(true); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + }); + + it('keeps image with escaped url and rewrites manifest', async () => { + const oldMetas = withOldMetas(IMAGE_V14_1_METAS); + const fileName = oldMetas.url.split('/').pop()!; + const newName = fileName.replace('.ota', `(%1).ota`); + const baseUrl = oldMetas.url.replace(fileName, ''); + oldMetas.url = baseUrl + escape(newName); + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [oldMetas]); + const imagePath = useImage(IMAGE_V14_1, BASE_IMAGES_TEST_DIR_PATH); + const baseName = path.basename(imagePath); + const renamedPath = imagePath.replace(baseName, newName); + renameSync(imagePath, renamedPath); + console.log(newName, oldMetas.url, renamedPath); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, true); + + expect(existsSync(renamedPath)).toStrictEqual(true); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + const outManifestMetas = withExtraMetas( + IMAGE_V14_1_METAS, + // @ts-expect-error override + {fileName: newName, url: `${baseUrl}${newName}`}, + ); + delete outManifestMetas.originalUrl; + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [outManifestMetas]); + }); + + it('ignores when same images referenced multiple times in manifest', async () => { + const oldMetas1 = withOldMetas(IMAGE_V14_1_METAS); + const oldMetas2 = withOldMetas(IMAGE_V14_1_METAS); + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [oldMetas1, oldMetas2]); + const image1Path = useImage(IMAGE_V14_1, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, true); + + expect(existsSync(image1Path)).toStrictEqual(true); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + expect(coreWarningSpy).toHaveBeenCalledWith( + expect.stringContaining(`found multiple times in ${common.BASE_INDEX_MANIFEST_FILENAME} manifest`), + ); + }); + + it('keeps same images referenced multiple times in manifest with different extra metas', async () => { + const oldMetas1 = withExtraMetas(withOldMetas(IMAGE_V14_1_METAS), {modelId: 'test1'}); + const oldMetas2 = withExtraMetas(withOldMetas(IMAGE_V14_1_METAS), {modelId: 'test2'}); + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [oldMetas1, oldMetas2]); + const image1Path = useImage(IMAGE_V14_1, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, true); + + expect(existsSync(image1Path)).toStrictEqual(true); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(IMAGE_V14_1_METAS, {modelId: 'test1'}), + withExtraMetas(IMAGE_V14_1_METAS, {modelId: 'test2'}), + ]); + expect(coreWarningSpy).toHaveBeenCalledWith( + expect.stringContaining(`found multiple times in ${common.BASE_INDEX_MANIFEST_FILENAME} manifest`), + ); + }); + + describe('downloads', () => { + let fetchSpy: jest.SpyInstance; + let setTimeoutSpy: jest.SpyInstance; + let fetchReturnedStatus: {ok: boolean; status: number; body?: object} = {ok: true, status: 200, body: {}}; + const get3rdPartyDir = jest.fn().mockReturnValue(IMAGES_TEST_DIR); + + const adaptUrl = (originalUrl: string, manifestName: string): string => { + if (manifestName === common.BASE_INDEX_MANIFEST_FILENAME) { + return originalUrl.replace(`/${common.PREV_IMAGES_DIR}/`, `/${common.BASE_IMAGES_DIR}/`); + } else if (manifestName === common.PREV_INDEX_MANIFEST_FILENAME) { + return originalUrl.replace(`/${common.BASE_IMAGES_DIR}/`, `/${common.PREV_IMAGES_DIR}/`); + } else { + throw new Error(`Not supported: ${manifestName}`); + } + }; + + afterAll(() => { + fetchSpy.mockRestore(); + setTimeoutSpy.mockRestore(); + }); + + beforeEach(() => { + process.env.NODE_EXTRA_CA_CERTS = 'cacerts.pem'; + fetchReturnedStatus = {ok: true, status: 200, body: {}}; + fetchSpy = jest.spyOn(global, 'fetch').mockImplementation( + // @ts-expect-error mocked as needed + (input) => { + return { + ok: fetchReturnedStatus.ok, + status: fetchReturnedStatus.status, + body: fetchReturnedStatus.body, + arrayBuffer: (): ArrayBuffer => readFileSync(getImageOriginalDirPath((input as string).split('/').pop()!)), + }; + }, + ); + setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation( + // @ts-expect-error mock + (fn) => { + fn(); + }, + ); + }); + + it('failure without CA Certificates ENV', async () => { + process.env.NODE_EXTRA_CA_CERTS = ''; + + await expect(async () => { + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + }).rejects.toThrow( + expect.objectContaining({message: expect.stringContaining(`Download 3rd Parties requires \`NODE_EXTRA_CA_CERTS=cacerts.pem\``)}), + ); + }); + + it('failure with malformed metas', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [ + // @ts-expect-error old metas + { + fileVersion: 192, + fileSize: 307682, + manufacturerCode: 4417, + imageType: 54179, + modelId: 'TS011F', + sha512: '01939ca4fc790432d2c233e19b2440c1e0248d2ce85c9299e0b88928cb2341de675350ac7b78187a25f06a2768f93db0a17c4ba950b60c82c072e0c0833cfcfb', + url: '', // not undefined to pass setManifest + }, + ]); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(0); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(2, common.BASE_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(3, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(4, common.BASE_INDEX_MANIFEST_FILENAME); + expect(coreErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Ignoring malformed`)); + }); + + it('failure from fetch ok', async () => { + setManifest( + common.BASE_INDEX_MANIFEST_FILENAME, + // @ts-expect-error old metas + [OLD_META_3RD_PARTY_1_METAS], + ); + fetchReturnedStatus.ok = false; + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(1); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(2, common.BASE_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(3, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(4, common.BASE_INDEX_MANIFEST_FILENAME); + expect(coreErrorSpy).toHaveBeenCalledWith( + `Invalid response from ${OLD_META_3RD_PARTY_1_METAS.url} status=${fetchReturnedStatus.status}.`, + ); + }); + + it('ignores urls from this repo', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + // prevent trigger removal because of missing file + useImage(IMAGE_V14_1, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(0); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(2, common.BASE_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(3, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(4, common.BASE_INDEX_MANIFEST_FILENAME); + }); + + it('ignores urls with no out dir specified', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [ + // @ts-expect-error old metas + { + fileVersion: 192, + fileSize: 307682, + manufacturerCode: 4417, + imageType: 54179, + modelId: 'TS011F', + sha512: '01939ca4fc790432d2c233e19b2440c1e0248d2ce85c9299e0b88928cb2341de675350ac7b78187a25f06a2768f93db0a17c4ba950b60c82c072e0c0833cfcfb', + url: 'https://www.elektroimportoren.no/docs/lib/4512772-Firmware-35.ota', + }, + ]); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(0); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(2, common.BASE_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(3, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(4, common.BASE_INDEX_MANIFEST_FILENAME); + expect(coreWarningSpy).toHaveBeenCalledWith(expect.stringContaining(`no out dir specified`)); + }); + + it('ignores invalid OTA file', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [ + Object.assign({}, withOldMetas(IMAGE_INVALID_METAS), { + url: `https://images.tuyaeu.com/smart/firmware/upgrade/20220907/${IMAGES_TEST_DIR}/${IMAGE_INVALID}`, + }), + ]); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(1); + expectWriteNoChange(1, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(2, common.BASE_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(3, common.PREV_INDEX_MANIFEST_FILENAME); + expectWriteNoChange(4, common.BASE_INDEX_MANIFEST_FILENAME); + expect(coreErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Ignoring`)); + expect(coreErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Not a valid OTA file`)); + }); + + it('ignores identical image', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [ + IMAGE_V14_1_METAS, + Object.assign({}, withOldMetas(IMAGE_V14_1_METAS), { + url: `https://images.tuyaeu.com/smart/firmware/upgrade/20220907/${IMAGES_TEST_DIR}/${IMAGE_V14_1}`, + }), + ]); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(1); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(0); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + expect(coreWarningSpy).toHaveBeenCalledWith(expect.stringContaining(`Conflict with image at index \`0\``)); + }); + + it('success without mocked get3rdPartyDir', async () => { + // NOTE: this is using a name (ZLinky_router_v13.ota) and out dir (Hue) that is unlikely to ever be in conflict with actual Hue images + setManifest( + common.BASE_INDEX_MANIFEST_FILENAME, + // @ts-expect-error old metas + [OLD_META_3RD_PARTY_1_METAS], + ); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(1); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(OLD_META_3RD_PARTY_1_REAL_METAS, { + originalUrl: OLD_META_3RD_PARTY_1_METAS.url, + // @ts-expect-error override + url: adaptUrl(OLD_META_3RD_PARTY_1_REAL_METAS.url, common.BASE_INDEX_MANIFEST_FILENAME).replace(IMAGES_TEST_DIR, 'Hue'), + }), + ]); + + rmSync(path.join(common.BASE_IMAGES_DIR, 'Hue', OLD_META_3RD_PARTY_1_REAL_IMAGE)); + }); + + it('success with add different metas and ignored', async () => { + setManifest( + common.BASE_INDEX_MANIFEST_FILENAME, + // @ts-expect-error old metas + [OLD_META_3RD_PARTY_1_METAS, OLD_META_3RD_PARTY_2_METAS, OLD_META_3RD_PARTY_IGNORED_METAS], + ); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(get3rdPartyDir).toHaveBeenCalledTimes(2); + expect(get3rdPartyDir).toHaveBeenNthCalledWith(1, OLD_META_3RD_PARTY_1_METAS); + expect(get3rdPartyDir).toHaveBeenNthCalledWith(2, OLD_META_3RD_PARTY_2_METAS); + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(2); // adds both, second process moves first to prev + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(OLD_META_3RD_PARTY_1_REAL_METAS, { + originalUrl: OLD_META_3RD_PARTY_1_METAS.url, + // @ts-expect-error override + url: adaptUrl(OLD_META_3RD_PARTY_1_REAL_METAS.url, common.BASE_INDEX_MANIFEST_FILENAME), + }), + withExtraMetas(OLD_META_3RD_PARTY_2_REAL_METAS, { + originalUrl: OLD_META_3RD_PARTY_2_METAS.url, + // @ts-expect-error override + url: adaptUrl(OLD_META_3RD_PARTY_2_REAL_METAS.url, common.BASE_INDEX_MANIFEST_FILENAME), + modelId: OLD_META_3RD_PARTY_2_METAS.modelId, + }), + ]); + expect(coreWarningSpy).toHaveBeenCalledWith(expect.stringContaining(`Removing ignored '${OLD_META_3RD_PARTY_IGNORED_METAS.url}'`)); + }); + + it('success with add+move same and ignored', async () => { + setManifest( + common.BASE_INDEX_MANIFEST_FILENAME, + // @ts-expect-error old metas + [OLD_META_3RD_PARTY_1_METAS, OLD_META_3RD_PARTY_IGNORED_METAS, withExtraMetas(OLD_META_3RD_PARTY_2_METAS, {modelId: undefined})], + ); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(2); // adds both, second process moves first to prev + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(OLD_META_3RD_PARTY_1_REAL_METAS, { + originalUrl: OLD_META_3RD_PARTY_1_METAS.url, + // @ts-expect-error override + url: adaptUrl(OLD_META_3RD_PARTY_1_REAL_METAS.url, common.PREV_INDEX_MANIFEST_FILENAME), + }), + ]); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(OLD_META_3RD_PARTY_2_REAL_METAS, { + originalUrl: OLD_META_3RD_PARTY_2_METAS.url, + // @ts-expect-error override + url: adaptUrl(OLD_META_3RD_PARTY_2_REAL_METAS.url, common.BASE_INDEX_MANIFEST_FILENAME), + }), + ]); + expect(coreWarningSpy).toHaveBeenCalledWith(expect.stringContaining(`Removing ignored '${OLD_META_3RD_PARTY_IGNORED_METAS.url}'`)); + }); + + it('success with add to prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [ + IMAGE_V14_1_METAS, + // @ts-expect-error old metas + OLD_META_3RD_PARTY_1_METAS, + ]); + // prevent trigger removal because of missing file + useImage(IMAGE_V14_1, BASE_IMAGES_TEST_DIR_PATH); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, get3rdPartyDir); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(1); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(0); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(1); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(OLD_META_3RD_PARTY_1_REAL_METAS, { + originalUrl: adaptUrl(OLD_META_3RD_PARTY_1_METAS.url, common.PREV_INDEX_MANIFEST_FILENAME), + }), + ]); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + expect(writeManifestSpy).toHaveBeenNthCalledWith(3, common.PREV_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(OLD_META_3RD_PARTY_1_REAL_METAS, { + originalUrl: adaptUrl(OLD_META_3RD_PARTY_1_METAS.url, common.PREV_INDEX_MANIFEST_FILENAME), + }), + ]); + expect(writeManifestSpy).toHaveBeenNthCalledWith(4, common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + }); + + it('success with escaped', async () => { + const oldMetas = structuredClone(OLD_META_3RD_PARTY_1_METAS); + const fileName = oldMetas.url.split('/').pop()!; + const newName = fileName.replace('.ota', `(%1).ota`); + const baseUrl = oldMetas.url.replace(fileName, ''); + oldMetas.url = baseUrl + escape(newName); + // @ts-expect-error old metas + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [oldMetas]); + // link back to existing image from fetch + fetchSpy = jest.spyOn(global, 'fetch').mockImplementationOnce( + // @ts-expect-error mocked as needed + () => { + return { + ok: fetchReturnedStatus.ok, + status: fetchReturnedStatus.status, + body: fetchReturnedStatus.body, + arrayBuffer: (): ArrayBuffer => readFileSync(getImageOriginalDirPath(fileName)), + }; + }, + ); + + // @ts-expect-error mocked as needed + await reProcessAllImages(github, core, context, true, false, () => IMAGES_TEST_DIR); + + expect(readManifestSpy).toHaveBeenCalledTimes(4); + expect(writeManifestSpy).toHaveBeenCalledTimes(4); + expect(fetchSpy).toHaveBeenCalledTimes(1); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, []); + const outManifestMetas = withExtraMetas(OLD_META_3RD_PARTY_1_REAL_METAS, { + // @ts-expect-error override + fileName: newName, + originalUrl: oldMetas.url, + url: common.getRepoFirmwareFileUrl(IMAGES_TEST_DIR, newName, common.BASE_IMAGES_DIR), + }); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, [outManifestMetas]); + }); + }); +}); diff --git a/tests/ghw_update_ota_pr.test.ts b/tests/ghw_update_ota_pr.test.ts new file mode 100644 index 00000000..3439165d --- /dev/null +++ b/tests/ghw_update_ota_pr.test.ts @@ -0,0 +1,531 @@ +import type CoreApi from '@actions/core'; +import type {Context} from '@actions/github/lib/context'; +import type {Octokit} from '@octokit/rest'; + +import type {RepoImageMeta} from '../src/types'; + +import {rmSync} from 'fs'; + +import * as common from '../src/common'; +import {updateOtaPR} from '../src/ghw_update_ota_pr'; +import { + BASE_IMAGES_TEST_DIR_PATH, + getAdjustedContent, + IMAGE_INVALID, + IMAGE_V12_1, + IMAGE_V12_1_METAS, + IMAGE_V13_1, + IMAGE_V13_1_METAS, + IMAGE_V14_1, + IMAGE_V14_1_METAS, + IMAGE_V14_2, + IMAGE_V14_2_METAS, + PREV_IMAGES_TEST_DIR_PATH, + useImage, + withExtraMetas, +} from './data.test'; + +const github = { + rest: { + issues: { + createComment: jest.fn< + ReturnType, + Parameters, + unknown + >(), + }, + pulls: { + createReviewComment: jest.fn< + ReturnType, + Parameters, + unknown + >(), + }, + }, +}; +const core: Partial = { + debug: console.debug, + info: console.log, + warning: console.warn, + error: console.error, + notice: console.log, + startGroup: jest.fn(), + endGroup: jest.fn(), +}; +const context: Partial = { + payload: { + pull_request: { + number: 1, + head: { + sha: 'abcd', + }, + }, + }, + issue: { + owner: 'Koenkk', + repo: 'zigbee-OTA', + number: 1, + }, + repo: { + owner: 'Koenkk', + repo: 'zigbee-OTA', + }, +}; + +describe('Github Workflow: Update OTA PR', () => { + let baseManifest: RepoImageMeta[]; + let prevManifest: RepoImageMeta[]; + let readManifestSpy: jest.SpyInstance; + let writeManifestSpy: jest.SpyInstance; + let addImageToBaseSpy: jest.SpyInstance; + let addImageToPrevSpy: jest.SpyInstance; + + const getManifest = (fileName: string): RepoImageMeta[] => { + if (fileName === common.BASE_INDEX_MANIFEST_FILENAME) { + return baseManifest; + } else if (fileName === common.PREV_INDEX_MANIFEST_FILENAME) { + return prevManifest; + } else { + throw new Error(`${fileName} not supported`); + } + }; + + const setManifest = (fileName: string, content: RepoImageMeta[]): void => { + const adjustedContent = getAdjustedContent(fileName, content); + + if (fileName === common.BASE_INDEX_MANIFEST_FILENAME) { + baseManifest = adjustedContent; + } else if (fileName === common.PREV_INDEX_MANIFEST_FILENAME) { + prevManifest = adjustedContent; + } else { + throw new Error(`${fileName} not supported`); + } + }; + + const resetManifests = (): void => { + baseManifest = []; + prevManifest = []; + }; + + const withBody = (body: string): Partial => { + const newContext = structuredClone(context); + + newContext.payload!.pull_request!.body = body; + + return newContext; + }; + + const expectNoChanges = (noReadManifest: boolean = false): void => { + if (noReadManifest) { + expect(readManifestSpy).toHaveBeenCalledTimes(0); + } else { + expect(readManifestSpy).toHaveBeenCalledTimes(2); + } + + expect(addImageToBaseSpy).toHaveBeenCalledTimes(0); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(0); + }; + + beforeAll(() => {}); + + afterAll(() => { + readManifestSpy.mockRestore(); + writeManifestSpy.mockRestore(); + addImageToBaseSpy.mockRestore(); + addImageToPrevSpy.mockRestore(); + rmSync(BASE_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(PREV_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + }); + + beforeEach(() => { + resetManifests(); + + readManifestSpy = jest.spyOn(common, 'readManifest').mockImplementation(getManifest); + writeManifestSpy = jest.spyOn(common, 'writeManifest').mockImplementation(setManifest); + addImageToBaseSpy = jest.spyOn(common, 'addImageToBase'); + addImageToPrevSpy = jest.spyOn(common, 'addImageToPrev'); + }); + + afterEach(() => { + rmSync(BASE_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(PREV_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + }); + + // XXX: Util + // it('Get headers', async () => { + // const firmwareBuffer = readFileSync(getImageOriginalDirPath(IMAGE_V14_1)); + // console.log(IMAGE_V14_1); + // console.log(JSON.stringify(common.parseImageHeader(firmwareBuffer))); + // console.log(`URL: ${common.getRepoFirmwareFileUrl(IMAGES_TEST_DIR, IMAGE_V14_1, common.BASE_IMAGES_DIR)}`); + // console.log(`SHA512: ${common.computeSHA512(firmwareBuffer)}`); + // }) + + it('hard failure from outside PR context', async () => { + const fileParam: string = `images/test.ota`; + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, {payload: {}}, fileParam); + }).rejects.toThrow(`Not a pull request`); + + expectNoChanges(true); + }); + + it('hard failure without fileParam', async () => { + // NOTE: this path should always be prevented by workflow `paths` filter + const fileParam: string = ''; + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow(`No file found in pull request.`); + + expectNoChanges(true); + }); + + it('failure with images in images1', async () => { + const fileParam: string = `images1/test2.ota,images/test.ota`; + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow(expect.objectContaining({message: expect.stringContaining(`Detected files in 'images1'`)})); + + expectNoChanges(true); + expect(github.rest.issues.createComment).toHaveBeenCalledTimes(1); + }); + + it('failure with edited manifest', async () => { + const fileParam: string = `index.json,images/test.ota`; + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow(expect.objectContaining({message: expect.stringContaining(`Detected manual changes in index.json`)})); + + expectNoChanges(true); + expect(github.rest.issues.createComment).toHaveBeenCalledTimes(1); + }); + + it('failure when no subfolder (manufacturer)', async () => { + const fileParam: string = `images/test.ota`; + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow( + expect.objectContaining({message: expect.stringContaining(`\`images/test.ota\` should be in its associated manufacturer subfolder.`)}), + ); + + expectNoChanges(false); + expect(github.rest.pulls.createReviewComment).toHaveBeenCalledTimes(1); + }); + + it('failure with invalid OTA file', async () => { + const fileParam: string = useImage(IMAGE_INVALID); + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow(expect.objectContaining({message: expect.stringContaining(`Not a valid OTA file`)})); + + expectNoChanges(false); + expect(github.rest.pulls.createReviewComment).toHaveBeenCalledTimes(1); + }); + + it('failure with identical OTA file', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + const fileParam: string = useImage(IMAGE_V14_1); + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow(expect.objectContaining({message: expect.stringContaining(`Conflict with image at index \`0\``)})); + + expectNoChanges(false); + expect(github.rest.pulls.createReviewComment).toHaveBeenCalledTimes(1); + }); + + it('failure with older OTA file that has identical in prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + setManifest(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + const fileParam: string = useImage(IMAGE_V13_1); + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow( + expect.objectContaining({message: expect.stringContaining(`an equal or better match is already present in prev manifest`)}), + ); + + expectNoChanges(false); + expect(github.rest.pulls.createReviewComment).toHaveBeenCalledTimes(1); + }); + + it('failure with older OTA file that has newer in prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + setManifest(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + const fileParam: string = useImage(IMAGE_V12_1); + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + }).rejects.toThrow( + expect.objectContaining({message: expect.stringContaining(`an equal or better match is already present in prev manifest`)}), + ); + + expectNoChanges(false); + expect(github.rest.pulls.createReviewComment).toHaveBeenCalledTimes(1); + }); + + it('success into base', async () => { + const fileParam: string = useImage(IMAGE_V14_1); + + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + }); + + it('success into prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + + const fileParam: string = useImage(IMAGE_V13_1); + + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(0); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(1); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + }); + + it('success with newer than current without existing prev', async () => { + const fileParam: string = [useImage(IMAGE_V13_1), useImage(IMAGE_V14_1)].join(','); + + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(2); // adds both, relocates first during second processing + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + }); + + it('success with newer than current with existing prev', async () => { + const fileParam: string = [useImage(IMAGE_V12_1), useImage(IMAGE_V13_1), useImage(IMAGE_V14_1)].join(','); + + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(3); // adds both, relocates first during second processing + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + }); + + it('success with older that is newer than prev', async () => { + setManifest(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V12_1_METAS]); + const fileParam: string = [useImage(IMAGE_V14_1), useImage(IMAGE_V13_1)].join(','); + + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(1); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + }); + + it('success with newer with missing file', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + const fileParam: string = [useImage(IMAGE_V14_1)].join(','); + + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, []); + }); + + it('success with multiple different files', async () => { + const fileParam: string = [useImage(IMAGE_V14_2), useImage(IMAGE_V14_1)].join(','); + + // @ts-expect-error mock + await updateOtaPR(github, core, context, fileParam); + + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(2); // adds both, relocates first during second processing + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_2_METAS, IMAGE_V14_1_METAS]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, []); + }); + + it('success with extra metas', async () => { + const fileParam: string = useImage(IMAGE_V14_1); + const newContext = withBody(`Text before start tag \`\`\`json {"manufacturerName": ["lixee"]} \`\`\` Text after end tag`); + + // @ts-expect-error mock + await updateOtaPR(github, core, newContext, fileParam); + + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(IMAGE_V14_1_METAS, {manufacturerName: ['lixee']}), + ]); + }); + + it('success with all extra metas', async () => { + const fileParam: string = useImage(IMAGE_V14_1); + const newContext = withBody(`Text before start tag +\`\`\`json +{ + "force": false, + "hardwareVersionMax": 2, + "hardwareVersionMin": 1, + "manufacturerName": ["lixee"], + "maxFileVersion": 5, + "minFileVersion": 3, + "modelId": "bogus", + "releaseNotes": "bugfixes" +} +\`\`\` +Text after end tag`); + + // @ts-expect-error mock + await updateOtaPR(github, core, newContext, fileParam); + + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(IMAGE_V14_1_METAS, { + force: false, + hardwareVersionMax: 2, + hardwareVersionMin: 1, + manufacturerName: ['lixee'], + maxFileVersion: 5, + minFileVersion: 3, + modelId: 'bogus', + releaseNotes: 'bugfixes', + }), + ]); + }); + + it('failure with invalid extra metas', async () => { + const fileParam: string = useImage(IMAGE_V14_1); + const newContext = withBody(`Text before start tag \`\`\`json {"manufacturerName": "myManuf"} \`\`\` Text after end tag`); + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, newContext, fileParam); + }).rejects.toThrow( + expect.objectContaining({message: expect.stringContaining(`Invalid format for 'manufacturerName', expected 'array of string' type.`)}), + ); + + expectNoChanges(true); + expect(github.rest.issues.createComment).toHaveBeenCalledTimes(1); + }); + + it.each([ + ['fileName'], + ['originalUrl'], + ['force'], + ['hardwareVersionMax'], + ['hardwareVersionMin'], + ['manufacturerName'], + ['maxFileVersion'], + ['minFileVersion'], + ['modelId'], + ['releaseNotes'], + ])('failure with invalid type for extra meta %s', async (metaName) => { + const fileParam: string = useImage(IMAGE_V14_1); + // use object since no value type is ever expected to be object + const newContext = withBody(`Text before start tag \`\`\`json {"${metaName}": {}} \`\`\` Text after end tag`); + + await expect(async () => { + // @ts-expect-error mock + await updateOtaPR(github, core, newContext, fileParam); + }).rejects.toThrow(expect.objectContaining({message: expect.stringContaining(`Invalid format for '${metaName}'`)})); + + expectNoChanges(true); + expect(github.rest.issues.createComment).toHaveBeenCalledTimes(1); + }); + + it('success with multiple files and specific extra metas', async () => { + const fileParam: string = [useImage(IMAGE_V13_1), useImage(IMAGE_V14_1)].join(','); + const newContext = withBody(`Text before start tag +\`\`\`json +[ + {"fileName": "${IMAGE_V14_1}", "manufacturerName": ["lixee"], "hardwareVersionMin": 2}, + {"fileName": "${IMAGE_V13_1}", "manufacturerName": ["lixee"]} +] +\`\`\` +Text after end tag`); + + // @ts-expect-error mock + await updateOtaPR(github, core, newContext, fileParam); + + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(2); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(IMAGE_V14_1_METAS, {manufacturerName: ['lixee'], hardwareVersionMin: 2}), + ]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(IMAGE_V13_1_METAS, {manufacturerName: ['lixee']}), + ]); + }); + + it('success with multiple files and specific extra metas, ignore without fileName', async () => { + const fileParam: string = [useImage(IMAGE_V13_1), useImage(IMAGE_V14_1)].join(','); + const newContext = withBody(`Text before start tag +\`\`\`json +[ + {"fileName": "${IMAGE_V14_1}", "manufacturerName": ["lixee"], "hardwareVersionMin": 2}, + {"manufacturerName": ["lixee"]} +] +\`\`\` +Text after end tag`); + + // @ts-expect-error mock + await updateOtaPR(github, core, newContext, fileParam); + + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(2); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [ + withExtraMetas(IMAGE_V14_1_METAS, {manufacturerName: ['lixee'], hardwareVersionMin: 2}), + ]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + }); +}); diff --git a/tests/images/45856_00000006.tar.gz b/tests/images/45856_00000006.tar.gz new file mode 100644 index 00000000..1a9e1586 Binary files /dev/null and b/tests/images/45856_00000006.tar.gz differ diff --git a/tests/images/ZLinky_router_v12.ota b/tests/images/ZLinky_router_v12.ota new file mode 100644 index 00000000..d8b39edb Binary files /dev/null and b/tests/images/ZLinky_router_v12.ota differ diff --git a/tests/images/ZLinky_router_v12_limited.ota b/tests/images/ZLinky_router_v12_limited.ota new file mode 100644 index 00000000..626cc57f Binary files /dev/null and b/tests/images/ZLinky_router_v12_limited.ota differ diff --git a/tests/images/ZLinky_router_v13.ota b/tests/images/ZLinky_router_v13.ota new file mode 100644 index 00000000..4ded97b0 Binary files /dev/null and b/tests/images/ZLinky_router_v13.ota differ diff --git a/tests/images/ZLinky_router_v13_limited.ota b/tests/images/ZLinky_router_v13_limited.ota new file mode 100644 index 00000000..aca00cfd Binary files /dev/null and b/tests/images/ZLinky_router_v13_limited.ota differ diff --git a/tests/images/ZLinky_router_v14.ota b/tests/images/ZLinky_router_v14.ota new file mode 100644 index 00000000..a00a8645 Binary files /dev/null and b/tests/images/ZLinky_router_v14.ota differ diff --git a/tests/images/ZLinky_router_v14_limited.ota b/tests/images/ZLinky_router_v14_limited.ota new file mode 100644 index 00000000..64b4568a Binary files /dev/null and b/tests/images/ZLinky_router_v14_limited.ota differ diff --git a/tests/images/not-a-valid-file.ota b/tests/images/not-a-valid-file.ota new file mode 100644 index 00000000..c23ddc48 --- /dev/null +++ b/tests/images/not-a-valid-file.ota @@ -0,0 +1 @@ +this is not a valid OTA file \ No newline at end of file diff --git a/tests/jest.config.ts b/tests/jest.config.ts new file mode 100644 index 00000000..eba6e626 --- /dev/null +++ b/tests/jest.config.ts @@ -0,0 +1,216 @@ +/** + * For a detailed explanation regarding each configuration property, visit: + * https://jestjs.io/docs/configuration + */ + +// import type {Config} from 'jest'; + +import {createDefaultEsmPreset, JestConfigWithTsJest} from 'ts-jest'; + +const defaultEsmPreset = createDefaultEsmPreset(); + +const config: JestConfigWithTsJest = { + // All imported modules in your tests should be mocked automatically + // automock: false, + + // Stop running tests after `n` failures + // bail: 0, + + // The directory where Jest should store its cached dependency information + cacheDirectory: '.jest-tmp', + + // Automatically clear mock calls, instances, contexts and results before every test + clearMocks: true, + + // Indicates whether the coverage information should be collected while executing the test + collectCoverage: false, + + // An array of glob patterns indicating a set of files for which coverage information should be collected + collectCoverageFrom: ['src/ghw_update_ota_pr.ts', 'src/process_firmware_image.ts', 'src/ghw_reprocess_all_images.ts'], + + // The directory where Jest should output its coverage files + coverageDirectory: 'coverage', + + // An array of regexp pattern strings used to skip coverage collection + // coveragePathIgnorePatterns: [ + // "\\\\node_modules\\\\" + // ], + + // Indicates which provider should be used to instrument code for coverage + coverageProvider: 'babel', + + // A list of reporter names that Jest uses when writing coverage reports + coverageReporters: [ + // "json", + // "text", + 'lcov', + // "clover" + ], + + // An object that configures minimum threshold enforcement for coverage results + coverageThreshold: { + global: { + branches: 100, + functions: 100, + lines: 100, + statements: 100, + }, + }, + + // A path to a custom dependency extractor + // dependencyExtractor: undefined, + + // Make calling deprecated APIs throw helpful error messages + // errorOnDeprecated: false, + + // The default configuration for fake timers + // fakeTimers: { + // "enableGlobally": false + // }, + + // Force coverage collection from ignored files using an array of glob patterns + // forceCoverageMatch: [], + + // A path to a module which exports an async function that is triggered once before all test suites + // globalSetup: undefined, + + // A path to a module which exports an async function that is triggered once after all test suites + // globalTeardown: undefined, + + // A set of global variables that need to be available in all test environments + // globals: {}, + + // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. + maxWorkers: '50%', + + // An array of directory names to be searched recursively up from the requiring module's location + // moduleDirectories: [ + // "node_modules" + // ], + + // An array of file extensions your modules use + moduleFileExtensions: [ + // commonly used first + 'ts', + 'json', + 'js', + 'mjs', + 'cjs', + 'jsx', + 'tsx', + 'node', + ], + + // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module + // moduleNameMapper: {}, + + // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader + // modulePathIgnorePatterns: [], + + // Activates notifications for test results + // notify: false, + + // An enum that specifies notification mode. Requires { notify: true } + // notifyMode: "failure-change", + + // A preset that is used as a base for Jest's configuration + // preset: undefined, + + // Run tests from one or more projects + // projects: undefined, + + // Use this configuration option to add custom reporters to Jest + // reporters: undefined, + + // Automatically reset mock state before every test + // resetMocks: false, + + // Reset the module registry before running each individual test + // resetModules: false, + + // A path to a custom resolver + // resolver: undefined, + + // Automatically restore mock state and implementation before every test + // restoreMocks: false, + + // The root directory that Jest should scan for tests and modules within + rootDir: '..', + + // A list of paths to directories that Jest should use to search for files in + // roots: [ + // "" + // ], + + // Allows you to use a custom runner instead of Jest's default test runner + // runner: "jest-runner", + + // The paths to modules that run some code to configure or set up the testing environment before each test + // setupFiles: [], + + // A list of paths to modules that run some code to configure or set up the testing framework before each test + // setupFilesAfterEnv: [], + + // The number of seconds after which a test is considered as slow and reported as such in the results. + // slowTestThreshold: 5, + + // A list of paths to snapshot serializer modules Jest should use for snapshot testing + // snapshotSerializers: [], + + // The test environment that will be used for testing + // testEnvironment: "jest-environment-node", + + // Options that will be passed to the testEnvironment + // testEnvironmentOptions: {}, + + // Adds a location field to test results + // testLocationInResults: false, + + // The glob patterns Jest uses to detect test files + // testMatch: [ + // "**/__tests__/**/*.[jt]s?(x)", + // "**/?(*.)+(spec|test).[tj]s?(x)" + // ], + + // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped + // testPathIgnorePatterns: [ + // "\\\\node_modules\\\\" + // ], + + // The regexp pattern or array of patterns that Jest uses to detect test files + // testRegex: [], + + // This option allows the use of a custom results processor + // testResultsProcessor: undefined, + + // This option allows use of a custom test runner + // testRunner: "jest-circus/runner", + + // A map from regular expressions to paths to transformers + // transform: undefined, + + // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation + // transformIgnorePatterns: [ + // "\\\\node_modules\\\\", + // "\\.pnp\\.[^\\\\]+$" + // ], + + // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them + // unmockedModulePathPatterns: undefined, + + // Indicates whether each individual test should be reported during the run + // verbose: undefined, + + // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode + // watchPathIgnorePatterns: [], + + // Whether to use watchman for file crawling + // watchman: true, + + ...defaultEsmPreset, + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, +}; + +export default config; diff --git a/tests/process_firmware_image.test.ts b/tests/process_firmware_image.test.ts new file mode 100644 index 00000000..4b9cbf79 --- /dev/null +++ b/tests/process_firmware_image.test.ts @@ -0,0 +1,401 @@ +import type {RepoImageMeta} from '../src/types'; + +import {existsSync, mkdirSync, readFileSync, rmSync} from 'fs'; + +import * as common from '../src/common'; +import {processFirmwareImage, ProcessFirmwareImageStatus} from '../src/process_firmware_image'; +import { + BASE_IMAGES_TEST_DIR_PATH, + getAdjustedContent, + getImageOriginalDirPath, + IMAGE_INVALID, + IMAGE_TAR, + IMAGE_TAR_METAS, + IMAGE_V12_1, + IMAGE_V12_1_METAS, + IMAGE_V13_1, + IMAGE_V13_1_METAS, + IMAGE_V14_1, + IMAGE_V14_1_METAS, + IMAGES_TEST_DIR, + PREV_IMAGES_TEST_DIR_PATH, + useImage, + withExtraMetas, +} from './data.test'; + +describe('Process Firmware Image', () => { + let baseManifest: RepoImageMeta[]; + let prevManifest: RepoImageMeta[]; + let consoleErrorSpy: jest.SpyInstance; + let consoleLogSpy: jest.SpyInstance; + let readManifestSpy: jest.SpyInstance; + let writeManifestSpy: jest.SpyInstance; + let addImageToBaseSpy: jest.SpyInstance; + let addImageToPrevSpy: jest.SpyInstance; + let fetchSpy: jest.SpyInstance; + let setTimeoutSpy: jest.SpyInstance; + let fetchReturnedStatus: {ok: boolean; status: number; body?: object} = {ok: true, status: 200, body: {}}; + + const getManifest = (fileName: string): RepoImageMeta[] => { + if (fileName === common.BASE_INDEX_MANIFEST_FILENAME) { + return baseManifest; + } else if (fileName === common.PREV_INDEX_MANIFEST_FILENAME) { + return prevManifest; + } else { + throw new Error(`${fileName} not supported`); + } + }; + + const setManifest = (fileName: string, content: RepoImageMeta[]): void => { + const adjustedContent = getAdjustedContent(fileName, content); + + if (fileName === common.BASE_INDEX_MANIFEST_FILENAME) { + baseManifest = adjustedContent; + } else if (fileName === common.PREV_INDEX_MANIFEST_FILENAME) { + prevManifest = adjustedContent; + } else { + throw new Error(`${fileName} not supported`); + } + }; + + const resetManifests = (): void => { + baseManifest = []; + prevManifest = []; + }; + + const withOriginalUrl = (originalUrl: string, meta: RepoImageMeta): RepoImageMeta => { + const newMeta = structuredClone(meta); + + newMeta.originalUrl = originalUrl; + + return newMeta; + }; + + const expectNoChanges = (noReadManifest: boolean = false): void => { + if (noReadManifest) { + expect(readManifestSpy).toHaveBeenCalledTimes(0); + } else { + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(fetchSpy).toHaveBeenCalledTimes(1); + } + + expect(addImageToBaseSpy).toHaveBeenCalledTimes(0); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(0); + }; + + const expectWriteNoChanges = (inBase: boolean = true, inPrev: boolean = true): void => { + if (inBase) { + expect(writeManifestSpy).toHaveBeenNthCalledWith( + 1, + common.PREV_INDEX_MANIFEST_FILENAME, + getManifest(common.PREV_INDEX_MANIFEST_FILENAME), + ); + } + + if (inPrev) { + expect(writeManifestSpy).toHaveBeenNthCalledWith( + 2, + common.BASE_INDEX_MANIFEST_FILENAME, + getManifest(common.BASE_INDEX_MANIFEST_FILENAME), + ); + } + }; + + beforeAll(() => {}); + + afterAll(() => { + consoleErrorSpy.mockRestore(); + consoleLogSpy.mockRestore(); + readManifestSpy.mockRestore(); + writeManifestSpy.mockRestore(); + addImageToBaseSpy.mockRestore(); + addImageToPrevSpy.mockRestore(); + fetchSpy.mockRestore(); + setTimeoutSpy.mockRestore(); + rmSync(BASE_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(PREV_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + }); + + beforeEach(() => { + resetManifests(); + + fetchReturnedStatus = {ok: true, status: 200, body: {}}; + consoleErrorSpy = jest.spyOn(console, 'error'); + consoleLogSpy = jest.spyOn(console, 'log'); + readManifestSpy = jest.spyOn(common, 'readManifest').mockImplementation(getManifest); + writeManifestSpy = jest.spyOn(common, 'writeManifest').mockImplementation(setManifest); + addImageToBaseSpy = jest.spyOn(common, 'addImageToBase'); + addImageToPrevSpy = jest.spyOn(common, 'addImageToPrev'); + fetchSpy = jest.spyOn(global, 'fetch').mockImplementation( + // @ts-expect-error mocked as needed + (input) => { + return { + ok: fetchReturnedStatus.ok, + status: fetchReturnedStatus.status, + body: fetchReturnedStatus.body, + arrayBuffer: (): ArrayBuffer => readFileSync(getImageOriginalDirPath(input as string)), + }; + }, + ); + setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation( + // @ts-expect-error mock + (fn) => { + fn(); + }, + ); + }); + + afterEach(() => { + rmSync(BASE_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + rmSync(PREV_IMAGES_TEST_DIR_PATH, {recursive: true, force: true}); + }); + + it('failure with fetch ok', async () => { + fetchReturnedStatus.ok = false; + fetchReturnedStatus.status = 429; + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.REQUEST_FAILED); + expect(consoleErrorSpy).toHaveBeenCalledWith( + expect.stringContaining(`Invalid response from ${IMAGE_V14_1} status=${fetchReturnedStatus.status}.`), + ); + expectNoChanges(false); + }); + + it('failure with fetch body', async () => { + fetchReturnedStatus.body = undefined; + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.REQUEST_FAILED); + expect(consoleErrorSpy).toHaveBeenCalledWith( + expect.stringContaining(`Invalid response from ${IMAGE_V14_1} status=${fetchReturnedStatus.status}.`), + ); + expectNoChanges(false); + }); + + it('failure with invalid OTA file', async () => { + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_INVALID, IMAGE_INVALID); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.ERROR); + expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining(`Not a valid OTA fil`)); + expectNoChanges(false); + }); + + it('failure with identical OTA file', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining(`Base manifest already has version`)); + expect(writeManifestSpy).toHaveBeenNthCalledWith(1, common.PREV_INDEX_MANIFEST_FILENAME, getManifest(common.PREV_INDEX_MANIFEST_FILENAME)); + expect(writeManifestSpy).toHaveBeenNthCalledWith(2, common.BASE_INDEX_MANIFEST_FILENAME, getManifest(common.BASE_INDEX_MANIFEST_FILENAME)); + expectWriteNoChanges(); + }); + + it('failure with older OTA file that has identical in prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + setManifest(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V13_1, IMAGE_V13_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining(`an equal or better match is already present in prev manifest`)); + expectWriteNoChanges(); + }); + + it('failure with older OTA file that has newer in prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [IMAGE_V14_1_METAS]); + setManifest(common.PREV_INDEX_MANIFEST_FILENAME, [IMAGE_V13_1_METAS]); + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V12_1, IMAGE_V12_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining(`an equal or better match is already present in prev manifest`)); + expectWriteNoChanges(); + }); + + it('success into base', async () => { + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V14_1, IMAGE_V14_1_METAS)]); + }); + + it('success into prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V14_1, IMAGE_V14_1_METAS)]); + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V13_1, IMAGE_V13_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(0); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(1); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expectWriteNoChanges(true, false); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V13_1, IMAGE_V13_1_METAS)]); + }); + + it('success with newer than current without existing prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V13_1, IMAGE_V13_1_METAS)]); + useImage(IMAGE_V13_1, BASE_IMAGES_TEST_DIR_PATH); + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V14_1, IMAGE_V14_1_METAS)]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V13_1, IMAGE_V13_1_METAS)]); + }); + + it('success with newer than current with existing prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V13_1, IMAGE_V13_1_METAS)]); + setManifest(common.PREV_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V12_1, IMAGE_V12_1_METAS)]); + useImage(IMAGE_V13_1, BASE_IMAGES_TEST_DIR_PATH); + useImage(IMAGE_V12_1, PREV_IMAGES_TEST_DIR_PATH); + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V14_1, IMAGE_V14_1_METAS)]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V13_1, IMAGE_V13_1_METAS)]); + }); + + it('success with older that is newer than prev', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V14_1, IMAGE_V14_1_METAS)]); + setManifest(common.PREV_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V12_1, IMAGE_V12_1_METAS)]); + useImage(IMAGE_V14_1, BASE_IMAGES_TEST_DIR_PATH); + useImage(IMAGE_V12_1, PREV_IMAGES_TEST_DIR_PATH); + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V13_1, IMAGE_V13_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(0); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(1); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V14_1, IMAGE_V14_1_METAS)]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V13_1, IMAGE_V13_1_METAS)]); + }); + + it('success with newer with missing file', async () => { + setManifest(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V13_1, IMAGE_V13_1_METAS)]); + // useImage(IMAGE_V13_1, BASE_IMAGES_TEST_DIR_PATH); + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledTimes(2); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_V14_1, IMAGE_V14_1_METAS)]); + expect(writeManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME, []); + }); + + it('success with extra metas', async () => { + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1, {manufacturerName: ['lixee']}); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [ + withOriginalUrl(IMAGE_V14_1, withExtraMetas(IMAGE_V14_1_METAS, {manufacturerName: ['lixee']})), + ]); + }); + + it('success with all extra metas', async () => { + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_V14_1, IMAGE_V14_1, { + originalUrl: `https://example.com/${IMAGE_V14_1}`, + force: false, + hardwareVersionMax: 2, + hardwareVersionMin: 1, + manufacturerName: ['lixee'], + maxFileVersion: 5, + minFileVersion: 3, + modelId: 'bogus', + releaseNotes: 'bugfixes', + }); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [ + withOriginalUrl( + `https://example.com/${IMAGE_V14_1}`, + withExtraMetas(IMAGE_V14_1_METAS, { + force: false, + hardwareVersionMax: 2, + hardwareVersionMin: 1, + manufacturerName: ['lixee'], + maxFileVersion: 5, + minFileVersion: 3, + modelId: 'bogus', + releaseNotes: 'bugfixes', + }), + ), + ]); + }); + + it('success with tar', async () => { + if (!existsSync(common.TMP_DIR)) { + mkdirSync(common.TMP_DIR, {recursive: true}); + } + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_TAR, IMAGE_TAR, {}, true, (f) => f.endsWith('.ota')); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.SUCCESS); + expect(readManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME); + expect(readManifestSpy).toHaveBeenCalledWith(common.PREV_INDEX_MANIFEST_FILENAME); + expect(addImageToBaseSpy).toHaveBeenCalledTimes(1); + expect(addImageToPrevSpy).toHaveBeenCalledTimes(0); + expect(writeManifestSpy).toHaveBeenCalledTimes(2); + expect(writeManifestSpy).toHaveBeenCalledWith(common.BASE_INDEX_MANIFEST_FILENAME, [withOriginalUrl(IMAGE_TAR, IMAGE_TAR_METAS)]); + + rmSync(common.TMP_DIR, {recursive: true, force: true}); + }); + + it('failure with invalid tar', async () => { + if (!existsSync(common.TMP_DIR)) { + mkdirSync(common.TMP_DIR, {recursive: true}); + } + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_INVALID, IMAGE_INVALID, {}, true, (f) => f.endsWith('.ota')); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.TAR_NO_IMAGE); + expectNoChanges(true); + + rmSync(common.TMP_DIR, {recursive: true, force: true}); + }); + + it('failure with extract tar (missing dir)', async () => { + // if (!existsSync(common.TMP_DIR)) { + // mkdirSync(common.TMP_DIR, {recursive: true}); + // } + + const status = await processFirmwareImage(IMAGES_TEST_DIR, IMAGE_TAR, IMAGE_TAR, {}, true, (f) => f.endsWith('.ota')); + + expect(status).toStrictEqual(ProcessFirmwareImageStatus.TAR_NO_IMAGE); + expect(consoleErrorSpy).toHaveBeenCalledWith(expect.objectContaining({syscall: 'chdir', code: 'ENOENT'})); + expectNoChanges(false); + + rmSync(common.TMP_DIR, {recursive: true, force: true}); + }); +}); diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 00000000..c2c9992f --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../tsconfig", + "include": ["./**/*", "./jest.config.ts"], + "compilerOptions": { + "types": ["jest"], + "rootDir": "..", + "noEmit": true + }, + "references": [{"path": ".."}] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..aa8afcbf --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "strict": true, + "declaration": true, + "module": "ES2022", + "moduleResolution": "node", + "target": "ES2022", + "lib": ["ES2022"], + "outDir": "dist", + "rootDir": "src", + "noUnusedLocals": true, + "esModuleInterop": true, + "noImplicitAny": true, + "noImplicitThis": true, + "composite": true + }, + "include": ["./src/**/*", "./eslint.config.mjs"], + "ts-node": { + "esm": true + } +}