diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 0846b7c..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: publish -on: - push: - branches: - - "main" -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - deno-version: [1.x] - steps: - - uses: actions/checkout@v2 - - name: Use Deno ${{ matrix.deno-version }} - uses: denoland/setup-deno@v1 - with: - deno-version: ${{ matrix.deno-version }} - - run: ./scripts/compile.sh - env: - CI: true - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: us-east-1 - - name: Upload S3 - run: | - aws s3 cp --acl public-read ./hyper-copy s3://hyperland diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml new file mode 100644 index 0000000..0c39c46 --- /dev/null +++ b/.github/workflows/test-and-publish.yml @@ -0,0 +1,110 @@ +name: 🏎 Test & Publish Adapter + +on: + pull_request: + branches: + - main + push: + branches: + - main + + # Perform a release using a workflow dispatch + workflow_dispatch: + inputs: + # See https://github.com/hyper63/hyper-ci-bump#inputs for available inputs for the bump action + version: + description: the semver version to bump to + required: true + +jobs: + + test: + runs-on: ubuntu-latest + strategy: + matrix: + deno-version: [1.x] + + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + + - name: 🦕 Setup Deno + uses: denoland/setup-deno@v1 + with: + deno-version: ${{ matrix.deno-version }} + + - name: ⚡ Run Tests + run: | + deno task test + env: + CI: true + + bump: + # Releases are performed via a workflow dispatch + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + needs: [test] + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: 👀 Env + run: | + echo "Event name: ${{ github.event_name }}" + echo "Git ref: ${{ github.ref }}" + echo "GH actor: ${{ github.actor }}" + echo "SHA: ${{ github.sha }}" + VER=`node --version`; echo "Node ver: $VER" + VER=`npm --version`; echo "npm ver: $VER" + + - name: 🤓 Set Git User + run: | + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + + - name: ✊ Bump + id: bump + uses: hyper63/hyper-ci-bump@main + with: + bump-to: ${{ github.event.inputs.version }} + + - name: ⬆️ Push + run: | + git push + git push --tags + + - name: 🤖 Create Github Release + if: steps.bump.outputs.tag + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.bump.outputs.tag }} + + publish: + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + needs: [bump] + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: 🛠 Build Executables + run: deno task compile + env: + CI: true + + - name: 🤫 Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + + - name: 🗄 Upload Executables to S3 + run: | + aws s3 cp --acl public-read ./hyper-copy s3://hyperland + + \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 32ac845..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: test -on: push -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - deno-version: [1.x] - steps: - - uses: actions/checkout@v2 - - name: Use Deno ${{ matrix.deno-version }} - uses: denoland/setup-deno@v1 - with: - deno-version: ${{ matrix.deno-version }} - - run: ./scripts/test.sh - env: - CI: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6b24714 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hyper-copy \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 142f703..527c76d 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,19 +1,2 @@ image: file: .gitpod.Dockerfile - -github: - prebuilds: - # enable for the default branch (defaults to true) - master: true - # enable for all branches in this repo (defaults to false) - branches: false - # enable for pull requests coming from this repo (defaults to true) - pullRequests: true - # enable for pull requests coming from forks (defaults to false) - pullRequestsFromForks: false - # add a check to pull requests (defaults to true) - addCheck: true - # add a "Review in Gitpod" button as a comment to pull requests (defaults to false) - addComment: false - # add a "Review in Gitpod" button to the pull request's description (defaults to false) - addBadge: false diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..333c450 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +deno task staged diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 0000000..ea4140f --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,4 @@ +{ + "*.{md,json,js,ts}": ["deno fmt"], + "README.md": ["deno run -A --no-lock npm:markdown-toc-gen@1 insert", "deno fmt"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 5e9e01e..cbac569 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,3 @@ { - "deno.enable": true, - "deno.lint": true, - "deno.unstable": true, - "deno.importMap": "./import_map.json", -} \ No newline at end of file + "deno.enable": true +} diff --git a/README.md b/README.md index 3adfa22..89c06a9 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@

⚡️ hyper copy ⚡️

-

Copy a hyper data service

+

Copy documents from one hyper Data Service to another hyper Data Service

-Test +Test --- -## Table of Contents + - [Quick Start](#quick-start) - [Requirements](#requirements) @@ -13,27 +13,36 @@ - [Contributing](#contributing) - [LICENSE](#license) + + --- ## Quick Start -``` sh +> First, make sure you've +> [created your destination hyper `Data` `Service`](https://docs.hyper.io/docs/api-reference/rest/data.html#create-a-data-service) + +```sh curl -O https://hyperland.s3.amazon.aws.com/hyper-copy chmod +x hyper-copy hyper-copy [SRC_CONNECTION_STRING] [TARGET_CONNECTION_STRING] ``` +`hyper-copy` will copy documents from `SRC_CONNECTION_STRING` to `TARGET_CONNECTION_STRING`, `1000` +at a time, until all documents have been copied. + ## Requirements -* Linux x64 Environment +- Linux x64 Environment > If there is interest in creating binaries for other enviroments, please submit an issue. ## Example -## Contributing +## Contributing -All contributions are welcome as long as they are targeted at improving and extending the capabilities of the copy functionality. +All contributions are welcome as long as they are targeted at improving and extending the +capabilities of the copy functionality. ## LICENSE diff --git a/copy.js b/copy.js index fbba42b..6d78f2c 100644 --- a/copy.js +++ b/copy.js @@ -1,11 +1,11 @@ -import * as R from 'ramda' -import crocks from 'crocks' -const { Async } = crocks -const { compose, prop, last } = R -const FINISHED = '__FINISHED__' -const lastId = compose(prop('id'), last) -const isOk = result => result.ok ? Async.of(result) : Async.Rejected('Error Copying Data') -const checkFinished = limit => xs => xs.length === limit ? lastId(xs) : FINISHED +import { crocks, R } from './deps.js'; + +const { Async } = crocks; +const { compose, prop, last } = R; +const FINISHED = '__FINISHED__'; +const lastId = compose(prop('id'), last); +const isOk = (result) => result.ok ? Async.of(result) : Async.Rejected('Error Copying Data'); +const checkFinished = (limit) => (xs) => xs.length === limit ? lastId(xs) : FINISHED; /** * @param {Async} list * @param {Async} bulk @@ -22,6 +22,6 @@ export default function (list, bulk) { .chain(bulk) .chain(isOk) .map(prop('results')) - .map(checkFinished(limit)) - } -} \ No newline at end of file + .map(checkFinished(limit)); + }; +} diff --git a/copy.test.js b/copy.test.js new file mode 100644 index 0000000..6e047e6 --- /dev/null +++ b/copy.test.js @@ -0,0 +1,33 @@ +import { assertEquals } from 'https://deno.land/std@0.119.0/testing/asserts.ts'; + +import { crocks } from './deps.js'; +import copy from './copy.js'; +const { Async } = crocks; + +const test = Deno.test; +const list = () => + Async.Resolved({ ok: true, docs: [{ id: '1', type: 'foo' }, { id: '2', type: 'bar' }] }); +const bulk = () => + Async.Resolved({ ok: true, results: [{ ok: true, id: '1' }, { ok: true, id: '2' }] }); + +const cp = copy(list, bulk); + +test('return last key', async () => { + const key = await cp(2, '').toPromise(); + assertEquals(key, '2'); +}); + +test('return finished', async () => { + const key = await cp(1001, '').toPromise(); + assertEquals(key, '__FINISHED__'); +}); + +test('error', async () => { + const b = () => Async.Resolved({ ok: false }); + const cp2 = copy(list, b); + try { + await cp2(1001, '').toPromise(); + } catch (err) { + assertEquals(err, 'Error Copying Data'); + } +}); diff --git a/copy_test.js b/copy_test.js deleted file mode 100644 index 7b0653e..0000000 --- a/copy_test.js +++ /dev/null @@ -1,30 +0,0 @@ -import { assert, assertEquals } from "https://deno.land/std@0.119.0/testing/asserts.ts"; -import copy from './copy.js' -import crocks from 'crocks' -const { Async } = crocks - -const test = Deno.test -const list = () => Async.Resolved({ ok: true, docs: [{ id: '1', type: 'foo' }, { id: '2', type: 'bar' }] }) -const bulk = () => Async.Resolved({ ok: true, results: [{ ok: true, id: '1' }, { ok: true, id: '2' }] }) - -const cp = copy(list, bulk) - -test('return last key', async () => { - const key = await cp(2, '').toPromise() - assertEquals(key, '2') -}) - -test('return finished', async () => { - const key = await cp(1001, '').toPromise() - assertEquals(key, '__FINISHED__') -}) - -test('error', async () => { - const b = () => Async.Resolved({ ok: false }) - const cp2 = copy(list, b) - try { - await cp2(1001, '').toPromise() - } catch (err) { - assertEquals(err, 'Error Copying Data') - } -}) \ No newline at end of file diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..3c7dbbe --- /dev/null +++ b/deno.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://deno.land/x/deno/cli/schemas/config-file.v1.json", + "description": "Copy documents from one hyper Data Service to another hyper Data Service", + "tasks": { + "cache": "deno cache --lock=deno.lock --lock-write ./deps.js", + "compile": "deno compile --allow-net --unstable --no-check --output hyper-copy mod.js", + "prepare": "deno run -A --no-lock npm:husky@^9", + "staged": "deno run -A --no-lock npm:lint-staged@^15", + "test": "deno lint && deno test --no-lock -A" + }, + "lint": { + "rules": { + "tags": ["recommended"] + } + }, + "fmt": { + "useTabs": false, + "lineWidth": 100, + "indentWidth": 2, + "singleQuote": true + } +} diff --git a/deno.lock b/deno.lock new file mode 100644 index 0000000..ae46acc --- /dev/null +++ b/deno.lock @@ -0,0 +1,192 @@ +{ + "version": "3", + "packages": { + "specifiers": { + "npm:@types/ramda@^0.28.23": "npm:@types/ramda@0.28.25", + "npm:crocks@0.12.4": "npm:crocks@0.12.4", + "npm:ramda@0.28.0": "npm:ramda@0.28.0", + "npm:ramda@0.29.1": "npm:ramda@0.29.1" + }, + "npm": { + "@types/ramda@0.28.25": { + "integrity": "sha512-HrQNqQAGcITpn9HAJFamDxm7iZeeXiP/95pN5OMbNniDjzCCeOHbBKNGmUy8NRi0fhYS+/cXeo91MFC+06gbow==", + "dependencies": { + "ts-toolbelt": "ts-toolbelt@6.15.5" + } + }, + "crocks@0.12.4": { + "integrity": "sha512-paln6xJUrR9e/OWMFsyTi4dLyr+q99C5f7PQbGgSDHtwsfW0sCNZvnpHzvniI2dAE0uoBgeIP1Ukmme8Z0HxxA==", + "dependencies": {} + }, + "ramda@0.28.0": { + "integrity": "sha512-9QnLuG/kPVgWvMQ4aODhsBUFKOUmnbUnsSXACv+NCQZcHbeb+v8Lodp8OVxtRULN1/xOyYLLaL6npE6dMq5QTA==", + "dependencies": {} + }, + "ramda@0.29.1": { + "integrity": "sha512-OfxIeWzd4xdUNxlWhgFazxsA/nl3mS4/jGZI5n00uWOoSSFRhC1b6gl6xvmzUamgmqELraWp0J/qqVlXYPDPyA==", + "dependencies": {} + }, + "ts-toolbelt@6.15.5": { + "integrity": "sha512-FZIXf1ksVyLcfr7M317jbB67XFJhOO1YqdTcuGaq9q5jLUoTikukZ+98TPjKiP2jC5CgmYdWWYs0s2nLSU0/1A==", + "dependencies": {} + } + } + }, + "redirects": { + "https://deno.land/x/base64/base64url.ts": "https://deno.land/x/base64@v0.2.1/base64url.ts", + "https://denopkg.com/chiefbiiko/sha512/mod.ts": "https://denopkg.com/chiefbiiko/sha512@master/mod.ts" + }, + "remote": { + "https://deno.land/std@0.207.0/assert/assert.ts": "9a97dad6d98c238938e7540736b826440ad8c1c1e54430ca4c4e623e585607ee", + "https://deno.land/std@0.207.0/assert/assertion_error.ts": "4d0bde9b374dfbcbe8ac23f54f567b77024fb67dbb1906a852d67fe050d42f56", + "https://deno.land/std@0.207.0/media_types/_db.ts": "7606d83e31f23ce1a7968cbaee852810c2cf477903a095696cdc62eaab7ce570", + "https://deno.land/std@0.207.0/media_types/_util.ts": "0879b04cc810ff18d3dcd97d361e03c9dfb29f67d7fc4a9c6c9d387282ef5fe8", + "https://deno.land/std@0.207.0/media_types/content_type.ts": "a7a3cb6a2b6e81101637afcaa9884d655b4568ded84fa7e6169bb690a87ee2aa", + "https://deno.land/std@0.207.0/media_types/extension.ts": "a7cd28c9417143387cdfed27d4e8607ebcf5b1ec27eb8473d5b000144689fe65", + "https://deno.land/std@0.207.0/media_types/extensions_by_type.ts": "43806d6a52a0d6d965ada9d20e60a982feb40bc7a82268178d94edb764694fed", + "https://deno.land/std@0.207.0/media_types/format_media_type.ts": "f5e1073c05526a6f5a516ac5c5587a1abd043bf1039c71cde1166aa4328c8baf", + "https://deno.land/std@0.207.0/media_types/get_charset.ts": "18b88274796fda5d353806bf409eb1d2ddb3f004eb4bd311662c4cdd8ac173db", + "https://deno.land/std@0.207.0/media_types/mod.ts": "d3f0b99f85053bc0b98ecc24eaa3546dfa09b856dc0bbaf60d8956d2cdd710c8", + "https://deno.land/std@0.207.0/media_types/parse_media_type.ts": "31ccf2388ffab31b49500bb89fa0f5de189c8897e2ee6c9954f207637d488211", + "https://deno.land/std@0.207.0/media_types/type_by_extension.ts": "a6f351c9fc2ed742393792f8c59550fa9ef940ca6b462ee16168a3cda6020c19", + "https://deno.land/std@0.207.0/media_types/vendor/mime-db.v1.52.0.ts": "6925bbcae81ca37241e3f55908d0505724358cda3384eaea707773b2c7e99586", + "https://deno.land/std@0.207.0/path/_common/assert_path.ts": "061e4d093d4ba5aebceb2c4da3318bfe3289e868570e9d3a8e327d91c2958946", + "https://deno.land/std@0.207.0/path/_common/basename.ts": "0d978ff818f339cd3b1d09dc914881f4d15617432ae519c1b8fdc09ff8d3789a", + "https://deno.land/std@0.207.0/path/_common/common.ts": "9e4233b2eeb50f8b2ae10ecc2108f58583aea6fd3e8907827020282dc2b76143", + "https://deno.land/std@0.207.0/path/_common/constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0", + "https://deno.land/std@0.207.0/path/_common/dirname.ts": "2ba7fb4cc9fafb0f38028f434179579ce61d4d9e51296fad22b701c3d3cd7397", + "https://deno.land/std@0.207.0/path/_common/format.ts": "11aa62e316dfbf22c126917f5e03ea5fe2ee707386555a8f513d27ad5756cf96", + "https://deno.land/std@0.207.0/path/_common/from_file_url.ts": "ef1bf3197d2efbf0297a2bdbf3a61d804b18f2bcce45548ae112313ec5be3c22", + "https://deno.land/std@0.207.0/path/_common/glob_to_reg_exp.ts": "5c3c2b79fc2294ec803d102bd9855c451c150021f452046312819fbb6d4dc156", + "https://deno.land/std@0.207.0/path/_common/normalize.ts": "2ba7fb4cc9fafb0f38028f434179579ce61d4d9e51296fad22b701c3d3cd7397", + "https://deno.land/std@0.207.0/path/_common/normalize_string.ts": "88c472f28ae49525f9fe82de8c8816d93442d46a30d6bb5063b07ff8a89ff589", + "https://deno.land/std@0.207.0/path/_common/relative.ts": "1af19d787a2a84b8c534cc487424fe101f614982ae4851382c978ab2216186b4", + "https://deno.land/std@0.207.0/path/_common/strip_trailing_separators.ts": "7ffc7c287e97bdeeee31b155828686967f222cd73f9e5780bfe7dfb1b58c6c65", + "https://deno.land/std@0.207.0/path/_common/to_file_url.ts": "a8cdd1633bc9175b7eebd3613266d7c0b6ae0fb0cff24120b6092ac31662f9ae", + "https://deno.land/std@0.207.0/path/_interface.ts": "6471159dfbbc357e03882c2266d21ef9afdb1e4aa771b0545e90db58a0ba314b", + "https://deno.land/std@0.207.0/path/_os.ts": "30b0c2875f360c9296dbe6b7f2d528f0f9c741cecad2e97f803f5219e91b40a2", + "https://deno.land/std@0.207.0/path/basename.ts": "04bb5ef3e86bba8a35603b8f3b69537112cdd19ce64b77f2522006da2977a5f3", + "https://deno.land/std@0.207.0/path/common.ts": "f4d061c7d0b95a65c2a1a52439edec393e906b40f1caf4604c389fae7caa80f5", + "https://deno.land/std@0.207.0/path/dirname.ts": "88a0a71c21debafc4da7a4cd44fd32e899462df458fbca152390887d41c40361", + "https://deno.land/std@0.207.0/path/extname.ts": "2da4e2490f3b48b7121d19fb4c91681a5e11bd6bd99df4f6f47d7a71bb6ecdf2", + "https://deno.land/std@0.207.0/path/format.ts": "3457530cc85d1b4bab175f9ae73998b34fd456c830d01883169af0681b8894fb", + "https://deno.land/std@0.207.0/path/from_file_url.ts": "e7fa233ea1dff9641e8d566153a24d95010110185a6f418dd2e32320926043f8", + "https://deno.land/std@0.207.0/path/glob_to_regexp.ts": "74d7448c471e293d03f05ccb968df4365fed6aaa508506b6325a8efdc01d8271", + "https://deno.land/std@0.207.0/path/is_absolute.ts": "67232b41b860571c5b7537f4954c88d86ae2ba45e883ee37d3dec27b74909d13", + "https://deno.land/std@0.207.0/path/is_glob.ts": "567dce5c6656bdedfc6b3ee6c0833e1e4db2b8dff6e62148e94a917f289c06ad", + "https://deno.land/std@0.207.0/path/join.ts": "98d3d76c819af4a11a81d5ba2dbb319f1ce9d63fc2b615597d4bcfddd4a89a09", + "https://deno.land/std@0.207.0/path/join_globs.ts": "9b84d5103b63d3dbed4b2cf8b12477b2ad415c7d343f1488505162dc0e5f4db8", + "https://deno.land/std@0.207.0/path/mod.ts": "3defabebc98279e62b392fee7a6937adc932a8f4dcd2471441e36c15b97b00e0", + "https://deno.land/std@0.207.0/path/normalize.ts": "aa95be9a92c7bd4f9dc0ba51e942a1973e2b93d266cd74f5ca751c136d520b66", + "https://deno.land/std@0.207.0/path/normalize_glob.ts": "674baa82e1c00b6cb153bbca36e06f8e0337cb8062db6d905ab5de16076ca46b", + "https://deno.land/std@0.207.0/path/parse.ts": "d87ff0deef3fb495bc0d862278ff96da5a06acf0625ca27769fc52ac0d3d6ece", + "https://deno.land/std@0.207.0/path/posix/_util.ts": "ecf49560fedd7dd376c6156cc5565cad97c1abe9824f4417adebc7acc36c93e5", + "https://deno.land/std@0.207.0/path/posix/basename.ts": "a630aeb8fd8e27356b1823b9dedd505e30085015407caa3396332752f6b8406a", + "https://deno.land/std@0.207.0/path/posix/common.ts": "e781d395dc76f6282e3f7dd8de13194abb8b04a82d109593141abc6e95755c8b", + "https://deno.land/std@0.207.0/path/posix/dirname.ts": "f48c9c42cc670803b505478b7ef162c7cfa9d8e751b59d278b2ec59470531472", + "https://deno.land/std@0.207.0/path/posix/extname.ts": "ee7f6571a9c0a37f9218fbf510c440d1685a7c13082c348d701396cc795e0be0", + "https://deno.land/std@0.207.0/path/posix/format.ts": "b94876f77e61bfe1f147d5ccb46a920636cd3cef8be43df330f0052b03875968", + "https://deno.land/std@0.207.0/path/posix/from_file_url.ts": "b97287a83e6407ac27bdf3ab621db3fccbf1c27df0a1b1f20e1e1b5acf38a379", + "https://deno.land/std@0.207.0/path/posix/glob_to_regexp.ts": "6ed00c71fbfe0ccc35977c35444f94e82200b721905a60bd1278b1b768d68b1a", + "https://deno.land/std@0.207.0/path/posix/is_absolute.ts": "159900a3422d11069d48395568217eb7fc105ceda2683d03d9b7c0f0769e01b8", + "https://deno.land/std@0.207.0/path/posix/is_glob.ts": "ec4fbc604b9db8487f7b56ab0e759b24a971ab6a45f7b0b698bc39b8b9f9680f", + "https://deno.land/std@0.207.0/path/posix/join.ts": "0c0d84bdc344876930126640011ec1b888e6facf74153ffad9ef26813aa2a076", + "https://deno.land/std@0.207.0/path/posix/join_globs.ts": "f4838d54b1f60a34a40625a3293f6e583135348be1b2974341ac04743cb26121", + "https://deno.land/std@0.207.0/path/posix/mod.ts": "f1b08a7f64294b7de87fc37190d63b6ce5b02889af9290c9703afe01951360ae", + "https://deno.land/std@0.207.0/path/posix/normalize.ts": "11de90a94ab7148cc46e5a288f7d732aade1d616bc8c862f5560fa18ff987b4b", + "https://deno.land/std@0.207.0/path/posix/normalize_glob.ts": "10a1840c628ebbab679254d5fa1c20e59106102354fb648a1765aed72eb9f3f9", + "https://deno.land/std@0.207.0/path/posix/parse.ts": "199208f373dd93a792e9c585352bfc73a6293411bed6da6d3bc4f4ef90b04c8e", + "https://deno.land/std@0.207.0/path/posix/relative.ts": "e2f230608b0f083e6deaa06e063943e5accb3320c28aef8d87528fbb7fe6504c", + "https://deno.land/std@0.207.0/path/posix/resolve.ts": "51579d83159d5c719518c9ae50812a63959bbcb7561d79acbdb2c3682236e285", + "https://deno.land/std@0.207.0/path/posix/separator.ts": "0b6573b5f3269a3164d8edc9cefc33a02dd51003731c561008c8bb60220ebac1", + "https://deno.land/std@0.207.0/path/posix/to_file_url.ts": "08d43ea839ee75e9b8b1538376cfe95911070a655cd312bc9a00f88ef14967b6", + "https://deno.land/std@0.207.0/path/posix/to_namespaced_path.ts": "c9228a0e74fd37e76622cd7b142b8416663a9b87db643302fa0926b5a5c83bdc", + "https://deno.land/std@0.207.0/path/relative.ts": "23d45ede8b7ac464a8299663a43488aad6b561414e7cbbe4790775590db6349c", + "https://deno.land/std@0.207.0/path/resolve.ts": "5b184efc87155a0af9fa305ff68a109e28de9aee81fc3e77cd01380f19daf867", + "https://deno.land/std@0.207.0/path/separator.ts": "40a3e9a4ad10bef23bc2cd6c610291b6c502a06237c2c4cd034a15ca78dedc1f", + "https://deno.land/std@0.207.0/path/to_file_url.ts": "edaafa089e0bce386e1b2d47afe7c72e379ff93b28a5829a5885e4b6c626d864", + "https://deno.land/std@0.207.0/path/to_namespaced_path.ts": "cf8734848aac3c7527d1689d2adf82132b1618eff3cc523a775068847416b22a", + "https://deno.land/std@0.207.0/path/windows/_util.ts": "f32b9444554c8863b9b4814025c700492a2b57ff2369d015360970a1b1099d54", + "https://deno.land/std@0.207.0/path/windows/basename.ts": "8a9dbf7353d50afbc5b221af36c02a72c2d1b2b5b9f7c65bf6a5a2a0baf88ad3", + "https://deno.land/std@0.207.0/path/windows/common.ts": "e781d395dc76f6282e3f7dd8de13194abb8b04a82d109593141abc6e95755c8b", + "https://deno.land/std@0.207.0/path/windows/dirname.ts": "5c2aa541384bf0bd9aca821275d2a8690e8238fa846198ef5c7515ce31a01a94", + "https://deno.land/std@0.207.0/path/windows/extname.ts": "07f4fa1b40d06a827446b3e3bcc8d619c5546b079b8ed0c77040bbef716c7614", + "https://deno.land/std@0.207.0/path/windows/format.ts": "343019130d78f172a5c49fdc7e64686a7faf41553268961e7b6c92a6d6548edf", + "https://deno.land/std@0.207.0/path/windows/from_file_url.ts": "d53335c12b0725893d768be3ac6bf0112cc5b639d2deb0171b35988493b46199", + "https://deno.land/std@0.207.0/path/windows/glob_to_regexp.ts": "290755e18ec6c1a4f4d711c3390537358e8e3179581e66261a0cf348b1a13395", + "https://deno.land/std@0.207.0/path/windows/is_absolute.ts": "245b56b5f355ede8664bd7f080c910a97e2169972d23075554ae14d73722c53c", + "https://deno.land/std@0.207.0/path/windows/is_glob.ts": "ec4fbc604b9db8487f7b56ab0e759b24a971ab6a45f7b0b698bc39b8b9f9680f", + "https://deno.land/std@0.207.0/path/windows/join.ts": "e6600bf88edeeef4e2276e155b8de1d5dec0435fd526ba2dc4d37986b2882f16", + "https://deno.land/std@0.207.0/path/windows/join_globs.ts": "f4838d54b1f60a34a40625a3293f6e583135348be1b2974341ac04743cb26121", + "https://deno.land/std@0.207.0/path/windows/mod.ts": "d7040f461465c2c21c1c68fc988ef0bdddd499912138cde3abf6ad60c7fb3814", + "https://deno.land/std@0.207.0/path/windows/normalize.ts": "9deebbf40c81ef540b7b945d4ccd7a6a2c5a5992f791e6d3377043031e164e69", + "https://deno.land/std@0.207.0/path/windows/normalize_glob.ts": "344ff5ed45430495b9a3d695567291e50e00b1b3b04ea56712a2acf07ab5c128", + "https://deno.land/std@0.207.0/path/windows/parse.ts": "120faf778fe1f22056f33ded069b68e12447668fcfa19540c0129561428d3ae5", + "https://deno.land/std@0.207.0/path/windows/relative.ts": "026855cd2c36c8f28f1df3c6fbd8f2449a2aa21f48797a74700c5d872b86d649", + "https://deno.land/std@0.207.0/path/windows/resolve.ts": "5ff441ab18a2346abadf778121128ee71bda4d0898513d4639a6ca04edca366b", + "https://deno.land/std@0.207.0/path/windows/separator.ts": "ae21f27015f10510ed1ac4a0ba9c4c9c967cbdd9d9e776a3e4967553c397bd5d", + "https://deno.land/std@0.207.0/path/windows/to_file_url.ts": "8e9ea9e1ff364aa06fa72999204229952d0a279dbb876b7b838b2b2fea55cce3", + "https://deno.land/std@0.207.0/path/windows/to_namespaced_path.ts": "e0f4d4a5e77f28a5708c1a33ff24360f35637ba6d8f103d19661255ef7bfd50d", + "https://deno.land/std@0.84.0/encoding/base64.ts": "e81fd4661e7af6711b1a03ed212617e1b1ff2999a11317655359cf9223bc6cce", + "https://deno.land/std@0.84.0/encoding/base64url.ts": "58e369ff130ac4b6d0661fe5189b93f839a91327b086f355c0ce0c74ec5e7c6c", + "https://deno.land/std@0.84.0/encoding/hex.ts": "f952e0727bddb3b2fd2e6889d104eacbd62e92091f540ebd6459317a61932d9b", + "https://deno.land/std@0.84.0/hash/sha256.ts": "2a06afd9c27942b87ffc8a93b3270065b5fe4ea144fe0939e5d050bfb86d40db", + "https://deno.land/std@0.84.0/hash/sha512.ts": "879e99a4c20d10ddadbe02a643a69565dfbabffc5fa7ddacff3ebcdb664b554c", + "https://deno.land/x/base64@v0.2.1/base.ts": "47dc8d68f07dc91524bdd6db36eccbe59cf4d935b5fc09f27357a3944bb3ff7b", + "https://deno.land/x/base64@v0.2.1/base64url.ts": "18bbf879b31f1f32cca8adaa2b6885ae325c2cec6a66c5817b684ca12c46ad5e", + "https://deno.land/x/base64@v0.2.1/mod.ts": "1cbdc4ba7229d3c6d1763fecdb9d46844777c7e153abb6dabea8b0dd01448db4", + "https://deno.land/x/djwt@v2.1/algorithm.ts": "af7e185c74f5319e39eb82d52b4c315d74c9bd798aa098feb6f47a4bc181b584", + "https://deno.land/x/djwt@v2.1/deps.ts": "2e17ae8502aa3944ee3e4d69747a83c09ebd64cb427b513a35d4d29fb626e6fa", + "https://deno.land/x/djwt@v2.1/mod.ts": "32c317ebc8d39393b84eff340e4cb66be32ec713b822939c83891a5d75ba9296", + "https://deno.land/x/djwt@v2.1/signature.ts": "ee591d5907d665c28e5687b1f18144ec604884fd2746d3baf81aa57a30698ffa", + "https://deno.land/x/god_crypto@v1.4.8/rsa.ts": "ccdac797dad64da4a0cd297b17fb987d6aa272c18568919c3365206912c20129", + "https://deno.land/x/god_crypto@v1.4.8/src/binary.ts": "f8c2ce60f9e0295cd54bbc3008cc4b388e919aa9128767d5f8e7eb4dd34fc8b4", + "https://deno.land/x/god_crypto@v1.4.8/src/hash.ts": "40123d03c2efa419472bfaaaaca66a11f710abc6de91cf42370d6578bda7f12c", + "https://deno.land/x/god_crypto@v1.4.8/src/helper.ts": "e664a39ea7c3300765e5daeec4e55036b7fc810b27c7d806bd1ec24e19bc09b7", + "https://deno.land/x/god_crypto@v1.4.8/src/math.ts": "f31a80dd819892e13b451852e6ee64178a4f55929d42f23f38a14e1e325e48b8", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/basic_encoding_rule.ts": "913d06dc6afb7eb5a716964c44a9a99ee293d525ba66e171a6b88fd1fb5d34b9", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/common.ts": "fadd40b40e61fe1723d546019cc8d8c309803aba9e11dd446f2ed5df2c10ea14", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/eme_oaep.ts": "b6552ec4e53d1b360ba5639dd6dd8efe176586331e98ba9102a1ae5e71c427e2", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/emsa_pss.ts": "9dd89fbecb1f53bcb0dc6338d1b0448677d6f35e356b3b51ebc23ae48bbbcc9a", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/export_key.ts": "07c33f4ae7f276e8b99d944a3a05cef965674f481d411b97b67b0e49235f063f", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/import_key.ts": "4d9577e4b0313416f947c4359b0b8cb55002e036949a569287697ac591c1ad2f", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/mod.ts": "0ea65d6ac21e1f007812ea250b986b8f532ec49bc6b1eb87ef4a2cfc0425032b", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/primitives.ts": "a86659455e16274a384fd7ef23e63945ae8892c542997c544f7e03f073c4be81", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/rsa_internal.ts": "c8827374377a5b28087fa392070dfe7586b0eac6e4e3fae84dd901a57b1b7541", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/rsa_js.ts": "fbb4f4f564fb230bdb370e6fdbcd81b33c8e04c49181dfb6b9ef75106499648d", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/rsa_key.ts": "1a729b884d0a09c50a5f6d68e9e13d07f1be7f1092a59486699d7c952ab7ca86", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/rsa_wc.ts": "614624a1d222d42192bc3c9da1e9656e88f921f5e8c24171567fdac90036337e", + "https://deno.land/x/god_crypto@v1.4.8/src/rsa/rsassa_pss.ts": "14987aab6b69fb5d9056bf260c722cc91376e34edb53ee30f38541ab5f7a2260", + "https://deno.land/x/god_crypto@v1.4.8/src/utility/asn1.ts": "91b4d357a3b3bca4c0c0d26e876061bf803e04e5f0bd418d35426d1858f9aaf8", + "https://deno.land/x/god_crypto@v1.4.8/src/utility/encode.ts": "2865eb23bceea73fde3e0d1c13254bc30d9144606fda30ae009fbf33e5c881a3", + "https://deno.land/x/hmac@v2.0.1/deps.ts": "c2cb0fb44389a76b253cc27a1cadfbe9f03ede2ddea0d940b5389d683940217c", + "https://deno.land/x/hmac@v2.0.1/mod.ts": "83590b95de468d0cf5398b7631b4fb62a64226786247fe265482045d799e8f97", + "https://deno.land/x/ms@v0.1.0/ms.ts": "13014fdf12808df48f6e557cc3be22d24db5b8e29b687d710f9012df3428d2c8", + "https://denopkg.com/chiefbiiko/sha1@v1.0.3/deps.ts": "2e1af51a48c8507017fdb057b950366601b177fb7e73d5de54c1b3e0e115d72e", + "https://denopkg.com/chiefbiiko/sha1@v1.0.3/mod.ts": "146a101c9776cc9c807053c93f23e4b321ade5251f65745df418f4a75d5fd27b", + "https://denopkg.com/chiefbiiko/sha1@v2.0.0/deps.ts": "434b70f37ed145ca5259353c96fdee1e7d1cd8c6a32baad9dce2aedc79d0a3bc", + "https://denopkg.com/chiefbiiko/sha1@v2.0.0/mod.ts": "146a101c9776cc9c807053c93f23e4b321ade5251f65745df418f4a75d5fd27b", + "https://denopkg.com/chiefbiiko/sha256@v1.0.2/deps.ts": "2e1af51a48c8507017fdb057b950366601b177fb7e73d5de54c1b3e0e115d72e", + "https://denopkg.com/chiefbiiko/sha256@v1.0.2/mod.ts": "f109aa5eeb201a0cbfaf44950b70a429838b187e8a84c5b810c1ac84953427cc", + "https://denopkg.com/chiefbiiko/sha256@v2.0.0/deps.ts": "434b70f37ed145ca5259353c96fdee1e7d1cd8c6a32baad9dce2aedc79d0a3bc", + "https://denopkg.com/chiefbiiko/sha256@v2.0.0/mod.ts": "f109aa5eeb201a0cbfaf44950b70a429838b187e8a84c5b810c1ac84953427cc", + "https://denopkg.com/chiefbiiko/sha512@master/deps.ts": "434b70f37ed145ca5259353c96fdee1e7d1cd8c6a32baad9dce2aedc79d0a3bc", + "https://denopkg.com/chiefbiiko/sha512@master/mod.ts": "33190babd4c0e748bb2568fd003444487c8798c8c3a618f6593098c12805fe15", + "https://denopkg.com/chiefbiiko/sha512@v2.0.0/deps.ts": "434b70f37ed145ca5259353c96fdee1e7d1cd8c6a32baad9dce2aedc79d0a3bc", + "https://denopkg.com/chiefbiiko/sha512@v2.0.0/mod.ts": "33190babd4c0e748bb2568fd003444487c8798c8c3a618f6593098c12805fe15", + "https://denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.ts": "4a927e5cd1d9b080d72881eb285b3b94edb6dadc1828aeb194117645f4481ac0", + "https://denopkg.com/chiefbiiko/std-encoding@v1.1.1/mod.ts": "e61017da4cef146863d614a961b4e61f1df14b72c906092bd02161f913e76522", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/deps.deno.ts": "535022689d9953a7018b61b2674f22da756a60e0d62e7b7617b6f0a71bf971a9", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/mod.ts": "93d99369a0c4ac4c280b3201fd7aae1a07d01ac33008768cefc7be5dd58e4186", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/services/cache.ts": "73d1da9331ec4dc65ee2b446e14641e9ce1530fb05bda7bb5b4295ef6a5f0cf1", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/services/data.ts": "2ecb609f14941fe3e069b0819cfd0e2567803c9246f5e0b6af07ecda09f0914a", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/services/info.ts": "deb128b2722f9028aea0dc7c6220c97989e1fbc6333a4156fc52d3e706a3bd33", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/services/queue.ts": "ce1902bdd0994747e2b5f31c63e762115d28285134d627582908f7898c6461c2", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/services/search.ts": "fc1e6f3311a157f806e3371e5a15b14e9d079c2ee724fc4f2357fd61c23fb408", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/services/storage.ts": "7d319360354374698fe8ee7d7a74302c9ad044599fb3c20323445ff34e8e25cf", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/types.ts": "fca376413f15a3cf3a67fb6958deee1e00b8874200177168d53e15aa9d185bc1", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/utils/hyper-query.ts": "e3642a64893f8584e153d16f6c79b58671c8e07ee24a9751595f191a4ef564c2", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/utils/hyper-request.ts": "d1de0570a47267f3279e61ba073f5eedfbce989481218ffa6e7daa3f1b84f33c", + "https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/utils/hyper-verify.ts": "9107c86167a7dc8e2044327f8f22fe6bb5c78bee2a86f376ca1426fcc8904f16" + } +} diff --git a/deps.js b/deps.js new file mode 100644 index 0000000..f9733e8 --- /dev/null +++ b/deps.js @@ -0,0 +1,4 @@ +export { default as crocks } from 'npm:crocks@0.12.4'; +export * as R from 'npm:ramda@0.29.1'; + +export { connect } from 'https://raw.githubusercontent.com/hyper63/hyper/hyper-connect%40v0.12.0/packages/connect/deno/mod.ts'; diff --git a/import_map.json b/import_map.json deleted file mode 100644 index 27e4c0e..0000000 --- a/import_map.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "imports": { - "hyper-connect": "https://x.nest.land/hyper-connect@0.1.9/deno/mod.ts", - "ramda": "https://cdn.skypack.dev/ramda@^0.27.1", - "crocks": "https://cdn.skypack.dev/crocks@^0.12.4" - } -} \ No newline at end of file diff --git a/mod.js b/mod.js index ed25e94..491883d 100644 --- a/mod.js +++ b/mod.js @@ -1,9 +1,8 @@ -import { connect } from 'hyper-connect' -import crocks from 'crocks' -import copy from './copy.js' +import { connect, crocks } from './deps.js'; +import copy from './copy.js'; -const { Async } = crocks -const FINISHED = '__FINISHED__' +const { Async } = crocks; +const FINISHED = '__FINISHED__'; if (Deno.args.length !== 2) { console.log(` @@ -16,28 +15,28 @@ Usage: hyper-copy $SRC $TARGET - `) - Deno.exit() + `); + Deno.exit(); } -const [SRC, TARGET] = Deno.args -const [src, target] = [connect(SRC), connect(TARGET)] -const list = Async.fromPromise(src.data.list) -const bulk = Async.fromPromise(target.data.bulk) -const cp = copy(list, bulk) -let key = '' -const BATCH = 1001 +const [SRC, TARGET] = Deno.args; +const [src, target] = [connect(SRC), connect(TARGET)]; +const list = Async.fromPromise(src.data.list); +const bulk = Async.fromPromise(target.data.bulk); +const cp = copy(list, bulk); +let key = ''; +const BATCH = 1001; -for (var i = 0; i < Infinity; i++) { +for (let i = 0; i < Infinity; i++) { try { - key = await cp(BATCH, key).toPromise() + key = await cp(BATCH, key).toPromise(); if (key === FINISHED) { - console.log('Finished Copy!') + console.log('Finished Copy!'); break; } } catch (err) { - console.log(err) + console.log(err); break; } - console.log('Batch: ', i) -} \ No newline at end of file + console.log('Batch: ', i); +} diff --git a/scripts/compile.sh b/scripts/compile.sh deleted file mode 100755 index fc7de38..0000000 --- a/scripts/compile.sh +++ /dev/null @@ -1 +0,0 @@ -deno compile --import-map=./import_map.json --allow-net --unstable --no-check --output hyper-copy mod.js \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 6bb6269..0000000 --- a/scripts/test.sh +++ /dev/null @@ -1 +0,0 @@ -deno test --import-map=./import_map.json \ No newline at end of file