├── .babelrc ├── .eslintrc.json ├── .flowconfig ├── .gitignore ├── .lintstagedrc.json ├── .prettierrc.json ├── LICENSE ├── README.md ├── dist ├── bundle.es.js └── flow-typed │ ├── Blocklist.js │ ├── Claim.js │ ├── CoinSwap.js │ ├── Collections.js │ ├── File.js │ ├── Lbry.js │ ├── LbryFirst.js │ ├── Notification.js │ ├── Publish.js │ ├── Redux.js │ ├── Reflector.js │ ├── Tags.js │ ├── Transaction.js │ ├── Txo.js │ ├── i18n.js │ ├── lbryURI.js │ ├── mime.js │ ├── npm │ ├── babel-core_vx.x.x.js │ ├── babel-eslint_vx.x.x.js │ ├── babel-loader_vx.x.x.js │ ├── babel-plugin-module-resolver_vx.x.x.js │ ├── babel-plugin-transform-flow-comments_vx.x.x.js │ ├── babel-preset-env_vx.x.x.js │ ├── babel-preset-stage-2_vx.x.x.js │ ├── eslint-config-standard-jsx_vx.x.x.js │ ├── eslint-config-standard_vx.x.x.js │ ├── eslint-plugin-flowtype_vx.x.x.js │ ├── eslint-plugin-import_vx.x.x.js │ ├── eslint-plugin-node_vx.x.x.js │ ├── eslint-plugin-promise_vx.x.x.js │ ├── eslint-plugin-react_vx.x.x.js │ ├── eslint-plugin-standard_vx.x.x.js │ ├── eslint_vx.x.x.js │ ├── flow-bin_v0.x.x.js │ ├── flow-typed_vx.x.x.js │ ├── from-entries.js │ ├── husky_vx.x.x.js │ ├── lint-staged_vx.x.x.js │ ├── prettier_v1.x.x.js │ ├── proxy-polyfill_vx.x.x.js │ ├── rollup-plugin-babel_vx.x.x.js │ ├── rollup-plugin-copy_vx.x.x.js │ ├── rollup-plugin-eslint_vx.x.x.js │ ├── rollup-plugin-flow_vx.x.x.js │ ├── rollup-plugin-includepaths_vx.x.x.js │ ├── rollup_vx.x.x.js │ └── uuid.js │ └── reselect.js ├── flow-typed ├── Blocklist.js ├── Claim.js ├── CoinSwap.js ├── Collections.js ├── File.js ├── Lbry.js ├── LbryFirst.js ├── Notification.js ├── Publish.js ├── Redux.js ├── Reflector.js ├── Tags.js ├── Transaction.js ├── Txo.js ├── i18n.js ├── lbryURI.js ├── npm │ ├── babel-core_vx.x.x.js │ ├── babel-eslint_vx.x.x.js │ ├── babel-loader_vx.x.x.js │ ├── babel-plugin-module-resolver_vx.x.x.js │ ├── babel-plugin-transform-flow-comments_vx.x.x.js │ ├── babel-preset-env_vx.x.x.js │ ├── babel-preset-stage-2_vx.x.x.js │ ├── eslint-config-standard-jsx_vx.x.x.js │ ├── eslint-config-standard_vx.x.x.js │ ├── eslint-plugin-flowtype_vx.x.x.js │ ├── eslint-plugin-import_vx.x.x.js │ ├── eslint-plugin-node_vx.x.x.js │ ├── eslint-plugin-promise_vx.x.x.js │ ├── eslint-plugin-react_vx.x.x.js │ ├── eslint-plugin-standard_vx.x.x.js │ ├── eslint_vx.x.x.js │ ├── flow-bin_v0.x.x.js │ ├── flow-typed_vx.x.x.js │ ├── from-entries.js │ ├── husky_vx.x.x.js │ ├── lint-staged_vx.x.x.js │ ├── prettier_v1.x.x.js │ ├── proxy-polyfill_vx.x.x.js │ ├── rollup-plugin-babel_vx.x.x.js │ ├── rollup-plugin-copy_vx.x.x.js │ ├── rollup-plugin-eslint_vx.x.x.js │ ├── rollup-plugin-flow_vx.x.x.js │ ├── rollup-plugin-includepaths_vx.x.x.js │ ├── rollup_vx.x.x.js │ └── uuid.js └── reselect.js ├── jest.config.js ├── package.json ├── rollup.config.js ├── src ├── constants │ ├── abandon_states.js │ ├── action_types.js │ ├── claim.js │ ├── collections.js │ ├── daemon_settings.js │ ├── icons.js │ ├── languages.js │ ├── licenses.js │ ├── pages.js │ ├── settings.js │ ├── shape_shift.js │ ├── shared_preferences.js │ ├── sort_options.js │ ├── speech_urls.js │ ├── tags.js │ ├── thumbnail_upload_statuses.js │ ├── transaction_list.js │ ├── transaction_types.js │ └── txo_list.js ├── index.js ├── lbry-first.js ├── lbry.js ├── lbryURI.js ├── redux │ ├── actions │ │ ├── blocked.js │ │ ├── claims.js │ │ ├── collections.js │ │ ├── content.js │ │ ├── file.js │ │ ├── file_info.js │ │ ├── notifications.js │ │ ├── publish.js │ │ ├── sync.js │ │ └── wallet.js │ ├── middleware │ │ └── shared-state.js │ ├── reducers │ │ ├── blocked.js │ │ ├── claims.js │ │ ├── collections.js │ │ ├── content.js │ │ ├── file_info.js │ │ ├── notifications.js │ │ ├── publish.js │ │ └── wallet.js │ └── selectors │ │ ├── blocked.js │ │ ├── claims.js │ │ ├── collections.js │ │ ├── content.js │ │ ├── file_info.js │ │ ├── notifications.js │ │ ├── publish.js │ │ └── wallet.js └── util │ ├── batch-actions.js │ ├── claim.js │ ├── debounce.js │ ├── deep-equal.js │ ├── format-credits.js │ ├── handle-fetch.js │ ├── merge-claim.js │ ├── parse-data.js │ ├── query-params.js │ └── redux-utils.js ├── tests ├── config │ └── jest-transformer.js └── parseURI.test.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["env", "stage-2"], 3 | "plugins": ["transform-flow-comments"] 4 | } 5 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": ["standard", "standard-jsx", "plugin:flowtype/recommended"], 4 | "plugins": ["flowtype", "import"], 5 | "env": { 6 | "browser": true, 7 | "node": true 8 | }, 9 | "globals": { 10 | "__": true 11 | }, 12 | "rules": { 13 | "camelcase": 0, 14 | "no-multi-spaces": 0, 15 | "new-cap": 0, 16 | "prefer-promise-reject-errors": 0, 17 | "no-unused-vars": 0, 18 | "standard/object-curly-even-spacing": 0, 19 | "handle-callback-err": 0, 20 | "one-var": 0, 21 | "object-curly-spacing": 0, 22 | "no-redeclare": 0, 23 | "no-return-await": 0, 24 | "standard/no-callback-literal": 0, 25 | "comma-dangle": ["error", "always-multiline"], 26 | "space-before-function-paren": ["error", "never"], 27 | "jsx-quotes": ["error", "prefer-double"], 28 | "no-use-before-define": 0, 29 | "semi": [ 30 | "error", 31 | "always", 32 | { 33 | "omitLastInOneLineBlock": true 34 | } 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | 4 | [include] 5 | 6 | [libs] 7 | ./flow-typed 8 | 9 | [options] 10 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe 11 | module.system.node.resolve_dirname=./src 12 | module.name_mapper='^redux\(.*\)$' -> '/src/redux\1' 13 | module.name_mapper='^util\(.*\)$' -> '/src/util\1' 14 | module.name_mapper='^constants\(.*\)$' -> '/src/constants\1' 15 | module.name_mapper='^lbry\(.*\)$' -> '/src/lbry\1' 16 | module.name_mapper='^lbry-first\(.*\)$' -> '/src/lbry-first\1' 17 | module.name_mapper='^lbryURI\(.*\)$' -> '/src/lbryURI\1' 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | yarn-error.log 3 | package-lock.json 4 | 5 | # Jetbrains 6 | .idea/ 7 | 8 | -------------------------------------------------------------------------------- /.lintstagedrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "linters": { 3 | "src/**/*.{js,json}": ["prettier --write", "git add"], 4 | "src/**/*.js": ["eslint --fix", "git add"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "printWidth": 100, 4 | "singleQuote": true 5 | } 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017-2021 LBRY Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 8 | following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 13 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 14 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 15 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lbry-redux 2 | 3 | [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) 4 | 5 | lbry-redux is a module which contains common React and redux code shared between lbry-desktop and lbry-android. 6 | 7 | ## Installation 8 | Add `lbry-redux` as a dependency to your `package.json` file. 9 | `"lbry-redux": "lbryio/lbry-redux"` 10 | 11 | ### Local development 12 | If you intend to make changes to the module and test immediately, you can use `npm link` to add the package to your `node_modules` folder. This will create a symlink to the folder where `lbry-redux` was cloned to. 13 | ``` 14 | cd lbry-redux 15 | yarn link 16 | cd /// (ex: cd ~/lbry-desktop) 17 | yarn link lbry-redux 18 | ```` 19 | 20 | ### Build 21 | Run `$ yarn build`. If the symlink does not work, just build the file and move the `bundle.js` file into the `node_modules/` folder. 22 | 23 | ### Tests 24 | Run `$ yarn test`. 25 | 26 | ## Contributing 27 | We :heart: contributions from everyone! We welcome [bug reports](https://github.com/lbryio/lbry-redux/issues/), [bug fixes](https://github.com/lbryio/lbry-redux/pulls) and feedback on the module is always appreciated. 28 | 29 | ## [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/lbryio/lbry-redux/issues) [![GitHub contributors](https://img.shields.io/github/contributors/lbryio/lbry-redux.svg)](https://GitHub.com/lbryio/lbry-redux/graphs/contributors/) 30 | 31 | ## License 32 | 33 | This module is released under the [MIT License](LICENSE) 34 | -------------------------------------------------------------------------------- /dist/flow-typed/Blocklist.js: -------------------------------------------------------------------------------- 1 | declare type BlocklistState = { 2 | blockedChannels: Array 3 | }; 4 | 5 | declare type BlocklistAction = { 6 | type: string, 7 | data: { 8 | uri: string, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /dist/flow-typed/Claim.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare type Claim = StreamClaim | ChannelClaim | CollectionClaim; 4 | 5 | declare type ChannelClaim = GenericClaim & { 6 | value: ChannelMetadata, 7 | }; 8 | 9 | declare type CollectionClaim = GenericClaim & { 10 | value: CollectionMetadata, 11 | }; 12 | 13 | declare type StreamClaim = GenericClaim & { 14 | value: StreamMetadata, 15 | }; 16 | 17 | declare type GenericClaim = { 18 | address: string, // address associated with tx 19 | amount: string, // bid amount at time of tx 20 | canonical_url: string, // URL with short id, includes channel with short id 21 | claim_id: string, // unique claim identifier 22 | claim_sequence: number, // not being used currently 23 | claim_op: 'create' | 'update', 24 | confirmations: number, 25 | decoded_claim: boolean, // Not available currently https://github.com/lbryio/lbry/issues/2044 26 | timestamp?: number, // date of last transaction 27 | height: number, // block height the tx was confirmed 28 | is_channel_signature_valid?: boolean, 29 | is_my_output: boolean, 30 | name: string, 31 | normalized_name: string, // `name` normalized via unicode NFD spec, 32 | nout: number, // index number for an output of a tx 33 | permanent_url: string, // name + claim_id 34 | short_url: string, // permanent_url with short id, no channel 35 | txid: string, // unique tx id 36 | type: 'claim' | 'update' | 'support', 37 | value_type: 'stream' | 'channel' | 'collection', 38 | signing_channel?: ChannelClaim, 39 | reposted_claim?: GenericClaim, 40 | repost_channel_url?: string, 41 | repost_url?: string, 42 | repost_bid_amount?: string, 43 | purchase_receipt?: PurchaseReceipt, 44 | meta: { 45 | activation_height: number, 46 | claims_in_channel?: number, 47 | creation_height: number, 48 | creation_timestamp: number, 49 | effective_amount: string, 50 | expiration_height: number, 51 | is_controlling: boolean, 52 | support_amount: string, 53 | reposted: number, 54 | trending_global: number, 55 | trending_group: number, 56 | trending_local: number, 57 | trending_mixed: number, 58 | }, 59 | }; 60 | 61 | declare type GenericMetadata = { 62 | title?: string, 63 | description?: string, 64 | thumbnail?: { 65 | url?: string, 66 | }, 67 | languages?: Array, 68 | tags?: Array, 69 | locations?: Array, 70 | }; 71 | 72 | declare type ChannelMetadata = GenericMetadata & { 73 | public_key: string, 74 | public_key_id: string, 75 | cover_url?: string, 76 | email?: string, 77 | website_url?: string, 78 | featured?: Array, 79 | }; 80 | 81 | declare type CollectionMetadata = GenericMetadata & { 82 | claims: Array, 83 | } 84 | 85 | declare type StreamMetadata = GenericMetadata & { 86 | license?: string, // License "title" ex: Creative Commons, Custom copyright 87 | license_url?: string, // Link to full license 88 | release_time?: number, // linux timestamp 89 | author?: string, 90 | 91 | source: { 92 | sd_hash: string, 93 | media_type?: string, 94 | hash?: string, 95 | name?: string, // file name 96 | size?: number, // size of file in bytes 97 | }, 98 | 99 | // Only exists if a stream has a fee 100 | fee?: Fee, 101 | 102 | stream_type: 'video' | 'audio' | 'image' | 'software', 103 | // Below correspond to `stream_type` 104 | video?: { 105 | duration: number, 106 | height: number, 107 | width: number, 108 | }, 109 | audio?: { 110 | duration: number, 111 | }, 112 | image?: { 113 | height: number, 114 | width: number, 115 | }, 116 | software?: { 117 | os: string, 118 | }, 119 | }; 120 | 121 | declare type Location = { 122 | latitude?: number, 123 | longitude?: number, 124 | country?: string, 125 | state?: string, 126 | city?: string, 127 | code?: string, 128 | }; 129 | 130 | declare type Fee = { 131 | amount: string, 132 | currency: string, 133 | address: string, 134 | }; 135 | 136 | declare type PurchaseReceipt = { 137 | address: string, 138 | amount: string, 139 | claim_id: string, 140 | confirmations: number, 141 | height: number, 142 | nout: number, 143 | timestamp: number, 144 | txid: string, 145 | type: 'purchase', 146 | }; 147 | 148 | declare type ClaimActionResolveInfo = { 149 | [string]: { 150 | stream: ?StreamClaim, 151 | channel: ?ChannelClaim, 152 | claimsInChannel: ?number, 153 | collection: ?CollectionClaim, 154 | }, 155 | } 156 | 157 | declare type ChannelUpdateParams = { 158 | claim_id: string, 159 | bid?: string, 160 | title?: string, 161 | cover_url?: string, 162 | thumbnail_url?: string, 163 | description?: string, 164 | website_url?: string, 165 | email?: string, 166 | tags?: Array, 167 | replace?: boolean, 168 | languages?: Array, 169 | locations?: Array, 170 | blocking?: boolean, 171 | } 172 | 173 | declare type ChannelPublishParams = { 174 | name: string, 175 | bid: string, 176 | blocking?: true, 177 | title?: string, 178 | cover_url?: string, 179 | thumbnail_url?: string, 180 | description?: string, 181 | website_url?: string, 182 | email?: string, 183 | tags?: Array, 184 | languages?: Array, 185 | } 186 | 187 | declare type CollectionUpdateParams = { 188 | claim_id: string, 189 | claim_ids?: Array, 190 | bid?: string, 191 | title?: string, 192 | cover_url?: string, 193 | thumbnail_url?: string, 194 | description?: string, 195 | website_url?: string, 196 | email?: string, 197 | tags?: Array, 198 | replace?: boolean, 199 | languages?: Array, 200 | locations?: Array, 201 | blocking?: boolean, 202 | } 203 | 204 | declare type CollectionPublishParams = { 205 | name: string, 206 | bid: string, 207 | claim_ids: Array, 208 | blocking?: true, 209 | title?: string, 210 | thumbnail_url?: string, 211 | description?: string, 212 | tags?: Array, 213 | languages?: Array, 214 | } 215 | -------------------------------------------------------------------------------- /dist/flow-typed/CoinSwap.js: -------------------------------------------------------------------------------- 1 | declare type CoinSwapInfo = { 2 | chargeCode: string, 3 | coins: Array, 4 | sendAddresses: { [string]: string}, 5 | sendAmounts: { [string]: any }, 6 | lbcAmount: number, 7 | status?: { 8 | status: string, 9 | receiptCurrency: string, 10 | receiptTxid: string, 11 | lbcTxid: string, 12 | }, 13 | } 14 | 15 | declare type CoinSwapState = { 16 | coinSwaps: Array, 17 | }; 18 | 19 | declare type CoinSwapAddAction = { 20 | type: string, 21 | data: CoinSwapInfo, 22 | }; 23 | 24 | declare type CoinSwapRemoveAction = { 25 | type: string, 26 | data: { 27 | chargeCode: string, 28 | }, 29 | }; 30 | -------------------------------------------------------------------------------- /dist/flow-typed/Collections.js: -------------------------------------------------------------------------------- 1 | declare type Collection = { 2 | id: string, 3 | items: Array, 4 | name: string, 5 | type: string, 6 | updatedAt: number, 7 | totalItems?: number, 8 | sourceId?: string, // if copied, claimId of original collection 9 | }; 10 | 11 | declare type CollectionState = { 12 | unpublished: CollectionGroup, 13 | resolved: CollectionGroup, 14 | pending: CollectionGroup, 15 | edited: CollectionGroup, 16 | builtin: CollectionGroup, 17 | saved: Array, 18 | isResolvingCollectionById: { [string]: boolean }, 19 | error?: string | null, 20 | }; 21 | 22 | declare type CollectionGroup = { 23 | [string]: Collection, 24 | } 25 | 26 | declare type CollectionEditParams = { 27 | claims?: Array, 28 | remove?: boolean, 29 | claimIds?: Array, 30 | replace?: boolean, 31 | order?: { from: number, to: number }, 32 | type?: string, 33 | name?: string, 34 | } 35 | -------------------------------------------------------------------------------- /dist/flow-typed/File.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare type FileListItem = { 4 | metadata: StreamMetadata, 5 | added_on: number, 6 | blobs_completed: number, 7 | blobs_in_stream: number, 8 | blobs_remaining: number, 9 | channel_claim_id: string, 10 | channel_name: string, 11 | claim_id: string, 12 | claim_name: string, 13 | completed: false, 14 | content_fee?: { txid: string }, 15 | purchase_receipt?: { txid: string, amount: string }, 16 | download_directory: string, 17 | download_path: string, 18 | file_name: string, 19 | key: string, 20 | mime_type: string, 21 | nout: number, 22 | outpoint: string, 23 | points_paid: number, 24 | protobuf: string, 25 | reflector_progress: number, 26 | sd_hash: string, 27 | status: string, 28 | stopped: false, 29 | stream_hash: string, 30 | stream_name: string, 31 | streaming_url: string, 32 | suggested_file_name: string, 33 | total_bytes: number, 34 | total_bytes_lower_bound: number, 35 | is_fully_reflected: boolean, 36 | // TODO: sdk plans to change `tx` 37 | // It isn't currently used by the apps 38 | tx: {}, 39 | txid: string, 40 | uploading_to_reflector: boolean, 41 | written_bytes: number, 42 | }; 43 | 44 | declare type FileState = { 45 | failedPurchaseUris: Array, 46 | purchasedUris: Array, 47 | }; 48 | 49 | declare type PurchaseUriCompleted = { 50 | type: ACTIONS.PURCHASE_URI_COMPLETED, 51 | data: { 52 | uri: string, 53 | streamingUrl: string, 54 | }, 55 | }; 56 | 57 | declare type PurchaseUriFailed = { 58 | type: ACTIONS.PURCHASE_URI_FAILED, 59 | data: { 60 | uri: string, 61 | error: any, 62 | }, 63 | }; 64 | 65 | declare type PurchaseUriStarted = { 66 | type: ACTIONS.PURCHASE_URI_STARTED, 67 | data: { 68 | uri: string, 69 | streamingUrl: string, 70 | }, 71 | }; 72 | 73 | declare type DeletePurchasedUri = { 74 | type: ACTIONS.CLEAR_PURCHASED_URI_SUCCESS, 75 | data: { 76 | uri: string, 77 | }, 78 | }; 79 | -------------------------------------------------------------------------------- /dist/flow-typed/LbryFirst.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare type LbryFirstStatusResponse = { 3 | Version: string, 4 | Message: string, 5 | Running: boolean, 6 | Commit: string, 7 | }; 8 | 9 | declare type LbryFirstVersionResponse = { 10 | build: string, 11 | lbrynet_version: string, 12 | os_release: string, 13 | os_system: string, 14 | platform: string, 15 | processor: string, 16 | python_version: string, 17 | }; 18 | /* SAMPLE UPLOAD RESPONSE (FULL) 19 | "Video": { 20 | "etag": "\"Dn5xIderbhAnUk5TAW0qkFFir0M/xlGLrlTox7VFTRcR8F77RbKtaU4\"", 21 | "id": "8InjtdvVmwE", 22 | "kind": "youtube#video", 23 | "snippet": { 24 | "categoryId": "22", 25 | "channelId": "UCXiVsGTU88fJjheB2rqF0rA", 26 | "channelTitle": "Mark Beamer", 27 | "liveBroadcastContent": "none", 28 | "localized": { 29 | "title": "my title" 30 | }, 31 | "publishedAt": "2020-05-05T04:17:53.000Z", 32 | "thumbnails": { 33 | "default": { 34 | "height": 90, 35 | "url": "https://i9.ytimg.com/vi/8InjtdvVmwE/default.jpg?sqp=CMTQw_UF&rs=AOn4CLB6dlhZMSMrazDlWRsitPgCsn8fVw", 36 | "width": 120 37 | }, 38 | "high": { 39 | "height": 360, 40 | "url": "https://i9.ytimg.com/vi/8InjtdvVmwE/hqdefault.jpg?sqp=CMTQw_UF&rs=AOn4CLB-Je_7l6qvASRAR_bSGWZHaXaJWQ", 41 | "width": 480 42 | }, 43 | "medium": { 44 | "height": 180, 45 | "url": "https://i9.ytimg.com/vi/8InjtdvVmwE/mqdefault.jpg?sqp=CMTQw_UF&rs=AOn4CLCvSnDLqVznRNMKuvJ_0misY_chPQ", 46 | "width": 320 47 | } 48 | }, 49 | "title": "my title" 50 | }, 51 | "status": { 52 | "embeddable": true, 53 | "license": "youtube", 54 | "privacyStatus": "private", 55 | "publicStatsViewable": true, 56 | "uploadStatus": "uploaded" 57 | } 58 | } 59 | */ 60 | declare type UploadResponse = { 61 | Video: { 62 | id: string, 63 | snippet: { 64 | channelId: string, 65 | }, 66 | status: { 67 | uploadStatus: string, 68 | }, 69 | }, 70 | }; 71 | 72 | declare type HasYTAuthResponse = { 73 | HashAuth: boolean, 74 | }; 75 | 76 | declare type YTSignupResponse = {}; 77 | 78 | // 79 | // Types used in the generic LbryFirst object that is exported 80 | // 81 | declare type LbryFirstTypes = { 82 | isConnected: boolean, 83 | connectPromise: ?Promise, 84 | connect: () => void, 85 | lbryFirstConnectionString: string, 86 | apiRequestHeaders: { [key: string]: string }, 87 | setApiHeader: (string, string) => void, 88 | unsetApiHeader: string => void, 89 | overrides: { [string]: ?Function }, 90 | setOverride: (string, Function) => void, 91 | 92 | // LbryFirst Methods 93 | stop: () => Promise, 94 | status: () => Promise, 95 | version: () => Promise, 96 | upload: any => Promise, 97 | hasYTAuth: string => Promise, 98 | ytSignup: () => Promise, 99 | }; 100 | -------------------------------------------------------------------------------- /dist/flow-typed/Notification.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | 4 | /* 5 | Toasts: 6 | - First-in, first-out queue 7 | - Simple messages that are shown in response to user interactions 8 | - Never saved 9 | - If they are the result of errors, use the isError flag when creating 10 | - For errors that should interrupt user behavior, use Error 11 | */ 12 | declare type ToastParams = { 13 | message: string, 14 | title?: string, 15 | linkText?: string, 16 | linkTarget?: string, 17 | isError?: boolean, 18 | }; 19 | 20 | declare type Toast = { 21 | id: string, 22 | params: ToastParams, 23 | }; 24 | 25 | declare type DoToast = { 26 | type: ACTIONS.CREATE_TOAST, 27 | data: Toast, 28 | }; 29 | 30 | /* 31 | Notifications: 32 | - List of notifications based on user interactions/app notifications 33 | - Always saved, but can be manually deleted 34 | - Can happen in the background, or because of user interaction (ex: publish confirmed) 35 | */ 36 | declare type Notification = { 37 | id: string, // Unique id 38 | dateCreated: number, 39 | isRead: boolean, // Used to display "new" notifications that a user hasn't seen yet 40 | source?: string, // The type/area an notification is from. Used for sorting (ex: publishes, transactions) 41 | // We may want to use priority/isDismissed in the future to specify how urgent a notification is 42 | // and if the user should see it immediately 43 | // isDissmied: boolean, 44 | // priority?: number 45 | }; 46 | 47 | declare type DoNotification = { 48 | type: ACTIONS.CREATE_NOTIFICATION, 49 | data: Notification, 50 | }; 51 | 52 | declare type DoEditNotification = { 53 | type: ACTIONS.EDIT_NOTIFICATION, 54 | data: { 55 | notification: Notification, 56 | }, 57 | }; 58 | 59 | declare type DoDeleteNotification = { 60 | type: ACTIONS.DELETE_NOTIFICATION, 61 | data: { 62 | id: string, // The id to delete 63 | }, 64 | }; 65 | 66 | /* 67 | Errors: 68 | - First-in, first-out queue 69 | - Errors that should interupt user behavior 70 | - For errors that can be shown without interrupting a user, use Toast with the isError flag 71 | */ 72 | declare type ErrorNotification = { 73 | title: string, 74 | text: string, 75 | }; 76 | 77 | declare type DoError = { 78 | type: ACTIONS.CREATE_ERROR, 79 | data: ErrorNotification, 80 | }; 81 | 82 | declare type DoDismissError = { 83 | type: ACTIONS.DISMISS_ERROR, 84 | }; 85 | 86 | /* 87 | NotificationState 88 | */ 89 | declare type NotificationState = { 90 | notifications: Array, 91 | errors: Array, 92 | toasts: Array, 93 | }; 94 | -------------------------------------------------------------------------------- /dist/flow-typed/Publish.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare type UpdatePublishFormData = { 4 | filePath?: string, 5 | contentIsFree?: boolean, 6 | fee?: { 7 | amount: string, 8 | currency: string, 9 | }, 10 | title?: string, 11 | thumbnail_url?: string, 12 | uploadThumbnailStatus?: string, 13 | thumbnailPath?: string, 14 | description?: string, 15 | language?: string, 16 | channel?: string, 17 | channelId?: string, 18 | name?: string, 19 | nameError?: string, 20 | bid?: string, 21 | bidError?: string, 22 | otherLicenseDescription?: string, 23 | licenseUrl?: string, 24 | licenseType?: string, 25 | uri?: string, 26 | nsfw: boolean, 27 | }; 28 | -------------------------------------------------------------------------------- /dist/flow-typed/Redux.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | /* eslint-disable no-use-before-define */ 3 | declare type GetState = () => any; 4 | declare type ThunkAction = (dispatch: Dispatch, getState: GetState) => any; 5 | declare type Dispatch = (action: {} | Promise<*> | Array<{}> | ThunkAction) => any; // Need to refer to ThunkAction 6 | /* eslint-enable */ 7 | -------------------------------------------------------------------------------- /dist/flow-typed/Reflector.js: -------------------------------------------------------------------------------- 1 | declare type ReflectingUpdate = { 2 | fileListItem: FileListItem, 3 | progress: number | boolean, 4 | stalled: boolean, 5 | }; 6 | -------------------------------------------------------------------------------- /dist/flow-typed/Tags.js: -------------------------------------------------------------------------------- 1 | declare type TagState = { 2 | followedTags: FollowedTags, 3 | knownTags: KnownTags, 4 | }; 5 | 6 | declare type Tag = { 7 | name: string, 8 | }; 9 | 10 | declare type KnownTags = { 11 | [string]: Tag, 12 | }; 13 | 14 | declare type FollowedTags = Array; 15 | 16 | declare type TagAction = { 17 | type: string, 18 | data: { 19 | name: string, 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /dist/flow-typed/Transaction.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare type Transaction = { 3 | amount: number, 4 | claim_id: string, 5 | claim_name: string, 6 | fee: number, 7 | nout: number, 8 | txid: string, 9 | type: string, 10 | date: Date, 11 | }; 12 | 13 | declare type Support = { 14 | address: string, 15 | amount: string, 16 | claim_id: string, 17 | confirmations: number, 18 | height: string, 19 | is_change: string, 20 | is_mine: string, 21 | name: string, 22 | normalized_name: string, 23 | nout: string, 24 | permanent_url: string, 25 | timestamp: number, 26 | txid: string, 27 | type: string, 28 | }; 29 | -------------------------------------------------------------------------------- /dist/flow-typed/Txo.js: -------------------------------------------------------------------------------- 1 | declare type Txo = { 2 | amount: number, 3 | claim_id: string, 4 | normalized_name: string, 5 | nout: number, 6 | txid: string, 7 | type: string, 8 | value_type: string, 9 | timestamp: number, 10 | is_my_output: boolean, 11 | is_my_input: boolean, 12 | is_spent: boolean, 13 | signing_channel?: { 14 | channel_id: string, 15 | }, 16 | }; 17 | 18 | declare type TxoListParams = { 19 | page: number, 20 | page_size: number, 21 | type: string, 22 | is_my_input?: boolean, 23 | is_my_output?: boolean, 24 | is_not_my_input?: boolean, 25 | is_not_my_output?: boolean, 26 | is_spent?: boolean, 27 | }; 28 | -------------------------------------------------------------------------------- /dist/flow-typed/i18n.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare function __(a: string, b?: {}): string; 3 | -------------------------------------------------------------------------------- /dist/flow-typed/lbryURI.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare type LbryUrlObj = { 3 | // Path and channel will always exist when calling parseURI 4 | // But they may not exist when code calls buildURI 5 | isChannel?: boolean, 6 | path?: string, 7 | streamName?: string, 8 | streamClaimId?: string, 9 | channelName?: string, 10 | channelClaimId?: string, 11 | primaryClaimSequence?: number, 12 | secondaryClaimSequence?: number, 13 | primaryBidPosition?: number, 14 | secondaryBidPosition?: number, 15 | startTime?: number, 16 | 17 | // Below are considered deprecated and should not be used due to unreliableness with claim.canonical_url 18 | claimName?: string, 19 | claimId?: string, 20 | contentName?: string, 21 | }; 22 | -------------------------------------------------------------------------------- /dist/flow-typed/mime.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare module 'mime' { 3 | declare module.exports: any; 4 | } 5 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/babel-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bc167658b3892d915f873ecc31946cba 2 | // flow-typed version: <>/babel-eslint_v^8.0.3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-eslint/lib/analyze-scope' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-eslint/lib/babylon-to-espree/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-eslint/lib/babylon-to-espree/toAST' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-eslint/lib/babylon-to-espree/toToken' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-eslint/lib/index' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'babel-eslint/lib/parse-with-patch' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'babel-eslint/lib/parse-with-scope' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'babel-eslint/lib/parse' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'babel-eslint/lib/patch-eslint-scope' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'babel-eslint/lib/visitor-keys' { 78 | declare module.exports: any; 79 | } 80 | 81 | // Filename aliases 82 | declare module 'babel-eslint/lib/analyze-scope.js' { 83 | declare module.exports: $Exports<'babel-eslint/lib/analyze-scope'>; 84 | } 85 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments.js' { 86 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/attachComments'>; 87 | } 88 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments.js' { 89 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertComments'>; 90 | } 91 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType.js' { 92 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertTemplateType'>; 93 | } 94 | declare module 'babel-eslint/lib/babylon-to-espree/index.js' { 95 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/index'>; 96 | } 97 | declare module 'babel-eslint/lib/babylon-to-espree/toAST.js' { 98 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toAST'>; 99 | } 100 | declare module 'babel-eslint/lib/babylon-to-espree/toToken.js' { 101 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toToken'>; 102 | } 103 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens.js' { 104 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toTokens'>; 105 | } 106 | declare module 'babel-eslint/lib/index.js' { 107 | declare module.exports: $Exports<'babel-eslint/lib/index'>; 108 | } 109 | declare module 'babel-eslint/lib/parse-with-patch.js' { 110 | declare module.exports: $Exports<'babel-eslint/lib/parse-with-patch'>; 111 | } 112 | declare module 'babel-eslint/lib/parse-with-scope.js' { 113 | declare module.exports: $Exports<'babel-eslint/lib/parse-with-scope'>; 114 | } 115 | declare module 'babel-eslint/lib/parse.js' { 116 | declare module.exports: $Exports<'babel-eslint/lib/parse'>; 117 | } 118 | declare module 'babel-eslint/lib/patch-eslint-scope.js' { 119 | declare module.exports: $Exports<'babel-eslint/lib/patch-eslint-scope'>; 120 | } 121 | declare module 'babel-eslint/lib/visitor-keys.js' { 122 | declare module.exports: $Exports<'babel-eslint/lib/visitor-keys'>; 123 | } 124 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/babel-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ac35c8b7c7b43815c9bfe7048b1f036b 2 | // flow-typed version: <>/babel-loader_v^7.1.4/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-loader/lib/fs-cache' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-loader/lib/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-loader/lib/resolve-rc' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-loader/lib/utils/exists' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-loader/lib/utils/read' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-loader/lib/utils/relative' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'babel-loader/lib/fs-cache.js' { 51 | declare module.exports: $Exports<'babel-loader/lib/fs-cache'>; 52 | } 53 | declare module 'babel-loader/lib/index.js' { 54 | declare module.exports: $Exports<'babel-loader/lib/index'>; 55 | } 56 | declare module 'babel-loader/lib/resolve-rc.js' { 57 | declare module.exports: $Exports<'babel-loader/lib/resolve-rc'>; 58 | } 59 | declare module 'babel-loader/lib/utils/exists.js' { 60 | declare module.exports: $Exports<'babel-loader/lib/utils/exists'>; 61 | } 62 | declare module 'babel-loader/lib/utils/read.js' { 63 | declare module.exports: $Exports<'babel-loader/lib/utils/read'>; 64 | } 65 | declare module 'babel-loader/lib/utils/relative.js' { 66 | declare module.exports: $Exports<'babel-loader/lib/utils/relative'>; 67 | } 68 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/babel-plugin-module-resolver_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ef8e8ad61abd95bef9ea072c0bdb3d98 2 | // flow-typed version: <>/babel-plugin-module-resolver_v^3.0.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-plugin-module-resolver' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-plugin-module-resolver' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-plugin-module-resolver/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-plugin-module-resolver/lib/log' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-plugin-module-resolver/lib/mapToRelative' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-plugin-module-resolver/lib/normalizeOptions' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-plugin-module-resolver/lib/resolvePath' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-plugin-module-resolver/lib/transformers/call' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-plugin-module-resolver/lib/transformers/import' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-plugin-module-resolver/lib/utils' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module 'babel-plugin-module-resolver/lib/index.js' { 59 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/index'>; 60 | } 61 | declare module 'babel-plugin-module-resolver/lib/log.js' { 62 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/log'>; 63 | } 64 | declare module 'babel-plugin-module-resolver/lib/mapToRelative.js' { 65 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/mapToRelative'>; 66 | } 67 | declare module 'babel-plugin-module-resolver/lib/normalizeOptions.js' { 68 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/normalizeOptions'>; 69 | } 70 | declare module 'babel-plugin-module-resolver/lib/resolvePath.js' { 71 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/resolvePath'>; 72 | } 73 | declare module 'babel-plugin-module-resolver/lib/transformers/call.js' { 74 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/transformers/call'>; 75 | } 76 | declare module 'babel-plugin-module-resolver/lib/transformers/import.js' { 77 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/transformers/import'>; 78 | } 79 | declare module 'babel-plugin-module-resolver/lib/utils.js' { 80 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/utils'>; 81 | } 82 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/babel-plugin-transform-flow-comments_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: acec4d6ed4d2870478d3cbe333f79115 2 | // flow-typed version: <>/babel-plugin-transform-flow-comments_v^6.17.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-plugin-transform-flow-comments' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-plugin-transform-flow-comments' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-plugin-transform-flow-comments/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-plugin-transform-flow-comments/lib/index.js' { 31 | declare module.exports: $Exports<'babel-plugin-transform-flow-comments/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/babel-preset-env_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1a890b0eb44450a184610ef421a6c13a 2 | // flow-typed version: <>/babel-preset-env_v^1.6.1/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-env' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-env' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-env/data/built-in-features' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-preset-env/data/plugin-features' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-preset-env/lib/default-includes' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-preset-env/lib/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-preset-env/lib/module-transformations' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-preset-env/lib/normalize-options' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-preset-env/lib/targets-parser' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-preset-env/lib/transform-polyfill-require-plugin' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-preset-env/lib/utils' { 58 | declare module.exports: any; 59 | } 60 | 61 | // Filename aliases 62 | declare module 'babel-preset-env/data/built-in-features.js' { 63 | declare module.exports: $Exports<'babel-preset-env/data/built-in-features'>; 64 | } 65 | declare module 'babel-preset-env/data/plugin-features.js' { 66 | declare module.exports: $Exports<'babel-preset-env/data/plugin-features'>; 67 | } 68 | declare module 'babel-preset-env/lib/default-includes.js' { 69 | declare module.exports: $Exports<'babel-preset-env/lib/default-includes'>; 70 | } 71 | declare module 'babel-preset-env/lib/index.js' { 72 | declare module.exports: $Exports<'babel-preset-env/lib/index'>; 73 | } 74 | declare module 'babel-preset-env/lib/module-transformations.js' { 75 | declare module.exports: $Exports<'babel-preset-env/lib/module-transformations'>; 76 | } 77 | declare module 'babel-preset-env/lib/normalize-options.js' { 78 | declare module.exports: $Exports<'babel-preset-env/lib/normalize-options'>; 79 | } 80 | declare module 'babel-preset-env/lib/targets-parser.js' { 81 | declare module.exports: $Exports<'babel-preset-env/lib/targets-parser'>; 82 | } 83 | declare module 'babel-preset-env/lib/transform-polyfill-require-plugin.js' { 84 | declare module.exports: $Exports<'babel-preset-env/lib/transform-polyfill-require-plugin'>; 85 | } 86 | declare module 'babel-preset-env/lib/utils.js' { 87 | declare module.exports: $Exports<'babel-preset-env/lib/utils'>; 88 | } 89 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/babel-preset-stage-2_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 3ebdc081e66800c1a33e3acb6581ff3c 2 | // flow-typed version: <>/babel-preset-stage-2_v^6.18.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-stage-2' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-stage-2' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-stage-2/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-stage-2/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-stage-2/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/eslint-config-standard-jsx_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 68331cab0e933e8a4092d45cad04cdea 2 | // flow-typed version: <>/eslint-config-standard-jsx_v^6.0.2/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-standard-jsx' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-standard-jsx' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'eslint-config-standard-jsx/index' { 29 | declare module.exports: $Exports<'eslint-config-standard-jsx'>; 30 | } 31 | declare module 'eslint-config-standard-jsx/index.js' { 32 | declare module.exports: $Exports<'eslint-config-standard-jsx'>; 33 | } 34 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/eslint-config-standard_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b7df2bd0c8381e6822c8dd629b61d47b 2 | // flow-typed version: <>/eslint-config-standard_v^12.0.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-standard' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-standard' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'eslint-config-standard/index' { 29 | declare module.exports: $Exports<'eslint-config-standard'>; 30 | } 31 | declare module 'eslint-config-standard/index.js' { 32 | declare module.exports: $Exports<'eslint-config-standard'>; 33 | } 34 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/eslint-plugin-standard_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 59893df9239e2d9724a90756a6525968 2 | // flow-typed version: <>/eslint-plugin-standard_v^4.0.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-standard' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-standard' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-standard/rules/array-bracket-even-spacing' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-standard/rules/computed-property-even-spacing' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-standard/rules/no-callback-literal' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-standard/rules/object-curly-even-spacing' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'eslint-plugin-standard/index' { 43 | declare module.exports: $Exports<'eslint-plugin-standard'>; 44 | } 45 | declare module 'eslint-plugin-standard/index.js' { 46 | declare module.exports: $Exports<'eslint-plugin-standard'>; 47 | } 48 | declare module 'eslint-plugin-standard/rules/array-bracket-even-spacing.js' { 49 | declare module.exports: $Exports<'eslint-plugin-standard/rules/array-bracket-even-spacing'>; 50 | } 51 | declare module 'eslint-plugin-standard/rules/computed-property-even-spacing.js' { 52 | declare module.exports: $Exports<'eslint-plugin-standard/rules/computed-property-even-spacing'>; 53 | } 54 | declare module 'eslint-plugin-standard/rules/no-callback-literal.js' { 55 | declare module.exports: $Exports<'eslint-plugin-standard/rules/no-callback-literal'>; 56 | } 57 | declare module 'eslint-plugin-standard/rules/object-curly-even-spacing.js' { 58 | declare module.exports: $Exports<'eslint-plugin-standard/rules/object-curly-even-spacing'>; 59 | } 60 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 2 | // flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/from-entries.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare module '@ungap/from-entries' { 4 | declare module.exports: any; 5 | } 6 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/husky_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 09dc7be6f5dfade9410350e5f356b1e6 2 | // flow-typed version: <>/husky_v^0.14.3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'husky' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'husky' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'husky/__tests__/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'husky/bin/install' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'husky/bin/uninstall' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'husky/src/install' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'husky/src/uninstall' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'husky/src/utils/find-hooks-dir' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'husky/src/utils/find-parent' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'husky/src/utils/get-hook-script' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'husky/src/utils/is-husky' { 58 | declare module.exports: any; 59 | } 60 | 61 | // Filename aliases 62 | declare module 'husky/__tests__/index.js' { 63 | declare module.exports: $Exports<'husky/__tests__/index'>; 64 | } 65 | declare module 'husky/bin/install.js' { 66 | declare module.exports: $Exports<'husky/bin/install'>; 67 | } 68 | declare module 'husky/bin/uninstall.js' { 69 | declare module.exports: $Exports<'husky/bin/uninstall'>; 70 | } 71 | declare module 'husky/src/install.js' { 72 | declare module.exports: $Exports<'husky/src/install'>; 73 | } 74 | declare module 'husky/src/uninstall.js' { 75 | declare module.exports: $Exports<'husky/src/uninstall'>; 76 | } 77 | declare module 'husky/src/utils/find-hooks-dir.js' { 78 | declare module.exports: $Exports<'husky/src/utils/find-hooks-dir'>; 79 | } 80 | declare module 'husky/src/utils/find-parent.js' { 81 | declare module.exports: $Exports<'husky/src/utils/find-parent'>; 82 | } 83 | declare module 'husky/src/utils/get-hook-script.js' { 84 | declare module.exports: $Exports<'husky/src/utils/get-hook-script'>; 85 | } 86 | declare module 'husky/src/utils/is-husky.js' { 87 | declare module.exports: $Exports<'husky/src/utils/is-husky'>; 88 | } 89 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/lint-staged_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1b9179cadf091d93c5142d3673b2e210 2 | // flow-typed version: <>/lint-staged_v^7.0.4/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'lint-staged' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'lint-staged' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'lint-staged/src/calcChunkSize' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'lint-staged/src/checkPkgScripts' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'lint-staged/src/findBin' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'lint-staged/src/generateTasks' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'lint-staged/src/getConfig' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'lint-staged/src/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'lint-staged/src/makeCmdTasks' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'lint-staged/src/printErrors' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'lint-staged/src/resolveGitDir' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'lint-staged/src/resolveTaskFn' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'lint-staged/src/runAll' { 66 | declare module.exports: any; 67 | } 68 | 69 | // Filename aliases 70 | declare module 'lint-staged/index' { 71 | declare module.exports: $Exports<'lint-staged'>; 72 | } 73 | declare module 'lint-staged/index.js' { 74 | declare module.exports: $Exports<'lint-staged'>; 75 | } 76 | declare module 'lint-staged/src/calcChunkSize.js' { 77 | declare module.exports: $Exports<'lint-staged/src/calcChunkSize'>; 78 | } 79 | declare module 'lint-staged/src/checkPkgScripts.js' { 80 | declare module.exports: $Exports<'lint-staged/src/checkPkgScripts'>; 81 | } 82 | declare module 'lint-staged/src/findBin.js' { 83 | declare module.exports: $Exports<'lint-staged/src/findBin'>; 84 | } 85 | declare module 'lint-staged/src/generateTasks.js' { 86 | declare module.exports: $Exports<'lint-staged/src/generateTasks'>; 87 | } 88 | declare module 'lint-staged/src/getConfig.js' { 89 | declare module.exports: $Exports<'lint-staged/src/getConfig'>; 90 | } 91 | declare module 'lint-staged/src/index.js' { 92 | declare module.exports: $Exports<'lint-staged/src/index'>; 93 | } 94 | declare module 'lint-staged/src/makeCmdTasks.js' { 95 | declare module.exports: $Exports<'lint-staged/src/makeCmdTasks'>; 96 | } 97 | declare module 'lint-staged/src/printErrors.js' { 98 | declare module.exports: $Exports<'lint-staged/src/printErrors'>; 99 | } 100 | declare module 'lint-staged/src/resolveGitDir.js' { 101 | declare module.exports: $Exports<'lint-staged/src/resolveGitDir'>; 102 | } 103 | declare module 'lint-staged/src/resolveTaskFn.js' { 104 | declare module.exports: $Exports<'lint-staged/src/resolveTaskFn'>; 105 | } 106 | declare module 'lint-staged/src/runAll.js' { 107 | declare module.exports: $Exports<'lint-staged/src/runAll'>; 108 | } 109 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/prettier_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 066c92e9ccb5f0711df8d73cbca837d6 2 | // flow-typed version: 9e32affdbd/prettier_v1.x.x/flow_>=v0.56.x 3 | 4 | declare module "prettier" { 5 | declare export type AST = Object; 6 | declare export type Doc = Object; 7 | declare export type FastPath = Object; 8 | 9 | declare export type PrettierParserName = 10 | | "babylon" 11 | | "flow" 12 | | "typescript" 13 | | "postcss" 14 | | "css" 15 | | "less" 16 | | "scss" 17 | | "json" 18 | | "graphql" 19 | | "markdown" 20 | | "vue"; 21 | 22 | declare export type PrettierParser = { 23 | [name: PrettierParserName]: (text: string, options?: Object) => AST 24 | }; 25 | 26 | declare export type CustomParser = ( 27 | text: string, 28 | parsers: PrettierParser, 29 | options: Options 30 | ) => AST; 31 | 32 | declare export type Options = {| 33 | printWidth?: number, 34 | tabWidth?: number, 35 | useTabs?: boolean, 36 | semi?: boolean, 37 | singleQuote?: boolean, 38 | trailingComma?: "none" | "es5" | "all", 39 | bracketSpacing?: boolean, 40 | jsxBracketSameLine?: boolean, 41 | arrowParens?: "avoid" | "always", 42 | rangeStart?: number, 43 | rangeEnd?: number, 44 | parser?: PrettierParserName | CustomParser, 45 | filepath?: string, 46 | requirePragma?: boolean, 47 | insertPragma?: boolean, 48 | proseWrap?: "always" | "never" | "preserve", 49 | plugins?: Array 50 | |}; 51 | 52 | declare export type Plugin = { 53 | languages: SupportLanguage, 54 | parsers: { [parserName: string]: Parser }, 55 | printers: { [astFormat: string]: Printer } 56 | }; 57 | 58 | declare export type Parser = { 59 | parse: ( 60 | text: string, 61 | parsers: { [parserName: string]: Parser }, 62 | options: Object 63 | ) => AST, 64 | astFormat: string 65 | }; 66 | 67 | declare export type Printer = { 68 | print: ( 69 | path: FastPath, 70 | options: Object, 71 | print: (path: FastPath) => Doc 72 | ) => Doc, 73 | embed: ( 74 | path: FastPath, 75 | print: (path: FastPath) => Doc, 76 | textToDoc: (text: string, options: Object) => Doc, 77 | options: Object 78 | ) => ?Doc 79 | }; 80 | 81 | declare export type CursorOptions = {| 82 | cursorOffset: number, 83 | printWidth?: $PropertyType, 84 | tabWidth?: $PropertyType, 85 | useTabs?: $PropertyType, 86 | semi?: $PropertyType, 87 | singleQuote?: $PropertyType, 88 | trailingComma?: $PropertyType, 89 | bracketSpacing?: $PropertyType, 90 | jsxBracketSameLine?: $PropertyType, 91 | arrowParens?: $PropertyType, 92 | parser?: $PropertyType, 93 | filepath?: $PropertyType, 94 | requirePragma?: $PropertyType, 95 | insertPragma?: $PropertyType, 96 | proseWrap?: $PropertyType, 97 | plugins?: $PropertyType 98 | |}; 99 | 100 | declare export type CursorResult = {| 101 | formatted: string, 102 | cursorOffset: number 103 | |}; 104 | 105 | declare export type ResolveConfigOptions = {| 106 | useCache?: boolean, 107 | config?: string, 108 | editorconfig?: boolean 109 | |}; 110 | 111 | declare export type SupportLanguage = { 112 | name: string, 113 | since: string, 114 | parsers: Array, 115 | group?: string, 116 | tmScope: string, 117 | aceMode: string, 118 | codemirrorMode: string, 119 | codemirrorMimeType: string, 120 | aliases?: Array, 121 | extensions: Array, 122 | filenames?: Array, 123 | linguistLanguageId: number, 124 | vscodeLanguageIds: Array 125 | }; 126 | 127 | declare export type SupportOption = {| 128 | since: string, 129 | type: "int" | "boolean" | "choice" | "path", 130 | deprecated?: string, 131 | redirect?: SupportOptionRedirect, 132 | description: string, 133 | oppositeDescription?: string, 134 | default: SupportOptionValue, 135 | range?: SupportOptionRange, 136 | choices?: SupportOptionChoice 137 | |}; 138 | 139 | declare export type SupportOptionRedirect = {| 140 | options: string, 141 | value: SupportOptionValue 142 | |}; 143 | 144 | declare export type SupportOptionRange = {| 145 | start: number, 146 | end: number, 147 | step: number 148 | |}; 149 | 150 | declare export type SupportOptionChoice = {| 151 | value: boolean | string, 152 | description?: string, 153 | since?: string, 154 | deprecated?: string, 155 | redirect?: SupportOptionValue 156 | |}; 157 | 158 | declare export type SupportOptionValue = number | boolean | string; 159 | 160 | declare export type SupportInfo = {| 161 | languages: Array, 162 | options: Array 163 | |}; 164 | 165 | declare export type Prettier = {| 166 | format: (source: string, options?: Options) => string, 167 | check: (source: string, options?: Options) => boolean, 168 | formatWithCursor: (source: string, options: CursorOptions) => CursorResult, 169 | resolveConfig: { 170 | (filePath: string, options?: ResolveConfigOptions): Promise, 171 | sync(filePath: string, options?: ResolveConfigOptions): ?Options 172 | }, 173 | clearConfigCache: () => void, 174 | getSupportInfo: (version?: string) => SupportInfo 175 | |}; 176 | 177 | declare export default Prettier; 178 | } 179 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/proxy-polyfill_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 85f3cee3ef579fc4277423833cd8f304 2 | // flow-typed version: <>/proxy-polyfill_v0.1.6/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'proxy-polyfill' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'proxy-polyfill' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'proxy-polyfill/proxy' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'proxy-polyfill/proxy.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'proxy-polyfill/suite' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module 'proxy-polyfill/proxy.js' { 39 | declare module.exports: $Exports<'proxy-polyfill/proxy'>; 40 | } 41 | declare module 'proxy-polyfill/proxy.min.js' { 42 | declare module.exports: $Exports<'proxy-polyfill/proxy.min'>; 43 | } 44 | declare module 'proxy-polyfill/suite.js' { 45 | declare module.exports: $Exports<'proxy-polyfill/suite'>; 46 | } 47 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/rollup-plugin-babel_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f394c50a048b5a7ebd278b90412df2ed 2 | // flow-typed version: <>/rollup-plugin-babel_v3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-babel' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-babel' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.cjs' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.es' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'rollup-plugin-babel/src/constants' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'rollup-plugin-babel/src/helperPlugin' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'rollup-plugin-babel/src/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'rollup-plugin-babel/src/preflightCheck' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'rollup-plugin-babel/src/utils' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.cjs.js' { 55 | declare module.exports: $Exports<'rollup-plugin-babel/dist/rollup-plugin-babel.cjs'>; 56 | } 57 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.es.js' { 58 | declare module.exports: $Exports<'rollup-plugin-babel/dist/rollup-plugin-babel.es'>; 59 | } 60 | declare module 'rollup-plugin-babel/src/constants.js' { 61 | declare module.exports: $Exports<'rollup-plugin-babel/src/constants'>; 62 | } 63 | declare module 'rollup-plugin-babel/src/helperPlugin.js' { 64 | declare module.exports: $Exports<'rollup-plugin-babel/src/helperPlugin'>; 65 | } 66 | declare module 'rollup-plugin-babel/src/index.js' { 67 | declare module.exports: $Exports<'rollup-plugin-babel/src/index'>; 68 | } 69 | declare module 'rollup-plugin-babel/src/preflightCheck.js' { 70 | declare module.exports: $Exports<'rollup-plugin-babel/src/preflightCheck'>; 71 | } 72 | declare module 'rollup-plugin-babel/src/utils.js' { 73 | declare module.exports: $Exports<'rollup-plugin-babel/src/utils'>; 74 | } 75 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/rollup-plugin-copy_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 0b11a12fd929a3a3afd136d42a652bd9 2 | // flow-typed version: <>/rollup-plugin-copy_v^1.1.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-copy' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-copy' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup-plugin-copy/dist/index.commonjs' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup-plugin-copy/dist/index.module' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'rollup-plugin-copy/dist/index.commonjs.js' { 35 | declare module.exports: $Exports<'rollup-plugin-copy/dist/index.commonjs'>; 36 | } 37 | declare module 'rollup-plugin-copy/dist/index.module.js' { 38 | declare module.exports: $Exports<'rollup-plugin-copy/dist/index.module'>; 39 | } 40 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/rollup-plugin-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 57ac4a4687dd0b10d420e17d2d30e534 2 | // flow-typed version: <>/rollup-plugin-eslint_v^5.1.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'rollup-plugin-eslint/index' { 29 | declare module.exports: $Exports<'rollup-plugin-eslint'>; 30 | } 31 | declare module 'rollup-plugin-eslint/index.js' { 32 | declare module.exports: $Exports<'rollup-plugin-eslint'>; 33 | } 34 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/rollup-plugin-flow_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 25586f0fba8b577d1a0f5bd6b4167dae 2 | // flow-typed version: <>/rollup-plugin-flow_v^1.1.1/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-flow' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-flow' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'rollup-plugin-flow/index' { 29 | declare module.exports: $Exports<'rollup-plugin-flow'>; 30 | } 31 | declare module 'rollup-plugin-flow/index.js' { 32 | declare module.exports: $Exports<'rollup-plugin-flow'>; 33 | } 34 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/rollup-plugin-includepaths_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: a36cd847454eb7e3f098cadbd0745e0a 2 | // flow-typed version: <>/rollup-plugin-includepaths_v^0.2.3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-includepaths' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-includepaths' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup-plugin-includepaths/src/plugin.es5' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup-plugin-includepaths/src/plugin' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'rollup-plugin-includepaths/src/plugin.es5.js' { 35 | declare module.exports: $Exports<'rollup-plugin-includepaths/src/plugin.es5'>; 36 | } 37 | declare module 'rollup-plugin-includepaths/src/plugin.js' { 38 | declare module.exports: $Exports<'rollup-plugin-includepaths/src/plugin'>; 39 | } 40 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/rollup_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: e8ee84a58128c679bea1b5976f7f00cf 2 | // flow-typed version: <>/rollup_v^1.8.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup/dist/rollup.browser.es' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup/dist/rollup.browser' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'rollup/dist/rollup.es' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'rollup/dist/rollup' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'rollup/dist/rollup.browser.es.js' { 43 | declare module.exports: $Exports<'rollup/dist/rollup.browser.es'>; 44 | } 45 | declare module 'rollup/dist/rollup.browser.js' { 46 | declare module.exports: $Exports<'rollup/dist/rollup.browser'>; 47 | } 48 | declare module 'rollup/dist/rollup.es.js' { 49 | declare module.exports: $Exports<'rollup/dist/rollup.es'>; 50 | } 51 | declare module 'rollup/dist/rollup.js' { 52 | declare module.exports: $Exports<'rollup/dist/rollup'>; 53 | } 54 | -------------------------------------------------------------------------------- /dist/flow-typed/npm/uuid.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare module 'uuid' { 4 | declare module.exports: any; 5 | } 6 | -------------------------------------------------------------------------------- /dist/flow-typed/reselect.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | // We should be using the `reselect` that comes with flow-typed but it's going to take a ton of work to get that working 3 | // without any errors. For now it's any type 4 | declare module 'reselect' { 5 | declare module.exports: any; 6 | } 7 | -------------------------------------------------------------------------------- /flow-typed/Blocklist.js: -------------------------------------------------------------------------------- 1 | declare type BlocklistState = { 2 | blockedChannels: Array 3 | }; 4 | 5 | declare type BlocklistAction = { 6 | type: string, 7 | data: { 8 | uri: string, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /flow-typed/Claim.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare type Claim = StreamClaim | ChannelClaim | CollectionClaim; 4 | 5 | declare type ChannelClaim = GenericClaim & { 6 | value: ChannelMetadata, 7 | }; 8 | 9 | declare type CollectionClaim = GenericClaim & { 10 | value: CollectionMetadata, 11 | }; 12 | 13 | declare type StreamClaim = GenericClaim & { 14 | value: StreamMetadata, 15 | }; 16 | 17 | declare type GenericClaim = { 18 | address: string, // address associated with tx 19 | amount: string, // bid amount at time of tx 20 | canonical_url: string, // URL with short id, includes channel with short id 21 | claim_id: string, // unique claim identifier 22 | claim_sequence: number, // not being used currently 23 | claim_op: 'create' | 'update', 24 | confirmations: number, 25 | decoded_claim: boolean, // Not available currently https://github.com/lbryio/lbry/issues/2044 26 | timestamp?: number, // date of last transaction 27 | height: number, // block height the tx was confirmed 28 | is_channel_signature_valid?: boolean, 29 | is_my_output: boolean, 30 | name: string, 31 | normalized_name: string, // `name` normalized via unicode NFD spec, 32 | nout: number, // index number for an output of a tx 33 | permanent_url: string, // name + claim_id 34 | short_url: string, // permanent_url with short id, no channel 35 | txid: string, // unique tx id 36 | type: 'claim' | 'update' | 'support', 37 | value_type: 'stream' | 'channel' | 'collection', 38 | signing_channel?: ChannelClaim, 39 | reposted_claim?: GenericClaim, 40 | repost_channel_url?: string, 41 | repost_url?: string, 42 | repost_bid_amount?: string, 43 | purchase_receipt?: PurchaseReceipt, 44 | meta: { 45 | activation_height: number, 46 | claims_in_channel?: number, 47 | creation_height: number, 48 | creation_timestamp: number, 49 | effective_amount: string, 50 | expiration_height: number, 51 | is_controlling: boolean, 52 | support_amount: string, 53 | reposted: number, 54 | trending_global: number, 55 | trending_group: number, 56 | trending_local: number, 57 | trending_mixed: number, 58 | }, 59 | }; 60 | 61 | declare type GenericMetadata = { 62 | title?: string, 63 | description?: string, 64 | thumbnail?: { 65 | url?: string, 66 | }, 67 | languages?: Array, 68 | tags?: Array, 69 | locations?: Array, 70 | }; 71 | 72 | declare type ChannelMetadata = GenericMetadata & { 73 | public_key: string, 74 | public_key_id: string, 75 | cover_url?: string, 76 | email?: string, 77 | website_url?: string, 78 | featured?: Array, 79 | }; 80 | 81 | declare type CollectionMetadata = GenericMetadata & { 82 | claims: Array, 83 | } 84 | 85 | declare type StreamMetadata = GenericMetadata & { 86 | license?: string, // License "title" ex: Creative Commons, Custom copyright 87 | license_url?: string, // Link to full license 88 | release_time?: number, // linux timestamp 89 | author?: string, 90 | 91 | source: { 92 | sd_hash: string, 93 | media_type?: string, 94 | hash?: string, 95 | name?: string, // file name 96 | size?: number, // size of file in bytes 97 | }, 98 | 99 | // Only exists if a stream has a fee 100 | fee?: Fee, 101 | 102 | stream_type: 'video' | 'audio' | 'image' | 'software', 103 | // Below correspond to `stream_type` 104 | video?: { 105 | duration: number, 106 | height: number, 107 | width: number, 108 | }, 109 | audio?: { 110 | duration: number, 111 | }, 112 | image?: { 113 | height: number, 114 | width: number, 115 | }, 116 | software?: { 117 | os: string, 118 | }, 119 | }; 120 | 121 | declare type Location = { 122 | latitude?: number, 123 | longitude?: number, 124 | country?: string, 125 | state?: string, 126 | city?: string, 127 | code?: string, 128 | }; 129 | 130 | declare type Fee = { 131 | amount: string, 132 | currency: string, 133 | address: string, 134 | }; 135 | 136 | declare type PurchaseReceipt = { 137 | address: string, 138 | amount: string, 139 | claim_id: string, 140 | confirmations: number, 141 | height: number, 142 | nout: number, 143 | timestamp: number, 144 | txid: string, 145 | type: 'purchase', 146 | }; 147 | 148 | declare type ClaimActionResolveInfo = { 149 | [string]: { 150 | stream: ?StreamClaim, 151 | channel: ?ChannelClaim, 152 | claimsInChannel: ?number, 153 | collection: ?CollectionClaim, 154 | }, 155 | } 156 | 157 | declare type ChannelUpdateParams = { 158 | claim_id: string, 159 | bid?: string, 160 | title?: string, 161 | cover_url?: string, 162 | thumbnail_url?: string, 163 | description?: string, 164 | website_url?: string, 165 | email?: string, 166 | tags?: Array, 167 | replace?: boolean, 168 | languages?: Array, 169 | locations?: Array, 170 | blocking?: boolean, 171 | } 172 | 173 | declare type ChannelPublishParams = { 174 | name: string, 175 | bid: string, 176 | blocking?: true, 177 | title?: string, 178 | cover_url?: string, 179 | thumbnail_url?: string, 180 | description?: string, 181 | website_url?: string, 182 | email?: string, 183 | tags?: Array, 184 | languages?: Array, 185 | } 186 | 187 | declare type CollectionUpdateParams = { 188 | claim_id: string, 189 | claim_ids?: Array, 190 | bid?: string, 191 | title?: string, 192 | cover_url?: string, 193 | thumbnail_url?: string, 194 | description?: string, 195 | website_url?: string, 196 | email?: string, 197 | tags?: Array, 198 | replace?: boolean, 199 | languages?: Array, 200 | locations?: Array, 201 | blocking?: boolean, 202 | } 203 | 204 | declare type CollectionPublishParams = { 205 | name: string, 206 | bid: string, 207 | claim_ids: Array, 208 | blocking?: true, 209 | title?: string, 210 | thumbnail_url?: string, 211 | description?: string, 212 | tags?: Array, 213 | languages?: Array, 214 | } 215 | -------------------------------------------------------------------------------- /flow-typed/CoinSwap.js: -------------------------------------------------------------------------------- 1 | declare type CoinSwapInfo = { 2 | chargeCode: string, 3 | coins: Array, 4 | sendAddresses: { [string]: string}, 5 | sendAmounts: { [string]: any }, 6 | lbcAmount: number, 7 | status?: { 8 | status: string, 9 | receiptCurrency: string, 10 | receiptTxid: string, 11 | lbcTxid: string, 12 | }, 13 | } 14 | 15 | declare type CoinSwapState = { 16 | coinSwaps: Array, 17 | }; 18 | 19 | declare type CoinSwapAddAction = { 20 | type: string, 21 | data: CoinSwapInfo, 22 | }; 23 | 24 | declare type CoinSwapRemoveAction = { 25 | type: string, 26 | data: { 27 | chargeCode: string, 28 | }, 29 | }; 30 | -------------------------------------------------------------------------------- /flow-typed/Collections.js: -------------------------------------------------------------------------------- 1 | declare type Collection = { 2 | id: string, 3 | items: Array, 4 | name: string, 5 | type: string, 6 | updatedAt: number, 7 | totalItems?: number, 8 | sourceId?: string, // if copied, claimId of original collection 9 | }; 10 | 11 | declare type CollectionState = { 12 | unpublished: CollectionGroup, 13 | resolved: CollectionGroup, 14 | pending: CollectionGroup, 15 | edited: CollectionGroup, 16 | builtin: CollectionGroup, 17 | saved: Array, 18 | isResolvingCollectionById: { [string]: boolean }, 19 | error?: string | null, 20 | }; 21 | 22 | declare type CollectionGroup = { 23 | [string]: Collection, 24 | } 25 | 26 | declare type CollectionEditParams = { 27 | claims?: Array, 28 | remove?: boolean, 29 | claimIds?: Array, 30 | replace?: boolean, 31 | order?: { from: number, to: number }, 32 | type?: string, 33 | name?: string, 34 | } 35 | -------------------------------------------------------------------------------- /flow-typed/File.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare type FileListItem = { 4 | metadata: StreamMetadata, 5 | added_on: number, 6 | blobs_completed: number, 7 | blobs_in_stream: number, 8 | blobs_remaining: number, 9 | channel_claim_id: string, 10 | channel_name: string, 11 | claim_id: string, 12 | claim_name: string, 13 | completed: false, 14 | content_fee?: { txid: string }, 15 | purchase_receipt?: { txid: string, amount: string }, 16 | download_directory: string, 17 | download_path: string, 18 | file_name: string, 19 | key: string, 20 | mime_type: string, 21 | nout: number, 22 | outpoint: string, 23 | points_paid: number, 24 | protobuf: string, 25 | reflector_progress: number, 26 | sd_hash: string, 27 | status: string, 28 | stopped: false, 29 | stream_hash: string, 30 | stream_name: string, 31 | streaming_url: string, 32 | suggested_file_name: string, 33 | total_bytes: number, 34 | total_bytes_lower_bound: number, 35 | is_fully_reflected: boolean, 36 | // TODO: sdk plans to change `tx` 37 | // It isn't currently used by the apps 38 | tx: {}, 39 | txid: string, 40 | uploading_to_reflector: boolean, 41 | written_bytes: number, 42 | }; 43 | 44 | declare type FileState = { 45 | failedPurchaseUris: Array, 46 | purchasedUris: Array, 47 | }; 48 | 49 | declare type PurchaseUriCompleted = { 50 | type: ACTIONS.PURCHASE_URI_COMPLETED, 51 | data: { 52 | uri: string, 53 | streamingUrl: string, 54 | }, 55 | }; 56 | 57 | declare type PurchaseUriFailed = { 58 | type: ACTIONS.PURCHASE_URI_FAILED, 59 | data: { 60 | uri: string, 61 | error: any, 62 | }, 63 | }; 64 | 65 | declare type PurchaseUriStarted = { 66 | type: ACTIONS.PURCHASE_URI_STARTED, 67 | data: { 68 | uri: string, 69 | streamingUrl: string, 70 | }, 71 | }; 72 | 73 | declare type DeletePurchasedUri = { 74 | type: ACTIONS.CLEAR_PURCHASED_URI_SUCCESS, 75 | data: { 76 | uri: string, 77 | }, 78 | }; 79 | -------------------------------------------------------------------------------- /flow-typed/LbryFirst.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare type LbryFirstStatusResponse = { 3 | Version: string, 4 | Message: string, 5 | Running: boolean, 6 | Commit: string, 7 | }; 8 | 9 | declare type LbryFirstVersionResponse = { 10 | build: string, 11 | lbrynet_version: string, 12 | os_release: string, 13 | os_system: string, 14 | platform: string, 15 | processor: string, 16 | python_version: string, 17 | }; 18 | /* SAMPLE UPLOAD RESPONSE (FULL) 19 | "Video": { 20 | "etag": "\"Dn5xIderbhAnUk5TAW0qkFFir0M/xlGLrlTox7VFTRcR8F77RbKtaU4\"", 21 | "id": "8InjtdvVmwE", 22 | "kind": "youtube#video", 23 | "snippet": { 24 | "categoryId": "22", 25 | "channelId": "UCXiVsGTU88fJjheB2rqF0rA", 26 | "channelTitle": "Mark Beamer", 27 | "liveBroadcastContent": "none", 28 | "localized": { 29 | "title": "my title" 30 | }, 31 | "publishedAt": "2020-05-05T04:17:53.000Z", 32 | "thumbnails": { 33 | "default": { 34 | "height": 90, 35 | "url": "https://i9.ytimg.com/vi/8InjtdvVmwE/default.jpg?sqp=CMTQw_UF&rs=AOn4CLB6dlhZMSMrazDlWRsitPgCsn8fVw", 36 | "width": 120 37 | }, 38 | "high": { 39 | "height": 360, 40 | "url": "https://i9.ytimg.com/vi/8InjtdvVmwE/hqdefault.jpg?sqp=CMTQw_UF&rs=AOn4CLB-Je_7l6qvASRAR_bSGWZHaXaJWQ", 41 | "width": 480 42 | }, 43 | "medium": { 44 | "height": 180, 45 | "url": "https://i9.ytimg.com/vi/8InjtdvVmwE/mqdefault.jpg?sqp=CMTQw_UF&rs=AOn4CLCvSnDLqVznRNMKuvJ_0misY_chPQ", 46 | "width": 320 47 | } 48 | }, 49 | "title": "my title" 50 | }, 51 | "status": { 52 | "embeddable": true, 53 | "license": "youtube", 54 | "privacyStatus": "private", 55 | "publicStatsViewable": true, 56 | "uploadStatus": "uploaded" 57 | } 58 | } 59 | */ 60 | declare type UploadResponse = { 61 | Video: { 62 | id: string, 63 | snippet: { 64 | channelId: string, 65 | }, 66 | status: { 67 | uploadStatus: string, 68 | }, 69 | }, 70 | }; 71 | 72 | declare type HasYTAuthResponse = { 73 | HashAuth: boolean, 74 | }; 75 | 76 | declare type YTSignupResponse = {}; 77 | 78 | // 79 | // Types used in the generic LbryFirst object that is exported 80 | // 81 | declare type LbryFirstTypes = { 82 | isConnected: boolean, 83 | connectPromise: ?Promise, 84 | connect: () => void, 85 | lbryFirstConnectionString: string, 86 | apiRequestHeaders: { [key: string]: string }, 87 | setApiHeader: (string, string) => void, 88 | unsetApiHeader: string => void, 89 | overrides: { [string]: ?Function }, 90 | setOverride: (string, Function) => void, 91 | 92 | // LbryFirst Methods 93 | stop: () => Promise, 94 | status: () => Promise, 95 | version: () => Promise, 96 | upload: any => Promise, 97 | hasYTAuth: string => Promise, 98 | ytSignup: () => Promise, 99 | }; 100 | -------------------------------------------------------------------------------- /flow-typed/Notification.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | 4 | /* 5 | Toasts: 6 | - First-in, first-out queue 7 | - Simple messages that are shown in response to user interactions 8 | - Never saved 9 | - If they are the result of errors, use the isError flag when creating 10 | - For errors that should interrupt user behavior, use Error 11 | */ 12 | declare type ToastParams = { 13 | message: string, 14 | title?: string, 15 | linkText?: string, 16 | linkTarget?: string, 17 | isError?: boolean, 18 | }; 19 | 20 | declare type Toast = { 21 | id: string, 22 | params: ToastParams, 23 | }; 24 | 25 | declare type DoToast = { 26 | type: ACTIONS.CREATE_TOAST, 27 | data: Toast, 28 | }; 29 | 30 | /* 31 | Notifications: 32 | - List of notifications based on user interactions/app notifications 33 | - Always saved, but can be manually deleted 34 | - Can happen in the background, or because of user interaction (ex: publish confirmed) 35 | */ 36 | declare type Notification = { 37 | id: string, // Unique id 38 | dateCreated: number, 39 | isRead: boolean, // Used to display "new" notifications that a user hasn't seen yet 40 | source?: string, // The type/area an notification is from. Used for sorting (ex: publishes, transactions) 41 | // We may want to use priority/isDismissed in the future to specify how urgent a notification is 42 | // and if the user should see it immediately 43 | // isDissmied: boolean, 44 | // priority?: number 45 | }; 46 | 47 | declare type DoNotification = { 48 | type: ACTIONS.CREATE_NOTIFICATION, 49 | data: Notification, 50 | }; 51 | 52 | declare type DoEditNotification = { 53 | type: ACTIONS.EDIT_NOTIFICATION, 54 | data: { 55 | notification: Notification, 56 | }, 57 | }; 58 | 59 | declare type DoDeleteNotification = { 60 | type: ACTIONS.DELETE_NOTIFICATION, 61 | data: { 62 | id: string, // The id to delete 63 | }, 64 | }; 65 | 66 | /* 67 | Errors: 68 | - First-in, first-out queue 69 | - Errors that should interupt user behavior 70 | - For errors that can be shown without interrupting a user, use Toast with the isError flag 71 | */ 72 | declare type ErrorNotification = { 73 | title: string, 74 | text: string, 75 | }; 76 | 77 | declare type DoError = { 78 | type: ACTIONS.CREATE_ERROR, 79 | data: ErrorNotification, 80 | }; 81 | 82 | declare type DoDismissError = { 83 | type: ACTIONS.DISMISS_ERROR, 84 | }; 85 | 86 | /* 87 | NotificationState 88 | */ 89 | declare type NotificationState = { 90 | notifications: Array, 91 | errors: Array, 92 | toasts: Array, 93 | }; 94 | -------------------------------------------------------------------------------- /flow-typed/Publish.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare type UpdatePublishFormData = { 4 | filePath?: string, 5 | contentIsFree?: boolean, 6 | fee?: { 7 | amount: string, 8 | currency: string, 9 | }, 10 | title?: string, 11 | thumbnail_url?: string, 12 | uploadThumbnailStatus?: string, 13 | thumbnailPath?: string, 14 | description?: string, 15 | language?: string, 16 | channel?: string, 17 | channelId?: string, 18 | name?: string, 19 | nameError?: string, 20 | bid?: string, 21 | bidError?: string, 22 | otherLicenseDescription?: string, 23 | licenseUrl?: string, 24 | licenseType?: string, 25 | uri?: string, 26 | nsfw: boolean, 27 | }; 28 | -------------------------------------------------------------------------------- /flow-typed/Redux.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | /* eslint-disable no-use-before-define */ 3 | declare type GetState = () => any; 4 | declare type ThunkAction = (dispatch: Dispatch, getState: GetState) => any; 5 | declare type Dispatch = (action: {} | Promise<*> | Array<{}> | ThunkAction) => any; // Need to refer to ThunkAction 6 | /* eslint-enable */ 7 | -------------------------------------------------------------------------------- /flow-typed/Reflector.js: -------------------------------------------------------------------------------- 1 | declare type ReflectingUpdate = { 2 | fileListItem: FileListItem, 3 | progress: number | boolean, 4 | stalled: boolean, 5 | }; 6 | -------------------------------------------------------------------------------- /flow-typed/Tags.js: -------------------------------------------------------------------------------- 1 | declare type TagState = { 2 | followedTags: FollowedTags, 3 | knownTags: KnownTags, 4 | }; 5 | 6 | declare type Tag = { 7 | name: string, 8 | }; 9 | 10 | declare type KnownTags = { 11 | [string]: Tag, 12 | }; 13 | 14 | declare type FollowedTags = Array; 15 | 16 | declare type TagAction = { 17 | type: string, 18 | data: { 19 | name: string, 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /flow-typed/Transaction.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare type Transaction = { 3 | amount: number, 4 | claim_id: string, 5 | claim_name: string, 6 | fee: number, 7 | nout: number, 8 | txid: string, 9 | type: string, 10 | date: Date, 11 | }; 12 | 13 | declare type Support = { 14 | address: string, 15 | amount: string, 16 | claim_id: string, 17 | confirmations: number, 18 | height: string, 19 | is_change: string, 20 | is_mine: string, 21 | name: string, 22 | normalized_name: string, 23 | nout: string, 24 | permanent_url: string, 25 | timestamp: number, 26 | txid: string, 27 | type: string, 28 | }; 29 | -------------------------------------------------------------------------------- /flow-typed/Txo.js: -------------------------------------------------------------------------------- 1 | declare type Txo = { 2 | amount: number, 3 | claim_id: string, 4 | normalized_name: string, 5 | nout: number, 6 | txid: string, 7 | type: string, 8 | value_type: string, 9 | timestamp: number, 10 | is_my_output: boolean, 11 | is_my_input: boolean, 12 | is_spent: boolean, 13 | signing_channel?: { 14 | channel_id: string, 15 | }, 16 | }; 17 | 18 | declare type TxoListParams = { 19 | page: number, 20 | page_size: number, 21 | type: string, 22 | is_my_input?: boolean, 23 | is_my_output?: boolean, 24 | is_not_my_input?: boolean, 25 | is_not_my_output?: boolean, 26 | is_spent?: boolean, 27 | }; 28 | -------------------------------------------------------------------------------- /flow-typed/i18n.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare function __(a: string, b?: {}): string; 3 | -------------------------------------------------------------------------------- /flow-typed/lbryURI.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare type LbryUrlObj = { 3 | // Path and channel will always exist when calling parseURI 4 | // But they may not exist when code calls buildURI 5 | isChannel?: boolean, 6 | path?: string, 7 | streamName?: string, 8 | streamClaimId?: string, 9 | channelName?: string, 10 | channelClaimId?: string, 11 | primaryClaimSequence?: number, 12 | secondaryClaimSequence?: number, 13 | primaryBidPosition?: number, 14 | secondaryBidPosition?: number, 15 | startTime?: number, 16 | 17 | // Below are considered deprecated and should not be used due to unreliableness with claim.canonical_url 18 | claimName?: string, 19 | claimId?: string, 20 | contentName?: string, 21 | }; 22 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: bc167658b3892d915f873ecc31946cba 2 | // flow-typed version: <>/babel-eslint_v^8.0.3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-eslint/lib/analyze-scope' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-eslint/lib/babylon-to-espree/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-eslint/lib/babylon-to-espree/toAST' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-eslint/lib/babylon-to-espree/toToken' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-eslint/lib/index' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'babel-eslint/lib/parse-with-patch' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'babel-eslint/lib/parse-with-scope' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'babel-eslint/lib/parse' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'babel-eslint/lib/patch-eslint-scope' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'babel-eslint/lib/visitor-keys' { 78 | declare module.exports: any; 79 | } 80 | 81 | // Filename aliases 82 | declare module 'babel-eslint/lib/analyze-scope.js' { 83 | declare module.exports: $Exports<'babel-eslint/lib/analyze-scope'>; 84 | } 85 | declare module 'babel-eslint/lib/babylon-to-espree/attachComments.js' { 86 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/attachComments'>; 87 | } 88 | declare module 'babel-eslint/lib/babylon-to-espree/convertComments.js' { 89 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertComments'>; 90 | } 91 | declare module 'babel-eslint/lib/babylon-to-espree/convertTemplateType.js' { 92 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/convertTemplateType'>; 93 | } 94 | declare module 'babel-eslint/lib/babylon-to-espree/index.js' { 95 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/index'>; 96 | } 97 | declare module 'babel-eslint/lib/babylon-to-espree/toAST.js' { 98 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toAST'>; 99 | } 100 | declare module 'babel-eslint/lib/babylon-to-espree/toToken.js' { 101 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toToken'>; 102 | } 103 | declare module 'babel-eslint/lib/babylon-to-espree/toTokens.js' { 104 | declare module.exports: $Exports<'babel-eslint/lib/babylon-to-espree/toTokens'>; 105 | } 106 | declare module 'babel-eslint/lib/index.js' { 107 | declare module.exports: $Exports<'babel-eslint/lib/index'>; 108 | } 109 | declare module 'babel-eslint/lib/parse-with-patch.js' { 110 | declare module.exports: $Exports<'babel-eslint/lib/parse-with-patch'>; 111 | } 112 | declare module 'babel-eslint/lib/parse-with-scope.js' { 113 | declare module.exports: $Exports<'babel-eslint/lib/parse-with-scope'>; 114 | } 115 | declare module 'babel-eslint/lib/parse.js' { 116 | declare module.exports: $Exports<'babel-eslint/lib/parse'>; 117 | } 118 | declare module 'babel-eslint/lib/patch-eslint-scope.js' { 119 | declare module.exports: $Exports<'babel-eslint/lib/patch-eslint-scope'>; 120 | } 121 | declare module 'babel-eslint/lib/visitor-keys.js' { 122 | declare module.exports: $Exports<'babel-eslint/lib/visitor-keys'>; 123 | } 124 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-loader_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ac35c8b7c7b43815c9bfe7048b1f036b 2 | // flow-typed version: <>/babel-loader_v^7.1.4/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-loader' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-loader' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-loader/lib/fs-cache' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-loader/lib/index' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-loader/lib/resolve-rc' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-loader/lib/utils/exists' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-loader/lib/utils/read' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-loader/lib/utils/relative' { 46 | declare module.exports: any; 47 | } 48 | 49 | // Filename aliases 50 | declare module 'babel-loader/lib/fs-cache.js' { 51 | declare module.exports: $Exports<'babel-loader/lib/fs-cache'>; 52 | } 53 | declare module 'babel-loader/lib/index.js' { 54 | declare module.exports: $Exports<'babel-loader/lib/index'>; 55 | } 56 | declare module 'babel-loader/lib/resolve-rc.js' { 57 | declare module.exports: $Exports<'babel-loader/lib/resolve-rc'>; 58 | } 59 | declare module 'babel-loader/lib/utils/exists.js' { 60 | declare module.exports: $Exports<'babel-loader/lib/utils/exists'>; 61 | } 62 | declare module 'babel-loader/lib/utils/read.js' { 63 | declare module.exports: $Exports<'babel-loader/lib/utils/read'>; 64 | } 65 | declare module 'babel-loader/lib/utils/relative.js' { 66 | declare module.exports: $Exports<'babel-loader/lib/utils/relative'>; 67 | } 68 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-plugin-module-resolver_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: ef8e8ad61abd95bef9ea072c0bdb3d98 2 | // flow-typed version: <>/babel-plugin-module-resolver_v^3.0.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-plugin-module-resolver' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-plugin-module-resolver' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-plugin-module-resolver/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-plugin-module-resolver/lib/log' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-plugin-module-resolver/lib/mapToRelative' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-plugin-module-resolver/lib/normalizeOptions' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-plugin-module-resolver/lib/resolvePath' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-plugin-module-resolver/lib/transformers/call' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-plugin-module-resolver/lib/transformers/import' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-plugin-module-resolver/lib/utils' { 54 | declare module.exports: any; 55 | } 56 | 57 | // Filename aliases 58 | declare module 'babel-plugin-module-resolver/lib/index.js' { 59 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/index'>; 60 | } 61 | declare module 'babel-plugin-module-resolver/lib/log.js' { 62 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/log'>; 63 | } 64 | declare module 'babel-plugin-module-resolver/lib/mapToRelative.js' { 65 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/mapToRelative'>; 66 | } 67 | declare module 'babel-plugin-module-resolver/lib/normalizeOptions.js' { 68 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/normalizeOptions'>; 69 | } 70 | declare module 'babel-plugin-module-resolver/lib/resolvePath.js' { 71 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/resolvePath'>; 72 | } 73 | declare module 'babel-plugin-module-resolver/lib/transformers/call.js' { 74 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/transformers/call'>; 75 | } 76 | declare module 'babel-plugin-module-resolver/lib/transformers/import.js' { 77 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/transformers/import'>; 78 | } 79 | declare module 'babel-plugin-module-resolver/lib/utils.js' { 80 | declare module.exports: $Exports<'babel-plugin-module-resolver/lib/utils'>; 81 | } 82 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-plugin-transform-flow-comments_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: acec4d6ed4d2870478d3cbe333f79115 2 | // flow-typed version: <>/babel-plugin-transform-flow-comments_v^6.17.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-plugin-transform-flow-comments' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-plugin-transform-flow-comments' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-plugin-transform-flow-comments/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-plugin-transform-flow-comments/lib/index.js' { 31 | declare module.exports: $Exports<'babel-plugin-transform-flow-comments/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-env_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1a890b0eb44450a184610ef421a6c13a 2 | // flow-typed version: <>/babel-preset-env_v^1.6.1/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-env' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-env' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-env/data/built-in-features' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'babel-preset-env/data/plugin-features' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'babel-preset-env/lib/default-includes' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'babel-preset-env/lib/index' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'babel-preset-env/lib/module-transformations' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'babel-preset-env/lib/normalize-options' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'babel-preset-env/lib/targets-parser' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'babel-preset-env/lib/transform-polyfill-require-plugin' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'babel-preset-env/lib/utils' { 58 | declare module.exports: any; 59 | } 60 | 61 | // Filename aliases 62 | declare module 'babel-preset-env/data/built-in-features.js' { 63 | declare module.exports: $Exports<'babel-preset-env/data/built-in-features'>; 64 | } 65 | declare module 'babel-preset-env/data/plugin-features.js' { 66 | declare module.exports: $Exports<'babel-preset-env/data/plugin-features'>; 67 | } 68 | declare module 'babel-preset-env/lib/default-includes.js' { 69 | declare module.exports: $Exports<'babel-preset-env/lib/default-includes'>; 70 | } 71 | declare module 'babel-preset-env/lib/index.js' { 72 | declare module.exports: $Exports<'babel-preset-env/lib/index'>; 73 | } 74 | declare module 'babel-preset-env/lib/module-transformations.js' { 75 | declare module.exports: $Exports<'babel-preset-env/lib/module-transformations'>; 76 | } 77 | declare module 'babel-preset-env/lib/normalize-options.js' { 78 | declare module.exports: $Exports<'babel-preset-env/lib/normalize-options'>; 79 | } 80 | declare module 'babel-preset-env/lib/targets-parser.js' { 81 | declare module.exports: $Exports<'babel-preset-env/lib/targets-parser'>; 82 | } 83 | declare module 'babel-preset-env/lib/transform-polyfill-require-plugin.js' { 84 | declare module.exports: $Exports<'babel-preset-env/lib/transform-polyfill-require-plugin'>; 85 | } 86 | declare module 'babel-preset-env/lib/utils.js' { 87 | declare module.exports: $Exports<'babel-preset-env/lib/utils'>; 88 | } 89 | -------------------------------------------------------------------------------- /flow-typed/npm/babel-preset-stage-2_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 3ebdc081e66800c1a33e3acb6581ff3c 2 | // flow-typed version: <>/babel-preset-stage-2_v^6.18.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'babel-preset-stage-2' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'babel-preset-stage-2' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'babel-preset-stage-2/lib/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | // Filename aliases 30 | declare module 'babel-preset-stage-2/lib/index.js' { 31 | declare module.exports: $Exports<'babel-preset-stage-2/lib/index'>; 32 | } 33 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-config-standard-jsx_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 68331cab0e933e8a4092d45cad04cdea 2 | // flow-typed version: <>/eslint-config-standard-jsx_v^6.0.2/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-standard-jsx' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-standard-jsx' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'eslint-config-standard-jsx/index' { 29 | declare module.exports: $Exports<'eslint-config-standard-jsx'>; 30 | } 31 | declare module 'eslint-config-standard-jsx/index.js' { 32 | declare module.exports: $Exports<'eslint-config-standard-jsx'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-config-standard_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b7df2bd0c8381e6822c8dd629b61d47b 2 | // flow-typed version: <>/eslint-config-standard_v^12.0.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-config-standard' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-config-standard' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'eslint-config-standard/index' { 29 | declare module.exports: $Exports<'eslint-config-standard'>; 30 | } 31 | declare module 'eslint-config-standard/index.js' { 32 | declare module.exports: $Exports<'eslint-config-standard'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/eslint-plugin-standard_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 59893df9239e2d9724a90756a6525968 2 | // flow-typed version: <>/eslint-plugin-standard_v^4.0.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'eslint-plugin-standard' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'eslint-plugin-standard' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'eslint-plugin-standard/rules/array-bracket-even-spacing' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'eslint-plugin-standard/rules/computed-property-even-spacing' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'eslint-plugin-standard/rules/no-callback-literal' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'eslint-plugin-standard/rules/object-curly-even-spacing' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'eslint-plugin-standard/index' { 43 | declare module.exports: $Exports<'eslint-plugin-standard'>; 44 | } 45 | declare module 'eslint-plugin-standard/index.js' { 46 | declare module.exports: $Exports<'eslint-plugin-standard'>; 47 | } 48 | declare module 'eslint-plugin-standard/rules/array-bracket-even-spacing.js' { 49 | declare module.exports: $Exports<'eslint-plugin-standard/rules/array-bracket-even-spacing'>; 50 | } 51 | declare module 'eslint-plugin-standard/rules/computed-property-even-spacing.js' { 52 | declare module.exports: $Exports<'eslint-plugin-standard/rules/computed-property-even-spacing'>; 53 | } 54 | declare module 'eslint-plugin-standard/rules/no-callback-literal.js' { 55 | declare module.exports: $Exports<'eslint-plugin-standard/rules/no-callback-literal'>; 56 | } 57 | declare module 'eslint-plugin-standard/rules/object-curly-even-spacing.js' { 58 | declare module.exports: $Exports<'eslint-plugin-standard/rules/object-curly-even-spacing'>; 59 | } 60 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-bin_v0.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583 2 | // flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x 3 | 4 | declare module "flow-bin" { 5 | declare module.exports: string; 6 | } 7 | -------------------------------------------------------------------------------- /flow-typed/npm/flow-typed_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: b46df6a09b982fc599f51cedf4d8ef6b 2 | // flow-typed version: <>/flow-typed_v^2.5.1/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'flow-typed' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'flow-typed' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'flow-typed/dist/cli' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'flow-typed/dist/commands/create-stub' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'flow-typed/dist/commands/install' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'flow-typed/dist/commands/runTests' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'flow-typed/dist/commands/search' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'flow-typed/dist/commands/update-cache' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'flow-typed/dist/commands/update' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'flow-typed/dist/commands/validateDefs' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'flow-typed/dist/commands/version' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'flow-typed/dist/lib/cacheRepoUtils' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'flow-typed/dist/lib/codeSign' { 66 | declare module.exports: any; 67 | } 68 | 69 | declare module 'flow-typed/dist/lib/fileUtils' { 70 | declare module.exports: any; 71 | } 72 | 73 | declare module 'flow-typed/dist/lib/flowProjectUtils' { 74 | declare module.exports: any; 75 | } 76 | 77 | declare module 'flow-typed/dist/lib/flowVersion' { 78 | declare module.exports: any; 79 | } 80 | 81 | declare module 'flow-typed/dist/lib/git' { 82 | declare module.exports: any; 83 | } 84 | 85 | declare module 'flow-typed/dist/lib/github' { 86 | declare module.exports: any; 87 | } 88 | 89 | declare module 'flow-typed/dist/lib/isInFlowTypedRepo' { 90 | declare module.exports: any; 91 | } 92 | 93 | declare module 'flow-typed/dist/lib/libDefs' { 94 | declare module.exports: any; 95 | } 96 | 97 | declare module 'flow-typed/dist/lib/node' { 98 | declare module.exports: any; 99 | } 100 | 101 | declare module 'flow-typed/dist/lib/npm/npmLibDefs' { 102 | declare module.exports: any; 103 | } 104 | 105 | declare module 'flow-typed/dist/lib/npm/npmProjectUtils' { 106 | declare module.exports: any; 107 | } 108 | 109 | declare module 'flow-typed/dist/lib/semver' { 110 | declare module.exports: any; 111 | } 112 | 113 | declare module 'flow-typed/dist/lib/stubUtils' { 114 | declare module.exports: any; 115 | } 116 | 117 | declare module 'flow-typed/dist/lib/validationErrors' { 118 | declare module.exports: any; 119 | } 120 | 121 | // Filename aliases 122 | declare module 'flow-typed/dist/cli.js' { 123 | declare module.exports: $Exports<'flow-typed/dist/cli'>; 124 | } 125 | declare module 'flow-typed/dist/commands/create-stub.js' { 126 | declare module.exports: $Exports<'flow-typed/dist/commands/create-stub'>; 127 | } 128 | declare module 'flow-typed/dist/commands/install.js' { 129 | declare module.exports: $Exports<'flow-typed/dist/commands/install'>; 130 | } 131 | declare module 'flow-typed/dist/commands/runTests.js' { 132 | declare module.exports: $Exports<'flow-typed/dist/commands/runTests'>; 133 | } 134 | declare module 'flow-typed/dist/commands/search.js' { 135 | declare module.exports: $Exports<'flow-typed/dist/commands/search'>; 136 | } 137 | declare module 'flow-typed/dist/commands/update-cache.js' { 138 | declare module.exports: $Exports<'flow-typed/dist/commands/update-cache'>; 139 | } 140 | declare module 'flow-typed/dist/commands/update.js' { 141 | declare module.exports: $Exports<'flow-typed/dist/commands/update'>; 142 | } 143 | declare module 'flow-typed/dist/commands/validateDefs.js' { 144 | declare module.exports: $Exports<'flow-typed/dist/commands/validateDefs'>; 145 | } 146 | declare module 'flow-typed/dist/commands/version.js' { 147 | declare module.exports: $Exports<'flow-typed/dist/commands/version'>; 148 | } 149 | declare module 'flow-typed/dist/lib/cacheRepoUtils.js' { 150 | declare module.exports: $Exports<'flow-typed/dist/lib/cacheRepoUtils'>; 151 | } 152 | declare module 'flow-typed/dist/lib/codeSign.js' { 153 | declare module.exports: $Exports<'flow-typed/dist/lib/codeSign'>; 154 | } 155 | declare module 'flow-typed/dist/lib/fileUtils.js' { 156 | declare module.exports: $Exports<'flow-typed/dist/lib/fileUtils'>; 157 | } 158 | declare module 'flow-typed/dist/lib/flowProjectUtils.js' { 159 | declare module.exports: $Exports<'flow-typed/dist/lib/flowProjectUtils'>; 160 | } 161 | declare module 'flow-typed/dist/lib/flowVersion.js' { 162 | declare module.exports: $Exports<'flow-typed/dist/lib/flowVersion'>; 163 | } 164 | declare module 'flow-typed/dist/lib/git.js' { 165 | declare module.exports: $Exports<'flow-typed/dist/lib/git'>; 166 | } 167 | declare module 'flow-typed/dist/lib/github.js' { 168 | declare module.exports: $Exports<'flow-typed/dist/lib/github'>; 169 | } 170 | declare module 'flow-typed/dist/lib/isInFlowTypedRepo.js' { 171 | declare module.exports: $Exports<'flow-typed/dist/lib/isInFlowTypedRepo'>; 172 | } 173 | declare module 'flow-typed/dist/lib/libDefs.js' { 174 | declare module.exports: $Exports<'flow-typed/dist/lib/libDefs'>; 175 | } 176 | declare module 'flow-typed/dist/lib/node.js' { 177 | declare module.exports: $Exports<'flow-typed/dist/lib/node'>; 178 | } 179 | declare module 'flow-typed/dist/lib/npm/npmLibDefs.js' { 180 | declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmLibDefs'>; 181 | } 182 | declare module 'flow-typed/dist/lib/npm/npmProjectUtils.js' { 183 | declare module.exports: $Exports<'flow-typed/dist/lib/npm/npmProjectUtils'>; 184 | } 185 | declare module 'flow-typed/dist/lib/semver.js' { 186 | declare module.exports: $Exports<'flow-typed/dist/lib/semver'>; 187 | } 188 | declare module 'flow-typed/dist/lib/stubUtils.js' { 189 | declare module.exports: $Exports<'flow-typed/dist/lib/stubUtils'>; 190 | } 191 | declare module 'flow-typed/dist/lib/validationErrors.js' { 192 | declare module.exports: $Exports<'flow-typed/dist/lib/validationErrors'>; 193 | } 194 | -------------------------------------------------------------------------------- /flow-typed/npm/from-entries.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare module '@ungap/from-entries' { 4 | declare module.exports: any; 5 | } 6 | -------------------------------------------------------------------------------- /flow-typed/npm/husky_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 09dc7be6f5dfade9410350e5f356b1e6 2 | // flow-typed version: <>/husky_v^0.14.3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'husky' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'husky' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'husky/__tests__/index' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'husky/bin/install' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'husky/bin/uninstall' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'husky/src/install' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'husky/src/uninstall' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'husky/src/utils/find-hooks-dir' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'husky/src/utils/find-parent' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'husky/src/utils/get-hook-script' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'husky/src/utils/is-husky' { 58 | declare module.exports: any; 59 | } 60 | 61 | // Filename aliases 62 | declare module 'husky/__tests__/index.js' { 63 | declare module.exports: $Exports<'husky/__tests__/index'>; 64 | } 65 | declare module 'husky/bin/install.js' { 66 | declare module.exports: $Exports<'husky/bin/install'>; 67 | } 68 | declare module 'husky/bin/uninstall.js' { 69 | declare module.exports: $Exports<'husky/bin/uninstall'>; 70 | } 71 | declare module 'husky/src/install.js' { 72 | declare module.exports: $Exports<'husky/src/install'>; 73 | } 74 | declare module 'husky/src/uninstall.js' { 75 | declare module.exports: $Exports<'husky/src/uninstall'>; 76 | } 77 | declare module 'husky/src/utils/find-hooks-dir.js' { 78 | declare module.exports: $Exports<'husky/src/utils/find-hooks-dir'>; 79 | } 80 | declare module 'husky/src/utils/find-parent.js' { 81 | declare module.exports: $Exports<'husky/src/utils/find-parent'>; 82 | } 83 | declare module 'husky/src/utils/get-hook-script.js' { 84 | declare module.exports: $Exports<'husky/src/utils/get-hook-script'>; 85 | } 86 | declare module 'husky/src/utils/is-husky.js' { 87 | declare module.exports: $Exports<'husky/src/utils/is-husky'>; 88 | } 89 | -------------------------------------------------------------------------------- /flow-typed/npm/lint-staged_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 1b9179cadf091d93c5142d3673b2e210 2 | // flow-typed version: <>/lint-staged_v^7.0.4/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'lint-staged' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'lint-staged' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'lint-staged/src/calcChunkSize' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'lint-staged/src/checkPkgScripts' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'lint-staged/src/findBin' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'lint-staged/src/generateTasks' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'lint-staged/src/getConfig' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'lint-staged/src/index' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'lint-staged/src/makeCmdTasks' { 50 | declare module.exports: any; 51 | } 52 | 53 | declare module 'lint-staged/src/printErrors' { 54 | declare module.exports: any; 55 | } 56 | 57 | declare module 'lint-staged/src/resolveGitDir' { 58 | declare module.exports: any; 59 | } 60 | 61 | declare module 'lint-staged/src/resolveTaskFn' { 62 | declare module.exports: any; 63 | } 64 | 65 | declare module 'lint-staged/src/runAll' { 66 | declare module.exports: any; 67 | } 68 | 69 | // Filename aliases 70 | declare module 'lint-staged/index' { 71 | declare module.exports: $Exports<'lint-staged'>; 72 | } 73 | declare module 'lint-staged/index.js' { 74 | declare module.exports: $Exports<'lint-staged'>; 75 | } 76 | declare module 'lint-staged/src/calcChunkSize.js' { 77 | declare module.exports: $Exports<'lint-staged/src/calcChunkSize'>; 78 | } 79 | declare module 'lint-staged/src/checkPkgScripts.js' { 80 | declare module.exports: $Exports<'lint-staged/src/checkPkgScripts'>; 81 | } 82 | declare module 'lint-staged/src/findBin.js' { 83 | declare module.exports: $Exports<'lint-staged/src/findBin'>; 84 | } 85 | declare module 'lint-staged/src/generateTasks.js' { 86 | declare module.exports: $Exports<'lint-staged/src/generateTasks'>; 87 | } 88 | declare module 'lint-staged/src/getConfig.js' { 89 | declare module.exports: $Exports<'lint-staged/src/getConfig'>; 90 | } 91 | declare module 'lint-staged/src/index.js' { 92 | declare module.exports: $Exports<'lint-staged/src/index'>; 93 | } 94 | declare module 'lint-staged/src/makeCmdTasks.js' { 95 | declare module.exports: $Exports<'lint-staged/src/makeCmdTasks'>; 96 | } 97 | declare module 'lint-staged/src/printErrors.js' { 98 | declare module.exports: $Exports<'lint-staged/src/printErrors'>; 99 | } 100 | declare module 'lint-staged/src/resolveGitDir.js' { 101 | declare module.exports: $Exports<'lint-staged/src/resolveGitDir'>; 102 | } 103 | declare module 'lint-staged/src/resolveTaskFn.js' { 104 | declare module.exports: $Exports<'lint-staged/src/resolveTaskFn'>; 105 | } 106 | declare module 'lint-staged/src/runAll.js' { 107 | declare module.exports: $Exports<'lint-staged/src/runAll'>; 108 | } 109 | -------------------------------------------------------------------------------- /flow-typed/npm/prettier_v1.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 066c92e9ccb5f0711df8d73cbca837d6 2 | // flow-typed version: 9e32affdbd/prettier_v1.x.x/flow_>=v0.56.x 3 | 4 | declare module "prettier" { 5 | declare export type AST = Object; 6 | declare export type Doc = Object; 7 | declare export type FastPath = Object; 8 | 9 | declare export type PrettierParserName = 10 | | "babylon" 11 | | "flow" 12 | | "typescript" 13 | | "postcss" 14 | | "css" 15 | | "less" 16 | | "scss" 17 | | "json" 18 | | "graphql" 19 | | "markdown" 20 | | "vue"; 21 | 22 | declare export type PrettierParser = { 23 | [name: PrettierParserName]: (text: string, options?: Object) => AST 24 | }; 25 | 26 | declare export type CustomParser = ( 27 | text: string, 28 | parsers: PrettierParser, 29 | options: Options 30 | ) => AST; 31 | 32 | declare export type Options = {| 33 | printWidth?: number, 34 | tabWidth?: number, 35 | useTabs?: boolean, 36 | semi?: boolean, 37 | singleQuote?: boolean, 38 | trailingComma?: "none" | "es5" | "all", 39 | bracketSpacing?: boolean, 40 | jsxBracketSameLine?: boolean, 41 | arrowParens?: "avoid" | "always", 42 | rangeStart?: number, 43 | rangeEnd?: number, 44 | parser?: PrettierParserName | CustomParser, 45 | filepath?: string, 46 | requirePragma?: boolean, 47 | insertPragma?: boolean, 48 | proseWrap?: "always" | "never" | "preserve", 49 | plugins?: Array 50 | |}; 51 | 52 | declare export type Plugin = { 53 | languages: SupportLanguage, 54 | parsers: { [parserName: string]: Parser }, 55 | printers: { [astFormat: string]: Printer } 56 | }; 57 | 58 | declare export type Parser = { 59 | parse: ( 60 | text: string, 61 | parsers: { [parserName: string]: Parser }, 62 | options: Object 63 | ) => AST, 64 | astFormat: string 65 | }; 66 | 67 | declare export type Printer = { 68 | print: ( 69 | path: FastPath, 70 | options: Object, 71 | print: (path: FastPath) => Doc 72 | ) => Doc, 73 | embed: ( 74 | path: FastPath, 75 | print: (path: FastPath) => Doc, 76 | textToDoc: (text: string, options: Object) => Doc, 77 | options: Object 78 | ) => ?Doc 79 | }; 80 | 81 | declare export type CursorOptions = {| 82 | cursorOffset: number, 83 | printWidth?: $PropertyType, 84 | tabWidth?: $PropertyType, 85 | useTabs?: $PropertyType, 86 | semi?: $PropertyType, 87 | singleQuote?: $PropertyType, 88 | trailingComma?: $PropertyType, 89 | bracketSpacing?: $PropertyType, 90 | jsxBracketSameLine?: $PropertyType, 91 | arrowParens?: $PropertyType, 92 | parser?: $PropertyType, 93 | filepath?: $PropertyType, 94 | requirePragma?: $PropertyType, 95 | insertPragma?: $PropertyType, 96 | proseWrap?: $PropertyType, 97 | plugins?: $PropertyType 98 | |}; 99 | 100 | declare export type CursorResult = {| 101 | formatted: string, 102 | cursorOffset: number 103 | |}; 104 | 105 | declare export type ResolveConfigOptions = {| 106 | useCache?: boolean, 107 | config?: string, 108 | editorconfig?: boolean 109 | |}; 110 | 111 | declare export type SupportLanguage = { 112 | name: string, 113 | since: string, 114 | parsers: Array, 115 | group?: string, 116 | tmScope: string, 117 | aceMode: string, 118 | codemirrorMode: string, 119 | codemirrorMimeType: string, 120 | aliases?: Array, 121 | extensions: Array, 122 | filenames?: Array, 123 | linguistLanguageId: number, 124 | vscodeLanguageIds: Array 125 | }; 126 | 127 | declare export type SupportOption = {| 128 | since: string, 129 | type: "int" | "boolean" | "choice" | "path", 130 | deprecated?: string, 131 | redirect?: SupportOptionRedirect, 132 | description: string, 133 | oppositeDescription?: string, 134 | default: SupportOptionValue, 135 | range?: SupportOptionRange, 136 | choices?: SupportOptionChoice 137 | |}; 138 | 139 | declare export type SupportOptionRedirect = {| 140 | options: string, 141 | value: SupportOptionValue 142 | |}; 143 | 144 | declare export type SupportOptionRange = {| 145 | start: number, 146 | end: number, 147 | step: number 148 | |}; 149 | 150 | declare export type SupportOptionChoice = {| 151 | value: boolean | string, 152 | description?: string, 153 | since?: string, 154 | deprecated?: string, 155 | redirect?: SupportOptionValue 156 | |}; 157 | 158 | declare export type SupportOptionValue = number | boolean | string; 159 | 160 | declare export type SupportInfo = {| 161 | languages: Array, 162 | options: Array 163 | |}; 164 | 165 | declare export type Prettier = {| 166 | format: (source: string, options?: Options) => string, 167 | check: (source: string, options?: Options) => boolean, 168 | formatWithCursor: (source: string, options: CursorOptions) => CursorResult, 169 | resolveConfig: { 170 | (filePath: string, options?: ResolveConfigOptions): Promise, 171 | sync(filePath: string, options?: ResolveConfigOptions): ?Options 172 | }, 173 | clearConfigCache: () => void, 174 | getSupportInfo: (version?: string) => SupportInfo 175 | |}; 176 | 177 | declare export default Prettier; 178 | } 179 | -------------------------------------------------------------------------------- /flow-typed/npm/proxy-polyfill_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 85f3cee3ef579fc4277423833cd8f304 2 | // flow-typed version: <>/proxy-polyfill_v0.1.6/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'proxy-polyfill' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'proxy-polyfill' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'proxy-polyfill/proxy' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'proxy-polyfill/proxy.min' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'proxy-polyfill/suite' { 34 | declare module.exports: any; 35 | } 36 | 37 | // Filename aliases 38 | declare module 'proxy-polyfill/proxy.js' { 39 | declare module.exports: $Exports<'proxy-polyfill/proxy'>; 40 | } 41 | declare module 'proxy-polyfill/proxy.min.js' { 42 | declare module.exports: $Exports<'proxy-polyfill/proxy.min'>; 43 | } 44 | declare module 'proxy-polyfill/suite.js' { 45 | declare module.exports: $Exports<'proxy-polyfill/suite'>; 46 | } 47 | -------------------------------------------------------------------------------- /flow-typed/npm/rollup-plugin-babel_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: f394c50a048b5a7ebd278b90412df2ed 2 | // flow-typed version: <>/rollup-plugin-babel_v3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-babel' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-babel' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.cjs' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.es' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'rollup-plugin-babel/src/constants' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'rollup-plugin-babel/src/helperPlugin' { 38 | declare module.exports: any; 39 | } 40 | 41 | declare module 'rollup-plugin-babel/src/index' { 42 | declare module.exports: any; 43 | } 44 | 45 | declare module 'rollup-plugin-babel/src/preflightCheck' { 46 | declare module.exports: any; 47 | } 48 | 49 | declare module 'rollup-plugin-babel/src/utils' { 50 | declare module.exports: any; 51 | } 52 | 53 | // Filename aliases 54 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.cjs.js' { 55 | declare module.exports: $Exports<'rollup-plugin-babel/dist/rollup-plugin-babel.cjs'>; 56 | } 57 | declare module 'rollup-plugin-babel/dist/rollup-plugin-babel.es.js' { 58 | declare module.exports: $Exports<'rollup-plugin-babel/dist/rollup-plugin-babel.es'>; 59 | } 60 | declare module 'rollup-plugin-babel/src/constants.js' { 61 | declare module.exports: $Exports<'rollup-plugin-babel/src/constants'>; 62 | } 63 | declare module 'rollup-plugin-babel/src/helperPlugin.js' { 64 | declare module.exports: $Exports<'rollup-plugin-babel/src/helperPlugin'>; 65 | } 66 | declare module 'rollup-plugin-babel/src/index.js' { 67 | declare module.exports: $Exports<'rollup-plugin-babel/src/index'>; 68 | } 69 | declare module 'rollup-plugin-babel/src/preflightCheck.js' { 70 | declare module.exports: $Exports<'rollup-plugin-babel/src/preflightCheck'>; 71 | } 72 | declare module 'rollup-plugin-babel/src/utils.js' { 73 | declare module.exports: $Exports<'rollup-plugin-babel/src/utils'>; 74 | } 75 | -------------------------------------------------------------------------------- /flow-typed/npm/rollup-plugin-copy_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 0b11a12fd929a3a3afd136d42a652bd9 2 | // flow-typed version: <>/rollup-plugin-copy_v^1.1.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-copy' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-copy' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup-plugin-copy/dist/index.commonjs' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup-plugin-copy/dist/index.module' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'rollup-plugin-copy/dist/index.commonjs.js' { 35 | declare module.exports: $Exports<'rollup-plugin-copy/dist/index.commonjs'>; 36 | } 37 | declare module 'rollup-plugin-copy/dist/index.module.js' { 38 | declare module.exports: $Exports<'rollup-plugin-copy/dist/index.module'>; 39 | } 40 | -------------------------------------------------------------------------------- /flow-typed/npm/rollup-plugin-eslint_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 57ac4a4687dd0b10d420e17d2d30e534 2 | // flow-typed version: <>/rollup-plugin-eslint_v^5.1.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-eslint' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-eslint' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'rollup-plugin-eslint/index' { 29 | declare module.exports: $Exports<'rollup-plugin-eslint'>; 30 | } 31 | declare module 'rollup-plugin-eslint/index.js' { 32 | declare module.exports: $Exports<'rollup-plugin-eslint'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/rollup-plugin-flow_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: 25586f0fba8b577d1a0f5bd6b4167dae 2 | // flow-typed version: <>/rollup-plugin-flow_v^1.1.1/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-flow' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-flow' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | 26 | 27 | // Filename aliases 28 | declare module 'rollup-plugin-flow/index' { 29 | declare module.exports: $Exports<'rollup-plugin-flow'>; 30 | } 31 | declare module 'rollup-plugin-flow/index.js' { 32 | declare module.exports: $Exports<'rollup-plugin-flow'>; 33 | } 34 | -------------------------------------------------------------------------------- /flow-typed/npm/rollup-plugin-includepaths_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: a36cd847454eb7e3f098cadbd0745e0a 2 | // flow-typed version: <>/rollup-plugin-includepaths_v^0.2.3/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup-plugin-includepaths' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup-plugin-includepaths' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup-plugin-includepaths/src/plugin.es5' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup-plugin-includepaths/src/plugin' { 30 | declare module.exports: any; 31 | } 32 | 33 | // Filename aliases 34 | declare module 'rollup-plugin-includepaths/src/plugin.es5.js' { 35 | declare module.exports: $Exports<'rollup-plugin-includepaths/src/plugin.es5'>; 36 | } 37 | declare module 'rollup-plugin-includepaths/src/plugin.js' { 38 | declare module.exports: $Exports<'rollup-plugin-includepaths/src/plugin'>; 39 | } 40 | -------------------------------------------------------------------------------- /flow-typed/npm/rollup_vx.x.x.js: -------------------------------------------------------------------------------- 1 | // flow-typed signature: e8ee84a58128c679bea1b5976f7f00cf 2 | // flow-typed version: <>/rollup_v^1.8.0/flow_v0.97.0 3 | 4 | /** 5 | * This is an autogenerated libdef stub for: 6 | * 7 | * 'rollup' 8 | * 9 | * Fill this stub out by replacing all the `any` types. 10 | * 11 | * Once filled out, we encourage you to share your work with the 12 | * community by sending a pull request to: 13 | * https://github.com/flowtype/flow-typed 14 | */ 15 | 16 | declare module 'rollup' { 17 | declare module.exports: any; 18 | } 19 | 20 | /** 21 | * We include stubs for each file inside this npm package in case you need to 22 | * require those files directly. Feel free to delete any files that aren't 23 | * needed. 24 | */ 25 | declare module 'rollup/dist/rollup.browser.es' { 26 | declare module.exports: any; 27 | } 28 | 29 | declare module 'rollup/dist/rollup.browser' { 30 | declare module.exports: any; 31 | } 32 | 33 | declare module 'rollup/dist/rollup.es' { 34 | declare module.exports: any; 35 | } 36 | 37 | declare module 'rollup/dist/rollup' { 38 | declare module.exports: any; 39 | } 40 | 41 | // Filename aliases 42 | declare module 'rollup/dist/rollup.browser.es.js' { 43 | declare module.exports: $Exports<'rollup/dist/rollup.browser.es'>; 44 | } 45 | declare module 'rollup/dist/rollup.browser.js' { 46 | declare module.exports: $Exports<'rollup/dist/rollup.browser'>; 47 | } 48 | declare module 'rollup/dist/rollup.es.js' { 49 | declare module.exports: $Exports<'rollup/dist/rollup.es'>; 50 | } 51 | declare module 'rollup/dist/rollup.js' { 52 | declare module.exports: $Exports<'rollup/dist/rollup'>; 53 | } 54 | -------------------------------------------------------------------------------- /flow-typed/npm/uuid.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | declare module 'uuid' { 4 | declare module.exports: any; 5 | } 6 | -------------------------------------------------------------------------------- /flow-typed/reselect.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | // We should be using the `reselect` that comes with flow-typed but it's going to take a ton of work to get that working 3 | // without any errors. For now it's any type 4 | declare module 'reselect' { 5 | declare module.exports: any; 6 | } 7 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | collectCoverageFrom: ["src/**/*.{js,jsx,mjs}"], 3 | testMatch: ["/tests/**/*.test.js"], 4 | transform: { 5 | "^.+\\.(js|jsx|mjs)$": "/tests/config/jest-transformer.js", 6 | }, 7 | transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"] 8 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lbry-redux", 3 | "version": "0.0.1", 4 | "description": "Common shared components for desktop and mobile.", 5 | "keywords": [ 6 | "lbry" 7 | ], 8 | "license": "MIT", 9 | "homepage": "https://lbry.com/", 10 | "bugs": { 11 | "url": "https://github.com/lbryio/lbry-redux/issues" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/lbryio/lbry-redux" 16 | }, 17 | "author": { 18 | "name": "LBRY Inc.", 19 | "email": "hello@lbry.com" 20 | }, 21 | "main": "dist/bundle.es.js", 22 | "module": "dist/bundle.es.js", 23 | "scripts": { 24 | "build": "cross-env NODE_ENV=production rollup --config", 25 | "dev": "rollup --config --watch", 26 | "precommit": "flow check && lint-staged", 27 | "lint": "eslint 'src/**/*.js' --fix", 28 | "format": "prettier 'src/**/*.{js,json}' --write", 29 | "test": "jest" 30 | }, 31 | "dependencies": { 32 | "@ungap/from-entries": "^0.2.1", 33 | "proxy-polyfill": "0.1.6", 34 | "reselect": "^3.0.0", 35 | "uuid": "^8.3.1" 36 | }, 37 | "devDependencies": { 38 | "@babel/plugin-proposal-class-properties": "^7.10.4", 39 | "@babel/plugin-proposal-decorators": "^7.10.5", 40 | "@babel/plugin-transform-flow-strip-types": "^7.10.4", 41 | "@babel/preset-env": "^7.11.0", 42 | "@babel/preset-react": "^7.10.4", 43 | "babel-core": "^6.26.0", 44 | "babel-eslint": "^8.0.3", 45 | "babel-loader": "^7.1.4", 46 | "babel-plugin-module-resolver": "^3.0.0", 47 | "babel-plugin-transform-flow-comments": "^6.17.0", 48 | "babel-preset-env": "^1.6.1", 49 | "babel-preset-stage-2": "^6.18.0", 50 | "cross-env": "^5.2.0", 51 | "eslint": "^5.16.0", 52 | "eslint-config-standard": "^12.0.0", 53 | "eslint-config-standard-jsx": "^6.0.2", 54 | "eslint-plugin-flowtype": "^2.46.1", 55 | "eslint-plugin-import": "^2.17.2", 56 | "eslint-plugin-node": "^8.0.1", 57 | "eslint-plugin-promise": "^4.1.1", 58 | "eslint-plugin-react": "^7.12.4", 59 | "eslint-plugin-standard": "^4.0.0", 60 | "flow-bin": "^0.97.0", 61 | "flow-typed": "^2.5.1", 62 | "husky": "^0.14.3", 63 | "jest": "^26.4.2", 64 | "lint-staged": "^7.0.4", 65 | "prettier": "^1.4.2", 66 | "rollup": "^1.8.0", 67 | "rollup-plugin-babel": "3", 68 | "rollup-plugin-copy": "^1.1.0", 69 | "rollup-plugin-eslint": "^5.1.0", 70 | "rollup-plugin-flow": "^1.1.1", 71 | "rollup-plugin-includepaths": "^0.2.3", 72 | "rollup-plugin-replace": "^2.2.0" 73 | }, 74 | "engines": { 75 | "yarn": "^1.3" 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import babel from 'rollup-plugin-babel'; 2 | import flow from 'rollup-plugin-flow'; 3 | import includePaths from 'rollup-plugin-includepaths'; 4 | import copy from 'rollup-plugin-copy'; 5 | import replace from 'rollup-plugin-replace'; 6 | 7 | let includePathOptions = { 8 | include: {}, 9 | paths: ['src'], 10 | external: [], 11 | extensions: ['.js'], 12 | }; 13 | 14 | const production = process.env.NODE_ENV === 'production'; 15 | 16 | export default { 17 | input: 'src/index.js', 18 | output: { 19 | file: 'dist/bundle.es.js', 20 | format: 'cjs', 21 | }, 22 | plugins: [ 23 | flow({ all: true }), 24 | includePaths(includePathOptions), 25 | babel({ 26 | babelrc: false, 27 | presets: ['stage-2'], 28 | }), 29 | copy({ targets: ['flow-typed'] }), 30 | replace({ 31 | 'process.env.NODE_ENV': production 32 | ? JSON.stringify('production') 33 | : JSON.stringify('development'), 34 | }), 35 | ], 36 | }; 37 | -------------------------------------------------------------------------------- /src/constants/abandon_states.js: -------------------------------------------------------------------------------- 1 | export const PENDING = 'pending'; 2 | export const DONE = 'done'; 3 | export const READY = 'ready'; 4 | export const ERROR = 'error'; 5 | -------------------------------------------------------------------------------- /src/constants/claim.js: -------------------------------------------------------------------------------- 1 | export const MINIMUM_PUBLISH_BID = 0.00000001; 2 | 3 | export const CHANNEL_ANONYMOUS = 'anonymous'; 4 | export const CHANNEL_NEW = 'new'; 5 | export const PAGE_SIZE = 20; 6 | 7 | export const LEVEL_1_STAKED_AMOUNT = 0; 8 | export const LEVEL_2_STAKED_AMOUNT = 1; 9 | export const LEVEL_3_STAKED_AMOUNT = 50; 10 | export const LEVEL_4_STAKED_AMOUNT = 250; 11 | export const LEVEL_5_STAKED_AMOUNT = 1000; 12 | -------------------------------------------------------------------------------- /src/constants/collections.js: -------------------------------------------------------------------------------- 1 | export const COLLECTION_ID = 'lid'; 2 | export const COLLECTION_INDEX = 'linx'; 3 | 4 | export const COL_TYPE_PLAYLIST = 'playlist'; 5 | export const COL_TYPE_CHANNELS = 'channelList'; 6 | 7 | export const WATCH_LATER_ID = 'watchlater'; 8 | export const FAVORITES_ID = 'favorites'; 9 | export const FAVORITE_CHANNELS_ID = 'favoriteChannels'; 10 | export const BUILTIN_LISTS = [WATCH_LATER_ID, FAVORITES_ID, FAVORITE_CHANNELS_ID]; 11 | 12 | export const COL_KEY_EDITED = 'edited'; 13 | export const COL_KEY_UNPUBLISHED = 'unpublished'; 14 | export const COL_KEY_PENDING = 'pending'; 15 | export const COL_KEY_SAVED = 'saved'; 16 | -------------------------------------------------------------------------------- /src/constants/daemon_settings.js: -------------------------------------------------------------------------------- 1 | export const ANNOUNCE_HEAD_AND_SD_ONLY = 'announce_head_and_sd_only'; 2 | export const API = 'api'; 3 | export const BLOB_DOWNLOAD_TIMEOUT = 'blob_download_timeout'; 4 | export const BLOB_LRU_CACHE_SIZE = 'blob_lru_cache_size'; 5 | export const BLOCKCHAIN_NAME = 'blockchain_name'; 6 | export const CACHE_TIME = 'cache_time'; 7 | export const COIN_SELECTION_STRATEGY = 'coin_selection_strategy'; 8 | export const COMMENT_SERVER = 'comment_server'; 9 | export const COMPONENTS_TO_SKIP = 'components_to_skip'; 10 | export const CONCURRENT_BLOB_ANNOUNCERS = 'concurrent_blob_announcers'; 11 | export const CONCURRENT_REFLECTOR_UPLOADS = 'concurrent_reflector_uploads'; 12 | export const CONFIG = 'config'; 13 | export const DATA_DIR = 'data_dir'; 14 | export const DOWNLOAD_DIR = 'download_dir'; 15 | export const DOWNLOAD_TIMEOUT = 'download_timeout'; 16 | export const FIXED_PEER_DELAY = 'fixed_peer_delay'; 17 | export const KNOWN_DHT_NODES = 'known_dht_nodes'; 18 | export const LBRYUM_SERVERS = 'lbryum_servers'; 19 | export const MAX_CONNECTIONS_PER_DOWNLOAD = 'max_connections_per_download'; 20 | export const MAX_KEY_FEE = 'max_key_fee'; 21 | export const DEFAULT_WALLET = 'default_wallet'; 22 | export const NETWORK_INTERFACE = 'network_interface'; 23 | export const NODE_RPC_TIMEOUT = 'node_rpc_timeout'; 24 | export const PEER_CONNECT_TIMEOUT = 'peer_connect_timeout'; 25 | export const REFLECT_STREAMS = 'reflect_streams'; 26 | export const REFLECTOR_SERVERS = 'reflector_servers'; 27 | export const S3_HEADERS_DEPTH = 's3_headers_depth'; 28 | export const SAVE_BLOBS = 'save_blobs'; 29 | export const SAVE_FILES = 'save_files'; 30 | export const SHARE_USAGE_DATA = 'share_usage_data'; 31 | export const SPLIT_BUCKETS_UNDER_INDEX = 'split_buckets_under_index'; 32 | export const STREAMING_GET = 'streaming_get'; 33 | export const STREAMING_SERVER = 'streaming_server'; 34 | export const TCP_PORT = 'tcp_port'; 35 | export const TRACK_BANDWIDTH = 'track_bandwidth'; 36 | export const UDP_PORT = 'udp_port'; 37 | export const USE_UPNP = 'use_upnp'; 38 | export const WALLET_DIR = 'wallet_dir'; 39 | export const WALLETS = 'wallets'; 40 | -------------------------------------------------------------------------------- /src/constants/icons.js: -------------------------------------------------------------------------------- 1 | export const FEATURED = 'rocket'; 2 | export const LOCAL = 'folder'; 3 | export const FILE = 'file'; 4 | export const HISTORY = 'history'; 5 | export const HELP_CIRCLE = 'question-circle'; 6 | -------------------------------------------------------------------------------- /src/constants/licenses.js: -------------------------------------------------------------------------------- 1 | export const CC_LICENSES = [ 2 | { 3 | value: 'Creative Commons Attribution 4.0 International', 4 | url: 'https://creativecommons.org/licenses/by/4.0/legalcode', 5 | }, 6 | { 7 | value: 'Creative Commons Attribution-ShareAlike 4.0 International', 8 | url: 'https://creativecommons.org/licenses/by-sa/4.0/legalcode', 9 | }, 10 | { 11 | value: 'Creative Commons Attribution-NoDerivatives 4.0 International', 12 | url: 'https://creativecommons.org/licenses/by-nd/4.0/legalcode', 13 | }, 14 | { 15 | value: 'Creative Commons Attribution-NonCommercial 4.0 International', 16 | url: 'https://creativecommons.org/licenses/by-nc/4.0/legalcode', 17 | }, 18 | { 19 | value: 'Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International', 20 | url: 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode', 21 | }, 22 | { 23 | value: 'Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International', 24 | url: 'https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode', 25 | }, 26 | ]; 27 | 28 | export const NONE = 'None'; 29 | export const PUBLIC_DOMAIN = 'Public Domain'; 30 | export const OTHER = 'other'; 31 | export const COPYRIGHT = 'copyright'; 32 | -------------------------------------------------------------------------------- /src/constants/pages.js: -------------------------------------------------------------------------------- 1 | export const AUTH = 'auth'; 2 | export const BACKUP = 'backup'; 3 | export const CHANNEL = 'channel'; 4 | export const DISCOVER = 'discover'; 5 | export const FILE = 'file'; 6 | export const DOWNLOADED = 'downloaded'; 7 | export const PUBLISHED = 'published'; 8 | export const GET_CREDITS = 'getcredits'; 9 | export const HELP = 'help'; 10 | export const INVITE = 'invite'; 11 | export const PUBLISH = 'publish'; 12 | export const REPORT = 'report'; 13 | export const REWARDS = 'rewards'; 14 | export const SEARCH = 'search'; 15 | export const SEND_CREDITS = 'send'; 16 | export const SETTINGS = 'settings'; 17 | export const SHOW = 'show'; 18 | export const SUBSCRIPTIONS = 'subscriptions'; 19 | export const TRANSACTION_HISTORY = 'history'; 20 | export const HISTORY = 'user_history'; 21 | export const WALLET = 'wallet'; 22 | -------------------------------------------------------------------------------- /src/constants/settings.js: -------------------------------------------------------------------------------- 1 | /* hardcoded names still exist for these in reducers/settings.js - only discovered when debugging */ 2 | /* Many SETTINGS are stored in the localStorage by their name - 3 | be careful about changing the value of a SETTINGS constant, as doing so can invalidate existing SETTINGS */ 4 | 5 | export const SHOW_NSFW = 'showNsfw'; 6 | export const CREDIT_REQUIRED_ACKNOWLEDGED = 'credit_required_acknowledged'; 7 | export const NEW_USER_ACKNOWLEDGED = 'welcome_acknowledged'; 8 | export const EMAIL_COLLECTION_ACKNOWLEDGED = 'email_collection_acknowledged'; 9 | export const FIRST_RUN_STARTED = 'first_run_started'; 10 | export const INVITE_ACKNOWLEDGED = 'invite_acknowledged'; 11 | export const FOLLOWING_ACKNOWLEDGED = 'following_acknowledged'; 12 | export const TAGS_ACKNOWLEDGED = 'tags_acknowledged'; 13 | export const REWARDS_ACKNOWLEDGED = 'rewards_acknowledged'; 14 | export const LANGUAGE = 'language'; 15 | export const SEARCH_IN_LANGUAGE = 'search_in_language'; 16 | export const SHOW_MATURE = 'show_mature'; 17 | export const HOMEPAGE = 'homepage'; 18 | export const HIDE_REPOSTS = 'hide_reposts'; 19 | export const SHOW_ANONYMOUS = 'show_anonymous'; 20 | export const SHOW_UNAVAILABLE = 'show_unavailable'; 21 | export const INSTANT_PURCHASE_ENABLED = 'instant_purchase_enabled'; 22 | export const INSTANT_PURCHASE_MAX = 'instant_purchase_max'; 23 | export const THEME = 'theme'; 24 | export const THEMES = 'themes'; 25 | export const AUTOMATIC_DARK_MODE_ENABLED = 'automatic_dark_mode_enabled'; 26 | export const AUTOPLAY_MEDIA = 'autoplay'; 27 | export const AUTOPLAY_NEXT = 'autoplay_next'; 28 | export const OS_NOTIFICATIONS_ENABLED = 'os_notifications_enabled'; 29 | export const AUTO_DOWNLOAD = 'auto_download'; 30 | export const AUTO_LAUNCH = 'auto_launch'; 31 | export const TO_TRAY_WHEN_CLOSED = 'to_tray_when_closed'; 32 | export const SUPPORT_OPTION = 'support_option'; 33 | export const HIDE_BALANCE = 'hide_balance'; 34 | export const HIDE_SPLASH_ANIMATION = 'hide_splash_animation'; 35 | export const FLOATING_PLAYER = 'floating_player'; 36 | export const DARK_MODE_TIMES = 'dark_mode_times'; 37 | export const ENABLE_SYNC = 'enable_sync'; 38 | export const ENABLE_PUBLISH_PREVIEW = 'enable-publish-preview'; 39 | export const TILE_LAYOUT = 'tile_layout'; 40 | export const VIDEO_THEATER_MODE = 'video_theater_mode'; 41 | export const VIDEO_PLAYBACK_RATE = 'video_playback_rate'; 42 | export const CUSTOM_COMMENTS_SERVER_ENABLED = 'custom_comments_server_enabled'; 43 | export const CUSTOM_COMMENTS_SERVER_URL = 'custom_comments_server_url'; 44 | 45 | // mobile settings 46 | export const BACKGROUND_PLAY_ENABLED = 'backgroundPlayEnabled'; 47 | export const FOREGROUND_NOTIFICATION_ENABLED = 'foregroundNotificationEnabled'; 48 | export const KEEP_DAEMON_RUNNING = 'keepDaemonRunning'; 49 | export const SHOW_URI_BAR_SUGGESTIONS = 'showUriBarSuggestions'; 50 | export const RECEIVE_SUBSCRIPTION_NOTIFICATIONS = 'receiveSubscriptionNotifications'; 51 | export const RECEIVE_REWARD_NOTIFICATIONS = 'receiveRewardNotifications'; 52 | export const RECEIVE_INTERESTS_NOTIFICATIONS = 'receiveInterestsNotifications'; 53 | export const RECEIVE_CREATOR_NOTIFICATIONS = 'receiveCreatorNotifications'; 54 | -------------------------------------------------------------------------------- /src/constants/shape_shift.js: -------------------------------------------------------------------------------- 1 | export const NO_DEPOSITS = 'no_deposits'; 2 | export const RECEIVED = 'received'; 3 | export const COMPLETE = 'complete'; 4 | -------------------------------------------------------------------------------- /src/constants/shared_preferences.js: -------------------------------------------------------------------------------- 1 | /* 2 | * How to use this file: 3 | * Settings exported from here will trigger the setting to be 4 | * sent to the preference middleware when set using the 5 | * usual setDaemonSettings and clearDaemonSettings methods. 6 | * 7 | * See redux/settings/actions in the app for where this is used. 8 | */ 9 | 10 | import * as DAEMON_SETTINGS from './daemon_settings'; 11 | import * as SETTINGS from './settings'; 12 | 13 | // DAEMON 14 | export const SDK_SYNC_KEYS = [DAEMON_SETTINGS.LBRYUM_SERVERS, DAEMON_SETTINGS.SHARE_USAGE_DATA]; 15 | 16 | // CLIENT 17 | export const CLIENT_SYNC_KEYS = [ 18 | SETTINGS.SHOW_MATURE, 19 | SETTINGS.HIDE_REPOSTS, 20 | SETTINGS.SHOW_ANONYMOUS, 21 | SETTINGS.INSTANT_PURCHASE_ENABLED, 22 | SETTINGS.INSTANT_PURCHASE_MAX, 23 | SETTINGS.THEME, 24 | SETTINGS.AUTOPLAY_MEDIA, 25 | SETTINGS.AUTOPLAY_NEXT, 26 | SETTINGS.HIDE_BALANCE, 27 | SETTINGS.HIDE_SPLASH_ANIMATION, 28 | SETTINGS.FLOATING_PLAYER, 29 | SETTINGS.DARK_MODE_TIMES, 30 | SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, 31 | SETTINGS.LANGUAGE, 32 | ]; 33 | -------------------------------------------------------------------------------- /src/constants/sort_options.js: -------------------------------------------------------------------------------- 1 | export const DATE_NEW = 'dateNew'; 2 | export const DATE_OLD = 'dateOld'; 3 | export const TITLE = 'title'; 4 | export const FILENAME = 'filename'; 5 | -------------------------------------------------------------------------------- /src/constants/speech_urls.js: -------------------------------------------------------------------------------- 1 | export const SPEECH_STATUS = 'https://spee.ch/api/config/site/publishing'; 2 | export const SPEECH_PUBLISH = 'https://spee.ch/api/claim/publish'; 3 | -------------------------------------------------------------------------------- /src/constants/thumbnail_upload_statuses.js: -------------------------------------------------------------------------------- 1 | export const API_DOWN = 'apiDown'; 2 | export const READY = 'ready'; 3 | export const IN_PROGRESS = 'inProgress'; 4 | export const COMPLETE = 'complete'; 5 | export const MANUAL = 'manual'; 6 | -------------------------------------------------------------------------------- /src/constants/transaction_list.js: -------------------------------------------------------------------------------- 1 | // PAGE SIZE 2 | export const PAGE_SIZE = 50; 3 | export const LATEST_PAGE_SIZE = 20; 4 | -------------------------------------------------------------------------------- /src/constants/transaction_types.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line import/prefer-default-export 2 | export const ALL = 'all'; 3 | export const SPEND = 'spend'; 4 | export const RECEIVE = 'receive'; 5 | export const PUBLISH = 'publish'; 6 | export const CHANNEL = 'channel'; 7 | export const TIP = 'tip'; 8 | export const SUPPORT = 'support'; 9 | export const UPDATE = 'update'; 10 | export const ABANDON = 'abandon'; 11 | -------------------------------------------------------------------------------- /src/constants/txo_list.js: -------------------------------------------------------------------------------- 1 | export const ACTIVE = 'active'; // spent, active, all 2 | export const TYPE = 'type'; // all, payment, support, channel, stream, repost 3 | export const SUB_TYPE = 'subtype'; // other, purchase, tip 4 | export const PAGE_SIZE = 'page_size'; 5 | export const PAGE = 'page'; 6 | export const ALL = 'all'; 7 | // dropdown types 8 | export const SENT = 'sent'; 9 | export const RECEIVED = 'received'; 10 | export const SUPPORT = 'support'; 11 | export const CHANNEL = 'channel'; 12 | export const PUBLISH = 'publish'; 13 | export const REPOST = 'repost'; 14 | export const DROPDOWN_TYPES = [ALL, SENT, RECEIVED, SUPPORT, CHANNEL, PUBLISH, REPOST]; 15 | // dropdown subtypes 16 | export const TIP = 'tip'; 17 | export const PURCHASE = 'purchase'; 18 | export const PAYMENT = 'payment'; 19 | export const DROPDOWN_SUBTYPES = [ALL, TIP, PURCHASE, PAYMENT]; 20 | 21 | // rpc params 22 | export const TX_TYPE = 'type'; // = other, stream, repost, channel, support, purchase 23 | export const IS_SPENT = 'is_spent'; 24 | export const IS_NOT_SPENT = 'is_not_spent'; 25 | export const IS_MY_INPUT = 'is_my_input'; 26 | export const IS_MY_OUTPUT = 'is_my_output'; 27 | export const IS_NOT_MY_INPUT = 'is_not_my_input'; 28 | export const IS_NOT_MY_OUTPUT = 'is_not_my_output'; // use to further distinguish payments to self / from self. 29 | export const IS_MY_INPUT_OR_OUTPUT = 'is_my_input_or_output'; 30 | export const EXCLUDE_INTERNAL_TRANSFERS = 'exclude_internal_transfers'; 31 | 32 | // sdk unique types 33 | export const OTHER = 'other'; 34 | export const STREAM = 'stream'; 35 | 36 | export const PAGE_SIZE_DEFAULT = 20; 37 | -------------------------------------------------------------------------------- /src/lbry-first.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import 'proxy-polyfill'; 3 | 4 | const CHECK_LBRYFIRST_STARTED_TRY_NUMBER = 200; 5 | // 6 | // Basic LBRYFIRST connection config 7 | // Offers a proxy to call LBRYFIRST methods 8 | 9 | // 10 | const LbryFirst: LbryFirstTypes = { 11 | isConnected: false, 12 | connectPromise: null, 13 | lbryFirstConnectionString: 'http://localhost:1337/rpc', 14 | apiRequestHeaders: { 'Content-Type': 'application/json' }, 15 | 16 | // Allow overriding lbryFirst connection string (e.g. to `/api/proxy` for lbryweb) 17 | setLbryFirstConnectionString: (value: string) => { 18 | LbryFirst.lbryFirstConnectionString = value; 19 | }, 20 | 21 | setApiHeader: (key: string, value: string) => { 22 | LbryFirst.apiRequestHeaders = Object.assign(LbryFirst.apiRequestHeaders, { [key]: value }); 23 | }, 24 | 25 | unsetApiHeader: key => { 26 | Object.keys(LbryFirst.apiRequestHeaders).includes(key) && 27 | delete LbryFirst.apiRequestHeaders['key']; 28 | }, 29 | // Allow overriding Lbry methods 30 | overrides: {}, 31 | setOverride: (methodName, newMethod) => { 32 | LbryFirst.overrides[methodName] = newMethod; 33 | }, 34 | getApiRequestHeaders: () => LbryFirst.apiRequestHeaders, 35 | 36 | // 37 | // LbryFirst Methods 38 | // 39 | status: (params = {}) => lbryFirstCallWithResult('status', params), 40 | stop: () => lbryFirstCallWithResult('stop', {}), 41 | version: () => lbryFirstCallWithResult('version', {}), 42 | 43 | // Upload to youtube 44 | upload: (params: { title: string, description: string, file_path: ?string } = {}) => { 45 | // Only upload when originally publishing for now 46 | if (!params.file_path) { 47 | return Promise.resolve(); 48 | } 49 | 50 | const uploadParams: { 51 | Title: string, 52 | Description: string, 53 | FilePath: string, 54 | Category: string, 55 | Keywords: string, 56 | } = { 57 | Title: params.title, 58 | Description: params.description, 59 | FilePath: params.file_path, 60 | Category: '', 61 | Keywords: '', 62 | }; 63 | 64 | return lbryFirstCallWithResult('youtube.Upload', uploadParams); 65 | }, 66 | 67 | hasYTAuth: (token: string) => { 68 | const hasYTAuthParams = {}; 69 | hasYTAuthParams.AuthToken = token; 70 | return lbryFirstCallWithResult('youtube.HasAuth', hasYTAuthParams); 71 | }, 72 | 73 | ytSignup: () => { 74 | const emptyParams = {}; 75 | return lbryFirstCallWithResult('youtube.Signup', emptyParams); 76 | }, 77 | 78 | remove: () => { 79 | const emptyParams = {}; 80 | return lbryFirstCallWithResult('youtube.Remove', emptyParams); 81 | }, 82 | 83 | // Connect to lbry-first 84 | connect: () => { 85 | if (LbryFirst.connectPromise === null) { 86 | LbryFirst.connectPromise = new Promise((resolve, reject) => { 87 | let tryNum = 0; 88 | // Check every half second to see if the lbryFirst is accepting connections 89 | function checkLbryFirstStarted() { 90 | tryNum += 1; 91 | LbryFirst.status() 92 | .then(resolve) 93 | .catch(() => { 94 | if (tryNum <= CHECK_LBRYFIRST_STARTED_TRY_NUMBER) { 95 | setTimeout(checkLbryFirstStarted, tryNum < 50 ? 400 : 1000); 96 | } else { 97 | reject(new Error('Unable to connect to LBRY')); 98 | } 99 | }); 100 | } 101 | 102 | checkLbryFirstStarted(); 103 | }); 104 | } 105 | 106 | // Flow thinks this could be empty, but it will always return a promise 107 | // $FlowFixMe 108 | return LbryFirst.connectPromise; 109 | }, 110 | }; 111 | 112 | function checkAndParse(response) { 113 | if (response.status >= 200 && response.status < 300) { 114 | return response.json(); 115 | } 116 | return response.json().then(json => { 117 | let error; 118 | if (json.error) { 119 | const errorMessage = typeof json.error === 'object' ? json.error.message : json.error; 120 | error = new Error(errorMessage); 121 | } else { 122 | error = new Error('Protocol error with unknown response signature'); 123 | } 124 | return Promise.reject(error); 125 | }); 126 | } 127 | 128 | export function apiCall(method: string, params: ?{}, resolve: Function, reject: Function) { 129 | const counter = new Date().getTime(); 130 | const paramsArray = [params]; 131 | const options = { 132 | method: 'POST', 133 | headers: LbryFirst.apiRequestHeaders, 134 | body: JSON.stringify({ 135 | jsonrpc: '2.0', 136 | method, 137 | params: paramsArray, 138 | id: counter, 139 | }), 140 | }; 141 | 142 | return fetch(LbryFirst.lbryFirstConnectionString, options) 143 | .then(checkAndParse) 144 | .then(response => { 145 | const error = response.error || (response.result && response.result.error); 146 | 147 | if (error) { 148 | return reject(error); 149 | } 150 | return resolve(response.result); 151 | }) 152 | .catch(reject); 153 | } 154 | 155 | function lbryFirstCallWithResult(name: string, params: ?{} = {}) { 156 | return new Promise((resolve, reject) => { 157 | apiCall( 158 | name, 159 | params, 160 | result => { 161 | resolve(result); 162 | }, 163 | reject 164 | ); 165 | }); 166 | } 167 | 168 | // This is only for a fallback 169 | // If there is a LbryFirst method that is being called by an app, it should be added to /flow-typed/LbryFirst.js 170 | const lbryFirstProxy = new Proxy(LbryFirst, { 171 | get(target: LbryFirstTypes, name: string) { 172 | if (name in target) { 173 | return target[name]; 174 | } 175 | 176 | return (params = {}) => 177 | new Promise((resolve, reject) => { 178 | apiCall(name, params, resolve, reject); 179 | }); 180 | }, 181 | }); 182 | 183 | export default lbryFirstProxy; 184 | -------------------------------------------------------------------------------- /src/redux/actions/blocked.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | 4 | export const doToggleBlockChannel = (uri: string) => ({ 5 | type: ACTIONS.TOGGLE_BLOCK_CHANNEL, 6 | data: { 7 | uri, 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /src/redux/actions/content.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | 4 | export function savePosition(claimId: string, outpoint: string, position: number) { 5 | return (dispatch: Dispatch) => { 6 | dispatch({ 7 | type: ACTIONS.SET_CONTENT_POSITION, 8 | data: { claimId, outpoint, position }, 9 | }); 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /src/redux/actions/file.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | import Lbry from 'lbry'; 4 | import { doToast } from 'redux/actions/notifications'; 5 | import { selectBalance } from 'redux/selectors/wallet'; 6 | import { 7 | makeSelectFileInfoForUri, 8 | selectDownloadingByOutpoint, 9 | makeSelectStreamingUrlForUri, 10 | } from 'redux/selectors/file_info'; 11 | import { makeSelectClaimForUri } from 'redux/selectors/claims'; 12 | 13 | type Dispatch = (action: any) => any; 14 | type GetState = () => { file: FileState }; 15 | 16 | export function doFileGet(uri: string, saveFile: boolean = true, onSuccess?: GetResponse => any) { 17 | return (dispatch: Dispatch, getState: () => any) => { 18 | const state = getState(); 19 | const { nout, txid } = makeSelectClaimForUri(uri)(state); 20 | const outpoint = `${txid}:${nout}`; 21 | 22 | dispatch({ 23 | type: ACTIONS.FETCH_FILE_INFO_STARTED, 24 | data: { 25 | outpoint, 26 | }, 27 | }); 28 | 29 | // set save_file argument to True to save the file (old behaviour) 30 | Lbry.get({ uri, save_file: saveFile }) 31 | .then((streamInfo: GetResponse) => { 32 | const timeout = 33 | streamInfo === null || typeof streamInfo !== 'object' || streamInfo.error === 'Timeout'; 34 | if (timeout) { 35 | dispatch({ 36 | type: ACTIONS.FETCH_FILE_INFO_FAILED, 37 | data: { outpoint }, 38 | }); 39 | 40 | dispatch(doToast({ message: `File timeout for uri ${uri}`, isError: true })); 41 | } else { 42 | if (streamInfo.purchase_receipt || streamInfo.content_fee) { 43 | dispatch({ 44 | type: ACTIONS.PURCHASE_URI_COMPLETED, 45 | data: { uri, purchaseReceipt: streamInfo.purchase_receipt || streamInfo.content_fee }, 46 | }); 47 | } 48 | dispatch({ 49 | type: ACTIONS.FETCH_FILE_INFO_COMPLETED, 50 | data: { 51 | fileInfo: streamInfo, 52 | outpoint: outpoint, 53 | }, 54 | }); 55 | 56 | if (onSuccess) { 57 | onSuccess(streamInfo); 58 | } 59 | } 60 | }) 61 | .catch(error => { 62 | dispatch({ 63 | type: ACTIONS.PURCHASE_URI_FAILED, 64 | data: { uri, error }, 65 | }); 66 | 67 | dispatch({ 68 | type: ACTIONS.FETCH_FILE_INFO_FAILED, 69 | data: { outpoint }, 70 | }); 71 | 72 | dispatch( 73 | doToast({ 74 | message: `Failed to view ${uri}, please try again. If this problem persists, visit https://lbry.com/faq/support for support.`, 75 | isError: true, 76 | }) 77 | ); 78 | }); 79 | }; 80 | } 81 | 82 | export function doPurchaseUri( 83 | uri: string, 84 | costInfo: { cost: number }, 85 | saveFile: boolean = true, 86 | onSuccess?: GetResponse => any 87 | ) { 88 | return (dispatch: Dispatch, getState: GetState) => { 89 | dispatch({ 90 | type: ACTIONS.PURCHASE_URI_STARTED, 91 | data: { uri }, 92 | }); 93 | 94 | const state = getState(); 95 | const balance = selectBalance(state); 96 | const fileInfo = makeSelectFileInfoForUri(uri)(state); 97 | const downloadingByOutpoint = selectDownloadingByOutpoint(state); 98 | const alreadyDownloading = fileInfo && !!downloadingByOutpoint[fileInfo.outpoint]; 99 | const alreadyStreaming = makeSelectStreamingUrlForUri(uri)(state); 100 | 101 | if (!saveFile && (alreadyDownloading || alreadyStreaming)) { 102 | dispatch({ 103 | type: ACTIONS.PURCHASE_URI_FAILED, 104 | data: { uri, error: `Already fetching uri: ${uri}` }, 105 | }); 106 | 107 | if (onSuccess) { 108 | onSuccess(fileInfo); 109 | } 110 | 111 | return; 112 | } 113 | 114 | const { cost } = costInfo; 115 | if (parseFloat(cost) > balance) { 116 | dispatch({ 117 | type: ACTIONS.PURCHASE_URI_FAILED, 118 | data: { uri, error: 'Insufficient credits' }, 119 | }); 120 | 121 | Promise.resolve(); 122 | return; 123 | } 124 | 125 | dispatch(doFileGet(uri, saveFile, onSuccess)); 126 | }; 127 | } 128 | 129 | export function doClearPurchasedUriSuccess() { 130 | return { 131 | type: ACTIONS.CLEAR_PURCHASED_URI_SUCCESS, 132 | }; 133 | } 134 | -------------------------------------------------------------------------------- /src/redux/actions/file_info.js: -------------------------------------------------------------------------------- 1 | import * as ACTIONS from 'constants/action_types'; 2 | import Lbry from 'lbry'; 3 | import { selectClaimsByUri } from 'redux/selectors/claims'; 4 | import { selectIsFetchingFileList, selectUrisLoading } from 'redux/selectors/file_info'; 5 | 6 | export function doFetchFileInfo(uri) { 7 | return (dispatch, getState) => { 8 | const state = getState(); 9 | const claim = selectClaimsByUri(state)[uri]; 10 | const outpoint = claim ? `${claim.txid}:${claim.nout}` : null; 11 | const alreadyFetching = !!selectUrisLoading(state)[uri]; 12 | 13 | if (!alreadyFetching) { 14 | dispatch({ 15 | type: ACTIONS.FETCH_FILE_INFO_STARTED, 16 | data: { 17 | outpoint, 18 | }, 19 | }); 20 | 21 | Lbry.file_list({ outpoint, full_status: true, page: 1, page_size: 1 }).then(result => { 22 | const { items: fileInfos } = result; 23 | const fileInfo = fileInfos[0]; 24 | 25 | dispatch({ 26 | type: ACTIONS.FETCH_FILE_INFO_COMPLETED, 27 | data: { 28 | outpoint, 29 | fileInfo: fileInfo || null, 30 | }, 31 | }); 32 | }); 33 | } 34 | }; 35 | } 36 | 37 | export function doFileList(page = 1, pageSize = 99999) { 38 | return (dispatch, getState) => { 39 | const state = getState(); 40 | const isFetching = selectIsFetchingFileList(state); 41 | 42 | if (!isFetching) { 43 | dispatch({ 44 | type: ACTIONS.FILE_LIST_STARTED, 45 | }); 46 | 47 | Lbry.file_list({ page, page_size: pageSize }).then(result => { 48 | const { items: fileInfos } = result; 49 | dispatch({ 50 | type: ACTIONS.FILE_LIST_SUCCEEDED, 51 | data: { 52 | fileInfos: fileInfos, 53 | }, 54 | }); 55 | }); 56 | } 57 | }; 58 | } 59 | 60 | export function doFetchFileInfos() { 61 | return (dispatch, getState) => { 62 | const state = getState(); 63 | const isFetchingFileInfo = selectIsFetchingFileList(state); 64 | if (!isFetchingFileInfo) dispatch(doFileList()); 65 | }; 66 | } 67 | 68 | export function doSetFileListSort(page, value) { 69 | return { 70 | type: ACTIONS.SET_FILE_LIST_SORT, 71 | data: { page, value }, 72 | }; 73 | } 74 | -------------------------------------------------------------------------------- /src/redux/actions/notifications.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | import { v4 as uuid } from 'uuid'; 4 | 5 | export function doToast(params: ToastParams) { 6 | if (!params) { 7 | throw Error("'params' object is required to create a toast notification"); 8 | } 9 | 10 | return { 11 | type: ACTIONS.CREATE_TOAST, 12 | data: { 13 | id: uuid(), 14 | params, 15 | }, 16 | }; 17 | } 18 | 19 | export function doDismissToast() { 20 | return { 21 | type: ACTIONS.DISMISS_TOAST, 22 | }; 23 | } 24 | 25 | export function doError(error: string | {}) { 26 | return { 27 | type: ACTIONS.CREATE_ERROR, 28 | data: { 29 | error, 30 | }, 31 | }; 32 | } 33 | 34 | export function doDismissError() { 35 | return { 36 | type: ACTIONS.DISMISS_ERROR, 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /src/redux/actions/sync.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | import Lbry from 'lbry'; 4 | 5 | type SharedData = { 6 | version: '0.1', 7 | value: { 8 | subscriptions?: Array, 9 | following?: Array<{ uri: string, notificationsDisabled: boolean }>, 10 | tags?: Array, 11 | blocked?: Array, 12 | coin_swap_codes?: Array, 13 | settings?: any, 14 | app_welcome_version?: number, 15 | sharing_3P?: boolean, 16 | unpublishedCollections: CollectionGroup, 17 | editedCollections: CollectionGroup, 18 | builtinCollections: CollectionGroup, 19 | savedCollections: Array, 20 | }, 21 | }; 22 | 23 | function extractUserState(rawObj: SharedData) { 24 | if (rawObj && rawObj.version === '0.1' && rawObj.value) { 25 | const { 26 | subscriptions, 27 | following, 28 | tags, 29 | blocked, 30 | coin_swap_codes, 31 | settings, 32 | app_welcome_version, 33 | sharing_3P, 34 | unpublishedCollections, 35 | editedCollections, 36 | builtinCollections, 37 | savedCollections, 38 | } = rawObj.value; 39 | 40 | return { 41 | ...(subscriptions ? { subscriptions } : {}), 42 | ...(following ? { following } : {}), 43 | ...(tags ? { tags } : {}), 44 | ...(blocked ? { blocked } : {}), 45 | ...(coin_swap_codes ? { coin_swap_codes } : {}), 46 | ...(settings ? { settings } : {}), 47 | ...(app_welcome_version ? { app_welcome_version } : {}), 48 | ...(sharing_3P ? { sharing_3P } : {}), 49 | ...(unpublishedCollections ? { unpublishedCollections } : {}), 50 | ...(editedCollections ? { editedCollections } : {}), 51 | ...(builtinCollections ? { builtinCollections } : {}), 52 | ...(savedCollections ? { savedCollections } : {}), 53 | }; 54 | } 55 | 56 | return {}; 57 | } 58 | 59 | export function doPopulateSharedUserState(sharedSettings: any) { 60 | return (dispatch: Dispatch) => { 61 | const { 62 | subscriptions, 63 | following, 64 | tags, 65 | blocked, 66 | coin_swap_codes, 67 | settings, 68 | app_welcome_version, 69 | sharing_3P, 70 | unpublishedCollections, 71 | editedCollections, 72 | builtinCollections, 73 | savedCollections, 74 | } = extractUserState(sharedSettings); 75 | dispatch({ 76 | type: ACTIONS.USER_STATE_POPULATE, 77 | data: { 78 | subscriptions, 79 | following, 80 | tags, 81 | blocked, 82 | coinSwapCodes: coin_swap_codes, 83 | settings, 84 | welcomeVersion: app_welcome_version, 85 | allowAnalytics: sharing_3P, 86 | unpublishedCollections, 87 | editedCollections, 88 | builtinCollections, 89 | savedCollections, 90 | }, 91 | }); 92 | }; 93 | } 94 | 95 | export function doPreferenceSet( 96 | key: string, 97 | value: any, 98 | version: string, 99 | success: Function, 100 | fail: Function 101 | ) { 102 | return (dispatch: Dispatch) => { 103 | const preference = { 104 | type: typeof value, 105 | version, 106 | value, 107 | }; 108 | 109 | const options = { 110 | key, 111 | value: JSON.stringify(preference), 112 | }; 113 | 114 | Lbry.preference_set(options) 115 | .then(() => { 116 | if (success) { 117 | success(preference); 118 | } 119 | }) 120 | .catch(err => { 121 | dispatch({ 122 | type: ACTIONS.SYNC_FATAL_ERROR, 123 | error: err, 124 | }); 125 | 126 | if (fail) { 127 | fail(); 128 | } 129 | }); 130 | }; 131 | } 132 | 133 | export function doPreferenceGet(key: string, success: Function, fail?: Function) { 134 | return (dispatch: Dispatch) => { 135 | const options = { 136 | key, 137 | }; 138 | 139 | return Lbry.preference_get(options) 140 | .then(result => { 141 | if (result) { 142 | const preference = result[key]; 143 | return success(preference); 144 | } 145 | 146 | return success(null); 147 | }) 148 | .catch(err => { 149 | dispatch({ 150 | type: ACTIONS.SYNC_FATAL_ERROR, 151 | error: err, 152 | }); 153 | 154 | if (fail) { 155 | fail(err); 156 | } 157 | }); 158 | }; 159 | } 160 | -------------------------------------------------------------------------------- /src/redux/middleware/shared-state.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import isEqual from 'util/deep-equal'; 3 | import { doPreferenceSet } from 'redux/actions/sync'; 4 | 5 | const RUN_PREFERENCES_DELAY_MS = 2000; 6 | const SHARED_PREFERENCE_VERSION = '0.1'; 7 | let oldShared = {}; 8 | let timeout; 9 | export const buildSharedStateMiddleware = ( 10 | actions: Array, 11 | sharedStateFilters: {}, 12 | sharedStateCb?: any => void 13 | ) => ({ 14 | getState, 15 | dispatch, 16 | }: { 17 | getState: () => { user: any, settings: any }, 18 | dispatch: any => void, 19 | }) => (next: ({}) => void) => (action: { type: string, data: any }) => { 20 | const currentState = getState(); 21 | 22 | // We don't care if sync is disabled here, we always want to backup preferences to the wallet 23 | if (!actions.includes(action.type) || typeof action === 'function') { 24 | return next(action); 25 | } 26 | clearTimeout(timeout); 27 | const actionResult = next(action); 28 | // Call `getState` after calling `next` to ensure the state has updated in response to the action 29 | function runPreferences() { 30 | const nextState: { user: any, settings: any } = getState(); 31 | const syncEnabled = 32 | nextState.settings && 33 | nextState.settings.clientSettings && 34 | nextState.settings.clientSettings.enable_sync; 35 | const hasVerifiedEmail = 36 | nextState.user && nextState.user.user && nextState.user.user.has_verified_email; 37 | const preferenceKey = syncEnabled && hasVerifiedEmail ? 'shared' : 'local'; 38 | const shared = {}; 39 | 40 | Object.keys(sharedStateFilters).forEach(key => { 41 | const filter = sharedStateFilters[key]; 42 | const { source, property, transform } = filter; 43 | let value = nextState[source][property]; 44 | if (transform) { 45 | value = transform(value); 46 | } 47 | 48 | shared[key] = value; 49 | }); 50 | 51 | if (!isEqual(oldShared, shared)) { 52 | // only update if the preference changed from last call in the same session 53 | oldShared = shared; 54 | dispatch(doPreferenceSet(preferenceKey, shared, SHARED_PREFERENCE_VERSION)); 55 | } 56 | 57 | if (sharedStateCb) { 58 | // Pass dispatch to the callback to consumers can dispatch actions in response to preference set 59 | sharedStateCb({ dispatch, getState }); 60 | } 61 | clearTimeout(timeout); 62 | return actionResult; 63 | } 64 | timeout = setTimeout(runPreferences, RUN_PREFERENCES_DELAY_MS); 65 | }; 66 | -------------------------------------------------------------------------------- /src/redux/reducers/blocked.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | import { handleActions } from 'util/redux-utils'; 4 | 5 | const defaultState: BlocklistState = { 6 | blockedChannels: [], 7 | }; 8 | 9 | export const blockedReducer = handleActions( 10 | { 11 | [ACTIONS.TOGGLE_BLOCK_CHANNEL]: ( 12 | state: BlocklistState, 13 | action: BlocklistAction 14 | ): BlocklistState => { 15 | const { blockedChannels } = state; 16 | const { uri } = action.data; 17 | let newBlockedChannels = blockedChannels.slice(); 18 | 19 | if (newBlockedChannels.includes(uri)) { 20 | newBlockedChannels = newBlockedChannels.filter(id => id !== uri); 21 | } else { 22 | newBlockedChannels.push(uri); 23 | } 24 | 25 | return { 26 | blockedChannels: newBlockedChannels, 27 | }; 28 | }, 29 | [ACTIONS.USER_STATE_POPULATE]: ( 30 | state: BlocklistState, 31 | action: { data: { blocked: ?Array } } 32 | ) => { 33 | const { blocked } = action.data; 34 | return { 35 | ...state, 36 | blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels, 37 | }; 38 | }, 39 | }, 40 | defaultState 41 | ); 42 | -------------------------------------------------------------------------------- /src/redux/reducers/content.js: -------------------------------------------------------------------------------- 1 | import * as ACTIONS from 'constants/action_types'; 2 | 3 | const reducers = {}; 4 | const defaultState = { 5 | positions: {}, 6 | }; 7 | 8 | reducers[ACTIONS.SET_CONTENT_POSITION] = (state, action) => { 9 | const { claimId, outpoint, position } = action.data; 10 | return { 11 | ...state, 12 | positions: { 13 | ...state.positions, 14 | [claimId]: { 15 | ...state.positions[claimId], 16 | [outpoint]: position, 17 | }, 18 | }, 19 | }; 20 | }; 21 | 22 | export function contentReducer(state = defaultState, action) { 23 | const handler = reducers[action.type]; 24 | if (handler) return handler(state, action); 25 | return state; 26 | } 27 | -------------------------------------------------------------------------------- /src/redux/reducers/file_info.js: -------------------------------------------------------------------------------- 1 | import * as ACTIONS from 'constants/action_types'; 2 | import * as SORT_OPTIONS from 'constants/sort_options'; 3 | import * as PAGES from 'constants/pages'; 4 | 5 | const reducers = {}; 6 | const defaultState = { 7 | fileListPublishedSort: SORT_OPTIONS.DATE_NEW, 8 | fileListDownloadedSort: SORT_OPTIONS.DATE_NEW, 9 | }; 10 | 11 | reducers[ACTIONS.FILE_LIST_STARTED] = state => 12 | Object.assign({}, state, { 13 | isFetchingFileList: true, 14 | }); 15 | 16 | reducers[ACTIONS.FILE_LIST_SUCCEEDED] = (state, action) => { 17 | const { fileInfos } = action.data; 18 | const newByOutpoint = Object.assign({}, state.byOutpoint); 19 | const pendingByOutpoint = Object.assign({}, state.pendingByOutpoint); 20 | 21 | fileInfos.forEach(fileInfo => { 22 | const { outpoint } = fileInfo; 23 | 24 | if (outpoint) newByOutpoint[fileInfo.outpoint] = fileInfo; 25 | }); 26 | 27 | return Object.assign({}, state, { 28 | isFetchingFileList: false, 29 | byOutpoint: newByOutpoint, 30 | pendingByOutpoint, 31 | }); 32 | }; 33 | 34 | reducers[ACTIONS.FETCH_FILE_INFO_STARTED] = (state, action) => { 35 | const { outpoint } = action.data; 36 | const newFetching = Object.assign({}, state.fetching); 37 | 38 | newFetching[outpoint] = true; 39 | 40 | return Object.assign({}, state, { 41 | fetching: newFetching, 42 | }); 43 | }; 44 | 45 | reducers[ACTIONS.FETCH_FILE_INFO_COMPLETED] = (state, action) => { 46 | const { fileInfo, outpoint } = action.data; 47 | 48 | const newByOutpoint = Object.assign({}, state.byOutpoint); 49 | const newFetching = Object.assign({}, state.fetching); 50 | 51 | newByOutpoint[outpoint] = fileInfo; 52 | delete newFetching[outpoint]; 53 | 54 | return Object.assign({}, state, { 55 | byOutpoint: newByOutpoint, 56 | fetching: newFetching, 57 | }); 58 | }; 59 | 60 | reducers[ACTIONS.FETCH_FILE_INFO_FAILED] = (state, action) => { 61 | const { outpoint } = action.data; 62 | const newFetching = Object.assign({}, state.fetching); 63 | delete newFetching[outpoint]; 64 | 65 | return Object.assign({}, state, { 66 | fetching: newFetching, 67 | }); 68 | }; 69 | 70 | reducers[ACTIONS.DOWNLOADING_STARTED] = (state, action) => { 71 | const { uri, outpoint, fileInfo } = action.data; 72 | 73 | const newByOutpoint = Object.assign({}, state.byOutpoint); 74 | const newDownloading = Object.assign({}, state.downloadingByOutpoint); 75 | 76 | newDownloading[outpoint] = true; 77 | newByOutpoint[outpoint] = fileInfo; 78 | 79 | return Object.assign({}, state, { 80 | downloadingByOutpoint: newDownloading, 81 | byOutpoint: newByOutpoint, 82 | }); 83 | }; 84 | 85 | reducers[ACTIONS.DOWNLOADING_PROGRESSED] = (state, action) => { 86 | const { outpoint, fileInfo } = action.data; 87 | 88 | const newByOutpoint = Object.assign({}, state.byOutpoint); 89 | const newDownloading = Object.assign({}, state.downloadingByOutpoint); 90 | 91 | newByOutpoint[outpoint] = fileInfo; 92 | newDownloading[outpoint] = true; 93 | 94 | return Object.assign({}, state, { 95 | byOutpoint: newByOutpoint, 96 | downloadingByOutpoint: newDownloading, 97 | }); 98 | }; 99 | 100 | reducers[ACTIONS.DOWNLOADING_CANCELED] = (state, action) => { 101 | const { uri, outpoint } = action.data; 102 | 103 | const newDownloading = Object.assign({}, state.downloadingByOutpoint); 104 | delete newDownloading[outpoint]; 105 | 106 | return Object.assign({}, state, { 107 | downloadingByOutpoint: newDownloading, 108 | }); 109 | }; 110 | 111 | reducers[ACTIONS.DOWNLOADING_COMPLETED] = (state, action) => { 112 | const { outpoint, fileInfo } = action.data; 113 | 114 | const newByOutpoint = Object.assign({}, state.byOutpoint); 115 | const newDownloading = Object.assign({}, state.downloadingByOutpoint); 116 | 117 | newByOutpoint[outpoint] = fileInfo; 118 | delete newDownloading[outpoint]; 119 | 120 | return Object.assign({}, state, { 121 | byOutpoint: newByOutpoint, 122 | downloadingByOutpoint: newDownloading, 123 | }); 124 | }; 125 | 126 | reducers[ACTIONS.FILE_DELETE] = (state, action) => { 127 | const { outpoint } = action.data; 128 | 129 | const newByOutpoint = Object.assign({}, state.byOutpoint); 130 | const downloadingByOutpoint = Object.assign({}, state.downloadingByOutpoint); 131 | 132 | delete newByOutpoint[outpoint]; 133 | delete downloadingByOutpoint[outpoint]; 134 | 135 | return Object.assign({}, state, { 136 | byOutpoint: newByOutpoint, 137 | downloadingByOutpoint, 138 | }); 139 | }; 140 | 141 | reducers[ACTIONS.SET_FILE_LIST_SORT] = (state, action) => { 142 | const pageSortStates = { 143 | [PAGES.PUBLISHED]: 'fileListPublishedSort', 144 | [PAGES.DOWNLOADED]: 'fileListDownloadedSort', 145 | }; 146 | const pageSortState = pageSortStates[action.data.page]; 147 | const { value } = action.data; 148 | 149 | return Object.assign({}, state, { 150 | [pageSortState]: value, 151 | }); 152 | }; 153 | 154 | export function fileInfoReducer(state = defaultState, action) { 155 | const handler = reducers[action.type]; 156 | if (handler) return handler(state, action); 157 | return state; 158 | } 159 | -------------------------------------------------------------------------------- /src/redux/reducers/notifications.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import * as ACTIONS from 'constants/action_types'; 3 | import { handleActions } from 'util/redux-utils'; 4 | 5 | const defaultState: NotificationState = { 6 | notifications: [], 7 | toasts: [], 8 | errors: [], 9 | }; 10 | 11 | const notificationsReducer = handleActions( 12 | { 13 | // Toasts 14 | [ACTIONS.CREATE_TOAST]: (state: NotificationState, action: DoToast) => { 15 | const toast: Toast = action.data; 16 | const newToasts: Array = state.toasts.slice(); 17 | newToasts.push(toast); 18 | 19 | return { 20 | ...state, 21 | toasts: newToasts, 22 | }; 23 | }, 24 | [ACTIONS.DISMISS_TOAST]: (state: NotificationState) => { 25 | const newToasts: Array = state.toasts.slice(); 26 | newToasts.shift(); 27 | 28 | return { 29 | ...state, 30 | toasts: newToasts, 31 | }; 32 | }, 33 | 34 | // Notifications 35 | [ACTIONS.CREATE_NOTIFICATION]: (state: NotificationState, action: DoNotification) => { 36 | const notification: Notification = action.data; 37 | const newNotifications: Array = state.notifications.slice(); 38 | newNotifications.push(notification); 39 | 40 | return { 41 | ...state, 42 | notifications: newNotifications, 43 | }; 44 | }, 45 | // Used to mark notifications as read/dismissed 46 | [ACTIONS.EDIT_NOTIFICATION]: (state: NotificationState, action: DoEditNotification) => { 47 | const { notification } = action.data; 48 | let notifications: Array = state.notifications.slice(); 49 | 50 | notifications = notifications.map(pastNotification => 51 | pastNotification.id === notification.id ? notification : pastNotification 52 | ); 53 | 54 | return { 55 | ...state, 56 | notifications, 57 | }; 58 | }, 59 | [ACTIONS.DELETE_NOTIFICATION]: (state: NotificationState, action: DoDeleteNotification) => { 60 | const { id } = action.data; 61 | let newNotifications: Array = state.notifications.slice(); 62 | newNotifications = newNotifications.filter(notification => notification.id !== id); 63 | 64 | return { 65 | ...state, 66 | notifications: newNotifications, 67 | }; 68 | }, 69 | 70 | // Errors 71 | [ACTIONS.CREATE_ERROR]: (state: NotificationState, action: DoError) => { 72 | const error: ErrorNotification = action.data; 73 | const newErrors: Array = state.errors.slice(); 74 | newErrors.push(error); 75 | 76 | return { 77 | ...state, 78 | errors: newErrors, 79 | }; 80 | }, 81 | [ACTIONS.DISMISS_ERROR]: (state: NotificationState) => { 82 | const newErrors: Array = state.errors.slice(); 83 | newErrors.shift(); 84 | 85 | return { 86 | ...state, 87 | errors: newErrors, 88 | }; 89 | }, 90 | }, 91 | defaultState 92 | ); 93 | 94 | export { notificationsReducer }; 95 | -------------------------------------------------------------------------------- /src/redux/reducers/publish.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { handleActions } from 'util/redux-utils'; 3 | import { buildURI } from 'lbryURI'; 4 | import * as ACTIONS from 'constants/action_types'; 5 | import * as THUMBNAIL_STATUSES from 'constants/thumbnail_upload_statuses'; 6 | import { CHANNEL_ANONYMOUS } from 'constants/claim'; 7 | 8 | type PublishState = { 9 | editingURI: ?string, 10 | fileText: ?string, 11 | filePath: ?string, 12 | remoteFileUrl: ?string, 13 | contentIsFree: boolean, 14 | fileDur: number, 15 | fileSize: number, 16 | fileVid: boolean, 17 | fee: { 18 | amount: number, 19 | currency: string, 20 | }, 21 | title: string, 22 | thumbnail_url: string, 23 | thumbnailPath: string, 24 | uploadThumbnailStatus: string, 25 | thumbnailError: ?boolean, 26 | description: string, 27 | language: string, 28 | releaseTime: ?number, 29 | releaseTimeEdited: ?number, 30 | channel: string, 31 | channelId: ?string, 32 | name: string, 33 | nameError: ?string, 34 | bid: number, 35 | bidError: ?string, 36 | otherLicenseDescription: string, 37 | licenseUrl: string, 38 | tags: Array, 39 | optimize: boolean, 40 | useLBRYUploader: boolean, 41 | }; 42 | 43 | const defaultState: PublishState = { 44 | editingURI: undefined, 45 | fileText: '', 46 | filePath: undefined, 47 | fileDur: 0, 48 | fileSize: 0, 49 | fileVid: false, 50 | remoteFileUrl: undefined, 51 | contentIsFree: true, 52 | fee: { 53 | amount: 1, 54 | currency: 'LBC', 55 | }, 56 | title: '', 57 | thumbnail_url: '', 58 | thumbnailPath: '', 59 | uploadThumbnailStatus: THUMBNAIL_STATUSES.API_DOWN, 60 | thumbnailError: undefined, 61 | description: '', 62 | language: '', 63 | releaseTime: undefined, 64 | releaseTimeEdited: undefined, 65 | nsfw: false, 66 | channel: CHANNEL_ANONYMOUS, 67 | channelId: '', 68 | name: '', 69 | nameError: undefined, 70 | bid: 0.01, 71 | bidError: undefined, 72 | licenseType: 'None', 73 | otherLicenseDescription: 'All rights reserved', 74 | licenseUrl: '', 75 | tags: [], 76 | publishing: false, 77 | publishSuccess: false, 78 | publishError: undefined, 79 | optimize: false, 80 | useLBRYUploader: false, 81 | }; 82 | 83 | export const publishReducer = handleActions( 84 | { 85 | [ACTIONS.UPDATE_PUBLISH_FORM]: (state, action): PublishState => { 86 | const { data } = action; 87 | return { 88 | ...state, 89 | ...data, 90 | }; 91 | }, 92 | [ACTIONS.CLEAR_PUBLISH]: (state: PublishState): PublishState => ({ 93 | ...defaultState, 94 | uri: undefined, 95 | channel: state.channel, 96 | bid: state.bid, 97 | optimize: state.optimize, 98 | language: state.language, 99 | }), 100 | [ACTIONS.PUBLISH_START]: (state: PublishState): PublishState => ({ 101 | ...state, 102 | publishing: true, 103 | publishSuccess: false, 104 | }), 105 | [ACTIONS.PUBLISH_FAIL]: (state: PublishState): PublishState => ({ 106 | ...state, 107 | publishing: false, 108 | }), 109 | [ACTIONS.PUBLISH_SUCCESS]: (state: PublishState): PublishState => ({ 110 | ...state, 111 | publishing: false, 112 | publishSuccess: true, 113 | }), 114 | [ACTIONS.DO_PREPARE_EDIT]: (state: PublishState, action) => { 115 | const { ...publishData } = action.data; 116 | const { channel, name, uri } = publishData; 117 | 118 | // The short uri is what is presented to the user 119 | // The editingUri is the full uri with claim id 120 | const shortUri = buildURI({ 121 | channelName: channel, 122 | streamName: name, 123 | }); 124 | 125 | return { 126 | ...defaultState, 127 | ...publishData, 128 | editingURI: uri, 129 | uri: shortUri, 130 | }; 131 | }, 132 | }, 133 | defaultState 134 | ); 135 | -------------------------------------------------------------------------------- /src/redux/selectors/blocked.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { createSelector } from 'reselect'; 3 | 4 | const selectState = (state: { blocked: BlocklistState }) => state.blocked || {}; 5 | 6 | export const selectBlockedChannels = createSelector( 7 | selectState, 8 | (state: BlocklistState) => state.blockedChannels 9 | ); 10 | 11 | export const selectBlockedChannelsCount = createSelector( 12 | selectBlockedChannels, 13 | (state: Array) => state.length 14 | ); 15 | 16 | export const selectChannelIsBlocked = (uri: string) => 17 | createSelector( 18 | selectBlockedChannels, 19 | (state: Array) => { 20 | return state.includes(uri); 21 | } 22 | ); 23 | -------------------------------------------------------------------------------- /src/redux/selectors/content.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { createSelector } from 'reselect'; 3 | import { makeSelectClaimForUri } from 'redux/selectors/claims'; 4 | 5 | export const selectState = (state: any) => state.content || {}; 6 | 7 | export const makeSelectContentPositionForUri = (uri: string) => 8 | createSelector( 9 | selectState, 10 | makeSelectClaimForUri(uri), 11 | (state, claim) => { 12 | if (!claim) { 13 | return null; 14 | } 15 | const outpoint = `${claim.txid}:${claim.nout}`; 16 | const id = claim.claim_id; 17 | return state.positions[id] ? state.positions[id][outpoint] : null; 18 | } 19 | ); 20 | -------------------------------------------------------------------------------- /src/redux/selectors/notifications.js: -------------------------------------------------------------------------------- 1 | import { createSelector } from 'reselect'; 2 | 3 | export const selectState = state => state.notifications || {}; 4 | 5 | export const selectToast = createSelector( 6 | selectState, 7 | state => { 8 | if (state.toasts.length) { 9 | const { id, params } = state.toasts[0]; 10 | return { 11 | id, 12 | ...params, 13 | }; 14 | } 15 | 16 | return null; 17 | } 18 | ); 19 | 20 | export const selectError = createSelector( 21 | selectState, 22 | state => { 23 | if (state.errors.length) { 24 | const { error } = state.errors[0]; 25 | return { 26 | error, 27 | }; 28 | } 29 | 30 | return null; 31 | } 32 | ); 33 | -------------------------------------------------------------------------------- /src/redux/selectors/publish.js: -------------------------------------------------------------------------------- 1 | import { createSelector } from 'reselect'; 2 | import { buildURI, parseURI } from 'lbryURI'; 3 | import { 4 | selectClaimsById, 5 | selectMyClaimsWithoutChannels, 6 | selectResolvingUris, 7 | selectClaimsByUri, 8 | } from 'redux/selectors/claims'; 9 | 10 | const selectState = state => state.publish || {}; 11 | 12 | // Is the current uri the same as the uri they clicked "edit" on 13 | export const selectIsStillEditing = createSelector( 14 | selectState, 15 | publishState => { 16 | const { editingURI, uri } = publishState; 17 | 18 | if (!editingURI || !uri) { 19 | return false; 20 | } 21 | 22 | const { 23 | isChannel: currentIsChannel, 24 | streamName: currentClaimName, 25 | channelName: currentContentName, 26 | } = parseURI(uri); 27 | const { 28 | isChannel: editIsChannel, 29 | streamName: editClaimName, 30 | channelName: editContentName, 31 | } = parseURI(editingURI); 32 | 33 | // Depending on the previous/current use of a channel, we need to compare different things 34 | // ex: going from a channel to anonymous, the new uri won't return contentName, so we need to use claimName 35 | const currentName = currentIsChannel ? currentContentName : currentClaimName; 36 | const editName = editIsChannel ? editContentName : editClaimName; 37 | return currentName === editName; 38 | } 39 | ); 40 | 41 | export const selectPublishFormValues = createSelector( 42 | selectState, 43 | state => state.settings, 44 | selectIsStillEditing, 45 | (publishState, settingsState, isStillEditing) => { 46 | const { languages, ...formValues } = publishState; 47 | const language = languages && languages.length && languages[0]; 48 | const { clientSettings } = settingsState; 49 | const { language: languageSet } = clientSettings; 50 | 51 | let actualLanguage; 52 | // Sets default if editing a claim with a set language 53 | if (!language && isStillEditing && languageSet) { 54 | actualLanguage = languageSet; 55 | } else { 56 | actualLanguage = language || languageSet || 'en'; 57 | } 58 | 59 | return { ...formValues, language: actualLanguage }; 60 | } 61 | ); 62 | 63 | export const makeSelectPublishFormValue = item => 64 | createSelector( 65 | selectState, 66 | state => state[item] 67 | ); 68 | 69 | export const selectMyClaimForUri = createSelector( 70 | selectPublishFormValues, 71 | selectIsStillEditing, 72 | selectClaimsById, 73 | selectMyClaimsWithoutChannels, 74 | ({ editingURI, uri }, isStillEditing, claimsById, myClaims) => { 75 | const { channelName: contentName, streamName: claimName } = parseURI(uri); 76 | const { streamClaimId: editClaimId } = parseURI(editingURI); 77 | 78 | // If isStillEditing 79 | // They clicked "edit" from the file page 80 | // They haven't changed the channel/name after clicking edit 81 | // Get the claim so they can edit without re-uploading a new file 82 | return isStillEditing 83 | ? claimsById[editClaimId] 84 | : myClaims.find(claim => 85 | !contentName 86 | ? claim.name === claimName 87 | : claim.name === contentName || claim.name === claimName 88 | ); 89 | } 90 | ); 91 | 92 | export const selectIsResolvingPublishUris = createSelector( 93 | selectState, 94 | selectResolvingUris, 95 | ({ uri, name }, resolvingUris) => { 96 | if (uri) { 97 | const isResolvingUri = resolvingUris.includes(uri); 98 | const { isChannel } = parseURI(uri); 99 | 100 | let isResolvingShortUri; 101 | if (isChannel && name) { 102 | const shortUri = buildURI({ streamName: name }); 103 | isResolvingShortUri = resolvingUris.includes(shortUri); 104 | } 105 | 106 | return isResolvingUri || isResolvingShortUri; 107 | } 108 | 109 | return false; 110 | } 111 | ); 112 | 113 | export const selectTakeOverAmount = createSelector( 114 | selectState, 115 | selectMyClaimForUri, 116 | selectClaimsByUri, 117 | ({ name }, myClaimForUri, claimsByUri) => { 118 | if (!name) { 119 | return null; 120 | } 121 | 122 | // We only care about the winning claim for the short uri 123 | const shortUri = buildURI({ streamName: name }); 124 | const claimForShortUri = claimsByUri[shortUri]; 125 | 126 | if (!myClaimForUri && claimForShortUri) { 127 | return claimForShortUri.meta.effective_amount; 128 | } else if (myClaimForUri && claimForShortUri) { 129 | // https://github.com/lbryio/lbry/issues/1476 130 | // We should check the current effective_amount on my claim to see how much additional lbc 131 | // is needed to win the claim. Currently this is not possible during a takeover. 132 | // With this, we could say something like, "You have x lbc in support, if you bid y additional LBC you will control the claim" 133 | // For now just ignore supports. We will just show the winning claim's bid amount 134 | return claimForShortUri.meta.effective_amount || claimForShortUri.amount; 135 | } 136 | 137 | return null; 138 | } 139 | ); 140 | -------------------------------------------------------------------------------- /src/util/batch-actions.js: -------------------------------------------------------------------------------- 1 | // https://github.com/reactjs/redux/issues/911 2 | export function batchActions(...actions) { 3 | return { 4 | type: 'BATCH_ACTIONS', 5 | actions, 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /src/util/claim.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | import { MATURE_TAGS } from 'constants/tags'; 3 | 4 | const matureTagMap = MATURE_TAGS.reduce((acc, tag) => ({ ...acc, [tag]: true }), {}); 5 | 6 | export const isClaimNsfw = (claim: Claim): boolean => { 7 | if (!claim) { 8 | throw new Error('No claim passed to isClaimNsfw()'); 9 | } 10 | 11 | if (!claim.value) { 12 | return false; 13 | } 14 | 15 | const tags = claim.value.tags || []; 16 | for (let i = 0; i < tags.length; i += 1) { 17 | const tag = tags[i].toLowerCase(); 18 | if (matureTagMap[tag]) { 19 | return true; 20 | } 21 | } 22 | 23 | return false; 24 | }; 25 | 26 | export function createNormalizedClaimSearchKey(options: { page: number, release_time?: string }) { 27 | // Ignore page because we don't care what the last page searched was, we want everything 28 | // Ignore release_time because that will change depending on when you call claim_search ex: release_time: ">12344567" 29 | const { page: optionToIgnoreForQuery, release_time: anotherToIgnore, ...rest } = options; 30 | const query = JSON.stringify(rest); 31 | return query; 32 | } 33 | 34 | export function concatClaims( 35 | claimList: Array = [], 36 | concatClaimList: Array = [] 37 | ): Array { 38 | if (!claimList || claimList.length === 0) { 39 | if (!concatClaimList) { 40 | return []; 41 | } 42 | return concatClaimList.slice(); 43 | } 44 | 45 | const claims = claimList.slice(); 46 | concatClaimList.forEach(claim => { 47 | if (!claims.some(item => item.claim_id === claim.claim_id)) { 48 | claims.push(claim); 49 | } 50 | }); 51 | 52 | return claims; 53 | } 54 | 55 | export function filterClaims(claims: Array, query: ?string): Array { 56 | if (query) { 57 | const queryMatchRegExp = new RegExp(query, 'i'); 58 | return claims.filter(claim => { 59 | const { value } = claim; 60 | 61 | return ( 62 | (value.title && value.title.match(queryMatchRegExp)) || 63 | (claim.signing_channel && claim.signing_channel.name.match(queryMatchRegExp)) || 64 | (claim.name && claim.name.match(queryMatchRegExp)) 65 | ); 66 | }); 67 | } 68 | 69 | return claims; 70 | } 71 | -------------------------------------------------------------------------------- /src/util/debounce.js: -------------------------------------------------------------------------------- 1 | // Returns a function, that, as long as it continues to be invoked, will not 2 | // be triggered. The function will be called after it stops being called for 3 | // N milliseconds. If `immediate` is passed, trigger the function on the 4 | // leading edge, instead of the trailing. 5 | export default function debouce(func, wait, immediate) { 6 | let timeout; 7 | 8 | return function() { 9 | const context = this; 10 | const args = arguments; 11 | const later = () => { 12 | timeout = null; 13 | if (!immediate) func.apply(context, args); 14 | }; 15 | 16 | const callNow = immediate && !timeout; 17 | clearTimeout(timeout); 18 | timeout = setTimeout(later, wait); 19 | if (callNow) func.apply(context, args); 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /src/util/deep-equal.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | // underscore's deep equal function 3 | // https://github.com/jashkenas/underscore/blob/master/underscore.js#L1189 4 | 5 | export default function isEqual(a, b, aStack, bStack) { 6 | // Identical objects are equal. `0 === -0`, but they aren't identical. 7 | // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). 8 | if (a === b) return a !== 0 || 1 / a === 1 / b; 9 | // `null` or `undefined` only equal to itself (strict comparison). 10 | if (a == null || b == null) return false; 11 | // `NaN`s are equivalent, but non-reflexive. 12 | if (a !== a) return b !== b; 13 | // Exhaust primitive checks 14 | var type = typeof a; 15 | if (type !== 'function' && type !== 'object' && typeof b != 'object') return false; 16 | return deepEq(a, b, aStack, bStack); 17 | } 18 | 19 | function deepEq(a, b, aStack, bStack) { 20 | // Compare `[[Class]]` names. 21 | var className = toString.call(a); 22 | if (className !== toString.call(b)) return false; 23 | switch (className) { 24 | // Strings, numbers, regular expressions, dates, and booleans are compared by value. 25 | case '[object RegExp]': 26 | // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') 27 | case '[object String]': 28 | // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is 29 | // equivalent to `new String("5")`. 30 | return '' + a === '' + b; 31 | case '[object Number]': 32 | // `NaN`s are equivalent, but non-reflexive. 33 | // Object(NaN) is equivalent to NaN. 34 | if (+a !== +a) return +b !== +b; 35 | // An `egal` comparison is performed for other numeric values. 36 | return +a === 0 ? 1 / +a === 1 / b : +a === +b; 37 | case '[object Date]': 38 | case '[object Boolean]': 39 | // Coerce dates and booleans to numeric primitive values. Dates are compared by their 40 | // millisecond representations. Note that invalid dates with millisecond representations 41 | // of `NaN` are not equivalent. 42 | return +a === +b; 43 | case '[object Symbol]': 44 | return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b); 45 | } 46 | 47 | var areArrays = className === '[object Array]'; 48 | if (!areArrays) { 49 | if (typeof a != 'object' || typeof b != 'object') return false; 50 | 51 | // Objects with different constructors are not equivalent, but `Object`s or `Array`s 52 | // from different frames are. 53 | var aCtor = a.constructor, 54 | bCtor = b.constructor; 55 | if ( 56 | aCtor !== bCtor && 57 | !( 58 | typeof aCtor === 'function' && 59 | aCtor instanceof aCtor && 60 | typeof bCtor === 'function' && 61 | bCtor instanceof bCtor 62 | ) && 63 | ('constructor' in a && 'constructor' in b) 64 | ) { 65 | return false; 66 | } 67 | } 68 | // Assume equality for cyclic structures. The algorithm for detecting cyclic 69 | // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. 70 | 71 | // Initializing stack of traversed objects. 72 | // It's done here since we only need them for objects and arrays comparison. 73 | aStack = aStack || []; 74 | bStack = bStack || []; 75 | var length = aStack.length; 76 | while (length--) { 77 | // Linear search. Performance is inversely proportional to the number of 78 | // unique nested structures. 79 | if (aStack[length] === a) return bStack[length] === b; 80 | } 81 | 82 | // Add the first object to the stack of traversed objects. 83 | aStack.push(a); 84 | bStack.push(b); 85 | 86 | // Recursively compare objects and arrays. 87 | if (areArrays) { 88 | // Compare array lengths to determine if a deep comparison is necessary. 89 | length = a.length; 90 | if (length !== b.length) return false; 91 | // Deep compare the contents, ignoring non-numeric properties. 92 | while (length--) { 93 | if (!isEqual(a[length], b[length], aStack, bStack)) return false; 94 | } 95 | } else { 96 | // Deep compare objects. 97 | var keys = Object.keys(a), 98 | key; 99 | length = keys.length; 100 | // Ensure that both objects contain the same number of properties before comparing deep equality. 101 | if (Object.keys(b).length !== length) return false; 102 | while (length--) { 103 | // Deep compare each member 104 | key = keys[length]; 105 | if (!(has(b, key) && isEqual(a[key], b[key], aStack, bStack))) return false; 106 | } 107 | } 108 | // Remove the first object from the stack of traversed objects. 109 | aStack.pop(); 110 | bStack.pop(); 111 | return true; 112 | } 113 | 114 | function has(obj, path) { 115 | return obj != null && hasOwnProperty.call(obj, path); 116 | } 117 | /* eslint-enable */ 118 | -------------------------------------------------------------------------------- /src/util/format-credits.js: -------------------------------------------------------------------------------- 1 | function numberWithCommas(x) { 2 | var parts = x.toString().split('.'); 3 | parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ','); 4 | return parts.join('.'); 5 | } 6 | 7 | export function formatCredits(amount, precision, shortFormat = false) { 8 | let actualAmount = parseFloat(amount); 9 | let actualPrecision = parseFloat(precision); 10 | let suffix = ''; 11 | 12 | if (Number.isNaN(actualAmount) || actualAmount === 0) return '0'; 13 | 14 | if (actualAmount >= 1000000) { 15 | if (precision <= 7) { 16 | if (shortFormat) { 17 | actualAmount = actualAmount / 1000000; 18 | suffix = 'M'; 19 | } else { 20 | actualPrecision -= 7; 21 | } 22 | } 23 | } else if (actualAmount >= 1000) { 24 | if (precision <= 4) { 25 | if (shortFormat) { 26 | actualAmount = actualAmount / 1000; 27 | suffix = 'K'; 28 | } else { 29 | actualPrecision -= 4; 30 | } 31 | } 32 | } 33 | 34 | return ( 35 | numberWithCommas( 36 | actualAmount.toFixed(actualPrecision >= 0 ? actualPrecision : 1).replace(/\.*0+$/, '') 37 | ) + suffix 38 | ); 39 | } 40 | 41 | export function formatFullPrice(amount, precision = 1) { 42 | let formated = ''; 43 | 44 | const quantity = amount.toString().split('.'); 45 | const fraction = quantity[1]; 46 | 47 | if (fraction) { 48 | const decimals = fraction.split(''); 49 | const first = decimals.filter(number => number !== '0')[0]; 50 | const index = decimals.indexOf(first); 51 | 52 | // Set format fraction 53 | formated = `.${fraction.substring(0, index + precision)}`; 54 | } 55 | 56 | return parseFloat(quantity[0] + formated); 57 | } 58 | 59 | export function creditsToString(amount) { 60 | const creditString = parseFloat(amount).toFixed(8); 61 | return creditString; 62 | } 63 | -------------------------------------------------------------------------------- /src/util/handle-fetch.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | export default function handleFetchResponse(response: Response): Promise { 3 | return response.status === 200 4 | ? Promise.resolve(response.json()) 5 | : Promise.reject(new Error(response.statusText)); 6 | } 7 | -------------------------------------------------------------------------------- /src/util/merge-claim.js: -------------------------------------------------------------------------------- 1 | /* 2 | new claim = { ...maybeResolvedClaim, ...pendingClaim, meta: maybeResolvedClaim['meta'] } 3 | */ 4 | 5 | export default function mergeClaims(maybeResolved, pending){ 6 | return { ...maybeResolved, ...pending, meta: maybeResolved.meta }; 7 | } 8 | -------------------------------------------------------------------------------- /src/util/parse-data.js: -------------------------------------------------------------------------------- 1 | // JSON parser 2 | const parseJson = (data, filters = []) => { 3 | const list = data.map(item => { 4 | const temp = {}; 5 | // Apply filters 6 | Object.entries(item).forEach(([key, value]) => { 7 | if (!filters.includes(key)) temp[key] = value; 8 | }); 9 | return temp; 10 | }); 11 | // Beautify JSON 12 | return JSON.stringify(list, null, '\t'); 13 | }; 14 | 15 | // CSV Parser 16 | // No need for an external module: 17 | // https://gist.github.com/btzr-io/55c3450ea3d709fc57540e762899fb85 18 | const parseCsv = (data, filters = []) => { 19 | // Get items for header 20 | const getHeaders = item => { 21 | const list = []; 22 | // Apply filters 23 | Object.entries(item).forEach(([key]) => { 24 | if (!filters.includes(key)) list.push(key); 25 | }); 26 | // return headers 27 | return list.join(','); 28 | }; 29 | 30 | // Get rows content 31 | const getData = list => 32 | list 33 | .map(item => { 34 | const row = []; 35 | // Apply filters 36 | Object.entries(item).forEach(([key, value]) => { 37 | if (!filters.includes(key)) row.push(value); 38 | }); 39 | // return rows 40 | return row.join(','); 41 | }) 42 | .join('\n'); 43 | 44 | // Return CSV string 45 | return `${getHeaders(data[0])} \n ${getData(data)}`; 46 | }; 47 | 48 | const parseData = (data, format, filters = []) => { 49 | // Check for validation 50 | const valid = data && data[0] && format; 51 | // Pick a format 52 | const formats = { 53 | csv: list => parseCsv(list, filters), 54 | json: list => parseJson(list, filters), 55 | }; 56 | 57 | // Return parsed data: JSON || CSV 58 | return valid && formats[format] ? formats[format](data) : undefined; 59 | }; 60 | 61 | export default parseData; 62 | -------------------------------------------------------------------------------- /src/util/query-params.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export function parseQueryParams(queryString: string) { 4 | if (queryString === '') return {}; 5 | const parts = queryString 6 | .split('?') 7 | .pop() 8 | .split('&') 9 | .map(p => p.split('=')); 10 | 11 | const params = {}; 12 | parts.forEach(array => { 13 | const [first, second] = array; 14 | params[first] = second; 15 | }); 16 | return params; 17 | } 18 | 19 | export function toQueryString(params: { [string]: string | number }) { 20 | if (!params) return ''; 21 | 22 | const parts = []; 23 | Object.keys(params).forEach(key => { 24 | if (Object.prototype.hasOwnProperty.call(params, key) && params[key]) { 25 | parts.push(`${key}=${params[key]}`); 26 | } 27 | }); 28 | 29 | return parts.join('&'); 30 | } 31 | -------------------------------------------------------------------------------- /src/util/redux-utils.js: -------------------------------------------------------------------------------- 1 | // util for creating reducers 2 | // based off of redux-actions 3 | // https://redux-actions.js.org/docs/api/handleAction.html#handleactions 4 | 5 | // eslint-disable-next-line import/prefer-default-export 6 | export const handleActions = (actionMap, defaultState) => (state = defaultState, action) => { 7 | const handler = actionMap[action.type]; 8 | 9 | if (handler) { 10 | const newState = handler(state, action); 11 | return Object.assign({}, state, newState); 12 | } 13 | 14 | // just return the original state if no handler 15 | // returning a copy here breaks redux-persist 16 | return state; 17 | }; 18 | -------------------------------------------------------------------------------- /tests/config/jest-transformer.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | babelrc: false, 3 | presets: [ 4 | [ 5 | "@babel/env", 6 | { 7 | modules: false 8 | } 9 | ], 10 | "@babel/react" 11 | ], 12 | plugins: [ 13 | ["@babel/plugin-proposal-decorators", { legacy: true }], 14 | ["@babel/plugin-proposal-class-properties", { loose: true }], 15 | "@babel/plugin-transform-flow-strip-types", 16 | "transform-es2015-modules-commonjs" 17 | ] 18 | }; 19 | module.exports = require("babel-jest").createTransformer(config); 20 | -------------------------------------------------------------------------------- /tests/parseURI.test.js: -------------------------------------------------------------------------------- 1 | import * as lbryURI from '../src/lbryURI.js'; 2 | import {describe, test} from "@jest/globals"; 3 | 4 | describe('parseURI tests', () => { 5 | 6 | test('Correctly parses channel URI', () => { 7 | let result = lbryURI.parseURI('lbry://@ChannelName'); 8 | expect(result.isChannel).toBeTruthy(); 9 | expect(result.path).toStrictEqual("@ChannelName"); 10 | expect(result.channelName).toStrictEqual("ChannelName"); 11 | expect(result.claimName).toStrictEqual("@ChannelName"); 12 | }); 13 | 14 | test('Correctly parses test case channel/stream lbry URI', () => { 15 | let result = lbryURI.parseURI('lbry://@CryptoGnome#1/whale-pool-how-to#e'); 16 | expect(result.isChannel).toStrictEqual(false);; 17 | expect(result.path).toStrictEqual("@CryptoGnome#1/whale-pool-how-to#e"); 18 | expect(result.claimId).toStrictEqual("1"); 19 | expect(result.streamClaimId).toStrictEqual("e"); 20 | expect(result.streamName).toStrictEqual("whale-pool-how-to"); 21 | expect(result.channelName).toStrictEqual("CryptoGnome"); 22 | expect(result.contentName).toStrictEqual("whale-pool-how-to"); 23 | }); 24 | 25 | test('Correctly parses lbry URI without protocol', () => { 26 | let result = lbryURI.parseURI('@CryptoGnome#1/whale-pool-how-to#e'); 27 | expect(result.isChannel).toStrictEqual(false);; 28 | expect(result.streamName).toStrictEqual("whale-pool-how-to"); 29 | expect(result.channelName).toStrictEqual("CryptoGnome"); 30 | }); 31 | 32 | test('Throws error for http protocol', () => { 33 | // TODO - this catches wrong type of error.. 34 | let uri = 'http://@CryptoGnome#1/whale-pool-how-to#e'; 35 | expect(() => lbryURI.parseURI(uri)).toThrowError(); 36 | }); 37 | 38 | test('Correctly parses search', () => { 39 | let result = lbryURI.parseURI('CryptoGn%ome'); 40 | expect(result.isChannel).toStrictEqual(false); 41 | expect(result.path).toStrictEqual("CryptoGn%ome"); 42 | expect(result.contentName).toStrictEqual("CryptoGn%ome"); 43 | }); 44 | }) 45 | --------------------------------------------------------------------------------