mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-11-04 06:49:31 +00:00 
			
		
		
		
	Updated
This commit is contained in:
		
							
								
								
									
										523
									
								
								node_modules/@google-cloud/storage/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										523
									
								
								node_modules/@google-cloud/storage/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,523 @@
 | 
			
		||||
# Changelog
 | 
			
		||||
 | 
			
		||||
[npm history][1]
 | 
			
		||||
 | 
			
		||||
[1]: https://www.npmjs.com/package/nodejs-storage?activeTab=versions
 | 
			
		||||
 | 
			
		||||
### [3.2.1](https://www.github.com/googleapis/nodejs-storage/compare/v3.2.0...v3.2.1) (2019-08-28)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* **docs:** stop redirecting reference docs to anchor, add new sample to README ([bbb5537](https://www.github.com/googleapis/nodejs-storage/commit/bbb5537))
 | 
			
		||||
* **samples:** fix failing sample view IAM member-role groups ([1c4f21f](https://www.github.com/googleapis/nodejs-storage/commit/1c4f21f))
 | 
			
		||||
 | 
			
		||||
## [3.2.0](https://www.github.com/googleapis/nodejs-storage/compare/v3.1.0...v3.2.0) (2019-08-22)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* **deps:** update @google-cloud/common with fixes for http ([#809](https://www.github.com/googleapis/nodejs-storage/issues/809)) ([8598631](https://www.github.com/googleapis/nodejs-storage/commit/8598631))
 | 
			
		||||
* **deps:** update dependency @google-cloud/pubsub to ^0.31.0 ([#814](https://www.github.com/googleapis/nodejs-storage/issues/814)) ([604e564](https://www.github.com/googleapis/nodejs-storage/commit/604e564))
 | 
			
		||||
* **deps:** update dependency date-and-time to ^0.9.0 ([#805](https://www.github.com/googleapis/nodejs-storage/issues/805)) ([8739a7d](https://www.github.com/googleapis/nodejs-storage/commit/8739a7d))
 | 
			
		||||
* **ts:** fix nock @~11.0.0 ([#819](https://www.github.com/googleapis/nodejs-storage/issues/819)) ([48f9b44](https://www.github.com/googleapis/nodejs-storage/commit/48f9b44))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Features
 | 
			
		||||
 | 
			
		||||
* hmac service account ([#751](https://www.github.com/googleapis/nodejs-storage/issues/751)) ([ed1ec7b](https://www.github.com/googleapis/nodejs-storage/commit/ed1ec7b))
 | 
			
		||||
 | 
			
		||||
## [3.1.0](https://www.github.com/googleapis/nodejs-storage/compare/v3.0.4...v3.1.0) (2019-08-09)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* **deps:** update dependency @google-cloud/paginator to v2 ([#781](https://www.github.com/googleapis/nodejs-storage/issues/781)) ([23244e9](https://www.github.com/googleapis/nodejs-storage/commit/23244e9))
 | 
			
		||||
* **deps:** update dependency @google-cloud/pubsub to ^0.30.0 ([#778](https://www.github.com/googleapis/nodejs-storage/issues/778)) ([7256650](https://www.github.com/googleapis/nodejs-storage/commit/7256650))
 | 
			
		||||
* allow calls with no request, add JSON proto ([30fff15](https://www.github.com/googleapis/nodejs-storage/commit/30fff15))
 | 
			
		||||
* **deps:** update dependency date-and-time to ^0.8.0 ([#779](https://www.github.com/googleapis/nodejs-storage/issues/779)) ([ab2734d](https://www.github.com/googleapis/nodejs-storage/commit/ab2734d))
 | 
			
		||||
* **deps:** upgrade @google-cloud/common version to show original… ([#795](https://www.github.com/googleapis/nodejs-storage/issues/795)) ([ea63cbe](https://www.github.com/googleapis/nodejs-storage/commit/ea63cbe))
 | 
			
		||||
* **deps:** use the latest extend ([#800](https://www.github.com/googleapis/nodejs-storage/issues/800)) ([a7f0172](https://www.github.com/googleapis/nodejs-storage/commit/a7f0172))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Features
 | 
			
		||||
 | 
			
		||||
* **file:** allow setting configPath of resumable upload ([#642](https://www.github.com/googleapis/nodejs-storage/issues/642)) ([a8ceb78](https://www.github.com/googleapis/nodejs-storage/commit/a8ceb78))
 | 
			
		||||
 | 
			
		||||
### [3.0.4](https://www.github.com/googleapis/nodejs-storage/compare/v3.0.3...v3.0.4) (2019-07-25)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* **deps:** update dependency pumpify to v2 ([#740](https://www.github.com/googleapis/nodejs-storage/issues/740)) ([71a4f59](https://www.github.com/googleapis/nodejs-storage/commit/71a4f59))
 | 
			
		||||
 | 
			
		||||
### [3.0.3](https://www.github.com/googleapis/nodejs-storage/compare/v3.0.2...v3.0.3) (2019-07-16)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* **typescript:** make SetLabelOptions optional ([#766](https://www.github.com/googleapis/nodejs-storage/issues/766)) ([4336882](https://www.github.com/googleapis/nodejs-storage/commit/4336882))
 | 
			
		||||
 | 
			
		||||
### [3.0.2](https://www.github.com/googleapis/nodejs-storage/compare/v3.0.1...v3.0.2) (2019-07-01)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* **docs:** fix sample code in docs ([#759](https://www.github.com/googleapis/nodejs-storage/issues/759)) ([f9e5fd8](https://www.github.com/googleapis/nodejs-storage/commit/f9e5fd8))
 | 
			
		||||
* **docs:** link to reference docs section on googleapis.dev ([#753](https://www.github.com/googleapis/nodejs-storage/issues/753)) ([5e3a96b](https://www.github.com/googleapis/nodejs-storage/commit/5e3a96b))
 | 
			
		||||
 | 
			
		||||
### [3.0.1](https://www.github.com/googleapis/nodejs-storage/compare/v3.0.0...v3.0.1) (2019-06-14)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* async should be dependency ([#743](https://www.github.com/googleapis/nodejs-storage/issues/743)) ([e542b8b](https://www.github.com/googleapis/nodejs-storage/commit/e542b8b))
 | 
			
		||||
 | 
			
		||||
## [3.0.0](https://www.github.com/googleapis/nodejs-storage/compare/v2.5.0...v3.0.0) (2019-06-14)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### ⚠ BREAKING CHANGES
 | 
			
		||||
 | 
			
		||||
* upgrade engines field to >=8.10.0 (#688)
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* **deps:** update dependency @google-cloud/common to v1 ([#705](https://www.github.com/googleapis/nodejs-storage/issues/705)) ([72a9f51](https://www.github.com/googleapis/nodejs-storage/commit/72a9f51))
 | 
			
		||||
* **deps:** update dependency @google-cloud/paginator to v1 ([#695](https://www.github.com/googleapis/nodejs-storage/issues/695)) ([ada995e](https://www.github.com/googleapis/nodejs-storage/commit/ada995e))
 | 
			
		||||
* **deps:** update dependency @google-cloud/promisify to v1 ([#693](https://www.github.com/googleapis/nodejs-storage/issues/693)) ([5df2f83](https://www.github.com/googleapis/nodejs-storage/commit/5df2f83))
 | 
			
		||||
* **deps:** update dependency @google-cloud/pubsub to ^0.29.0 ([#714](https://www.github.com/googleapis/nodejs-storage/issues/714)) ([3ee1a2c](https://www.github.com/googleapis/nodejs-storage/commit/3ee1a2c))
 | 
			
		||||
* **deps:** update dependency arrify to v2 ([#667](https://www.github.com/googleapis/nodejs-storage/issues/667)) ([ce02c27](https://www.github.com/googleapis/nodejs-storage/commit/ce02c27))
 | 
			
		||||
* validate action of getSignedUrl() function ([#684](https://www.github.com/googleapis/nodejs-storage/issues/684)) ([1b09d24](https://www.github.com/googleapis/nodejs-storage/commit/1b09d24))
 | 
			
		||||
* **deps:** update dependency date-and-time to ^0.7.0 ([#736](https://www.github.com/googleapis/nodejs-storage/issues/736)) ([7071f26](https://www.github.com/googleapis/nodejs-storage/commit/7071f26))
 | 
			
		||||
* **deps:** update dependency xdg-basedir to v4 ([#681](https://www.github.com/googleapis/nodejs-storage/issues/681)) ([8b40e6a](https://www.github.com/googleapis/nodejs-storage/commit/8b40e6a))
 | 
			
		||||
* **docs:** move to new client docs URL ([#738](https://www.github.com/googleapis/nodejs-storage/issues/738)) ([a637f99](https://www.github.com/googleapis/nodejs-storage/commit/a637f99))
 | 
			
		||||
* **ts:** improve return types for response metadata ([#666](https://www.github.com/googleapis/nodejs-storage/issues/666)) ([da42bed](https://www.github.com/googleapis/nodejs-storage/commit/da42bed))
 | 
			
		||||
* **types:** fix signatures of listing methods ([#703](https://www.github.com/googleapis/nodejs-storage/issues/703)) ([42937a8](https://www.github.com/googleapis/nodejs-storage/commit/42937a8))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Build System
 | 
			
		||||
 | 
			
		||||
* upgrade engines field to >=8.10.0 ([#688](https://www.github.com/googleapis/nodejs-storage/issues/688)) ([6a1fa0f](https://www.github.com/googleapis/nodejs-storage/commit/6a1fa0f))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Features
 | 
			
		||||
 | 
			
		||||
* add file.isPublic() function ([#708](https://www.github.com/googleapis/nodejs-storage/issues/708)) ([f86cadb](https://www.github.com/googleapis/nodejs-storage/commit/f86cadb))
 | 
			
		||||
* support apiEndpoint override ([#728](https://www.github.com/googleapis/nodejs-storage/issues/728)) ([61eeb64](https://www.github.com/googleapis/nodejs-storage/commit/61eeb64))
 | 
			
		||||
 | 
			
		||||
## v2.5.0
 | 
			
		||||
 | 
			
		||||
04-04-2019 12:27 PDT
 | 
			
		||||
 | 
			
		||||
This release brings an option to file#getSignedURL to create a version 4 Signed URL.
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
file.getSignedUrl({
 | 
			
		||||
  version: 'v4', // optional, defaults to v2 (existing version)
 | 
			
		||||
  action: 'read',
 | 
			
		||||
  expires: FUTURE_DATE,
 | 
			
		||||
})
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### New Features
 | 
			
		||||
- feat: introduce v4 signed url ([#637](https://github.com/googleapis/nodejs-storage/pull/637))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- chore(deps): update dependency @types/node to v11.13.0 ([#662](https://github.com/googleapis/nodejs-storage/pull/662))
 | 
			
		||||
- chore(deps): update dependency @types/tmp to v0.1.0
 | 
			
		||||
- chore(deps): upgrade to newest version of @google-cloud/common ([#657](https://github.com/googleapis/nodejs-storage/pull/657))
 | 
			
		||||
- chore(deps): update dependency typescript to ~3.4.0
 | 
			
		||||
- chore(deps): update dependency tmp to ^0.1.0 ([#641](https://github.com/googleapis/nodejs-storage/pull/641))
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
- docs: regenerate the samples/README.md ([#649](https://github.com/googleapis/nodejs-storage/pull/649))
 | 
			
		||||
- docs: slight difference in how nightly synthtool run generated README ([#650](https://github.com/googleapis/nodejs-storage/pull/650))
 | 
			
		||||
- docs: new synthtool generated README ([#645](https://github.com/googleapis/nodejs-storage/pull/645))
 | 
			
		||||
- docs(samples): refactor the quickstart to match the new rubric ([#647](https://github.com/googleapis/nodejs-storage/pull/647))
 | 
			
		||||
- docs: update README format
 | 
			
		||||
- docs: add requires_billing, retire .cloud-repo-tools.json ([#644](https://github.com/googleapis/nodejs-storage/pull/644))
 | 
			
		||||
- docs: add additional api_id field ([#640](https://github.com/googleapis/nodejs-storage/pull/640))
 | 
			
		||||
- docs: document destination option ([#633](https://github.com/googleapis/nodejs-storage/pull/633))
 | 
			
		||||
- docs: clarify in docs, the meaning of ASIA and coldline ([#632](https://github.com/googleapis/nodejs-storage/pull/632))
 | 
			
		||||
- docs: add a .repo-metadata.json ([#639](https://github.com/googleapis/nodejs-storage/pull/639))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- test(v2-sign): add multi-valued headers system-test ([#646](https://github.com/googleapis/nodejs-storage/pull/646))
 | 
			
		||||
- refactor: replace once with onetime ([#660](https://github.com/googleapis/nodejs-storage/pull/660))
 | 
			
		||||
- fix: do not download cached files ([#643](https://github.com/googleapis/nodejs-storage/pull/643))
 | 
			
		||||
- chore: publish to npm using wombat ([#634](https://github.com/googleapis/nodejs-storage/pull/634))
 | 
			
		||||
- build: use per-repo npm publish token ([#630](https://github.com/googleapis/nodejs-storage/pull/630))
 | 
			
		||||
 | 
			
		||||
## v2.4.3
 | 
			
		||||
 | 
			
		||||
03-13-2019 17:10 PDT
 | 
			
		||||
 | 
			
		||||
### Bug Fixes / Implementation Changes
 | 
			
		||||
- fix: getSigned(Policy|Url) throws if expiration is invalid Date ([#614](https://github.com/googleapis/nodejs-storage/pull/614))
 | 
			
		||||
- fix: handle errors from file#createReadStream ([#615](https://github.com/googleapis/nodejs-storage/pull/615))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- fix(deps): update dependency @google-cloud/paginator to ^0.2.0
 | 
			
		||||
- fix(deps): update dependency gcs-resumable-upload to v1 ([#619](https://github.com/googleapis/nodejs-storage/pull/619))
 | 
			
		||||
- fix(deps): update dependency @google-cloud/pubsub to ^0.27.0 ([#620](https://github.com/googleapis/nodejs-storage/pull/620))
 | 
			
		||||
- fix(deps): update dependency @google-cloud/pubsub to ^0.26.0 ([#618](https://github.com/googleapis/nodejs-storage/pull/618))
 | 
			
		||||
- fix(deps): update dependency @google-cloud/pubsub to ^0.25.0 ([#616](https://github.com/googleapis/nodejs-storage/pull/616))
 | 
			
		||||
- chore(deps): update dependency mocha to v6 ([#611](https://github.com/googleapis/nodejs-storage/pull/611))
 | 
			
		||||
- fix(deps): update dependency @google-cloud/promisify to ^0.4.0 ([#609](https://github.com/googleapis/nodejs-storage/pull/609))
 | 
			
		||||
- chore(deps): update dependency @types/tmp to v0.0.34 ([#608](https://github.com/googleapis/nodejs-storage/pull/608))
 | 
			
		||||
- fix(deps): update dependency yargs to v13 ([#606](https://github.com/googleapis/nodejs-storage/pull/606))
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
- docs: update links in contrib guide ([#610](https://github.com/googleapis/nodejs-storage/pull/610))
 | 
			
		||||
- docs: update contributing path in README ([#603](https://github.com/googleapis/nodejs-storage/pull/603))
 | 
			
		||||
- chore: move CONTRIBUTING.md to root ([#601](https://github.com/googleapis/nodejs-storage/pull/601))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- build: Add docuploader credentials to node publish jobs ([#624](https://github.com/googleapis/nodejs-storage/pull/624))
 | 
			
		||||
- build: use node10 to run samples-test, system-test etc ([#623](https://github.com/googleapis/nodejs-storage/pull/623))
 | 
			
		||||
- build: update release configuration
 | 
			
		||||
- build: use linkinator for docs test ([#607](https://github.com/googleapis/nodejs-storage/pull/607))
 | 
			
		||||
- build: create docs test npm scripts ([#605](https://github.com/googleapis/nodejs-storage/pull/605))
 | 
			
		||||
- build: test using @grpc/grpc-js in CI ([#604](https://github.com/googleapis/nodejs-storage/pull/604))
 | 
			
		||||
- chore: remove console.log in system test ([#599](https://github.com/googleapis/nodejs-storage/pull/599))
 | 
			
		||||
 | 
			
		||||
## v2.4.2
 | 
			
		||||
 | 
			
		||||
02-05-2019 16:55 PST
 | 
			
		||||
  
 | 
			
		||||
### Dependencies
 | 
			
		||||
 | 
			
		||||
- deps: update @google-cloud/common ([#596](https://github.com/googleapis/nodejs-storage/pull/596))
 | 
			
		||||
- chore(deps): update dependency typescript to ~3.3.0 ([#591](https://github.com/googleapis/nodejs-storage/pull/591))
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
 | 
			
		||||
- docs: add lint/fix example to contributing guide ([#594](https://github.com/googleapis/nodejs-storage/pull/594))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
 | 
			
		||||
- test: skip public bucket system tests running under VPCSC ([#595](https://github.com/googleapis/nodejs-storage/pull/595))
 | 
			
		||||
 | 
			
		||||
## v2.4.1
 | 
			
		||||
 | 
			
		||||
01-29-2019 13:05 PST
 | 
			
		||||
 | 
			
		||||
### Implementation Changes
 | 
			
		||||
- fix(ts): fix Storage.createBucket overloaded signature ([#589](https://github.com/googleapis/nodejs-storage/pull/589))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- fix(deps): update dependency @google-cloud/pubsub to ^0.24.0 ([#588](https://github.com/googleapis/nodejs-storage/pull/588))
 | 
			
		||||
 | 
			
		||||
## v2.4.0
 | 
			
		||||
 | 
			
		||||
01-28-2019 12:13 PST
 | 
			
		||||
 | 
			
		||||
### New Features
 | 
			
		||||
- fix: `expires` can be a Date, string, or number ([#548](https://github.com/googleapis/nodejs-storage/pull/548))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- deps: upgrade nodejs-common ([#582](https://github.com/googleapis/nodejs-storage/pull/582))
 | 
			
		||||
- chore(deps): update dependency eslint-config-prettier to v4 ([#586](https://github.com/googleapis/nodejs-storage/pull/586))
 | 
			
		||||
- fix(deps): update dependency @google-cloud/pubsub to ^0.23.0 ([#583](https://github.com/googleapis/nodejs-storage/pull/583))
 | 
			
		||||
- fix(deps): update dependency concat-stream to v2 ([#563](https://github.com/googleapis/nodejs-storage/pull/563))
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
- docs(samples): Bucket Policy Only Samples ([#557](https://github.com/googleapis/nodejs-storage/pull/557))
 | 
			
		||||
- fix(docs): move jsdoc away from interface ([#565](https://github.com/googleapis/nodejs-storage/pull/565))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- test: Bucket Policy Only related system test ([#579](https://github.com/googleapis/nodejs-storage/pull/579))
 | 
			
		||||
- build: check broken links in generated docs ([#567](https://github.com/googleapis/nodejs-storage/pull/567))
 | 
			
		||||
- build: include only build/src in compiled source ([#572](https://github.com/googleapis/nodejs-storage/pull/572))
 | 
			
		||||
 | 
			
		||||
## v2.3.4
 | 
			
		||||
 | 
			
		||||
12-19-2018 14:21 PST
 | 
			
		||||
 | 
			
		||||
### Implementation Changes
 | 
			
		||||
- fix(types): file.getMetadata should resolves to Metadata, not File ([#560](https://github.com/googleapis/nodejs-storage/pull/560))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- refactor: modernize the sample tests ([#558](https://github.com/googleapis/nodejs-storage/pull/558))
 | 
			
		||||
- chore(build): inject yoshi automation key ([#555](https://github.com/googleapis/nodejs-storage/pull/555))
 | 
			
		||||
- chore: update nyc and eslint configs ([#554](https://github.com/googleapis/nodejs-storage/pull/554))
 | 
			
		||||
- chore: fix publish.sh permission +x ([#552](https://github.com/googleapis/nodejs-storage/pull/552))
 | 
			
		||||
- fix(build): fix Kokoro release script ([#551](https://github.com/googleapis/nodejs-storage/pull/551))
 | 
			
		||||
- build: add Kokoro configs for autorelease ([#550](https://github.com/googleapis/nodejs-storage/pull/550))
 | 
			
		||||
 | 
			
		||||
## v2.3.3
 | 
			
		||||
 | 
			
		||||
12-06-2018 17:09 PST
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- chore(deps): update dependency @types/configstore to v4 ([#537](https://github.com/googleapis/nodejs-storage/pull/537))
 | 
			
		||||
- chore(deps): update dependency @google-cloud/pubsub to ^0.22.0 ([#535](https://github.com/googleapis/nodejs-storage/pull/535))
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
- fix(docs): place doc comment above the last overload ([#544](https://github.com/googleapis/nodejs-storage/pull/544))
 | 
			
		||||
- docs: update readme badges ([#536](https://github.com/googleapis/nodejs-storage/pull/536))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- chore: always nyc report before calling codecov ([#543](https://github.com/googleapis/nodejs-storage/pull/543))
 | 
			
		||||
- chore: nyc ignore build/test by default ([#542](https://github.com/googleapis/nodejs-storage/pull/542))
 | 
			
		||||
- chore: update license file ([#539](https://github.com/googleapis/nodejs-storage/pull/539))
 | 
			
		||||
 | 
			
		||||
## v2.3.2
 | 
			
		||||
 | 
			
		||||
This patch release fixed an issue affecting reading from a file on GCS ([#528](https://github.com/googleapis/nodejs-storage/issues/528)).
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- fix(dep): upgrade teeny-request to v3.11.3 ([#529](https://github.com/googleapis/nodejs-storage/pull/529))
 | 
			
		||||
- fix(deps): update dependency @google-cloud/common to ^0.27.0 ([#525](https://github.com/googleapis/nodejs-storage/pull/525))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- refactor: convert sample tests from ava to mocha ([#523](https://github.com/googleapis/nodejs-storage/pull/523))
 | 
			
		||||
- docs(samples): updated samples code to use async await ([#521](https://github.com/googleapis/nodejs-storage/pull/521))
 | 
			
		||||
- chore: add synth.metadata
 | 
			
		||||
- fix(ts): Update bucket options types ([#518](https://github.com/googleapis/nodejs-storage/pull/518))
 | 
			
		||||
 | 
			
		||||
## v2.3.1
 | 
			
		||||
 | 
			
		||||
11-14-2018 22:15 PST
 | 
			
		||||
 | 
			
		||||
### Bug fixes
 | 
			
		||||
- fix: fix TypeScript and system tests ([#515](https://github.com/googleapis/nodejs-storage/pull/515))
 | 
			
		||||
- fix(deps): update dependency through2 to v3 ([#507](https://github.com/googleapis/nodejs-storage/pull/507))
 | 
			
		||||
- docs: File#setMetadata in parallel results in unpredictable state ([#504](https://github.com/googleapis/nodejs-storage/pull/504))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- chore(deps): update dependency gts to ^0.9.0 ([#514](https://github.com/googleapis/nodejs-storage/pull/514))
 | 
			
		||||
- chore: update eslintignore config ([#513](https://github.com/googleapis/nodejs-storage/pull/513))
 | 
			
		||||
- chore(deps): update dependency @google-cloud/nodejs-repo-tools to v3 ([#512](https://github.com/googleapis/nodejs-storage/pull/512))
 | 
			
		||||
- refactor: use object.assign where possible ([#510](https://github.com/googleapis/nodejs-storage/pull/510))
 | 
			
		||||
- chore: drop contributors from multiple places ([#511](https://github.com/googleapis/nodejs-storage/pull/511))
 | 
			
		||||
- chore: use latest npm on Windows ([#509](https://github.com/googleapis/nodejs-storage/pull/509))
 | 
			
		||||
 | 
			
		||||
## v2.3.0
 | 
			
		||||
 | 
			
		||||
### Implementation Changes
 | 
			
		||||
- fix(types): Fixes getSignedUrl Return Type ([#496](https://github.com/googleapis/nodejs-storage/pull/496))
 | 
			
		||||
-
 | 
			
		||||
### New Features
 | 
			
		||||
- Introduce Object Lifecycle Management ([#471](https://github.com/googleapis/nodejs-storage/pull/471))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- chore(deps): update dependency eslint-plugin-node to v8 ([#490](https://github.com/googleapis/nodejs-storage/pull/490))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- chore: update issue templates ([#488](https://github.com/googleapis/nodejs-storage/pull/488))
 | 
			
		||||
 | 
			
		||||
## v2.2.0
 | 
			
		||||
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
- fix: re-enable typescript types ([#484](https://github.com/googleapis/nodejs-storage/pull/484))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- fix(deps): update dependency @google-cloud/common to ^0.26.0 (edited) ([#480](https://github.com/googleapis/nodejs-storage/pull/480))
 | 
			
		||||
- chore: Remove 'is' dependency ([#462](https://github.com/googleapis/nodejs-storage/pull/462))
 | 
			
		||||
- chore: upgrade teeny-request to 3.11.0 with type definitions ([#457](https://github.com/googleapis/nodejs-storage/pull/457))
 | 
			
		||||
- feat: use small HTTP dependency ([#416](https://github.com/googleapis/nodejs-storage/pull/416))
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
- docs: Minor docs correction ([#465](https://github.com/googleapis/nodejs-storage/pull/465))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- chore: remove old issue template ([#485](https://github.com/googleapis/nodejs-storage/pull/485))
 | 
			
		||||
- chore(typescript): enable noImplicitAny ([#483](https://github.com/googleapis/nodejs-storage/pull/483))
 | 
			
		||||
- chore(typescript): improve typescript types and update tests ([#482](https://github.com/googleapis/nodejs-storage/pull/482))
 | 
			
		||||
- build: run tests on node11 ([#481](https://github.com/googleapis/nodejs-storage/pull/481))
 | 
			
		||||
- chores(build): do not collect sponge.xml from windows builds ([#478](https://github.com/googleapis/nodejs-storage/pull/478))
 | 
			
		||||
- chores(build): run codecov on continuous builds ([#476](https://github.com/googleapis/nodejs-storage/pull/476))
 | 
			
		||||
- chore: update new issue template ([#475](https://github.com/googleapis/nodejs-storage/pull/475))
 | 
			
		||||
- fix: enable noImplicitAny for src/bucket.ts ([#472](https://github.com/googleapis/nodejs-storage/pull/472))
 | 
			
		||||
- fix(tests): use unique prefix for system tests to avoid collision with another run ([#468](https://github.com/googleapis/nodejs-storage/pull/468))
 | 
			
		||||
- fix: improve the types ([#467](https://github.com/googleapis/nodejs-storage/pull/467))
 | 
			
		||||
- chore: move class Storage to storage.ts, create index.ts that contains all exports ([#464](https://github.com/googleapis/nodejs-storage/pull/464))
 | 
			
		||||
- chore: add types to many unit tests ([#463](https://github.com/googleapis/nodejs-storage/pull/463))
 | 
			
		||||
- fix: Annotate Iam types ([#461](https://github.com/googleapis/nodejs-storage/pull/461))
 | 
			
		||||
- fix: complete bucket.ts noImplicitAny ([#460](https://github.com/googleapis/nodejs-storage/pull/460))
 | 
			
		||||
- fix: improve the types on acl.ts ([#459](https://github.com/googleapis/nodejs-storage/pull/459))
 | 
			
		||||
- fix: improve types (7) ([#458](https://github.com/googleapis/nodejs-storage/pull/458))
 | 
			
		||||
- fix: improve the types ([#453](https://github.com/googleapis/nodejs-storage/pull/453))
 | 
			
		||||
- chore: update build config ([#455](https://github.com/googleapis/nodejs-storage/pull/455))
 | 
			
		||||
- fix: improve typescript types in src/file.ts ([#450](https://github.com/googleapis/nodejs-storage/pull/450))
 | 
			
		||||
- build: fix codecov uploading on Kokoro ([#451](https://github.com/googleapis/nodejs-storage/pull/451))
 | 
			
		||||
- test: Attempt to re-enable iam#testPermissions ([#429](https://github.com/googleapis/nodejs-storage/pull/429))
 | 
			
		||||
- chore(deps): update dependency sinon to v7 ([#449](https://github.com/googleapis/nodejs-storage/pull/449))
 | 
			
		||||
- Re-generate library using /synth.py ([#448](https://github.com/googleapis/nodejs-storage/pull/448))
 | 
			
		||||
- Correct parameter name. ([#446](https://github.com/googleapis/nodejs-storage/pull/446))
 | 
			
		||||
 | 
			
		||||
## v2.1.0
 | 
			
		||||
 | 
			
		||||
This release brings support for Bucket/Object lock operations, as well as disable TypeScript as we continue to annotate the project with types.
 | 
			
		||||
 | 
			
		||||
### New Features
 | 
			
		||||
- feat: Support Bucket/Object lock operations ([#374](https://github.com/googleapis/nodejs-storage/pull/374))
 | 
			
		||||
 | 
			
		||||
### Implementation Changes
 | 
			
		||||
- disable types for now ([#392](https://github.com/googleapis/nodejs-storage/pull/392))
 | 
			
		||||
- Don't publish sourcemaps ([#412](https://github.com/googleapis/nodejs-storage/pull/412))
 | 
			
		||||
#### TypeScript support (in progress)
 | 
			
		||||
- fix: add better types for file.ts ([#436](https://github.com/googleapis/nodejs-storage/pull/436))
 | 
			
		||||
- fix: use ~ for typescript (and fix compile errors) ([#426](https://github.com/googleapis/nodejs-storage/pull/426))
 | 
			
		||||
- fix: Add typing for File#download() ([#409](https://github.com/googleapis/nodejs-storage/pull/409))
 | 
			
		||||
- chore: convert system tests to typescript ([#424](https://github.com/googleapis/nodejs-storage/pull/424))
 | 
			
		||||
- Improve TypeScript types (part 4) ([#402](https://github.com/googleapis/nodejs-storage/pull/402))
 | 
			
		||||
- ts: convert jsdoc types to typescript interfaces (1) ([#383](https://github.com/googleapis/nodejs-storage/pull/383))
 | 
			
		||||
- fix: TS definition ([#387](https://github.com/googleapis/nodejs-storage/pull/387))
 | 
			
		||||
- Annotate types [#3](https://github.com/googleapis/nodejs-storage/pull/3) ([#391](https://github.com/googleapis/nodejs-storage/pull/391))
 | 
			
		||||
- Annotate types (2) ([#388](https://github.com/googleapis/nodejs-storage/pull/388))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- chore(deps): update dependency eslint-plugin-prettier to v3 ([#419](https://github.com/googleapis/nodejs-storage/pull/419))
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
- docs: Modify source location for templates ([#410](https://github.com/googleapis/nodejs-storage/pull/410))
 | 
			
		||||
- docs: Explain `Bucket#upload()` still exists ([#421](https://github.com/googleapis/nodejs-storage/pull/421))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- fix(tests): fix system tests on CircleCI ([#431](https://github.com/googleapis/nodejs-storage/pull/431))
 | 
			
		||||
- fix(tests): system-test compiles to ./build, fix relative path ([#428](https://github.com/googleapis/nodejs-storage/pull/428))
 | 
			
		||||
- Update kokoro config ([#425](https://github.com/googleapis/nodejs-storage/pull/425))
 | 
			
		||||
- chore(samples): convert samples to async/await ([#422](https://github.com/googleapis/nodejs-storage/pull/422))
 | 
			
		||||
- build: samples test by adding approprate test variables ([#423](https://github.com/googleapis/nodejs-storage/pull/423))
 | 
			
		||||
- build: bring in latest kokoro cfgs to run System tests on PRs ([#413](https://github.com/googleapis/nodejs-storage/pull/413))
 | 
			
		||||
- test: remove appveyor config ([#411](https://github.com/googleapis/nodejs-storage/pull/411))
 | 
			
		||||
- Enable prefer-const in the eslint config ([#404](https://github.com/googleapis/nodejs-storage/pull/404))
 | 
			
		||||
- fix(test): instantiate PubSub using new ([#403](https://github.com/googleapis/nodejs-storage/pull/403))
 | 
			
		||||
- fix: optionsOrCallback could be undefined if not given, check before assign ([#401](https://github.com/googleapis/nodejs-storage/pull/401))
 | 
			
		||||
- Fix the requesterPays methods ([#400](https://github.com/googleapis/nodejs-storage/pull/400))
 | 
			
		||||
- Enable no-var in eslint ([#398](https://github.com/googleapis/nodejs-storage/pull/398))
 | 
			
		||||
- samples: don't use USA formatted dates for expiry ([#396](https://github.com/googleapis/nodejs-storage/pull/396))
 | 
			
		||||
- fix: copy(): Use correct destination file name in URI ([#389](https://github.com/googleapis/nodejs-storage/pull/389))
 | 
			
		||||
 | 
			
		||||
## v2.0.3
 | 
			
		||||
 | 
			
		||||
### Implementation Changes
 | 
			
		||||
- Improve TypeScript types ([#381](https://github.com/googleapis/nodejs-storage/pull/381))
 | 
			
		||||
- Make some parameters optional ([#380](https://github.com/googleapis/nodejs-storage/pull/380))
 | 
			
		||||
 | 
			
		||||
## v2.0.2
 | 
			
		||||
 | 
			
		||||
### Implementation Changes
 | 
			
		||||
- Improve the types (#377)
 | 
			
		||||
 | 
			
		||||
## v2.0.1
 | 
			
		||||
 | 
			
		||||
**This fixes types declaration issues with projects using TypeScript.**
 | 
			
		||||
 | 
			
		||||
### Implementation Changes
 | 
			
		||||
- Enable noImplicitThis in the tsconfig ([#370](https://github.com/googleapis/nodejs-storage/pull/370))
 | 
			
		||||
- Fix the path to the d.ts ([#364](https://github.com/googleapis/nodejs-storage/pull/364))
 | 
			
		||||
- fix: make dependency on request explicit ([#361](https://github.com/googleapis/nodejs-storage/pull/361))
 | 
			
		||||
- fix: remove trailing slashes from bucket name. ([#266](https://github.com/googleapis/nodejs-storage/pull/266))
 | 
			
		||||
 | 
			
		||||
### Dependencies
 | 
			
		||||
- fix(deps): update dependency @google-cloud/common to ^0.24.0 ([#367](https://github.com/googleapis/nodejs-storage/pull/367))
 | 
			
		||||
- fix(deps): update dependency gcs-resumable-upload to ^0.13.0 ([#368](https://github.com/googleapis/nodejs-storage/pull/368))
 | 
			
		||||
- Remove unused dependencies ([#363](https://github.com/googleapis/nodejs-storage/pull/363))
 | 
			
		||||
- Remove safe-buffer ([#359](https://github.com/googleapis/nodejs-storage/pull/359))
 | 
			
		||||
- samples: update dependency @google-cloud/storage to v2 ([#350](https://github.com/googleapis/nodejs-storage/pull/350))
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- Update CI config ([#371](https://github.com/googleapis/nodejs-storage/pull/371))
 | 
			
		||||
- build(kokoro): run docker as user node ([#358](https://github.com/googleapis/nodejs-storage/pull/358))
 | 
			
		||||
- build: fix multiline in circle.yml ([#357](https://github.com/googleapis/nodejs-storage/pull/357))
 | 
			
		||||
- fix executable modes on .sh's; add pre-system-test.sh hook ([#356](https://github.com/googleapis/nodejs-storage/pull/356))
 | 
			
		||||
- decrypt both service account keys ([#353](https://github.com/googleapis/nodejs-storage/pull/353))
 | 
			
		||||
- Retry npm install in CI ([#352](https://github.com/googleapis/nodejs-storage/pull/352))
 | 
			
		||||
- Add synth script and run it ([#351](https://github.com/googleapis/nodejs-storage/pull/351))
 | 
			
		||||
 | 
			
		||||
## v2.0.0
 | 
			
		||||
 | 
			
		||||
**This release has breaking changes**.  This release has a few notable breaking changes.  Please take care when upgrading!
 | 
			
		||||
 | 
			
		||||
### require syntax changes
 | 
			
		||||
The import style of this library has been changed to support [es module](https://nodejs.org/api/esm.html) syntax.  This provides both forward compatibility with es modules, and better supports the TypeScript and Babel ecosystems.  As a result, the import syntax has changed:
 | 
			
		||||
 | 
			
		||||
#### Old Code
 | 
			
		||||
```js
 | 
			
		||||
const storage = require('@google-cloud/storage')();
 | 
			
		||||
// or...
 | 
			
		||||
const Storage = require('@google-cloud/storage');
 | 
			
		||||
const storage = new Storage({
 | 
			
		||||
  // config...
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### New Code
 | 
			
		||||
```js
 | 
			
		||||
const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
const storage = new Storage({
 | 
			
		||||
  // config...
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### `bucket.upload` no longer accepts URLs
 | 
			
		||||
To better support a variety of HTTP clients, the remote fetching functionality of `bucket.upload` has been removed. It can be replaced with your favorite HTTP client.
 | 
			
		||||
 | 
			
		||||
#### Old Code
 | 
			
		||||
```js
 | 
			
		||||
bucket.upload('https://example.com/images/image.png', function(err, file, res) {
 | 
			
		||||
  // handle upload...
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
#### New Code
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
const request = require('request');
 | 
			
		||||
const file = bucket.file(name);
 | 
			
		||||
const writeStream = file.createWriteStream();
 | 
			
		||||
request(url).pipe(writeStream);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### Breaking changes
 | 
			
		||||
- semver: do not support upload() from url (#337)
 | 
			
		||||
- fix: drop support for node.js 4.x and 9.x (#282)
 | 
			
		||||
 | 
			
		||||
### Features
 | 
			
		||||
- refactor(ts): merge initial TypeScript conversion (#334)
 | 
			
		||||
- feat: Add Storage#getServiceAccount(). (#331)
 | 
			
		||||
- Kms sample (#209)
 | 
			
		||||
 | 
			
		||||
### Bug fixes
 | 
			
		||||
- fix: gzip and Cache-Control headers in upload sample (#225)
 | 
			
		||||
- fix: move this.[ROLE]s initialization from Acl to AclAccessorRoleMethods (#252)
 | 
			
		||||
- fix: signedURL cname (#210) (#234)
 | 
			
		||||
 | 
			
		||||
### Internal / Testing Changes
 | 
			
		||||
- chore(deps): update dependency nyc to v13 (#341)
 | 
			
		||||
- fix(deps): update dependency @google-cloud/common to ^0.23.0 (#340)
 | 
			
		||||
- test: throw on deprecation (#319)
 | 
			
		||||
- chore(deps): update dependency eslint-config-prettier to v3 (#336)
 | 
			
		||||
- fix(deps): update dependency gcs-resumable-upload to ^0.12.0 (#317)
 | 
			
		||||
- Fix system tests for string comparisons (#328)
 | 
			
		||||
- chore: ignore package-lock.json (#326)
 | 
			
		||||
- chore: update renovate config (#322)
 | 
			
		||||
- chore: regen lock files (#318)
 | 
			
		||||
- chore(deps): lock file maintenance (#313)
 | 
			
		||||
- chore: move mocha options to mocha.opts (#311)
 | 
			
		||||
- chore(deps): lock file maintenance (#309)
 | 
			
		||||
- test: use strictEqual in tests (#306)
 | 
			
		||||
- chore(deps): update dependency eslint-plugin-node to v7 (#305)
 | 
			
		||||
- chore(deps): lock file maintenance (#303)
 | 
			
		||||
- chore(deps): lock file maintenance (#285)
 | 
			
		||||
- fix: test meant to assert err msg exists (#280)
 | 
			
		||||
- fix(deps): update dependency yargs to v12 (#270)
 | 
			
		||||
- fix(deps): update dependency uuid to v3.3.2 (#269)
 | 
			
		||||
- chore: update gcs-resumable-upload to 0.11.1 (#265)
 | 
			
		||||
- fix(deps): update dependency uuid to v3.3.0 (#262)
 | 
			
		||||
- chore(deps): update dependency sinon to v6 (#263)
 | 
			
		||||
- Configure Renovate (#250)
 | 
			
		||||
- refactor: drop repo-tool as an exec wrapper (#258)
 | 
			
		||||
- chore: update sample lockfiles (#256)
 | 
			
		||||
- fix: update linking for samples (#254)
 | 
			
		||||
- chore(package): update eslint to version 5.0.0 (#253)
 | 
			
		||||
- refactor(es6): Refactor constructor pattern as ES6 class (#246)
 | 
			
		||||
- Update @google-cloud/common to the latest version 🚀 (#226)
 | 
			
		||||
- system-tests: fix channel test. (#243)
 | 
			
		||||
- refactor: Update to the latest version of nodejs-common and gcs-resumable-upload (#202)
 | 
			
		||||
- Fix permission of bash script for Kokoro (#223)
 | 
			
		||||
- chore(package): update nyc to version 12.0.2 (#216)
 | 
			
		||||
- chore: fix prettier incompatibility (#211)
 | 
			
		||||
							
								
								
									
										202
									
								
								node_modules/@google-cloud/storage/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										202
									
								
								node_modules/@google-cloud/storage/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,202 @@
 | 
			
		||||
 | 
			
		||||
                                 Apache License
 | 
			
		||||
                           Version 2.0, January 2004
 | 
			
		||||
                        http://www.apache.org/licenses/
 | 
			
		||||
 | 
			
		||||
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 | 
			
		||||
 | 
			
		||||
   1. Definitions.
 | 
			
		||||
 | 
			
		||||
      "License" shall mean the terms and conditions for use, reproduction,
 | 
			
		||||
      and distribution as defined by Sections 1 through 9 of this document.
 | 
			
		||||
 | 
			
		||||
      "Licensor" shall mean the copyright owner or entity authorized by
 | 
			
		||||
      the copyright owner that is granting the License.
 | 
			
		||||
 | 
			
		||||
      "Legal Entity" shall mean the union of the acting entity and all
 | 
			
		||||
      other entities that control, are controlled by, or are under common
 | 
			
		||||
      control with that entity. For the purposes of this definition,
 | 
			
		||||
      "control" means (i) the power, direct or indirect, to cause the
 | 
			
		||||
      direction or management of such entity, whether by contract or
 | 
			
		||||
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
 | 
			
		||||
      outstanding shares, or (iii) beneficial ownership of such entity.
 | 
			
		||||
 | 
			
		||||
      "You" (or "Your") shall mean an individual or Legal Entity
 | 
			
		||||
      exercising permissions granted by this License.
 | 
			
		||||
 | 
			
		||||
      "Source" form shall mean the preferred form for making modifications,
 | 
			
		||||
      including but not limited to software source code, documentation
 | 
			
		||||
      source, and configuration files.
 | 
			
		||||
 | 
			
		||||
      "Object" form shall mean any form resulting from mechanical
 | 
			
		||||
      transformation or translation of a Source form, including but
 | 
			
		||||
      not limited to compiled object code, generated documentation,
 | 
			
		||||
      and conversions to other media types.
 | 
			
		||||
 | 
			
		||||
      "Work" shall mean the work of authorship, whether in Source or
 | 
			
		||||
      Object form, made available under the License, as indicated by a
 | 
			
		||||
      copyright notice that is included in or attached to the work
 | 
			
		||||
      (an example is provided in the Appendix below).
 | 
			
		||||
 | 
			
		||||
      "Derivative Works" shall mean any work, whether in Source or Object
 | 
			
		||||
      form, that is based on (or derived from) the Work and for which the
 | 
			
		||||
      editorial revisions, annotations, elaborations, or other modifications
 | 
			
		||||
      represent, as a whole, an original work of authorship. For the purposes
 | 
			
		||||
      of this License, Derivative Works shall not include works that remain
 | 
			
		||||
      separable from, or merely link (or bind by name) to the interfaces of,
 | 
			
		||||
      the Work and Derivative Works thereof.
 | 
			
		||||
 | 
			
		||||
      "Contribution" shall mean any work of authorship, including
 | 
			
		||||
      the original version of the Work and any modifications or additions
 | 
			
		||||
      to that Work or Derivative Works thereof, that is intentionally
 | 
			
		||||
      submitted to Licensor for inclusion in the Work by the copyright owner
 | 
			
		||||
      or by an individual or Legal Entity authorized to submit on behalf of
 | 
			
		||||
      the copyright owner. For the purposes of this definition, "submitted"
 | 
			
		||||
      means any form of electronic, verbal, or written communication sent
 | 
			
		||||
      to the Licensor or its representatives, including but not limited to
 | 
			
		||||
      communication on electronic mailing lists, source code control systems,
 | 
			
		||||
      and issue tracking systems that are managed by, or on behalf of, the
 | 
			
		||||
      Licensor for the purpose of discussing and improving the Work, but
 | 
			
		||||
      excluding communication that is conspicuously marked or otherwise
 | 
			
		||||
      designated in writing by the copyright owner as "Not a Contribution."
 | 
			
		||||
 | 
			
		||||
      "Contributor" shall mean Licensor and any individual or Legal Entity
 | 
			
		||||
      on behalf of whom a Contribution has been received by Licensor and
 | 
			
		||||
      subsequently incorporated within the Work.
 | 
			
		||||
 | 
			
		||||
   2. Grant of Copyright License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      copyright license to reproduce, prepare Derivative Works of,
 | 
			
		||||
      publicly display, publicly perform, sublicense, and distribute the
 | 
			
		||||
      Work and such Derivative Works in Source or Object form.
 | 
			
		||||
 | 
			
		||||
   3. Grant of Patent License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      (except as stated in this section) patent license to make, have made,
 | 
			
		||||
      use, offer to sell, sell, import, and otherwise transfer the Work,
 | 
			
		||||
      where such license applies only to those patent claims licensable
 | 
			
		||||
      by such Contributor that are necessarily infringed by their
 | 
			
		||||
      Contribution(s) alone or by combination of their Contribution(s)
 | 
			
		||||
      with the Work to which such Contribution(s) was submitted. If You
 | 
			
		||||
      institute patent litigation against any entity (including a
 | 
			
		||||
      cross-claim or counterclaim in a lawsuit) alleging that the Work
 | 
			
		||||
      or a Contribution incorporated within the Work constitutes direct
 | 
			
		||||
      or contributory patent infringement, then any patent licenses
 | 
			
		||||
      granted to You under this License for that Work shall terminate
 | 
			
		||||
      as of the date such litigation is filed.
 | 
			
		||||
 | 
			
		||||
   4. Redistribution. You may reproduce and distribute copies of the
 | 
			
		||||
      Work or Derivative Works thereof in any medium, with or without
 | 
			
		||||
      modifications, and in Source or Object form, provided that You
 | 
			
		||||
      meet the following conditions:
 | 
			
		||||
 | 
			
		||||
      (a) You must give any other recipients of the Work or
 | 
			
		||||
          Derivative Works a copy of this License; and
 | 
			
		||||
 | 
			
		||||
      (b) You must cause any modified files to carry prominent notices
 | 
			
		||||
          stating that You changed the files; and
 | 
			
		||||
 | 
			
		||||
      (c) You must retain, in the Source form of any Derivative Works
 | 
			
		||||
          that You distribute, all copyright, patent, trademark, and
 | 
			
		||||
          attribution notices from the Source form of the Work,
 | 
			
		||||
          excluding those notices that do not pertain to any part of
 | 
			
		||||
          the Derivative Works; and
 | 
			
		||||
 | 
			
		||||
      (d) If the Work includes a "NOTICE" text file as part of its
 | 
			
		||||
          distribution, then any Derivative Works that You distribute must
 | 
			
		||||
          include a readable copy of the attribution notices contained
 | 
			
		||||
          within such NOTICE file, excluding those notices that do not
 | 
			
		||||
          pertain to any part of the Derivative Works, in at least one
 | 
			
		||||
          of the following places: within a NOTICE text file distributed
 | 
			
		||||
          as part of the Derivative Works; within the Source form or
 | 
			
		||||
          documentation, if provided along with the Derivative Works; or,
 | 
			
		||||
          within a display generated by the Derivative Works, if and
 | 
			
		||||
          wherever such third-party notices normally appear. The contents
 | 
			
		||||
          of the NOTICE file are for informational purposes only and
 | 
			
		||||
          do not modify the License. You may add Your own attribution
 | 
			
		||||
          notices within Derivative Works that You distribute, alongside
 | 
			
		||||
          or as an addendum to the NOTICE text from the Work, provided
 | 
			
		||||
          that such additional attribution notices cannot be construed
 | 
			
		||||
          as modifying the License.
 | 
			
		||||
 | 
			
		||||
      You may add Your own copyright statement to Your modifications and
 | 
			
		||||
      may provide additional or different license terms and conditions
 | 
			
		||||
      for use, reproduction, or distribution of Your modifications, or
 | 
			
		||||
      for any such Derivative Works as a whole, provided Your use,
 | 
			
		||||
      reproduction, and distribution of the Work otherwise complies with
 | 
			
		||||
      the conditions stated in this License.
 | 
			
		||||
 | 
			
		||||
   5. Submission of Contributions. Unless You explicitly state otherwise,
 | 
			
		||||
      any Contribution intentionally submitted for inclusion in the Work
 | 
			
		||||
      by You to the Licensor shall be under the terms and conditions of
 | 
			
		||||
      this License, without any additional terms or conditions.
 | 
			
		||||
      Notwithstanding the above, nothing herein shall supersede or modify
 | 
			
		||||
      the terms of any separate license agreement you may have executed
 | 
			
		||||
      with Licensor regarding such Contributions.
 | 
			
		||||
 | 
			
		||||
   6. Trademarks. This License does not grant permission to use the trade
 | 
			
		||||
      names, trademarks, service marks, or product names of the Licensor,
 | 
			
		||||
      except as required for reasonable and customary use in describing the
 | 
			
		||||
      origin of the Work and reproducing the content of the NOTICE file.
 | 
			
		||||
 | 
			
		||||
   7. Disclaimer of Warranty. Unless required by applicable law or
 | 
			
		||||
      agreed to in writing, Licensor provides the Work (and each
 | 
			
		||||
      Contributor provides its Contributions) on an "AS IS" BASIS,
 | 
			
		||||
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
      implied, including, without limitation, any warranties or conditions
 | 
			
		||||
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
 | 
			
		||||
      PARTICULAR PURPOSE. You are solely responsible for determining the
 | 
			
		||||
      appropriateness of using or redistributing the Work and assume any
 | 
			
		||||
      risks associated with Your exercise of permissions under this License.
 | 
			
		||||
 | 
			
		||||
   8. Limitation of Liability. In no event and under no legal theory,
 | 
			
		||||
      whether in tort (including negligence), contract, or otherwise,
 | 
			
		||||
      unless required by applicable law (such as deliberate and grossly
 | 
			
		||||
      negligent acts) or agreed to in writing, shall any Contributor be
 | 
			
		||||
      liable to You for damages, including any direct, indirect, special,
 | 
			
		||||
      incidental, or consequential damages of any character arising as a
 | 
			
		||||
      result of this License or out of the use or inability to use the
 | 
			
		||||
      Work (including but not limited to damages for loss of goodwill,
 | 
			
		||||
      work stoppage, computer failure or malfunction, or any and all
 | 
			
		||||
      other commercial damages or losses), even if such Contributor
 | 
			
		||||
      has been advised of the possibility of such damages.
 | 
			
		||||
 | 
			
		||||
   9. Accepting Warranty or Additional Liability. While redistributing
 | 
			
		||||
      the Work or Derivative Works thereof, You may choose to offer,
 | 
			
		||||
      and charge a fee for, acceptance of support, warranty, indemnity,
 | 
			
		||||
      or other liability obligations and/or rights consistent with this
 | 
			
		||||
      License. However, in accepting such obligations, You may act only
 | 
			
		||||
      on Your own behalf and on Your sole responsibility, not on behalf
 | 
			
		||||
      of any other Contributor, and only if You agree to indemnify,
 | 
			
		||||
      defend, and hold each Contributor harmless for any liability
 | 
			
		||||
      incurred by, or claims asserted against, such Contributor by reason
 | 
			
		||||
      of your accepting any such warranty or additional liability.
 | 
			
		||||
 | 
			
		||||
   END OF TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
   APPENDIX: How to apply the Apache License to your work.
 | 
			
		||||
 | 
			
		||||
      To apply the Apache License to your work, attach the following
 | 
			
		||||
      boilerplate notice, with the fields enclosed by brackets "[]"
 | 
			
		||||
      replaced with your own identifying information. (Don't include
 | 
			
		||||
      the brackets!)  The text should be enclosed in the appropriate
 | 
			
		||||
      comment syntax for the file format. We also recommend that a
 | 
			
		||||
      file or class name and description of purpose be included on the
 | 
			
		||||
      same "printed page" as the copyright notice for easier
 | 
			
		||||
      identification within third-party archives.
 | 
			
		||||
 | 
			
		||||
   Copyright [yyyy] [name of copyright owner]
 | 
			
		||||
 | 
			
		||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
   you may not use this file except in compliance with the License.
 | 
			
		||||
   You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
       http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
   Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
   distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
   See the License for the specific language governing permissions and
 | 
			
		||||
   limitations under the License.
 | 
			
		||||
							
								
								
									
										152
									
								
								node_modules/@google-cloud/storage/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								node_modules/@google-cloud/storage/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,152 @@
 | 
			
		||||
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
 | 
			
		||||
[//]: # "To regenerate it, use `python -m synthtool`."
 | 
			
		||||
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
 | 
			
		||||
 | 
			
		||||
# [Google Cloud Storage: Node.js Client](https://github.com/googleapis/nodejs-storage)
 | 
			
		||||
 | 
			
		||||
[](https://cloud.google.com/terms/launch-stages)
 | 
			
		||||
[](https://www.npmjs.org/package/@google-cloud/storage)
 | 
			
		||||
[](https://codecov.io/gh/googleapis/nodejs-storage)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
> Node.js idiomatic client for [Cloud Storage][product-docs].
 | 
			
		||||
 | 
			
		||||
[Cloud Storage](https://cloud.google.com/storage/docs) allows world-wide
 | 
			
		||||
storage and retrieval of any amount of data at any time. You can use Google
 | 
			
		||||
Cloud Storage for a range of scenarios including serving website content,
 | 
			
		||||
storing data for archival and disaster recovery, or distributing large data
 | 
			
		||||
objects to users via direct download.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* [Google Cloud Storage Node.js Client API Reference][client-docs]
 | 
			
		||||
* [Google Cloud Storage Documentation][product-docs]
 | 
			
		||||
* [github.com/googleapis/nodejs-storage](https://github.com/googleapis/nodejs-storage)
 | 
			
		||||
 | 
			
		||||
Read more about the client libraries for Cloud APIs, including the older
 | 
			
		||||
Google APIs Client Libraries, in [Client Libraries Explained][explained].
 | 
			
		||||
 | 
			
		||||
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
 | 
			
		||||
 | 
			
		||||
**Table of contents:**
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* [Quickstart](#quickstart)
 | 
			
		||||
  * [Before you begin](#before-you-begin)
 | 
			
		||||
  * [Installing the client library](#installing-the-client-library)
 | 
			
		||||
  * [Using the client library](#using-the-client-library)
 | 
			
		||||
* [Samples](#samples)
 | 
			
		||||
* [Versioning](#versioning)
 | 
			
		||||
* [Contributing](#contributing)
 | 
			
		||||
* [License](#license)
 | 
			
		||||
 | 
			
		||||
## Quickstart
 | 
			
		||||
 | 
			
		||||
### Before you begin
 | 
			
		||||
 | 
			
		||||
1.  [Select or create a Cloud Platform project][projects].
 | 
			
		||||
1.  [Enable billing for your project][billing].
 | 
			
		||||
1.  [Enable the Google Cloud Storage API][enable_api].
 | 
			
		||||
1.  [Set up authentication with a service account][auth] so you can access the
 | 
			
		||||
    API from your local workstation.
 | 
			
		||||
 | 
			
		||||
### Installing the client library
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
npm install @google-cloud/storage
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Using the client library
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
  // Imports the Google Cloud client library
 | 
			
		||||
  const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 | 
			
		||||
  // Creates a client
 | 
			
		||||
  const storage = new Storage();
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * TODO(developer): Uncomment these variables before running the sample.
 | 
			
		||||
   */
 | 
			
		||||
  // const bucketName = 'bucket-name';
 | 
			
		||||
 | 
			
		||||
  async function createBucket() {
 | 
			
		||||
    // Creates the new bucket
 | 
			
		||||
    await storage.createBucket(bucketName);
 | 
			
		||||
    console.log(`Bucket ${bucketName} created.`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createBucket();
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Samples
 | 
			
		||||
 | 
			
		||||
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-storage/tree/master/samples) directory. The samples' `README.md`
 | 
			
		||||
has instructions for running the samples.
 | 
			
		||||
 | 
			
		||||
| Sample                      | Source Code                       | Try it |
 | 
			
		||||
| --------------------------- | --------------------------------- | ------ |
 | 
			
		||||
| Acl | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/acl.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/acl.js,samples/README.md) |
 | 
			
		||||
| Bucket Lock | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/bucketLock.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/bucketLock.js,samples/README.md) |
 | 
			
		||||
| Storage Get Bucket Metadata. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/bucketMetadata.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/bucketMetadata.js,samples/README.md) |
 | 
			
		||||
| Buckets | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/buckets.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/buckets.js,samples/README.md) |
 | 
			
		||||
| Encryption | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/encryption.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/encryption.js,samples/README.md) |
 | 
			
		||||
| Files | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/files.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/files.js,samples/README.md) |
 | 
			
		||||
| Activate HMAC SA Key. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/hmacKeyActivate.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/hmacKeyActivate.js,samples/README.md) |
 | 
			
		||||
| Create HMAC SA Key. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/hmacKeyCreate.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/hmacKeyCreate.js,samples/README.md) |
 | 
			
		||||
| Deactivate HMAC SA Key. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/hmacKeyDeactivate.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/hmacKeyDeactivate.js,samples/README.md) |
 | 
			
		||||
| Delete HMAC SA Key. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/hmacKeyDelete.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/hmacKeyDelete.js,samples/README.md) |
 | 
			
		||||
| Get HMAC SA Key Metadata. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/hmacKeyGet.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/hmacKeyGet.js,samples/README.md) |
 | 
			
		||||
| List HMAC SA Keys Metadata. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/hmacKeysList.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/hmacKeysList.js,samples/README.md) |
 | 
			
		||||
| Iam | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/iam.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/iam.js,samples/README.md) |
 | 
			
		||||
| Notifications | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/notifications.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/notifications.js,samples/README.md) |
 | 
			
		||||
| Quickstart | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
 | 
			
		||||
| Requester Pays | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/requesterPays.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/requesterPays.js,samples/README.md) |
 | 
			
		||||
| Upload a directory to a bucket. | [source code](https://github.com/googleapis/nodejs-storage/blob/master/samples/uploadDirectory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-storage&page=editor&open_in_editor=samples/uploadDirectory.js,samples/README.md) |
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
The [Google Cloud Storage Node.js Client API Reference][client-docs] documentation
 | 
			
		||||
also contains samples.
 | 
			
		||||
 | 
			
		||||
## Versioning
 | 
			
		||||
 | 
			
		||||
This library follows [Semantic Versioning](http://semver.org/).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
This library is considered to be **General Availability (GA)**. This means it
 | 
			
		||||
is stable; the code surface will not change in backwards-incompatible ways
 | 
			
		||||
unless absolutely necessary (e.g. because of critical security issues) or with
 | 
			
		||||
an extensive deprecation period. Issues and requests against **GA** libraries
 | 
			
		||||
are addressed with the highest priority.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
More Information: [Google Cloud Platform Launch Stages][launch_stages]
 | 
			
		||||
 | 
			
		||||
[launch_stages]: https://cloud.google.com/terms/launch-stages
 | 
			
		||||
 | 
			
		||||
## Contributing
 | 
			
		||||
 | 
			
		||||
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-storage/blob/master/CONTRIBUTING.md).
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
Apache Version 2.0
 | 
			
		||||
 | 
			
		||||
See [LICENSE](https://github.com/googleapis/nodejs-storage/blob/master/LICENSE)
 | 
			
		||||
 | 
			
		||||
[client-docs]: https://googleapis.dev/nodejs/storage/latest
 | 
			
		||||
[product-docs]: https://cloud.google.com/storage
 | 
			
		||||
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
 | 
			
		||||
[projects]: https://console.cloud.google.com/project
 | 
			
		||||
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
 | 
			
		||||
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=storage-api.googleapis.com
 | 
			
		||||
[auth]: https://cloud.google.com/docs/authentication/getting-started
 | 
			
		||||
							
								
								
									
										163
									
								
								node_modules/@google-cloud/storage/build/src/acl.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										163
									
								
								node_modules/@google-cloud/storage/build/src/acl.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,163 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
import { BodyResponseCallback, DecorateRequestOptions, Metadata } from '@google-cloud/common';
 | 
			
		||||
export interface AclOptions {
 | 
			
		||||
    pathPrefix: string;
 | 
			
		||||
    request: (reqOpts: DecorateRequestOptions, callback: BodyResponseCallback) => void;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetAclResponse = [AccessControlObject | AccessControlObject[], Metadata];
 | 
			
		||||
export interface GetAclCallback {
 | 
			
		||||
    (err: Error | null, acl?: AccessControlObject | AccessControlObject[] | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetAclOptions {
 | 
			
		||||
    entity: string;
 | 
			
		||||
    generation?: number;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface UpdateAclOptions {
 | 
			
		||||
    entity: string;
 | 
			
		||||
    role: string;
 | 
			
		||||
    generation?: number;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type UpdateAclResponse = [AccessControlObject, Metadata];
 | 
			
		||||
export interface UpdateAclCallback {
 | 
			
		||||
    (err: Error | null, acl?: AccessControlObject | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface AddAclOptions {
 | 
			
		||||
    entity: string;
 | 
			
		||||
    role: string;
 | 
			
		||||
    generation?: number;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type AddAclResponse = [AccessControlObject, Metadata];
 | 
			
		||||
export interface AddAclCallback {
 | 
			
		||||
    (err: Error | null, acl?: AccessControlObject | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type RemoveAclResponse = [Metadata];
 | 
			
		||||
export interface RemoveAclCallback {
 | 
			
		||||
    (err: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface RemoveAclOptions {
 | 
			
		||||
    entity: string;
 | 
			
		||||
    generation?: number;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface AccessControlObject {
 | 
			
		||||
    entity: string;
 | 
			
		||||
    role: string;
 | 
			
		||||
    projectTeam: string;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Attach functionality to a {@link Storage.acl} instance. This will add an
 | 
			
		||||
 * object for each role group (owners, readers, and writers), with each object
 | 
			
		||||
 * containing methods to add or delete a type of entity.
 | 
			
		||||
 *
 | 
			
		||||
 * As an example, here are a few methods that are created.
 | 
			
		||||
 *
 | 
			
		||||
 *   myBucket.acl.readers.deleteGroup('groupId', function(err) {});
 | 
			
		||||
 *
 | 
			
		||||
 *   myBucket.acl.owners.addUser('email@example.com', function(err, acl) {});
 | 
			
		||||
 *
 | 
			
		||||
 *   myBucket.acl.writers.addDomain('example.com', function(err, acl) {});
 | 
			
		||||
 *
 | 
			
		||||
 * @private
 | 
			
		||||
 */
 | 
			
		||||
declare class AclRoleAccessorMethods {
 | 
			
		||||
    private static accessMethods;
 | 
			
		||||
    private static entities;
 | 
			
		||||
    private static roles;
 | 
			
		||||
    owners: {};
 | 
			
		||||
    readers: {};
 | 
			
		||||
    writers: {};
 | 
			
		||||
    constructor();
 | 
			
		||||
    _assignAccessMethods(role: string): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
 * bucket access. ACLs are the mechanism you use to share objects with other
 | 
			
		||||
 * users and allow other users to access your buckets and objects.
 | 
			
		||||
 *
 | 
			
		||||
 * An ACL consists of one or more entries, where each entry grants permissions
 | 
			
		||||
 * to an entity. Permissions define the actions that can be performed against an
 | 
			
		||||
 * object or bucket (for example, `READ` or `WRITE`); the entity defines who the
 | 
			
		||||
 * permission applies to (for example, a specific user or group of users).
 | 
			
		||||
 *
 | 
			
		||||
 * Where an `entity` value is accepted, we follow the format the Cloud Storage
 | 
			
		||||
 * API expects.
 | 
			
		||||
 *
 | 
			
		||||
 * Refer to
 | 
			
		||||
 * https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls
 | 
			
		||||
 * for the most up-to-date values.
 | 
			
		||||
 *
 | 
			
		||||
 *   - `user-userId`
 | 
			
		||||
 *   - `user-email`
 | 
			
		||||
 *   - `group-groupId`
 | 
			
		||||
 *   - `group-email`
 | 
			
		||||
 *   - `domain-domain`
 | 
			
		||||
 *   - `project-team-projectId`
 | 
			
		||||
 *   - `allUsers`
 | 
			
		||||
 *   - `allAuthenticatedUsers`
 | 
			
		||||
 *
 | 
			
		||||
 * Examples:
 | 
			
		||||
 *
 | 
			
		||||
 *   - The user "liz@example.com" would be `user-liz@example.com`.
 | 
			
		||||
 *   - The group "example@googlegroups.com" would be
 | 
			
		||||
 *     `group-example@googlegroups.com`.
 | 
			
		||||
 *   - To refer to all members of the Google Apps for Business domain
 | 
			
		||||
 *     "example.com", the entity would be `domain-example.com`.
 | 
			
		||||
 *
 | 
			
		||||
 * For more detailed information, see
 | 
			
		||||
 * [About Access Control Lists](http://goo.gl/6qBBPO).
 | 
			
		||||
 *
 | 
			
		||||
 * @constructor Acl
 | 
			
		||||
 * @mixin
 | 
			
		||||
 * @param {object} options Configuration options.
 | 
			
		||||
 */
 | 
			
		||||
declare class Acl extends AclRoleAccessorMethods {
 | 
			
		||||
    default: Acl;
 | 
			
		||||
    pathPrefix: string;
 | 
			
		||||
    request_: (reqOpts: DecorateRequestOptions, callback: BodyResponseCallback) => void;
 | 
			
		||||
    constructor(options: AclOptions);
 | 
			
		||||
    add(options: AddAclOptions): Promise<AddAclResponse>;
 | 
			
		||||
    add(options: AddAclOptions, callback: AddAclCallback): void;
 | 
			
		||||
    delete(options: RemoveAclOptions): Promise<RemoveAclResponse>;
 | 
			
		||||
    delete(options: RemoveAclOptions, callback: RemoveAclCallback): void;
 | 
			
		||||
    get(options?: GetAclOptions): Promise<GetAclResponse>;
 | 
			
		||||
    get(options: GetAclOptions, callback: GetAclCallback): void;
 | 
			
		||||
    get(callback: GetAclCallback): void;
 | 
			
		||||
    update(options: UpdateAclOptions): Promise<UpdateAclResponse>;
 | 
			
		||||
    update(options: UpdateAclOptions, callback: UpdateAclCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Transform API responses to a consistent object format.
 | 
			
		||||
     *
 | 
			
		||||
     * @private
 | 
			
		||||
     */
 | 
			
		||||
    makeAclObject_(accessControlObject: AccessControlObject): AccessControlObject;
 | 
			
		||||
    /**
 | 
			
		||||
     * Patch requests up to the bucket's request object.
 | 
			
		||||
     *
 | 
			
		||||
     * @private
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} method Action.
 | 
			
		||||
     * @param {string} path Request path.
 | 
			
		||||
     * @param {*} query Request query object.
 | 
			
		||||
     * @param {*} body Request body contents.
 | 
			
		||||
     * @param {function} callback Callback function.
 | 
			
		||||
     */
 | 
			
		||||
    request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
 | 
			
		||||
}
 | 
			
		||||
export { Acl, AclRoleAccessorMethods };
 | 
			
		||||
							
								
								
									
										706
									
								
								node_modules/@google-cloud/storage/build/src/acl.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										706
									
								
								node_modules/@google-cloud/storage/build/src/acl.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,706 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const promisify_1 = require("@google-cloud/promisify");
 | 
			
		||||
const arrify = require("arrify");
 | 
			
		||||
/**
 | 
			
		||||
 * Attach functionality to a {@link Storage.acl} instance. This will add an
 | 
			
		||||
 * object for each role group (owners, readers, and writers), with each object
 | 
			
		||||
 * containing methods to add or delete a type of entity.
 | 
			
		||||
 *
 | 
			
		||||
 * As an example, here are a few methods that are created.
 | 
			
		||||
 *
 | 
			
		||||
 *   myBucket.acl.readers.deleteGroup('groupId', function(err) {});
 | 
			
		||||
 *
 | 
			
		||||
 *   myBucket.acl.owners.addUser('email@example.com', function(err, acl) {});
 | 
			
		||||
 *
 | 
			
		||||
 *   myBucket.acl.writers.addDomain('example.com', function(err, acl) {});
 | 
			
		||||
 *
 | 
			
		||||
 * @private
 | 
			
		||||
 */
 | 
			
		||||
class AclRoleAccessorMethods {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        this.owners = {};
 | 
			
		||||
        this.readers = {};
 | 
			
		||||
        this.writers = {};
 | 
			
		||||
        /**
 | 
			
		||||
         * An object of convenience methods to add or delete owner ACL permissions
 | 
			
		||||
         * for a given entity.
 | 
			
		||||
         *
 | 
			
		||||
         * The supported methods include:
 | 
			
		||||
         *
 | 
			
		||||
         *   - `myFile.acl.owners.addAllAuthenticatedUsers`
 | 
			
		||||
         *   - `myFile.acl.owners.deleteAllAuthenticatedUsers`
 | 
			
		||||
         *   - `myFile.acl.owners.addAllUsers`
 | 
			
		||||
         *   - `myFile.acl.owners.deleteAllUsers`
 | 
			
		||||
         *   - `myFile.acl.owners.addDomain`
 | 
			
		||||
         *   - `myFile.acl.owners.deleteDomain`
 | 
			
		||||
         *   - `myFile.acl.owners.addGroup`
 | 
			
		||||
         *   - `myFile.acl.owners.deleteGroup`
 | 
			
		||||
         *   - `myFile.acl.owners.addProject`
 | 
			
		||||
         *   - `myFile.acl.owners.deleteProject`
 | 
			
		||||
         *   - `myFile.acl.owners.addUser`
 | 
			
		||||
         *   - `myFile.acl.owners.deleteUser`
 | 
			
		||||
         *
 | 
			
		||||
         * @name Acl#owners
 | 
			
		||||
         *
 | 
			
		||||
         * @example
 | 
			
		||||
         * const storage = require('@google-cloud/storage')();
 | 
			
		||||
         * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
         * const myFile = myBucket.file('my-file');
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // Add a user as an owner of a file.
 | 
			
		||||
         * //-
 | 
			
		||||
         * const myBucket = gcs.bucket('my-bucket');
 | 
			
		||||
         * const myFile = myBucket.file('my-file');
 | 
			
		||||
         * myFile.acl.owners.addUser('email@example.com', function(err, aclObject)
 | 
			
		||||
         * {});
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // For reference, the above command is the same as running the following.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.add({
 | 
			
		||||
         *   entity: 'user-email@example.com',
 | 
			
		||||
         *   role: gcs.acl.OWNER_ROLE
 | 
			
		||||
         * }, function(err, aclObject) {});
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.owners.addUser('email@example.com').then(function(data) {
 | 
			
		||||
         *   const aclObject = data[0];
 | 
			
		||||
         *   const apiResponse = data[1];
 | 
			
		||||
         * });
 | 
			
		||||
         */
 | 
			
		||||
        this.owners = {};
 | 
			
		||||
        /**
 | 
			
		||||
         * An object of convenience methods to add or delete reader ACL permissions
 | 
			
		||||
         * for a given entity.
 | 
			
		||||
         *
 | 
			
		||||
         * The supported methods include:
 | 
			
		||||
         *
 | 
			
		||||
         *   - `myFile.acl.readers.addAllAuthenticatedUsers`
 | 
			
		||||
         *   - `myFile.acl.readers.deleteAllAuthenticatedUsers`
 | 
			
		||||
         *   - `myFile.acl.readers.addAllUsers`
 | 
			
		||||
         *   - `myFile.acl.readers.deleteAllUsers`
 | 
			
		||||
         *   - `myFile.acl.readers.addDomain`
 | 
			
		||||
         *   - `myFile.acl.readers.deleteDomain`
 | 
			
		||||
         *   - `myFile.acl.readers.addGroup`
 | 
			
		||||
         *   - `myFile.acl.readers.deleteGroup`
 | 
			
		||||
         *   - `myFile.acl.readers.addProject`
 | 
			
		||||
         *   - `myFile.acl.readers.deleteProject`
 | 
			
		||||
         *   - `myFile.acl.readers.addUser`
 | 
			
		||||
         *   - `myFile.acl.readers.deleteUser`
 | 
			
		||||
         *
 | 
			
		||||
         * @name Acl#readers
 | 
			
		||||
         *
 | 
			
		||||
         * @example
 | 
			
		||||
         * const storage = require('@google-cloud/storage')();
 | 
			
		||||
         * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
         * const myFile = myBucket.file('my-file');
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // Add a user as a reader of a file.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.readers.addUser('email@example.com', function(err, aclObject)
 | 
			
		||||
         * {});
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // For reference, the above command is the same as running the following.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.add({
 | 
			
		||||
         *   entity: 'user-email@example.com',
 | 
			
		||||
         *   role: gcs.acl.READER_ROLE
 | 
			
		||||
         * }, function(err, aclObject) {});
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.readers.addUser('email@example.com').then(function(data) {
 | 
			
		||||
         *   const aclObject = data[0];
 | 
			
		||||
         *   const apiResponse = data[1];
 | 
			
		||||
         * });
 | 
			
		||||
         */
 | 
			
		||||
        this.readers = {};
 | 
			
		||||
        /**
 | 
			
		||||
         * An object of convenience methods to add or delete writer ACL permissions
 | 
			
		||||
         * for a given entity.
 | 
			
		||||
         *
 | 
			
		||||
         * The supported methods include:
 | 
			
		||||
         *
 | 
			
		||||
         *   - `myFile.acl.writers.addAllAuthenticatedUsers`
 | 
			
		||||
         *   - `myFile.acl.writers.deleteAllAuthenticatedUsers`
 | 
			
		||||
         *   - `myFile.acl.writers.addAllUsers`
 | 
			
		||||
         *   - `myFile.acl.writers.deleteAllUsers`
 | 
			
		||||
         *   - `myFile.acl.writers.addDomain`
 | 
			
		||||
         *   - `myFile.acl.writers.deleteDomain`
 | 
			
		||||
         *   - `myFile.acl.writers.addGroup`
 | 
			
		||||
         *   - `myFile.acl.writers.deleteGroup`
 | 
			
		||||
         *   - `myFile.acl.writers.addProject`
 | 
			
		||||
         *   - `myFile.acl.writers.deleteProject`
 | 
			
		||||
         *   - `myFile.acl.writers.addUser`
 | 
			
		||||
         *   - `myFile.acl.writers.deleteUser`
 | 
			
		||||
         *
 | 
			
		||||
         * @name Acl#writers
 | 
			
		||||
         *
 | 
			
		||||
         * @example
 | 
			
		||||
         * const storage = require('@google-cloud/storage')();
 | 
			
		||||
         * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
         * const myFile = myBucket.file('my-file');
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // Add a user as a writer of a file.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.writers.addUser('email@example.com', function(err, aclObject)
 | 
			
		||||
         * {});
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // For reference, the above command is the same as running the following.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.add({
 | 
			
		||||
         *   entity: 'user-email@example.com',
 | 
			
		||||
         *   role: gcs.acl.WRITER_ROLE
 | 
			
		||||
         * }, function(err, aclObject) {});
 | 
			
		||||
         *
 | 
			
		||||
         * //-
 | 
			
		||||
         * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
         * //-
 | 
			
		||||
         * myFile.acl.writers.addUser('email@example.com').then(function(data) {
 | 
			
		||||
         *   const aclObject = data[0];
 | 
			
		||||
         *   const apiResponse = data[1];
 | 
			
		||||
         * });
 | 
			
		||||
         */
 | 
			
		||||
        this.writers = {};
 | 
			
		||||
        AclRoleAccessorMethods.roles.forEach(this._assignAccessMethods.bind(this));
 | 
			
		||||
    }
 | 
			
		||||
    _assignAccessMethods(role) {
 | 
			
		||||
        const accessMethods = AclRoleAccessorMethods.accessMethods;
 | 
			
		||||
        const entities = AclRoleAccessorMethods.entities;
 | 
			
		||||
        const roleGroup = role.toLowerCase() + 's';
 | 
			
		||||
        // tslint:disable-next-line:no-any
 | 
			
		||||
        this[roleGroup] = entities.reduce((acc, entity) => {
 | 
			
		||||
            const isPrefix = entity.charAt(entity.length - 1) === '-';
 | 
			
		||||
            accessMethods.forEach(accessMethod => {
 | 
			
		||||
                let method = accessMethod + entity[0].toUpperCase() + entity.substr(1);
 | 
			
		||||
                if (isPrefix) {
 | 
			
		||||
                    method = method.replace('-', '');
 | 
			
		||||
                }
 | 
			
		||||
                // Wrap the parent accessor method (e.g. `add` or `delete`) to avoid the
 | 
			
		||||
                // more complex API of specifying an `entity` and `role`.
 | 
			
		||||
                // tslint:disable-next-line:no-any
 | 
			
		||||
                acc[method] = (entityId, options, callback) => {
 | 
			
		||||
                    let apiEntity;
 | 
			
		||||
                    if (typeof options === 'function') {
 | 
			
		||||
                        callback = options;
 | 
			
		||||
                        options = {};
 | 
			
		||||
                    }
 | 
			
		||||
                    if (isPrefix) {
 | 
			
		||||
                        apiEntity = entity + entityId;
 | 
			
		||||
                    }
 | 
			
		||||
                    else {
 | 
			
		||||
                        // If the entity is not a prefix, it is a special entity group
 | 
			
		||||
                        // that does not require further details. The accessor methods
 | 
			
		||||
                        // only accept a callback.
 | 
			
		||||
                        apiEntity = entity;
 | 
			
		||||
                        callback = entityId;
 | 
			
		||||
                    }
 | 
			
		||||
                    options = Object.assign({
 | 
			
		||||
                        entity: apiEntity,
 | 
			
		||||
                        role,
 | 
			
		||||
                    }, options);
 | 
			
		||||
                    const args = [options];
 | 
			
		||||
                    if (typeof callback === 'function') {
 | 
			
		||||
                        args.push(callback);
 | 
			
		||||
                    }
 | 
			
		||||
                    // tslint:disable-next-line:no-any
 | 
			
		||||
                    return this[accessMethod].apply(this, args);
 | 
			
		||||
                };
 | 
			
		||||
            });
 | 
			
		||||
            return acc;
 | 
			
		||||
        }, {});
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
AclRoleAccessorMethods.accessMethods = ['add', 'delete'];
 | 
			
		||||
AclRoleAccessorMethods.entities = [
 | 
			
		||||
    // Special entity groups that do not require further specification.
 | 
			
		||||
    'allAuthenticatedUsers',
 | 
			
		||||
    'allUsers',
 | 
			
		||||
    // Entity groups that require specification, e.g. `user-email@example.com`.
 | 
			
		||||
    'domain-',
 | 
			
		||||
    'group-',
 | 
			
		||||
    'project-',
 | 
			
		||||
    'user-',
 | 
			
		||||
];
 | 
			
		||||
AclRoleAccessorMethods.roles = ['OWNER', 'READER', 'WRITER'];
 | 
			
		||||
exports.AclRoleAccessorMethods = AclRoleAccessorMethods;
 | 
			
		||||
/**
 | 
			
		||||
 * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
 * bucket access. ACLs are the mechanism you use to share objects with other
 | 
			
		||||
 * users and allow other users to access your buckets and objects.
 | 
			
		||||
 *
 | 
			
		||||
 * An ACL consists of one or more entries, where each entry grants permissions
 | 
			
		||||
 * to an entity. Permissions define the actions that can be performed against an
 | 
			
		||||
 * object or bucket (for example, `READ` or `WRITE`); the entity defines who the
 | 
			
		||||
 * permission applies to (for example, a specific user or group of users).
 | 
			
		||||
 *
 | 
			
		||||
 * Where an `entity` value is accepted, we follow the format the Cloud Storage
 | 
			
		||||
 * API expects.
 | 
			
		||||
 *
 | 
			
		||||
 * Refer to
 | 
			
		||||
 * https://cloud.google.com/storage/docs/json_api/v1/defaultObjectAccessControls
 | 
			
		||||
 * for the most up-to-date values.
 | 
			
		||||
 *
 | 
			
		||||
 *   - `user-userId`
 | 
			
		||||
 *   - `user-email`
 | 
			
		||||
 *   - `group-groupId`
 | 
			
		||||
 *   - `group-email`
 | 
			
		||||
 *   - `domain-domain`
 | 
			
		||||
 *   - `project-team-projectId`
 | 
			
		||||
 *   - `allUsers`
 | 
			
		||||
 *   - `allAuthenticatedUsers`
 | 
			
		||||
 *
 | 
			
		||||
 * Examples:
 | 
			
		||||
 *
 | 
			
		||||
 *   - The user "liz@example.com" would be `user-liz@example.com`.
 | 
			
		||||
 *   - The group "example@googlegroups.com" would be
 | 
			
		||||
 *     `group-example@googlegroups.com`.
 | 
			
		||||
 *   - To refer to all members of the Google Apps for Business domain
 | 
			
		||||
 *     "example.com", the entity would be `domain-example.com`.
 | 
			
		||||
 *
 | 
			
		||||
 * For more detailed information, see
 | 
			
		||||
 * [About Access Control Lists](http://goo.gl/6qBBPO).
 | 
			
		||||
 *
 | 
			
		||||
 * @constructor Acl
 | 
			
		||||
 * @mixin
 | 
			
		||||
 * @param {object} options Configuration options.
 | 
			
		||||
 */
 | 
			
		||||
class Acl extends AclRoleAccessorMethods {
 | 
			
		||||
    constructor(options) {
 | 
			
		||||
        super();
 | 
			
		||||
        this.pathPrefix = options.pathPrefix;
 | 
			
		||||
        this.request_ = options.request;
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} AddAclResponse
 | 
			
		||||
     * @property {object} 0 The Acl Objects.
 | 
			
		||||
     * @property {object} 1 The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback AddAclCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {object} acl The Acl Objects.
 | 
			
		||||
     * @param {object} apiResponse The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Add access controls on a {@link Bucket} or {@link File}.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [BucketAccessControls: insert API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert}
 | 
			
		||||
     * @see [ObjectAccessControls: insert API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object} options Configuration options.
 | 
			
		||||
     * @param {string} options.entity Whose permissions will be added.
 | 
			
		||||
     * @param {string} options.role Permissions allowed for the defined entity.
 | 
			
		||||
     *     See {@link https://cloud.google.com/storage/docs/access-control Access
 | 
			
		||||
     * Control}.
 | 
			
		||||
     * @param {number} [options.generation] **File Objects Only** Select a specific
 | 
			
		||||
     *     revision of this file (as opposed to the latest version, the default).
 | 
			
		||||
     * @param {string} [options.userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @param {AddAclCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<AddAclResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const storage = require('@google-cloud/storage')();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const myFile = myBucket.file('my-file');
 | 
			
		||||
     *
 | 
			
		||||
     * const options = {
 | 
			
		||||
     *   entity: 'user-useremail@example.com',
 | 
			
		||||
     *   role: gcs.acl.OWNER_ROLE
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * myBucket.acl.add(options, function(err, aclObject, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // For file ACL operations, you can also specify a `generation` property.
 | 
			
		||||
     * // Here is how you would grant ownership permissions to a user on a
 | 
			
		||||
     * specific
 | 
			
		||||
     * // revision of a file.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myFile.acl.add({
 | 
			
		||||
     *   entity: 'user-useremail@example.com',
 | 
			
		||||
     *   role: gcs.acl.OWNER_ROLE,
 | 
			
		||||
     *   generation: 1
 | 
			
		||||
     * }, function(err, aclObject, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myBucket.acl.add(options).then(function(data) {
 | 
			
		||||
     *   const aclObject = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_add_file_owner
 | 
			
		||||
     * Example of adding an owner to a file:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_add_bucket_owner
 | 
			
		||||
     * Example of adding an owner to a bucket:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_add_bucket_default_owner
 | 
			
		||||
     * Example of adding a default owner to a bucket:
 | 
			
		||||
     */
 | 
			
		||||
    add(options, callback) {
 | 
			
		||||
        const query = {};
 | 
			
		||||
        if (options.generation) {
 | 
			
		||||
            query.generation = options.generation;
 | 
			
		||||
        }
 | 
			
		||||
        if (options.userProject) {
 | 
			
		||||
            query.userProject = options.userProject;
 | 
			
		||||
        }
 | 
			
		||||
        this.request({
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            uri: '',
 | 
			
		||||
            qs: query,
 | 
			
		||||
            json: {
 | 
			
		||||
                entity: options.entity,
 | 
			
		||||
                role: options.role.toUpperCase(),
 | 
			
		||||
            },
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            callback(null, this.makeAclObject_(resp), resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} RemoveAclResponse
 | 
			
		||||
     * @property {object} 0 The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback RemoveAclCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {object} apiResponse The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Delete access controls on a {@link Bucket} or {@link File}.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [BucketAccessControls: delete API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/delete}
 | 
			
		||||
     * @see [ObjectAccessControls: delete API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/delete}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object} options Configuration object.
 | 
			
		||||
     * @param {string} options.entity Whose permissions will be revoked.
 | 
			
		||||
     * @param {int} [options.generation] **File Objects Only** Select a specific
 | 
			
		||||
     *     revision of this file (as opposed to the latest version, the default).
 | 
			
		||||
     * @param {string} [options.userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @param {RemoveAclCallback} callback The callback function.
 | 
			
		||||
     * @returns {Promise<RemoveAclResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const storage = require('@google-cloud/storage')();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const myFile = myBucket.file('my-file');
 | 
			
		||||
     *
 | 
			
		||||
     * myBucket.acl.delete({
 | 
			
		||||
     *   entity: 'user-useremail@example.com'
 | 
			
		||||
     * }, function(err, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // For file ACL operations, you can also specify a `generation` property.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myFile.acl.delete({
 | 
			
		||||
     *   entity: 'user-useremail@example.com',
 | 
			
		||||
     *   generation: 1
 | 
			
		||||
     * }, function(err, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myFile.acl.delete().then(function(data) {
 | 
			
		||||
     *   const apiResponse = data[0];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_remove_bucket_owner
 | 
			
		||||
     * Example of removing an owner from a bucket:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_remove_bucket_default_owner
 | 
			
		||||
     * Example of removing a default owner from a bucket:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_remove_file_owner
 | 
			
		||||
     * Example of removing an owner from a bucket:
 | 
			
		||||
     */
 | 
			
		||||
    delete(options, callback) {
 | 
			
		||||
        const query = {};
 | 
			
		||||
        if (options.generation) {
 | 
			
		||||
            query.generation = options.generation;
 | 
			
		||||
        }
 | 
			
		||||
        if (options.userProject) {
 | 
			
		||||
            query.userProject = options.userProject;
 | 
			
		||||
        }
 | 
			
		||||
        this.request({
 | 
			
		||||
            method: 'DELETE',
 | 
			
		||||
            uri: '/' + encodeURIComponent(options.entity),
 | 
			
		||||
            qs: query,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            callback(err, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} GetAclResponse
 | 
			
		||||
     * @property {object|object[]} 0 Single or array of Acl Objects.
 | 
			
		||||
     * @property {object} 1 The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback GetAclCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {object|object[]} acl Single or array of Acl Objects.
 | 
			
		||||
     * @param {object} apiResponse The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Get access controls on a {@link Bucket} or {@link File}. If
 | 
			
		||||
     * an entity is omitted, you will receive an array of all applicable access
 | 
			
		||||
     * controls.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [BucketAccessControls: get API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/get}
 | 
			
		||||
     * @see [ObjectAccessControls: get API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/get}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object|function} [options] Configuration options. If you want to
 | 
			
		||||
     *     receive a list of all access controls, pass the callback function as
 | 
			
		||||
     * the only argument.
 | 
			
		||||
     * @param {string} [options.entity] Whose permissions will be fetched.
 | 
			
		||||
     * @param {number} [options.generation] **File Objects Only** Select a specific
 | 
			
		||||
     *     revision of this file (as opposed to the latest version, the default).
 | 
			
		||||
     * @param {string} [options.userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @param {GetAclCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<GetAclResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const storage = require('@google-cloud/storage')();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const myFile = myBucket.file('my-file');
 | 
			
		||||
     *
 | 
			
		||||
     * myBucket.acl.get({
 | 
			
		||||
     *   entity: 'user-useremail@example.com'
 | 
			
		||||
     * }, function(err, aclObject, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Get all access controls.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myBucket.acl.get(function(err, aclObjects, apiResponse) {
 | 
			
		||||
     *   // aclObjects = [
 | 
			
		||||
     *   //   {
 | 
			
		||||
     *   //     entity: 'user-useremail@example.com',
 | 
			
		||||
     *   //     role: 'owner'
 | 
			
		||||
     *   //   }
 | 
			
		||||
     *   // ]
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // For file ACL operations, you can also specify a `generation` property.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myFile.acl.get({
 | 
			
		||||
     *   entity: 'user-useremail@example.com',
 | 
			
		||||
     *   generation: 1
 | 
			
		||||
     * }, function(err, aclObject, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myBucket.acl.get().then(function(data) {
 | 
			
		||||
     *   const aclObject = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_print_file_acl
 | 
			
		||||
     * Example of printing a file's ACL:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_print_file_acl_for_user
 | 
			
		||||
     * Example of printing a file's ACL for a specific user:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_print_bucket_acl
 | 
			
		||||
     * Example of printing a bucket's ACL:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_print_bucket_acl_for_user
 | 
			
		||||
     * Example of printing a bucket's ACL for a specific user:
 | 
			
		||||
     */
 | 
			
		||||
    get(optionsOrCallback, cb) {
 | 
			
		||||
        const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : null;
 | 
			
		||||
        const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : cb;
 | 
			
		||||
        let path = '';
 | 
			
		||||
        const query = {};
 | 
			
		||||
        if (options) {
 | 
			
		||||
            path = '/' + encodeURIComponent(options.entity);
 | 
			
		||||
            if (options.generation) {
 | 
			
		||||
                query.generation = options.generation;
 | 
			
		||||
            }
 | 
			
		||||
            if (options.userProject) {
 | 
			
		||||
                query.userProject = options.userProject;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        this.request({
 | 
			
		||||
            uri: path,
 | 
			
		||||
            qs: query,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            let results;
 | 
			
		||||
            if (resp.items) {
 | 
			
		||||
                results = arrify(resp.items).map(this.makeAclObject_);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                results = this.makeAclObject_(resp);
 | 
			
		||||
            }
 | 
			
		||||
            callback(null, results, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} UpdateAclResponse
 | 
			
		||||
     * @property {object} 0 The updated Acl Objects.
 | 
			
		||||
     * @property {object} 1 The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback UpdateAclCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {object} acl The updated Acl Objects.
 | 
			
		||||
     * @param {object} apiResponse The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Update access controls on a {@link Bucket} or {@link File}.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [BucketAccessControls: update API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/update}
 | 
			
		||||
     * @see [ObjectAccessControls: update API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/update}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object} options Configuration options.
 | 
			
		||||
     * @param {string} options.entity Whose permissions will be updated.
 | 
			
		||||
     * @param {string} options.role Permissions allowed for the defined entity.
 | 
			
		||||
     *     See {@link Storage.acl}.
 | 
			
		||||
     * @param {number} [options.generation] **File Objects Only** Select a specific
 | 
			
		||||
     *     revision of this file (as opposed to the latest version, the default).
 | 
			
		||||
     * @param {string} [options.userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @param {UpdateAclCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<UpdateAclResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const storage = require('@google-cloud/storage')();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const myFile = myBucket.file('my-file');
 | 
			
		||||
     *
 | 
			
		||||
     * const options = {
 | 
			
		||||
     *   entity: 'user-useremail@example.com',
 | 
			
		||||
     *   role: gcs.acl.WRITER_ROLE
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * myBucket.acl.update(options, function(err, aclObject, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // For file ACL operations, you can also specify a `generation` property.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myFile.acl.update({
 | 
			
		||||
     *   entity: 'user-useremail@example.com',
 | 
			
		||||
     *   role: gcs.acl.WRITER_ROLE,
 | 
			
		||||
     *   generation: 1
 | 
			
		||||
     * }, function(err, aclObject, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myFile.acl.update(options).then(function(data) {
 | 
			
		||||
     *   const aclObject = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    update(options, callback) {
 | 
			
		||||
        const query = {};
 | 
			
		||||
        if (options.generation) {
 | 
			
		||||
            query.generation = options.generation;
 | 
			
		||||
        }
 | 
			
		||||
        if (options.userProject) {
 | 
			
		||||
            query.userProject = options.userProject;
 | 
			
		||||
        }
 | 
			
		||||
        this.request({
 | 
			
		||||
            method: 'PUT',
 | 
			
		||||
            uri: '/' + encodeURIComponent(options.entity),
 | 
			
		||||
            qs: query,
 | 
			
		||||
            json: {
 | 
			
		||||
                role: options.role.toUpperCase(),
 | 
			
		||||
            },
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            callback(null, this.makeAclObject_(resp), resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Transform API responses to a consistent object format.
 | 
			
		||||
     *
 | 
			
		||||
     * @private
 | 
			
		||||
     */
 | 
			
		||||
    makeAclObject_(accessControlObject) {
 | 
			
		||||
        const obj = {
 | 
			
		||||
            entity: accessControlObject.entity,
 | 
			
		||||
            role: accessControlObject.role,
 | 
			
		||||
        };
 | 
			
		||||
        if (accessControlObject.projectTeam) {
 | 
			
		||||
            obj.projectTeam = accessControlObject.projectTeam;
 | 
			
		||||
        }
 | 
			
		||||
        return obj;
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Patch requests up to the bucket's request object.
 | 
			
		||||
     *
 | 
			
		||||
     * @private
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} method Action.
 | 
			
		||||
     * @param {string} path Request path.
 | 
			
		||||
     * @param {*} query Request query object.
 | 
			
		||||
     * @param {*} body Request body contents.
 | 
			
		||||
     * @param {function} callback Callback function.
 | 
			
		||||
     */
 | 
			
		||||
    request(reqOpts, callback) {
 | 
			
		||||
        reqOpts.uri = this.pathPrefix + reqOpts.uri;
 | 
			
		||||
        this.request_(reqOpts, callback);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.Acl = Acl;
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * All async methods (except for streams) will return a Promise in the event
 | 
			
		||||
 * that a callback is omitted.
 | 
			
		||||
 */
 | 
			
		||||
promisify_1.promisifyAll(Acl, {
 | 
			
		||||
    exclude: ['request'],
 | 
			
		||||
});
 | 
			
		||||
//# sourceMappingURL=acl.js.map
 | 
			
		||||
							
								
								
									
										528
									
								
								node_modules/@google-cloud/storage/build/src/bucket.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										528
									
								
								node_modules/@google-cloud/storage/build/src/bucket.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,528 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
/// <reference types="node" />
 | 
			
		||||
import { ApiError, BodyResponseCallback, DecorateRequestOptions, DeleteCallback, ExistsCallback, GetConfig, Metadata, ResponseBody, ServiceObject } from '@google-cloud/common';
 | 
			
		||||
import { Acl } from './acl';
 | 
			
		||||
import { Channel } from './channel';
 | 
			
		||||
import { File, FileOptions, CreateResumableUploadOptions, CreateWriteStreamOptions } from './file';
 | 
			
		||||
import { Iam } from './iam';
 | 
			
		||||
import { Notification } from './notification';
 | 
			
		||||
import { Storage } from './storage';
 | 
			
		||||
interface BucketOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetFilesResponse = [File[], {}, Metadata];
 | 
			
		||||
export interface GetFilesCallback {
 | 
			
		||||
    (err: Error | null, files?: File[], nextQuery?: {}, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
interface WatchAllOptions {
 | 
			
		||||
    delimiter?: string;
 | 
			
		||||
    maxResults?: number;
 | 
			
		||||
    pageToken?: string;
 | 
			
		||||
    prefix?: string;
 | 
			
		||||
    projection?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
    versions?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface AddLifecycleRuleOptions {
 | 
			
		||||
    append?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface LifecycleRule {
 | 
			
		||||
    action: {
 | 
			
		||||
        type: string;
 | 
			
		||||
        storageClass?: string;
 | 
			
		||||
    } | string;
 | 
			
		||||
    condition: {
 | 
			
		||||
        [key: string]: boolean | Date | number | string;
 | 
			
		||||
    };
 | 
			
		||||
    storageClass?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface GetFilesOptions {
 | 
			
		||||
    autoPaginate?: boolean;
 | 
			
		||||
    delimiter?: string;
 | 
			
		||||
    directory?: string;
 | 
			
		||||
    prefix?: string;
 | 
			
		||||
    maxApiCalls?: number;
 | 
			
		||||
    maxResults?: number;
 | 
			
		||||
    pageToken?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
    versions?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface CombineOptions {
 | 
			
		||||
    kmsKeyName?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface CombineCallback {
 | 
			
		||||
    (err: Error | null, newFile: File | null, apiResponse: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type CombineResponse = [File, Metadata];
 | 
			
		||||
export interface CreateChannelConfig extends WatchAllOptions {
 | 
			
		||||
    address: string;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateChannelOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type CreateChannelResponse = [Channel, Metadata];
 | 
			
		||||
export interface CreateChannelCallback {
 | 
			
		||||
    (err: Error | null, channel: Channel | null, apiResponse: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateNotificationOptions {
 | 
			
		||||
    customAttributes?: {
 | 
			
		||||
        [key: string]: string;
 | 
			
		||||
    };
 | 
			
		||||
    eventTypes?: string[];
 | 
			
		||||
    objectNamePrefix?: string;
 | 
			
		||||
    payloadFormat?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateNotificationCallback {
 | 
			
		||||
    (err: Error | null, notification: Notification | null, apiResponse: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type CreateNotificationResponse = [Notification, Metadata];
 | 
			
		||||
export interface DeleteBucketOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type DeleteBucketResponse = [Metadata];
 | 
			
		||||
export interface DeleteBucketCallback extends DeleteCallback {
 | 
			
		||||
    (err: Error | null, apiResponse: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface DeleteFilesOptions extends GetFilesOptions {
 | 
			
		||||
    force?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface DeleteFilesCallback {
 | 
			
		||||
    (err: Error | Error[] | null, apiResponse?: object): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type DeleteLabelsResponse = [Metadata];
 | 
			
		||||
export interface DeleteLabelsCallback extends SetLabelsCallback {
 | 
			
		||||
}
 | 
			
		||||
export declare type DisableRequesterPaysResponse = [Metadata];
 | 
			
		||||
export interface DisableRequesterPaysCallback {
 | 
			
		||||
    (err?: Error | null, apiResponse?: object): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type EnableRequesterPaysResponse = [Metadata];
 | 
			
		||||
export interface EnableRequesterPaysCallback {
 | 
			
		||||
    (err?: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface BucketExistsOptions extends GetConfig {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type BucketExistsResponse = [boolean];
 | 
			
		||||
export interface BucketExistsCallback extends ExistsCallback {
 | 
			
		||||
}
 | 
			
		||||
export interface GetBucketOptions extends GetConfig {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetBucketResponse = [Bucket, Metadata];
 | 
			
		||||
export interface GetBucketCallback {
 | 
			
		||||
    (err: ApiError | null, bucket: Bucket | null, apiResponse: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetLabelsOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetLabelsResponse = [Metadata];
 | 
			
		||||
export interface GetLabelsCallback {
 | 
			
		||||
    (err: Error | null, labels: object | null): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetBucketMetadataResponse = [Metadata, Metadata];
 | 
			
		||||
export interface GetBucketMetadataCallback {
 | 
			
		||||
    (err: ApiError | null, metadata: Metadata | null, apiResponse: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetBucketMetadataOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface GetNotificationsOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface GetNotificationsCallback {
 | 
			
		||||
    (err: Error | null, notifications: Notification[] | null, apiResponse: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetNotificationsResponse = [Notification[], Metadata];
 | 
			
		||||
export interface MakeBucketPrivateOptions {
 | 
			
		||||
    includeFiles?: boolean;
 | 
			
		||||
    force?: boolean;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type MakeBucketPrivateResponse = [File[]];
 | 
			
		||||
export interface MakeBucketPrivateCallback {
 | 
			
		||||
    (err?: Error | null, files?: File[]): void;
 | 
			
		||||
}
 | 
			
		||||
export interface MakeBucketPublicOptions {
 | 
			
		||||
    includeFiles?: boolean;
 | 
			
		||||
    force?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface MakeBucketPublicCallback {
 | 
			
		||||
    (err?: Error | null, files?: File[]): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type MakeBucketPublicResponse = [File[]];
 | 
			
		||||
export interface SetBucketMetadataOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type SetBucketMetadataResponse = [Metadata];
 | 
			
		||||
export interface SetBucketMetadataCallback {
 | 
			
		||||
    (err?: Error | null, metadata?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface BucketLockCallback {
 | 
			
		||||
    (err?: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type BucketLockResponse = [Metadata];
 | 
			
		||||
export interface Labels {
 | 
			
		||||
    [key: string]: string;
 | 
			
		||||
}
 | 
			
		||||
export interface SetLabelsOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type SetLabelsResponse = [Metadata];
 | 
			
		||||
export interface SetLabelsCallback {
 | 
			
		||||
    (err?: Error | null, metadata?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface SetBucketStorageClassOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface SetBucketStorageClassCallback {
 | 
			
		||||
    (err?: Error | null): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type UploadResponse = [File, Metadata];
 | 
			
		||||
export interface UploadCallback {
 | 
			
		||||
    (err: Error | null, file?: File | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface UploadOptions extends CreateResumableUploadOptions, CreateWriteStreamOptions {
 | 
			
		||||
    destination?: string | File;
 | 
			
		||||
    encryptionKey?: string | Buffer;
 | 
			
		||||
    kmsKeyName?: string;
 | 
			
		||||
    resumable?: boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface MakeAllFilesPublicPrivateOptions {
 | 
			
		||||
    force?: boolean;
 | 
			
		||||
    private?: boolean;
 | 
			
		||||
    public?: boolean;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
interface MakeAllFilesPublicPrivateCallback {
 | 
			
		||||
    (err?: Error | Error[] | null, files?: File[]): void;
 | 
			
		||||
}
 | 
			
		||||
declare type MakeAllFilesPublicPrivateResponse = [File[]];
 | 
			
		||||
/**
 | 
			
		||||
 * Create a Bucket object to interact with a Cloud Storage bucket.
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 * @hideconstructor
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Storage} storage A {@link Storage} instance.
 | 
			
		||||
 * @param {string} name The name of the bucket.
 | 
			
		||||
 * @param {object} [options] Configuration object.
 | 
			
		||||
 * @param {string} [options.userProject] User project.
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const bucket = storage.bucket('albums');
 | 
			
		||||
 */
 | 
			
		||||
declare class Bucket extends ServiceObject {
 | 
			
		||||
    /**
 | 
			
		||||
     * The bucket's name.
 | 
			
		||||
     * @name Bucket#name
 | 
			
		||||
     * @type {string}
 | 
			
		||||
     */
 | 
			
		||||
    name: string;
 | 
			
		||||
    /**
 | 
			
		||||
     * A reference to the {@link Storage} associated with this {@link Bucket}
 | 
			
		||||
     * instance.
 | 
			
		||||
     * @name Bucket#storage
 | 
			
		||||
     * @type {Storage}
 | 
			
		||||
     */
 | 
			
		||||
    storage: Storage;
 | 
			
		||||
    /**
 | 
			
		||||
     * A user project to apply to each request from this bucket.
 | 
			
		||||
     * @name Bucket#userProject
 | 
			
		||||
     * @type {string}
 | 
			
		||||
     */
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
    /**
 | 
			
		||||
     * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
     * bucket access. ACLs are the mechanism you use to share objects with other
 | 
			
		||||
     * users and allow other users to access your buckets and objects.
 | 
			
		||||
     *
 | 
			
		||||
     * An ACL consists of one or more entries, where each entry grants permissions
 | 
			
		||||
     * to an entity. Permissions define the actions that can be performed against
 | 
			
		||||
     * an object or bucket (for example, `READ` or `WRITE`); the entity defines
 | 
			
		||||
     * who the permission applies to (for example, a specific user or group of
 | 
			
		||||
     * users).
 | 
			
		||||
     *
 | 
			
		||||
     * The `acl` object on a Bucket instance provides methods to get you a list of
 | 
			
		||||
     * the ACLs defined on your bucket, as well as set, update, and delete them.
 | 
			
		||||
     *
 | 
			
		||||
     * Buckets also have
 | 
			
		||||
     * [default
 | 
			
		||||
     * ACLs](https://cloud.google.com/storage/docs/access-control/lists#default)
 | 
			
		||||
     * for all created files. Default ACLs specify permissions that all new
 | 
			
		||||
     * objects added to the bucket will inherit by default. You can add, delete,
 | 
			
		||||
     * get, and update entities and permissions for these as well with
 | 
			
		||||
     * {@link Bucket#acl.default}.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [About Access Control Lists]{@link http://goo.gl/6qBBPO}
 | 
			
		||||
     * @see [Default ACLs]{@link https://cloud.google.com/storage/docs/access-control/lists#default}
 | 
			
		||||
     *
 | 
			
		||||
     * @name Bucket#acl
 | 
			
		||||
     * @mixes Acl
 | 
			
		||||
     * @property {Acl} default Cloud Storage Buckets have
 | 
			
		||||
     * [default
 | 
			
		||||
     * ACLs](https://cloud.google.com/storage/docs/access-control/lists#default)
 | 
			
		||||
     * for all created files. You can add, delete, get, and update entities and
 | 
			
		||||
     * permissions for these as well. The method signatures and examples are all
 | 
			
		||||
     * the same, after only prefixing the method call with `default`.
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Make a bucket's contents publicly readable.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * const options = {
 | 
			
		||||
     *   entity: 'allUsers',
 | 
			
		||||
     *   role: storage.acl.READER_ROLE
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * myBucket.acl.add(options, function(err, aclObject) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * myBucket.acl.add(options).then(function(data) {
 | 
			
		||||
     *   const aclObject = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_print_bucket_acl
 | 
			
		||||
     * Example of printing a bucket's ACL:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_print_bucket_acl_for_user
 | 
			
		||||
     * Example of printing a bucket's ACL for a specific user:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_add_bucket_owner
 | 
			
		||||
     * Example of adding an owner to a bucket:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_remove_bucket_owner
 | 
			
		||||
     * Example of removing an owner from a bucket:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_add_bucket_default_owner
 | 
			
		||||
     * Example of adding a default owner to a bucket:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/acl.js</caption>
 | 
			
		||||
     * region_tag:storage_remove_bucket_default_owner
 | 
			
		||||
     * Example of removing a default owner from a bucket:
 | 
			
		||||
     */
 | 
			
		||||
    acl: Acl;
 | 
			
		||||
    /**
 | 
			
		||||
     * Get and set IAM policies for your bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * @name Bucket#iam
 | 
			
		||||
     * @mixes Iam
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Cloud Storage IAM Management](https://cloud.google.com/storage/docs/access-control/iam#short_title_iam_management)
 | 
			
		||||
     * @see [Granting, Changing, and Revoking Access](https://cloud.google.com/iam/docs/granting-changing-revoking-access)
 | 
			
		||||
     * @see [IAM Roles](https://cloud.google.com/iam/docs/understanding-roles)
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('albums');
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Get the IAM policy for your bucket.
 | 
			
		||||
     * //-
 | 
			
		||||
     * bucket.iam.getPolicy(function(err, policy) {
 | 
			
		||||
     *   console.log(policy);
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * bucket.iam.getPolicy().then(function(data) {
 | 
			
		||||
     *   const policy = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/iam.js</caption>
 | 
			
		||||
     * region_tag:storage_view_bucket_iam_members
 | 
			
		||||
     * Example of retrieving a bucket's IAM policy:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/iam.js</caption>
 | 
			
		||||
     * region_tag:storage_add_bucket_iam_member
 | 
			
		||||
     * Example of adding to a bucket's IAM policy:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/iam.js</caption>
 | 
			
		||||
     * region_tag:storage_remove_bucket_iam_member
 | 
			
		||||
     * Example of removing from a bucket's IAM policy:
 | 
			
		||||
     */
 | 
			
		||||
    iam: Iam;
 | 
			
		||||
    /**
 | 
			
		||||
     * Get {@link File} objects for the files currently in the bucket as a
 | 
			
		||||
     * readable object stream.
 | 
			
		||||
     *
 | 
			
		||||
     * @method Bucket#getFilesStream
 | 
			
		||||
     * @param {GetFilesOptions} [query] Query object for listing files.
 | 
			
		||||
     * @returns {ReadableStream} A readable stream that emits {@link File} instances.
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('albums');
 | 
			
		||||
     *
 | 
			
		||||
     * bucket.getFilesStream()
 | 
			
		||||
     *   .on('error', console.error)
 | 
			
		||||
     *   .on('data', function(file) {
 | 
			
		||||
     *     // file is a File object.
 | 
			
		||||
     *   })
 | 
			
		||||
     *   .on('end', function() {
 | 
			
		||||
     *     // All files retrieved.
 | 
			
		||||
     *   });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If you anticipate many results, you can end a stream early to prevent
 | 
			
		||||
     * // unnecessary processing and API requests.
 | 
			
		||||
     * //-
 | 
			
		||||
     * bucket.getFilesStream()
 | 
			
		||||
     *   .on('data', function(file) {
 | 
			
		||||
     *     this.end();
 | 
			
		||||
     *   });
 | 
			
		||||
     */
 | 
			
		||||
    getFilesStream: Function;
 | 
			
		||||
    constructor(storage: Storage, name: string, options?: BucketOptions);
 | 
			
		||||
    addLifecycleRule(rule: LifecycleRule, options?: AddLifecycleRuleOptions): Promise<SetBucketMetadataResponse>;
 | 
			
		||||
    addLifecycleRule(rule: LifecycleRule, options: AddLifecycleRuleOptions, callback: SetBucketMetadataCallback): void;
 | 
			
		||||
    addLifecycleRule(rule: LifecycleRule, callback: SetBucketMetadataCallback): void;
 | 
			
		||||
    combine(sources: string[] | File[], destination: string | File, options?: CombineOptions): Promise<CombineResponse>;
 | 
			
		||||
    combine(sources: string[] | File[], destination: string | File, options: CombineOptions, callback: CombineCallback): void;
 | 
			
		||||
    combine(sources: string[] | File[], destination: string | File, callback: CombineCallback): void;
 | 
			
		||||
    createChannel(id: string, config: CreateChannelConfig, options?: CreateChannelOptions): Promise<CreateChannelResponse>;
 | 
			
		||||
    createChannel(id: string, config: CreateChannelConfig, callback: CreateChannelCallback): void;
 | 
			
		||||
    createChannel(id: string, config: CreateChannelConfig, options: CreateChannelOptions, callback: CreateChannelCallback): void;
 | 
			
		||||
    createNotification(topic: string, options?: CreateNotificationOptions): Promise<CreateNotificationResponse>;
 | 
			
		||||
    createNotification(topic: string, options: CreateNotificationOptions, callback: CreateNotificationCallback): void;
 | 
			
		||||
    createNotification(topic: string, callback: CreateNotificationCallback): void;
 | 
			
		||||
    deleteFiles(query?: DeleteFilesOptions): Promise<void>;
 | 
			
		||||
    deleteFiles(callback: DeleteFilesCallback): void;
 | 
			
		||||
    deleteFiles(query: DeleteFilesOptions, callback: DeleteFilesCallback): void;
 | 
			
		||||
    deleteLabels(labels?: string | string[]): Promise<DeleteLabelsResponse>;
 | 
			
		||||
    deleteLabels(callback: DeleteLabelsCallback): void;
 | 
			
		||||
    deleteLabels(labels: string | string[], callback: DeleteLabelsCallback): void;
 | 
			
		||||
    disableRequesterPays(): Promise<DisableRequesterPaysResponse>;
 | 
			
		||||
    disableRequesterPays(callback: DisableRequesterPaysCallback): void;
 | 
			
		||||
    enableRequesterPays(): Promise<EnableRequesterPaysResponse>;
 | 
			
		||||
    enableRequesterPays(callback: EnableRequesterPaysCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a {@link File} object. See {@link File} to see how to handle
 | 
			
		||||
     * the different use cases you may have.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} name The name of the file in this bucket.
 | 
			
		||||
     * @param {object} [options] Configuration options.
 | 
			
		||||
     * @param {string|number} [options.generation] Only use a specific revision of
 | 
			
		||||
     *     this file.
 | 
			
		||||
     * @param {string} [options.encryptionKey] A custom encryption key. See
 | 
			
		||||
     *     [Customer-supplied Encryption
 | 
			
		||||
     * Keys](https://cloud.google.com/storage/docs/encryption#customer-supplied).
 | 
			
		||||
     * @param {string} [options.kmsKeyName] The name of the Cloud KMS key that will
 | 
			
		||||
     *     be used to encrypt the object. Must be in the format:
 | 
			
		||||
     *     `projects/my-project/locations/location/keyRings/my-kr/cryptoKeys/my-key`.
 | 
			
		||||
     *     KMS key ring must use the same location as the bucket.
 | 
			
		||||
     * @returns {File}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('albums');
 | 
			
		||||
     * const file = bucket.file('my-existing-file.png');
 | 
			
		||||
     */
 | 
			
		||||
    file(name: string, options?: FileOptions): File;
 | 
			
		||||
    getFiles(query?: GetFilesOptions): Promise<GetFilesResponse>;
 | 
			
		||||
    getFiles(query: GetFilesOptions, callback: GetFilesCallback): void;
 | 
			
		||||
    getFiles(callback: GetFilesCallback): void;
 | 
			
		||||
    getLabels(options: GetLabelsOptions): Promise<GetLabelsResponse>;
 | 
			
		||||
    getLabels(callback: GetLabelsCallback): void;
 | 
			
		||||
    getLabels(options: GetLabelsOptions, callback: GetLabelsCallback): void;
 | 
			
		||||
    getNotifications(options?: GetNotificationsOptions): Promise<GetNotificationsResponse>;
 | 
			
		||||
    getNotifications(callback: GetNotificationsCallback): void;
 | 
			
		||||
    getNotifications(options: GetNotificationsOptions, callback: GetNotificationsCallback): void;
 | 
			
		||||
    lock(metageneration: number | string): Promise<BucketLockResponse>;
 | 
			
		||||
    lock(metageneration: number | string, callback: BucketLockCallback): void;
 | 
			
		||||
    makePrivate(options?: MakeBucketPrivateOptions): Promise<MakeBucketPrivateResponse>;
 | 
			
		||||
    makePrivate(callback: MakeBucketPrivateCallback): void;
 | 
			
		||||
    makePrivate(options: MakeBucketPrivateOptions, callback: MakeBucketPrivateCallback): void;
 | 
			
		||||
    makePublic(options?: MakeBucketPublicOptions): Promise<MakeBucketPublicResponse>;
 | 
			
		||||
    makePublic(callback: MakeBucketPublicCallback): void;
 | 
			
		||||
    makePublic(options: MakeBucketPublicOptions, callback: MakeBucketPublicCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a reference to a Cloud Pub/Sub Notification.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} id ID of notification.
 | 
			
		||||
     * @returns {Notification}
 | 
			
		||||
     * @see Notification
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const notification = bucket.notification('1');
 | 
			
		||||
     */
 | 
			
		||||
    notification(id: string): Notification;
 | 
			
		||||
    removeRetentionPeriod(): Promise<SetBucketMetadataResponse>;
 | 
			
		||||
    removeRetentionPeriod(callback: SetBucketMetadataCallback): void;
 | 
			
		||||
    request(reqOpts: DecorateRequestOptions): Promise<[ResponseBody, Metadata]>;
 | 
			
		||||
    request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
 | 
			
		||||
    setLabels(labels: Labels, options?: SetLabelsOptions): Promise<SetLabelsResponse>;
 | 
			
		||||
    setLabels(labels: Labels, callback: SetLabelsCallback): void;
 | 
			
		||||
    setLabels(labels: Labels, options: SetLabelsOptions, callback: SetLabelsCallback): void;
 | 
			
		||||
    setRetentionPeriod(duration: number): Promise<SetBucketMetadataResponse>;
 | 
			
		||||
    setRetentionPeriod(duration: number, callback: SetBucketMetadataCallback): void;
 | 
			
		||||
    setStorageClass(storageClass: string, options?: SetBucketStorageClassOptions): Promise<SetBucketMetadataResponse>;
 | 
			
		||||
    setStorageClass(storageClass: string, callback: SetBucketStorageClassCallback): void;
 | 
			
		||||
    setStorageClass(storageClass: string, options: SetBucketStorageClassOptions, callback: SetBucketStorageClassCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Set a user project to be billed for all requests made from this Bucket
 | 
			
		||||
     * object and any files referenced from this Bucket object.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} userProject The user project.
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('albums');
 | 
			
		||||
     *
 | 
			
		||||
     * bucket.setUserProject('grape-spaceship-123');
 | 
			
		||||
     */
 | 
			
		||||
    setUserProject(userProject: string): void;
 | 
			
		||||
    upload(pathString: string, options?: UploadOptions): Promise<UploadResponse>;
 | 
			
		||||
    upload(pathString: string, options: UploadOptions, callback: UploadCallback): void;
 | 
			
		||||
    upload(pathString: string, callback: UploadCallback): void;
 | 
			
		||||
    makeAllFilesPublicPrivate_(options?: MakeAllFilesPublicPrivateOptions): Promise<MakeAllFilesPublicPrivateResponse>;
 | 
			
		||||
    makeAllFilesPublicPrivate_(callback: MakeAllFilesPublicPrivateCallback): void;
 | 
			
		||||
    makeAllFilesPublicPrivate_(options: MakeAllFilesPublicPrivateOptions, callback: MakeAllFilesPublicPrivateCallback): void;
 | 
			
		||||
    getId(): string;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Reference to the {@link Bucket} class.
 | 
			
		||||
 * @name module:@google-cloud/storage.Bucket
 | 
			
		||||
 * @see Bucket
 | 
			
		||||
 */
 | 
			
		||||
export { Bucket };
 | 
			
		||||
							
								
								
									
										2355
									
								
								node_modules/@google-cloud/storage/build/src/bucket.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2355
									
								
								node_modules/@google-cloud/storage/build/src/bucket.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										46
									
								
								node_modules/@google-cloud/storage/build/src/channel.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								node_modules/@google-cloud/storage/build/src/channel.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
import { Metadata, ServiceObject } from '@google-cloud/common';
 | 
			
		||||
import { Storage } from './storage';
 | 
			
		||||
export interface StopCallback {
 | 
			
		||||
    (err: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Create a channel object to interact with a Cloud Storage channel.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Object Change Notification]{@link https://cloud.google.com/storage/docs/object-change-notification}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 *
 | 
			
		||||
 * @param {string} id The ID of the channel.
 | 
			
		||||
 * @param {string} resourceId The resource ID of the channel.
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const channel = storage.channel('id', 'resource-id');
 | 
			
		||||
 */
 | 
			
		||||
declare class Channel extends ServiceObject {
 | 
			
		||||
    constructor(storage: Storage, id: string, resourceId: string);
 | 
			
		||||
    stop(): Promise<Metadata>;
 | 
			
		||||
    stop(callback: StopCallback): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Reference to the {@link Channel} class.
 | 
			
		||||
 * @name module:@google-cloud/storage.Channel
 | 
			
		||||
 * @see Channel
 | 
			
		||||
 */
 | 
			
		||||
export { Channel };
 | 
			
		||||
							
								
								
									
										105
									
								
								node_modules/@google-cloud/storage/build/src/channel.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								node_modules/@google-cloud/storage/build/src/channel.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,105 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const common_1 = require("@google-cloud/common");
 | 
			
		||||
const promisify_1 = require("@google-cloud/promisify");
 | 
			
		||||
/**
 | 
			
		||||
 * Create a channel object to interact with a Cloud Storage channel.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Object Change Notification]{@link https://cloud.google.com/storage/docs/object-change-notification}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 *
 | 
			
		||||
 * @param {string} id The ID of the channel.
 | 
			
		||||
 * @param {string} resourceId The resource ID of the channel.
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const channel = storage.channel('id', 'resource-id');
 | 
			
		||||
 */
 | 
			
		||||
class Channel extends common_1.ServiceObject {
 | 
			
		||||
    constructor(storage, id, resourceId) {
 | 
			
		||||
        const config = {
 | 
			
		||||
            parent: storage,
 | 
			
		||||
            baseUrl: '/channels',
 | 
			
		||||
            // An ID shouldn't be included in the API requests.
 | 
			
		||||
            // RE:
 | 
			
		||||
            // https://github.com/GoogleCloudPlatform/google-cloud-node/issues/1145
 | 
			
		||||
            id: '',
 | 
			
		||||
            methods: {
 | 
			
		||||
            // Only need `request`.
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
        super(config);
 | 
			
		||||
        // TODO: remove type cast to any once ServiceObject's type declaration has
 | 
			
		||||
        // been fixed. https://github.com/googleapis/nodejs-common/issues/176
 | 
			
		||||
        const metadata = this.metadata;
 | 
			
		||||
        metadata.id = id;
 | 
			
		||||
        metadata.resourceId = resourceId;
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} StopResponse
 | 
			
		||||
     * @property {object} 0 The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback StopCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {object} apiResponse The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Stop this channel.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {StopCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<StopResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const channel = storage.channel('id', 'resource-id');
 | 
			
		||||
     * channel.stop(function(err, apiResponse) {
 | 
			
		||||
     *   if (!err) {
 | 
			
		||||
     *     // Channel stopped successfully.
 | 
			
		||||
     *   }
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * channel.stop().then(function(data) {
 | 
			
		||||
     *   const apiResponse = data[0];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    stop(callback) {
 | 
			
		||||
        callback = callback || common_1.util.noop;
 | 
			
		||||
        this.request({
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            uri: '/stop',
 | 
			
		||||
            json: this.metadata,
 | 
			
		||||
        }, (err, apiResponse) => {
 | 
			
		||||
            callback(err, apiResponse);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.Channel = Channel;
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * All async methods (except for streams) will return a Promise in the event
 | 
			
		||||
 * that a callback is omitted.
 | 
			
		||||
 */
 | 
			
		||||
promisify_1.promisifyAll(Channel);
 | 
			
		||||
//# sourceMappingURL=channel.js.map
 | 
			
		||||
							
								
								
									
										675
									
								
								node_modules/@google-cloud/storage/build/src/file.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										675
									
								
								node_modules/@google-cloud/storage/build/src/file.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,675 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
/// <reference types="node" />
 | 
			
		||||
import { BodyResponseCallback, DecorateRequestOptions, GetConfig, Metadata, ServiceObject } from '@google-cloud/common';
 | 
			
		||||
import { Writable, Readable } from 'stream';
 | 
			
		||||
import * as http from 'http';
 | 
			
		||||
import { Storage } from './storage';
 | 
			
		||||
import { Bucket } from './bucket';
 | 
			
		||||
import { Acl } from './acl';
 | 
			
		||||
import { ResponseBody, Duplexify } from '@google-cloud/common/build/src/util';
 | 
			
		||||
export declare type GetExpirationDateResponse = [Date];
 | 
			
		||||
export interface GetExpirationDateCallback {
 | 
			
		||||
    (err: Error | null, expirationDate?: Date | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetSignedUrlConfig {
 | 
			
		||||
    action: 'read' | 'write' | 'delete' | 'resumable';
 | 
			
		||||
    version?: 'v2' | 'v4';
 | 
			
		||||
    cname?: string;
 | 
			
		||||
    contentMd5?: string;
 | 
			
		||||
    contentType?: string;
 | 
			
		||||
    expires: string | number | Date;
 | 
			
		||||
    extensionHeaders?: http.OutgoingHttpHeaders;
 | 
			
		||||
    promptSaveAs?: string;
 | 
			
		||||
    responseDisposition?: string;
 | 
			
		||||
    responseType?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare enum ActionToHTTPMethod {
 | 
			
		||||
    read = "GET",
 | 
			
		||||
    write = "PUT",
 | 
			
		||||
    delete = "DELETE",
 | 
			
		||||
    resumable = "POST"
 | 
			
		||||
}
 | 
			
		||||
export declare type GetSignedUrlResponse = [string];
 | 
			
		||||
export interface GetSignedUrlCallback {
 | 
			
		||||
    (err: Error | null, url?: string): void;
 | 
			
		||||
}
 | 
			
		||||
export interface PolicyDocument {
 | 
			
		||||
    expiration: string;
 | 
			
		||||
    conditions: Array<Array<string | number>>;
 | 
			
		||||
    string: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetSignedPolicyResponse = [PolicyDocument];
 | 
			
		||||
export interface GetSignedPolicyCallback {
 | 
			
		||||
    (err: Error | null, policy?: PolicyDocument): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetSignedPolicyOptions {
 | 
			
		||||
    equals?: string[] | string[][];
 | 
			
		||||
    expires: string | number | Date;
 | 
			
		||||
    startsWith?: string[] | string[][];
 | 
			
		||||
    acl?: string;
 | 
			
		||||
    successRedirect?: string;
 | 
			
		||||
    successStatus?: string;
 | 
			
		||||
    contentLengthRange?: {
 | 
			
		||||
        min?: number;
 | 
			
		||||
        max?: number;
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
export interface GetFileMetadataOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetFileMetadataResponse = [Metadata, Metadata];
 | 
			
		||||
export interface GetFileMetadataCallback {
 | 
			
		||||
    (err: Error | null, metadata?: Metadata, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetFileOptions extends GetConfig {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetFileResponse = [File, Metadata];
 | 
			
		||||
export interface GetFileCallback {
 | 
			
		||||
    (err: Error | null, file?: File, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface FileExistsOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type FileExistsResponse = [boolean];
 | 
			
		||||
export interface FileExistsCallback {
 | 
			
		||||
    (err: Error | null, exists?: boolean): void;
 | 
			
		||||
}
 | 
			
		||||
export interface DeleteFileOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type DeleteFileResponse = [Metadata];
 | 
			
		||||
export interface DeleteFileCallback {
 | 
			
		||||
    (err: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type PredefinedAcl = 'authenticatedRead' | 'bucketOwnerFullControl' | 'bucketOwnerRead' | 'private' | 'projectPrivate' | 'publicRead';
 | 
			
		||||
export interface CreateResumableUploadOptions {
 | 
			
		||||
    configPath?: string;
 | 
			
		||||
    metadata?: Metadata;
 | 
			
		||||
    origin?: string;
 | 
			
		||||
    offset?: number;
 | 
			
		||||
    predefinedAcl?: PredefinedAcl;
 | 
			
		||||
    private?: boolean;
 | 
			
		||||
    public?: boolean;
 | 
			
		||||
    uri?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type CreateResumableUploadResponse = [string];
 | 
			
		||||
export interface CreateResumableUploadCallback {
 | 
			
		||||
    (err: Error | null, uri?: string): void;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateWriteStreamOptions extends CreateResumableUploadOptions {
 | 
			
		||||
    contentType?: string;
 | 
			
		||||
    gzip?: string | boolean;
 | 
			
		||||
    resumable?: boolean;
 | 
			
		||||
    validation?: string | boolean;
 | 
			
		||||
}
 | 
			
		||||
export interface MakeFilePrivateOptions {
 | 
			
		||||
    strict?: boolean;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type MakeFilePrivateResponse = [Metadata];
 | 
			
		||||
export interface MakeFilePrivateCallback extends SetFileMetadataCallback {
 | 
			
		||||
}
 | 
			
		||||
export interface IsPublicCallback {
 | 
			
		||||
    (err: Error | null, resp?: boolean): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type IsPublicResponse = [boolean];
 | 
			
		||||
export declare type MakeFilePublicResponse = [Metadata];
 | 
			
		||||
export interface MakeFilePublicCallback {
 | 
			
		||||
    (err?: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type MoveResponse = [Metadata];
 | 
			
		||||
export interface MoveCallback {
 | 
			
		||||
    (err: Error | null, destinationFile?: File | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface MoveOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type RotateEncryptionKeyOptions = string | Buffer | EncryptionKeyOptions;
 | 
			
		||||
export interface EncryptionKeyOptions {
 | 
			
		||||
    encryptionKey?: string | Buffer;
 | 
			
		||||
    kmsKeyName?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface RotateEncryptionKeyCallback extends CopyCallback {
 | 
			
		||||
}
 | 
			
		||||
export declare type RotateEncryptionKeyResponse = CopyResponse;
 | 
			
		||||
export interface FileOptions {
 | 
			
		||||
    encryptionKey?: string | Buffer;
 | 
			
		||||
    generation?: number | string;
 | 
			
		||||
    kmsKeyName?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface CopyOptions {
 | 
			
		||||
    destinationKmsKeyName?: string;
 | 
			
		||||
    keepAcl?: string;
 | 
			
		||||
    predefinedAcl?: string;
 | 
			
		||||
    token?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type CopyResponse = [File, Metadata];
 | 
			
		||||
export interface CopyCallback {
 | 
			
		||||
    (err: Error | null, file?: File | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type DownloadResponse = [Buffer];
 | 
			
		||||
export declare type DownloadCallback = (err: RequestError | null, contents: Buffer) => void;
 | 
			
		||||
export interface DownloadOptions extends CreateReadStreamOptions {
 | 
			
		||||
    destination?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateReadStreamOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
    validation?: 'md5' | 'crc32c' | false | true;
 | 
			
		||||
    start?: number;
 | 
			
		||||
    end?: number;
 | 
			
		||||
}
 | 
			
		||||
export interface SaveOptions extends CreateWriteStreamOptions {
 | 
			
		||||
}
 | 
			
		||||
export interface SaveCallback {
 | 
			
		||||
    (err?: Error | null): void;
 | 
			
		||||
}
 | 
			
		||||
export interface SetFileMetadataOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface SetFileMetadataCallback {
 | 
			
		||||
    (err?: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type SetFileMetadataResponse = [Metadata];
 | 
			
		||||
export declare type SetStorageClassResponse = [Metadata];
 | 
			
		||||
export interface SetStorageClassOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface SetStorageClassCallback {
 | 
			
		||||
    (err?: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
declare class RequestError extends Error {
 | 
			
		||||
    code?: string;
 | 
			
		||||
    errors?: Error[];
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * A File object is created from your {@link Bucket} object using
 | 
			
		||||
 * {@link Bucket#file}.
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 */
 | 
			
		||||
declare class File extends ServiceObject<File> {
 | 
			
		||||
    /**
 | 
			
		||||
     * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
     * bucket access. ACLs are the mechanism you use to share objects with other
 | 
			
		||||
     * users and allow other users to access your buckets and objects.
 | 
			
		||||
     *
 | 
			
		||||
     * An ACL consists of one or more entries, where each entry grants permissions
 | 
			
		||||
     * to an entity. Permissions define the actions that can be performed against
 | 
			
		||||
     * an object or bucket (for example, `READ` or `WRITE`); the entity defines
 | 
			
		||||
     * who the permission applies to (for example, a specific user or group of
 | 
			
		||||
     * users).
 | 
			
		||||
     *
 | 
			
		||||
     * The `acl` object on a File instance provides methods to get you a list of
 | 
			
		||||
     * the ACLs defined on your bucket, as well as set, update, and delete them.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [About Access Control lists]{@link http://goo.gl/6qBBPO}
 | 
			
		||||
     *
 | 
			
		||||
     * @name File#acl
 | 
			
		||||
     * @mixes Acl
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * const file = myBucket.file('my-file');
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Make a file publicly readable.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const options = {
 | 
			
		||||
     *   entity: 'allUsers',
 | 
			
		||||
     *   role: storage.acl.READER_ROLE
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * file.acl.add(options, function(err, aclObject) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * file.acl.add(options).then(function(data) {
 | 
			
		||||
     *   const aclObject = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    acl: Acl;
 | 
			
		||||
    bucket: Bucket;
 | 
			
		||||
    storage: Storage;
 | 
			
		||||
    kmsKeyName?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
    name: string;
 | 
			
		||||
    generation?: number;
 | 
			
		||||
    parent: Bucket;
 | 
			
		||||
    private encryptionKey?;
 | 
			
		||||
    private encryptionKeyBase64?;
 | 
			
		||||
    private encryptionKeyHash?;
 | 
			
		||||
    private encryptionKeyInterceptor?;
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} FileOptions Options passed to the File constructor.
 | 
			
		||||
     * @property {string} [encryptionKey] A custom encryption key.
 | 
			
		||||
     * @property {number} [generation] Generation to scope the file to.
 | 
			
		||||
     * @property {string} [kmsKeyName] Cloud KMS Key used to encrypt this
 | 
			
		||||
     *     object, if the object is encrypted by such a key. Limited availability;
 | 
			
		||||
     *     usable only by enabled projects.
 | 
			
		||||
     * @property {string} [userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for all requests made from File object.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a file object.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Bucket} bucket The Bucket instance this file is
 | 
			
		||||
     *     attached to.
 | 
			
		||||
     * @param {string} name The name of the remote file.
 | 
			
		||||
     * @param {FileOptions} [options] Configuration options.
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * const file = myBucket.file('my-file');
 | 
			
		||||
     */
 | 
			
		||||
    constructor(bucket: Bucket, name: string, options?: FileOptions);
 | 
			
		||||
    copy(destination: string | Bucket | File): Promise<CopyResponse>;
 | 
			
		||||
    copy(destination: string | Bucket | File, callback: CopyCallback): void;
 | 
			
		||||
    copy(destination: string | Bucket | File, options: CopyOptions, callback: CopyCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} CreateReadStreamOptions Configuration options for File#createReadStream.
 | 
			
		||||
     * @property {string} [userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @property {string|boolean} [validation] Possible values: `"md5"`,
 | 
			
		||||
     *     `"crc32c"`, or `false`. By default, data integrity is validated with a
 | 
			
		||||
     *     CRC32c checksum. You may use MD5 if preferred, but that hash is not
 | 
			
		||||
     *     supported for composite objects. An error will be raised if MD5 is
 | 
			
		||||
     *     specified but is not available. You may also choose to skip validation
 | 
			
		||||
     *     completely, however this is **not recommended**.
 | 
			
		||||
     * @property {number} [start] A byte offset to begin the file's download
 | 
			
		||||
     *     from. Default is 0. NOTE: Byte ranges are inclusive; that is,
 | 
			
		||||
     *     `options.start = 0` and `options.end = 999` represent the first 1000
 | 
			
		||||
     *     bytes in a file or object. NOTE: when specifying a byte range, data
 | 
			
		||||
     *     integrity is not available.
 | 
			
		||||
     * @property {number} [end] A byte offset to stop reading the file at.
 | 
			
		||||
     *     NOTE: Byte ranges are inclusive; that is, `options.start = 0` and
 | 
			
		||||
     *     `options.end = 999` represent the first 1000 bytes in a file or object.
 | 
			
		||||
     *     NOTE: when specifying a byte range, data integrity is not available.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a readable stream to read the contents of the remote file. It can be
 | 
			
		||||
     * piped to a writable stream or listened to for 'data' events to read a
 | 
			
		||||
     * file's contents.
 | 
			
		||||
     *
 | 
			
		||||
     * In the unlikely event there is a mismatch between what you downloaded and
 | 
			
		||||
     * the version in your Bucket, your error handler will receive an error with
 | 
			
		||||
     * code "CONTENT_DOWNLOAD_MISMATCH". If you receive this error, the best
 | 
			
		||||
     * recourse is to try downloading the file again.
 | 
			
		||||
     *
 | 
			
		||||
     * For faster crc32c computation, you must manually install
 | 
			
		||||
     * [`fast-crc32c`](http://www.gitnpm.com/fast-crc32c):
 | 
			
		||||
     *
 | 
			
		||||
     *     $ npm install --save fast-crc32c
 | 
			
		||||
     *
 | 
			
		||||
     * NOTE: Readable streams will emit the `end` event when the file is fully
 | 
			
		||||
     * downloaded.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {CreateReadStreamOptions} [options] Configuration options.
 | 
			
		||||
     * @returns {ReadableStream}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * //-
 | 
			
		||||
     * // <h4>Downloading a File</h4>
 | 
			
		||||
     * //
 | 
			
		||||
     * // The example below demonstrates how we can reference a remote file, then
 | 
			
		||||
     * // pipe its contents to a local file. This is effectively creating a local
 | 
			
		||||
     * // backup of your remote data.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * const fs = require('fs');
 | 
			
		||||
     * const remoteFile = bucket.file('image.png');
 | 
			
		||||
     * const localFilename = '/Users/stephen/Photos/image.png';
 | 
			
		||||
     *
 | 
			
		||||
     * remoteFile.createReadStream()
 | 
			
		||||
     *   .on('error', function(err) {})
 | 
			
		||||
     *   .on('response', function(response) {
 | 
			
		||||
     *     // Server connected and responded with the specified status and headers.
 | 
			
		||||
     *    })
 | 
			
		||||
     *   .on('end', function() {
 | 
			
		||||
     *     // The file is fully downloaded.
 | 
			
		||||
     *   })
 | 
			
		||||
     *   .pipe(fs.createWriteStream(localFilename));
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // To limit the downloaded data to only a byte range, pass an options
 | 
			
		||||
     * object.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const logFile = myBucket.file('access_log');
 | 
			
		||||
     * logFile.createReadStream({
 | 
			
		||||
     *     start: 10000,
 | 
			
		||||
     *     end: 20000
 | 
			
		||||
     *   })
 | 
			
		||||
     *   .on('error', function(err) {})
 | 
			
		||||
     *   .pipe(fs.createWriteStream('/Users/stephen/logfile.txt'));
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // To read a tail byte range, specify only `options.end` as a negative
 | 
			
		||||
     * // number.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const logFile = myBucket.file('access_log');
 | 
			
		||||
     * logFile.createReadStream({
 | 
			
		||||
     *     end: -100
 | 
			
		||||
     *   })
 | 
			
		||||
     *   .on('error', function(err) {})
 | 
			
		||||
     *   .pipe(fs.createWriteStream('/Users/stephen/logfile.txt'));
 | 
			
		||||
     */
 | 
			
		||||
    createReadStream(options?: CreateReadStreamOptions): Readable;
 | 
			
		||||
    createResumableUpload(options?: CreateResumableUploadOptions): Promise<CreateResumableUploadResponse>;
 | 
			
		||||
    createResumableUpload(options: CreateResumableUploadOptions, callback: CreateResumableUploadCallback): void;
 | 
			
		||||
    createResumableUpload(callback: CreateResumableUploadCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} CreateWriteStreamOptions Configuration options for File#createWriteStream().
 | 
			
		||||
     * @property {string} [configPath] **This only applies to resumable
 | 
			
		||||
     *     uploads.** Where the `gcs-resumable-upload` configuration file should
 | 
			
		||||
     * be stored on your system. This maps to the [configstore option by the same
 | 
			
		||||
     * name](https://github.com/yeoman/configstore/tree/0df1ec950d952b1f0dfb39ce22af8e505dffc71a#configpath).
 | 
			
		||||
     * @property {string} [contentType] Alias for
 | 
			
		||||
     *     `options.metadata.contentType`. If set to `auto`, the file name is used
 | 
			
		||||
     *     to determine the contentType.
 | 
			
		||||
     * @property {string|boolean} [gzip] If true, automatically gzip the file.
 | 
			
		||||
     *     If set to `auto`, the contentType is used to determine if the file
 | 
			
		||||
     * should be gzipped. This will set `options.metadata.contentEncoding` to
 | 
			
		||||
     * `gzip` if necessary.
 | 
			
		||||
     * @property {object} [metadata] See the examples below or
 | 
			
		||||
     *     [Objects: insert request
 | 
			
		||||
     * body](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request_properties_JSON)
 | 
			
		||||
     *     for more details.
 | 
			
		||||
     * @property {number} [offset] The starting byte of the upload stream, for
 | 
			
		||||
     *     resuming an interrupted upload. Defaults to 0.
 | 
			
		||||
     * @property {string} [predefinedAcl] Apply a predefined set of access
 | 
			
		||||
     *     controls to this object.
 | 
			
		||||
     *
 | 
			
		||||
     *     Acceptable values are:
 | 
			
		||||
     *     - **`authenticatedRead`** - Object owner gets `OWNER` access, and
 | 
			
		||||
     *       `allAuthenticatedUsers` get `READER` access.
 | 
			
		||||
     *
 | 
			
		||||
     *     - **`bucketOwnerFullControl`** - Object owner gets `OWNER` access, and
 | 
			
		||||
     *       project team owners get `OWNER` access.
 | 
			
		||||
     *
 | 
			
		||||
     *     - **`bucketOwnerRead`** - Object owner gets `OWNER` access, and project
 | 
			
		||||
     *       team owners get `READER` access.
 | 
			
		||||
     *
 | 
			
		||||
     *     - **`private`** - Object owner gets `OWNER` access.
 | 
			
		||||
     *
 | 
			
		||||
     *     - **`projectPrivate`** - Object owner gets `OWNER` access, and project
 | 
			
		||||
     *       team members get access according to their roles.
 | 
			
		||||
     *
 | 
			
		||||
     *     - **`publicRead`** - Object owner gets `OWNER` access, and `allUsers`
 | 
			
		||||
     * get `READER` access.
 | 
			
		||||
     * @property {boolean} [private] Make the uploaded file private. (Alias for
 | 
			
		||||
     *     `options.predefinedAcl = 'private'`)
 | 
			
		||||
     * @property {boolean} [public] Make the uploaded file public. (Alias for
 | 
			
		||||
     *     `options.predefinedAcl = 'publicRead'`)
 | 
			
		||||
     * @property {boolean} [resumable] Force a resumable upload. NOTE: When
 | 
			
		||||
     *     working with streams, the file format and size is unknown until it's
 | 
			
		||||
     *     completely consumed. Because of this, it's best for you to be explicit
 | 
			
		||||
     *     for what makes sense given your input.
 | 
			
		||||
     * @property {string} [uri] The URI for an already-created resumable
 | 
			
		||||
     *     upload. See {@link File#createResumableUpload}.
 | 
			
		||||
     * @property {string} [userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @property {string|boolean} [validation] Possible values: `"md5"`,
 | 
			
		||||
     *     `"crc32c"`, or `false`. By default, data integrity is validated with a
 | 
			
		||||
     *     CRC32c checksum. You may use MD5 if preferred, but that hash is not
 | 
			
		||||
     *     supported for composite objects. An error will be raised if MD5 is
 | 
			
		||||
     *     specified but is not available. You may also choose to skip validation
 | 
			
		||||
     *     completely, however this is **not recommended**.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a writable stream to overwrite the contents of the file in your
 | 
			
		||||
     * bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * A File object can also be used to create files for the first time.
 | 
			
		||||
     *
 | 
			
		||||
     * Resumable uploads are automatically enabled and must be shut off explicitly
 | 
			
		||||
     * by setting `options.resumable` to `false`.
 | 
			
		||||
     *
 | 
			
		||||
     * Resumable uploads require write access to the $HOME directory. Through
 | 
			
		||||
     * [`config-store`](http://www.gitnpm.com/configstore), some metadata is
 | 
			
		||||
     * stored. By default, if the directory is not writable, we will fall back to
 | 
			
		||||
     * a simple upload. However, if you explicitly request a resumable upload, and
 | 
			
		||||
     * we cannot write to the config directory, we will return a
 | 
			
		||||
     * `ResumableUploadError`.
 | 
			
		||||
     *
 | 
			
		||||
     * <p class="notice">
 | 
			
		||||
     *   There is some overhead when using a resumable upload that can cause
 | 
			
		||||
     *   noticeable performance degradation while uploading a series of small
 | 
			
		||||
     * files. When uploading files less than 10MB, it is recommended that the
 | 
			
		||||
     * resumable feature is disabled.
 | 
			
		||||
     * </p>
 | 
			
		||||
     *
 | 
			
		||||
     * For faster crc32c computation, you must manually install
 | 
			
		||||
     * [`fast-crc32c`](http://www.gitnpm.com/fast-crc32c):
 | 
			
		||||
     *
 | 
			
		||||
     *     $ npm install --save fast-crc32c
 | 
			
		||||
     *
 | 
			
		||||
     * NOTE: Writable streams will emit the `finish` event when the file is fully
 | 
			
		||||
     * uploaded.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Upload Options (Simple or Resumable)]{@link https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload}
 | 
			
		||||
     * @see [Objects: insert API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/objects/insert}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {CreateWriteStreamOptions} [options] Configuration options.
 | 
			
		||||
     * @returns {WritableStream}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const fs = require('fs');
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * const file = myBucket.file('my-file');
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // <h4>Uploading a File</h4>
 | 
			
		||||
     * //
 | 
			
		||||
     * // Now, consider a case where we want to upload a file to your bucket. You
 | 
			
		||||
     * // have the option of using {@link Bucket#upload}, but that is just
 | 
			
		||||
     * // a convenience method which will do the following.
 | 
			
		||||
     * //-
 | 
			
		||||
     * fs.createReadStream('/Users/stephen/Photos/birthday-at-the-zoo/panda.jpg')
 | 
			
		||||
     *   .pipe(file.createWriteStream())
 | 
			
		||||
     *   .on('error', function(err) {})
 | 
			
		||||
     *   .on('finish', function() {
 | 
			
		||||
     *     // The file upload is complete.
 | 
			
		||||
     *   });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // <h4>Uploading a File with gzip compression</h4>
 | 
			
		||||
     * //-
 | 
			
		||||
     * fs.createReadStream('/Users/stephen/site/index.html')
 | 
			
		||||
     *   .pipe(file.createWriteStream({ gzip: true }))
 | 
			
		||||
     *   .on('error', function(err) {})
 | 
			
		||||
     *   .on('finish', function() {
 | 
			
		||||
     *     // The file upload is complete.
 | 
			
		||||
     *   });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Downloading the file with `createReadStream` will automatically decode
 | 
			
		||||
     * // the file.
 | 
			
		||||
     * //-
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // <h4>Uploading a File with Metadata</h4>
 | 
			
		||||
     * //
 | 
			
		||||
     * // One last case you may run into is when you want to upload a file to your
 | 
			
		||||
     * // bucket and set its metadata at the same time. Like above, you can use
 | 
			
		||||
     * // {@link Bucket#upload} to do this, which is just a wrapper around
 | 
			
		||||
     * // the following.
 | 
			
		||||
     * //-
 | 
			
		||||
     * fs.createReadStream('/Users/stephen/Photos/birthday-at-the-zoo/panda.jpg')
 | 
			
		||||
     *   .pipe(file.createWriteStream({
 | 
			
		||||
     *     metadata: {
 | 
			
		||||
     *       contentType: 'image/jpeg',
 | 
			
		||||
     *       metadata: {
 | 
			
		||||
     *         custom: 'metadata'
 | 
			
		||||
     *       }
 | 
			
		||||
     *     }
 | 
			
		||||
     *   }))
 | 
			
		||||
     *   .on('error', function(err) {})
 | 
			
		||||
     *   .on('finish', function() {
 | 
			
		||||
     *     // The file upload is complete.
 | 
			
		||||
     *   });
 | 
			
		||||
     */
 | 
			
		||||
    createWriteStream(options?: CreateWriteStreamOptions): Writable;
 | 
			
		||||
    download(options?: DownloadOptions): Promise<DownloadResponse>;
 | 
			
		||||
    download(options: DownloadOptions, callback: DownloadCallback): void;
 | 
			
		||||
    download(callback: DownloadCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * The Storage API allows you to use a custom key for server-side encryption.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Customer-supplied Encryption Keys]{@link https://cloud.google.com/storage/docs/encryption#customer-supplied}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string|buffer} encryptionKey An AES-256 encryption key.
 | 
			
		||||
     * @returns {File}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const crypto = require('crypto');
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * const encryptionKey = crypto.randomBytes(32);
 | 
			
		||||
     *
 | 
			
		||||
     * const fileWithCustomEncryption = myBucket.file('my-file');
 | 
			
		||||
     * fileWithCustomEncryption.setEncryptionKey(encryptionKey);
 | 
			
		||||
     *
 | 
			
		||||
     * const fileWithoutCustomEncryption = myBucket.file('my-file');
 | 
			
		||||
     *
 | 
			
		||||
     * fileWithCustomEncryption.save('data', function(err) {
 | 
			
		||||
     *   // Try to download with the File object that hasn't had
 | 
			
		||||
     *   // `setEncryptionKey()` called:
 | 
			
		||||
     *   fileWithoutCustomEncryption.download(function(err) {
 | 
			
		||||
     *     // We will receive an error:
 | 
			
		||||
     *     //   err.message === 'Bad Request'
 | 
			
		||||
     *
 | 
			
		||||
     *     // Try again with the File object we called `setEncryptionKey()` on:
 | 
			
		||||
     *     fileWithCustomEncryption.download(function(err, contents) {
 | 
			
		||||
     *       // contents.toString() === 'data'
 | 
			
		||||
     *     });
 | 
			
		||||
     *   });
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/encryption.js</caption>
 | 
			
		||||
     * region_tag:storage_upload_encrypted_file
 | 
			
		||||
     * Example of uploading an encrypted file:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/encryption.js</caption>
 | 
			
		||||
     * region_tag:storage_download_encrypted_file
 | 
			
		||||
     * Example of downloading an encrypted file:
 | 
			
		||||
     */
 | 
			
		||||
    setEncryptionKey(encryptionKey: string | Buffer): this;
 | 
			
		||||
    getExpirationDate(): Promise<GetExpirationDateResponse>;
 | 
			
		||||
    getExpirationDate(callback: GetExpirationDateCallback): void;
 | 
			
		||||
    getSignedPolicy(options: GetSignedPolicyOptions): Promise<GetSignedPolicyResponse>;
 | 
			
		||||
    getSignedPolicy(options: GetSignedPolicyOptions, callback: GetSignedPolicyCallback): void;
 | 
			
		||||
    getSignedPolicy(callback: GetSignedPolicyCallback): void;
 | 
			
		||||
    getSignedUrl(cfg: GetSignedUrlConfig): Promise<GetSignedUrlResponse>;
 | 
			
		||||
    getSignedUrl(cfg: GetSignedUrlConfig, callback: GetSignedUrlCallback): void;
 | 
			
		||||
    private getSignedUrlV2;
 | 
			
		||||
    private getSignedUrlV4;
 | 
			
		||||
    isPublic(): Promise<IsPublicResponse>;
 | 
			
		||||
    isPublic(callback: IsPublicCallback): void;
 | 
			
		||||
    makePrivate(options?: MakeFilePrivateOptions): Promise<MakeFilePrivateResponse>;
 | 
			
		||||
    makePrivate(callback: MakeFilePrivateCallback): void;
 | 
			
		||||
    makePrivate(options: MakeFilePrivateOptions, callback: MakeFilePrivateCallback): void;
 | 
			
		||||
    makePublic(): Promise<MakeFilePublicResponse>;
 | 
			
		||||
    makePublic(callback: MakeFilePublicCallback): void;
 | 
			
		||||
    move(destination: string | Bucket | File, options?: MoveOptions): Promise<MoveResponse>;
 | 
			
		||||
    move(destination: string | Bucket | File, callback: MoveCallback): void;
 | 
			
		||||
    move(destination: string | Bucket | File, options: MoveOptions, callback: MoveCallback): void;
 | 
			
		||||
    request(reqOpts: DecorateRequestOptions): Promise<[ResponseBody, Metadata]>;
 | 
			
		||||
    request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
 | 
			
		||||
    rotateEncryptionKey(options?: RotateEncryptionKeyOptions): Promise<RotateEncryptionKeyResponse>;
 | 
			
		||||
    rotateEncryptionKey(callback: RotateEncryptionKeyCallback): void;
 | 
			
		||||
    rotateEncryptionKey(options: RotateEncryptionKeyOptions, callback: RotateEncryptionKeyCallback): void;
 | 
			
		||||
    save(data: any, options?: SaveOptions): Promise<void>;
 | 
			
		||||
    save(data: any, callback: SaveCallback): void;
 | 
			
		||||
    save(data: any, options: SaveOptions, callback: SaveCallback): void;
 | 
			
		||||
    setStorageClass(storageClass: string, options?: SetStorageClassOptions): Promise<SetStorageClassResponse>;
 | 
			
		||||
    setStorageClass(storageClass: string, options: SetStorageClassOptions, callback: SetStorageClassCallback): void;
 | 
			
		||||
    setStorageClass(storageClass: string, callback?: SetStorageClassCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Set a user project to be billed for all requests made from this File
 | 
			
		||||
     * object.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} userProject The user project.
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('albums');
 | 
			
		||||
     * const file = bucket.file('my-file');
 | 
			
		||||
     *
 | 
			
		||||
     * file.setUserProject('grape-spaceship-123');
 | 
			
		||||
     */
 | 
			
		||||
    setUserProject(userProject: string): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * This creates a gcs-resumable-upload upload stream.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [gcs-resumable-upload]{@link https://github.com/stephenplusplus/gcs-resumable-upload}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Duplexify} stream - Duplexify stream of data to pipe to the file.
 | 
			
		||||
     * @param {object=} options - Configuration object.
 | 
			
		||||
     *
 | 
			
		||||
     * @private
 | 
			
		||||
     */
 | 
			
		||||
    startResumableUpload_(dup: Duplexify, options: CreateResumableUploadOptions): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Takes a readable stream and pipes it to a remote file. Unlike
 | 
			
		||||
     * `startResumableUpload_`, which uses the resumable upload technique, this
 | 
			
		||||
     * method uses a simple upload (all or nothing).
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Duplexify} dup - Duplexify stream of data to pipe to the file.
 | 
			
		||||
     * @param {object=} options - Configuration object.
 | 
			
		||||
     *
 | 
			
		||||
     * @private
 | 
			
		||||
     */
 | 
			
		||||
    startSimpleUpload_(dup: Duplexify, options?: CreateResumableUploadOptions): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Create canonical headers for signing v4 url.
 | 
			
		||||
     *
 | 
			
		||||
     * The canonical headers for v4-signing a request demands header names are
 | 
			
		||||
     * first lowercased, followed by sorting the header names.
 | 
			
		||||
     * Then, construct the canonical headers part of the request:
 | 
			
		||||
     *  <lowercasedHeaderName> + ":" + Trim(<value>) + "\n"
 | 
			
		||||
     *  ..
 | 
			
		||||
     *  <lowercasedHeaderName> + ":" + Trim(<value>) + "\n"
 | 
			
		||||
     *
 | 
			
		||||
     * @param headers
 | 
			
		||||
     * @private
 | 
			
		||||
     */
 | 
			
		||||
    private getCanonicalHeaders;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Reference to the {@link File} class.
 | 
			
		||||
 * @name module:@google-cloud/storage.File
 | 
			
		||||
 * @see File
 | 
			
		||||
 */
 | 
			
		||||
export { File };
 | 
			
		||||
							
								
								
									
										2645
									
								
								node_modules/@google-cloud/storage/build/src/file.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2645
									
								
								node_modules/@google-cloud/storage/build/src/file.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										78
									
								
								node_modules/@google-cloud/storage/build/src/hmacKey.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								node_modules/@google-cloud/storage/build/src/hmacKey.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,78 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
import { Metadata, ServiceObject } from '@google-cloud/common';
 | 
			
		||||
import { Storage } from './storage';
 | 
			
		||||
export interface HmacKeyOptions {
 | 
			
		||||
    projectId?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface HmacKeyMetadata {
 | 
			
		||||
    accessId: string;
 | 
			
		||||
    etag?: string;
 | 
			
		||||
    id?: string;
 | 
			
		||||
    projectId?: string;
 | 
			
		||||
    serviceAccountEmail?: string;
 | 
			
		||||
    state?: string;
 | 
			
		||||
    timeCreated?: string;
 | 
			
		||||
    updated?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface SetHmacKeyMetadataOptions {
 | 
			
		||||
    /**
 | 
			
		||||
     * This parameter is currently ignored.
 | 
			
		||||
     */
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface SetHmacKeyMetadata {
 | 
			
		||||
    state?: 'ACTIVE' | 'INACTIVE';
 | 
			
		||||
    etag?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface HmacKeyMetadataCallback {
 | 
			
		||||
    (err: Error | null, metadata?: HmacKeyMetadata, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type HmacKeyMetadataResponse = [HmacKeyMetadata, Metadata];
 | 
			
		||||
/**
 | 
			
		||||
 * An HmacKey object contains metadata of an HMAC key created from a
 | 
			
		||||
 * service account through the {@link Storage} client using
 | 
			
		||||
 * {@link Storage#createHmacKey}.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [HMAC keys documentation]{@link https://cloud.google.com/storage/docs/authentication/hmackeys}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 */
 | 
			
		||||
export declare class HmacKey extends ServiceObject<HmacKeyMetadata | undefined> {
 | 
			
		||||
    metadata: HmacKeyMetadata | undefined;
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} HmacKeyOptions
 | 
			
		||||
     * @property {string} [projectId] The project ID of the project that owns
 | 
			
		||||
     *     the service account of the requested HMAC key. If not provided,
 | 
			
		||||
     *     the project ID used to instantiate the Storage client will be used.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs an HmacKey object.
 | 
			
		||||
     *
 | 
			
		||||
     * Note: this only create a local reference to an HMAC key, to create
 | 
			
		||||
     * an HMAC key, use {@link Storage#createHmacKey}.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Storage} storage The Storage instance this HMAC key is
 | 
			
		||||
     *     attached to.
 | 
			
		||||
     * @param {string} accessId The unique accessId for this HMAC key.
 | 
			
		||||
     * @param {HmacKeyOptions} options Constructor configurations.
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const hmacKey = storage.hmacKey('access-id');
 | 
			
		||||
     */
 | 
			
		||||
    constructor(storage: Storage, accessId: string, options?: HmacKeyOptions);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										290
									
								
								node_modules/@google-cloud/storage/build/src/hmacKey.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										290
									
								
								node_modules/@google-cloud/storage/build/src/hmacKey.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,290 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const common_1 = require("@google-cloud/common");
 | 
			
		||||
/**
 | 
			
		||||
 * An HmacKey object contains metadata of an HMAC key created from a
 | 
			
		||||
 * service account through the {@link Storage} client using
 | 
			
		||||
 * {@link Storage#createHmacKey}.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [HMAC keys documentation]{@link https://cloud.google.com/storage/docs/authentication/hmackeys}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 */
 | 
			
		||||
class HmacKey extends common_1.ServiceObject {
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} HmacKeyOptions
 | 
			
		||||
     * @property {string} [projectId] The project ID of the project that owns
 | 
			
		||||
     *     the service account of the requested HMAC key. If not provided,
 | 
			
		||||
     *     the project ID used to instantiate the Storage client will be used.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs an HmacKey object.
 | 
			
		||||
     *
 | 
			
		||||
     * Note: this only create a local reference to an HMAC key, to create
 | 
			
		||||
     * an HMAC key, use {@link Storage#createHmacKey}.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Storage} storage The Storage instance this HMAC key is
 | 
			
		||||
     *     attached to.
 | 
			
		||||
     * @param {string} accessId The unique accessId for this HMAC key.
 | 
			
		||||
     * @param {HmacKeyOptions} options Constructor configurations.
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const hmacKey = storage.hmacKey('access-id');
 | 
			
		||||
     */
 | 
			
		||||
    constructor(storage, accessId, options) {
 | 
			
		||||
        const methods = {
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {object} DeleteHmacKeyOptions
 | 
			
		||||
             * @property {string} [userProject] This parameter is currently ignored.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {array} DeleteHmacKeyResponse
 | 
			
		||||
             * @property {object} 0 The full API response.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @callback DeleteHmacKeyCallback
 | 
			
		||||
             * @param {?Error} err Request error, if any.
 | 
			
		||||
             * @param {object} apiResponse The full API response.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * Deletes an HMAC key.
 | 
			
		||||
             * Key state must be set to `INACTIVE` prior to deletion.
 | 
			
		||||
             * Caution: HMAC keys cannot be recovered once you delete them.
 | 
			
		||||
             *
 | 
			
		||||
             * The authenticated user must have `storage.hmacKeys.delete` permission for the project in which the key exists.
 | 
			
		||||
             *
 | 
			
		||||
             * @method HmacKey#delete
 | 
			
		||||
             * @param {DeleteHmacKeyOptions} [options] Configuration options.
 | 
			
		||||
             * @param {DeleteHmacKeyCallback} [callback] Callback function.
 | 
			
		||||
             * @returns {Promise<DeleteHmacKeyResponse>}
 | 
			
		||||
             *
 | 
			
		||||
             * @example
 | 
			
		||||
             * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
             * const storage = new Storage();
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // Delete HMAC key after making the key inactive.
 | 
			
		||||
             * //-
 | 
			
		||||
             * const hmacKey = storage.hmacKey('ACCESS_ID');
 | 
			
		||||
             * hmacKey.setMetadata({state: 'INACTIVE'}, (err, hmacKeyMetadata) => {
 | 
			
		||||
             *     if (err) {
 | 
			
		||||
             *       // The request was an error.
 | 
			
		||||
             *       console.error(err);
 | 
			
		||||
             *       return;
 | 
			
		||||
             *     }
 | 
			
		||||
             *     hmacKey.delete((err) => {
 | 
			
		||||
             *       if (err) {
 | 
			
		||||
             *         console.error(err);
 | 
			
		||||
             *         return;
 | 
			
		||||
             *       }
 | 
			
		||||
             *       // The HMAC key is deleted.
 | 
			
		||||
             *     });
 | 
			
		||||
             *   });
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // If the callback is omitted, a promise is returned.
 | 
			
		||||
             * //-
 | 
			
		||||
             * const hmacKey = storage.hmacKey('ACCESS_ID');
 | 
			
		||||
             * hmacKey
 | 
			
		||||
             *   .setMetadata({state: 'INACTIVE'})
 | 
			
		||||
             *   .then(() => {
 | 
			
		||||
             *     return hmacKey.delete();
 | 
			
		||||
             *   });
 | 
			
		||||
             */
 | 
			
		||||
            delete: true,
 | 
			
		||||
            /**
 | 
			
		||||
             * @callback GetHmacKeyCallback
 | 
			
		||||
             * @param {?Error} err Request error, if any.
 | 
			
		||||
             * @param {HmacKey} hmacKey this {@link HmacKey} instance.
 | 
			
		||||
             * @param {object} apiResponse The full API response.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {array} GetHmacKeyResponse
 | 
			
		||||
             * @property {HmacKey} 0 This {@link HmacKey} instance.
 | 
			
		||||
             * @property {object} 1 The full API response.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {object} GetHmacKeyOptions
 | 
			
		||||
             * @property {string} [userProject] This parameter is currently ignored.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * Retrieves and populate an HMAC key's metadata, and return
 | 
			
		||||
             * this {@link HmacKey} instance.
 | 
			
		||||
             *
 | 
			
		||||
             * HmacKey.get() does not give the HMAC key secret, as
 | 
			
		||||
             * it is only returned on creation.
 | 
			
		||||
             *
 | 
			
		||||
             * The authenticated user must have `storage.hmacKeys.get` permission
 | 
			
		||||
             * for the project in which the key exists.
 | 
			
		||||
             *
 | 
			
		||||
             * @method HmacKey#get
 | 
			
		||||
             * @param {GetHmacKeyOptions} [options] Configuration options.
 | 
			
		||||
             * @param {GetHmacKeyCallback} [callback] Callback function.
 | 
			
		||||
             * @returns {Promise<GetHmacKeyResponse>}
 | 
			
		||||
             *
 | 
			
		||||
             * @example
 | 
			
		||||
             * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
             * const storage = new Storage();
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // Get the HmacKey's Metadata.
 | 
			
		||||
             * //-
 | 
			
		||||
             * storage.hmacKey('ACCESS_ID')
 | 
			
		||||
             *   .get((err, hmacKey) => {
 | 
			
		||||
             *     if (err) {
 | 
			
		||||
             *       // The request was an error.
 | 
			
		||||
             *       console.error(err);
 | 
			
		||||
             *       return;
 | 
			
		||||
             *     }
 | 
			
		||||
             *     // do something with the returned HmacKey object.
 | 
			
		||||
             *   });
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // If the callback is omitted, a promise is returned.
 | 
			
		||||
             * //-
 | 
			
		||||
             * storage.hmacKey('ACCESS_ID')
 | 
			
		||||
             *   .get()
 | 
			
		||||
             *   .then((data) => {
 | 
			
		||||
             *     const hmacKey = data[0];
 | 
			
		||||
             *   });
 | 
			
		||||
             */
 | 
			
		||||
            get: true,
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {object} GetHmacKeyMetadataOptions
 | 
			
		||||
             * @property {string} [userProject] This parameter is currently ignored.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * Retrieves and populate an HMAC key's metadata, and return
 | 
			
		||||
             * the HMAC key's metadata as an object.
 | 
			
		||||
             *
 | 
			
		||||
             * HmacKey.getMetadata() does not give the HMAC key secret, as
 | 
			
		||||
             * it is only returned on creation.
 | 
			
		||||
             *
 | 
			
		||||
             * The authenticated user must have `storage.hmacKeys.get` permission
 | 
			
		||||
             * for the project in which the key exists.
 | 
			
		||||
             *
 | 
			
		||||
             * @method HmacKey#getMetadata
 | 
			
		||||
             * @param {GetHmacKeyMetadataOptions} [options] Configuration options.
 | 
			
		||||
             * @param {HmacKeyMetadataCallback} [callback] Callback function.
 | 
			
		||||
             * @returns {Promise<HmacKeyMetadataResponse>}
 | 
			
		||||
             *
 | 
			
		||||
             * @example
 | 
			
		||||
             * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
             * const storage = new Storage();
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // Get the HmacKey's metadata and populate to the metadata property.
 | 
			
		||||
             * //-
 | 
			
		||||
             * storage.hmacKey('ACCESS_ID')
 | 
			
		||||
             *   .getMetadata((err, hmacKeyMetadata) => {
 | 
			
		||||
             *     if (err) {
 | 
			
		||||
             *       // The request was an error.
 | 
			
		||||
             *       console.error(err);
 | 
			
		||||
             *       return;
 | 
			
		||||
             *     }
 | 
			
		||||
             *     console.log(hmacKeyMetadata);
 | 
			
		||||
             *   });
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // If the callback is omitted, a promise is returned.
 | 
			
		||||
             * //-
 | 
			
		||||
             * storage.hmacKey('ACCESS_ID')
 | 
			
		||||
             *   .getMetadata()
 | 
			
		||||
             *   .then((data) => {
 | 
			
		||||
             *     const hmacKeyMetadata = data[0];
 | 
			
		||||
             *     console.log(hmacKeyMetadata);
 | 
			
		||||
             *   });
 | 
			
		||||
             */
 | 
			
		||||
            getMetadata: true,
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {object} SetHmacKeyMetadata Subset of {@link HmacKeyMetadata} to update.
 | 
			
		||||
             * @property {string} state New state of the HmacKey. Either 'ACTIVE' or 'INACTIVE'.
 | 
			
		||||
             * @property {string} [etag] Include an etag from a previous get HMAC key request
 | 
			
		||||
             *    to perform safe read-modify-write.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {object} SetHmacKeyMetadataOptions
 | 
			
		||||
             * @property {string} [userProject] This parameter is currently ignored.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @callback HmacKeyMetadataCallback
 | 
			
		||||
             * @param {?Error} err Request error, if any.
 | 
			
		||||
             * @param {HmacKeyMetadata} metadata The updated {@link HmacKeyMetadata} object.
 | 
			
		||||
             * @param {object} apiResponse The full API response.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {array} HmacKeyMetadataResponse
 | 
			
		||||
             * @property {HmacKeyMetadata} 0 The updated {@link HmacKeyMetadata} object.
 | 
			
		||||
             * @property {object} 1 The full API response.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * Updates the state of an HMAC key. See {@link SetHmacKeyMetadata} for
 | 
			
		||||
             * valid states.
 | 
			
		||||
             *
 | 
			
		||||
             * @method HmacKey#setMetadata
 | 
			
		||||
             * @param {SetHmacKeyMetadata} metadata The new metadata.
 | 
			
		||||
             * @param {SetHmacKeyMetadataOptions} [options] Configuration options.
 | 
			
		||||
             * @param {HmacKeyMetadataCallback} [callback] Callback function.
 | 
			
		||||
             * @returns {Promise<HmacKeyMetadataResponse>}
 | 
			
		||||
             *
 | 
			
		||||
             * @example
 | 
			
		||||
             * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
             * const storage = new Storage();
 | 
			
		||||
             *
 | 
			
		||||
             * const metadata = {
 | 
			
		||||
             *   state: 'INACTIVE',
 | 
			
		||||
             * };
 | 
			
		||||
             *
 | 
			
		||||
             * storage.hmacKey('ACCESS_ID')
 | 
			
		||||
             *   .setMetadata(metadata, (err, hmacKeyMetadata) => {
 | 
			
		||||
             *     if (err) {
 | 
			
		||||
             *       // The request was an error.
 | 
			
		||||
             *       console.error(err);
 | 
			
		||||
             *       return;
 | 
			
		||||
             *     }
 | 
			
		||||
             *     console.log(hmacKeyMetadata);
 | 
			
		||||
             *   });
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // If the callback is omitted, a promise is returned.
 | 
			
		||||
             * //-
 | 
			
		||||
             * storage.hmacKey('ACCESS_ID')
 | 
			
		||||
             *   .setMetadata(metadata)
 | 
			
		||||
             *   .then((data) => {
 | 
			
		||||
             *     const hmacKeyMetadata = data[0];
 | 
			
		||||
             *     console.log(hmacKeyMetadata);
 | 
			
		||||
             *   });
 | 
			
		||||
             */
 | 
			
		||||
            setMetadata: {
 | 
			
		||||
                reqOpts: {
 | 
			
		||||
                    method: 'PUT',
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
        const projectId = (options && options.projectId) || storage.projectId;
 | 
			
		||||
        super({
 | 
			
		||||
            parent: storage,
 | 
			
		||||
            id: accessId,
 | 
			
		||||
            baseUrl: `/projects/${projectId}/hmacKeys`,
 | 
			
		||||
            methods,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.HmacKey = HmacKey;
 | 
			
		||||
//# sourceMappingURL=hmacKey.js.map
 | 
			
		||||
							
								
								
									
										135
									
								
								node_modules/@google-cloud/storage/build/src/iam.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										135
									
								
								node_modules/@google-cloud/storage/build/src/iam.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,135 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
import { Metadata } from '@google-cloud/common';
 | 
			
		||||
import { Bucket } from './bucket';
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {object} GetPolicyOptions
 | 
			
		||||
 * @property {string} [userProject] The ID of the project which will be billed for
 | 
			
		||||
 *     the request.
 | 
			
		||||
 */
 | 
			
		||||
export interface GetPolicyOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {array} GetPolicyResponse
 | 
			
		||||
 * @property {object} 0 The policy.
 | 
			
		||||
 * @property {object} 1 The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export declare type GetPolicyResponse = [Policy, Metadata];
 | 
			
		||||
/**
 | 
			
		||||
 * @callback GetPolicyCallback
 | 
			
		||||
 * @param {?Error} err Request error, if any.
 | 
			
		||||
 * @param {object} acl The policy.
 | 
			
		||||
 * @param {object} apiResponse The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export interface GetPolicyCallback {
 | 
			
		||||
    (err?: Error | null, acl?: Policy, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {object} SetPolicyOptions
 | 
			
		||||
 * @param {string} [userProject] The ID of the project which will be
 | 
			
		||||
 *     billed for the request.
 | 
			
		||||
 */
 | 
			
		||||
export interface SetPolicyOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {array} SetPolicyResponse
 | 
			
		||||
 * @property {object} 0 The policy.
 | 
			
		||||
 * @property {object} 1 The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export declare type SetPolicyResponse = [Policy, Metadata];
 | 
			
		||||
/**
 | 
			
		||||
 * @callback SetPolicyCallback
 | 
			
		||||
 * @param {?Error} err Request error, if any.
 | 
			
		||||
 * @param {object} acl The policy.
 | 
			
		||||
 * @param {object} apiResponse The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export interface SetPolicyCallback {
 | 
			
		||||
    (err?: Error | null, acl?: Policy, apiResponse?: object): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {object} Policy
 | 
			
		||||
 * @property {array} policy.bindings Bindings associate members with roles.
 | 
			
		||||
 * @property {string} [policy.etag] Etags are used to perform a read-modify-write.
 | 
			
		||||
 */
 | 
			
		||||
export interface Policy {
 | 
			
		||||
    bindings: PolicyBinding[];
 | 
			
		||||
    etag?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface PolicyBinding {
 | 
			
		||||
    role: string;
 | 
			
		||||
    members: string[];
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {array} TestIamPermissionsResponse
 | 
			
		||||
 * @property {object} 0 A subset of permissions that the caller is allowed.
 | 
			
		||||
 * @property {object} 1 The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export declare type TestIamPermissionsResponse = [{
 | 
			
		||||
    [key: string]: boolean;
 | 
			
		||||
}, Metadata];
 | 
			
		||||
/**
 | 
			
		||||
 * @callback TestIamPermissionsCallback
 | 
			
		||||
 * @param {?Error} err Request error, if any.
 | 
			
		||||
 * @param {object} acl A subset of permissions that the caller is allowed.
 | 
			
		||||
 * @param {object} apiResponse The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export interface TestIamPermissionsCallback {
 | 
			
		||||
    (err?: Error | null, acl?: {
 | 
			
		||||
        [key: string]: boolean;
 | 
			
		||||
    } | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {object} TestIamPermissionsOptions Configuration options for Iam#testPermissions().
 | 
			
		||||
 * @param {string} [userProject] The ID of the project which will be
 | 
			
		||||
 *     billed for the request.
 | 
			
		||||
 */
 | 
			
		||||
export interface TestIamPermissionsOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Get and set IAM policies for your Cloud Storage bucket.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Cloud Storage IAM Management](https://cloud.google.com/storage/docs/access-control/iam#short_title_iam_management)
 | 
			
		||||
 * @see [Granting, Changing, and Revoking Access](https://cloud.google.com/iam/docs/granting-changing-revoking-access)
 | 
			
		||||
 * @see [IAM Roles](https://cloud.google.com/iam/docs/understanding-roles)
 | 
			
		||||
 *
 | 
			
		||||
 * @constructor Iam
 | 
			
		||||
 * @mixin
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Bucket} bucket The parent instance.
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const bucket = storage.bucket('my-bucket');
 | 
			
		||||
 * // bucket.iam
 | 
			
		||||
 */
 | 
			
		||||
declare class Iam {
 | 
			
		||||
    private request_;
 | 
			
		||||
    private resourceId_;
 | 
			
		||||
    constructor(bucket: Bucket);
 | 
			
		||||
    getPolicy(options?: GetPolicyOptions): Promise<GetPolicyResponse>;
 | 
			
		||||
    getPolicy(options: GetPolicyOptions, callback: GetPolicyCallback): void;
 | 
			
		||||
    getPolicy(callback: GetPolicyCallback): void;
 | 
			
		||||
    setPolicy(policy: Policy, options?: SetPolicyOptions): Promise<SetPolicyResponse>;
 | 
			
		||||
    setPolicy(policy: Policy, callback: SetPolicyCallback): void;
 | 
			
		||||
    setPolicy(policy: Policy, options: SetPolicyOptions, callback: SetPolicyCallback): void;
 | 
			
		||||
    testPermissions(permissions: string | string[], options?: TestIamPermissionsOptions): Promise<TestIamPermissionsResponse>;
 | 
			
		||||
    testPermissions(permissions: string | string[], callback: TestIamPermissionsCallback): void;
 | 
			
		||||
    testPermissions(permissions: string | string[], options: TestIamPermissionsOptions, callback: TestIamPermissionsCallback): void;
 | 
			
		||||
}
 | 
			
		||||
export { Iam };
 | 
			
		||||
							
								
								
									
										224
									
								
								node_modules/@google-cloud/storage/build/src/iam.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										224
									
								
								node_modules/@google-cloud/storage/build/src/iam.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,224 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const promisify_1 = require("@google-cloud/promisify");
 | 
			
		||||
const arrify = require("arrify");
 | 
			
		||||
const util_1 = require("./util");
 | 
			
		||||
/**
 | 
			
		||||
 * Get and set IAM policies for your Cloud Storage bucket.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Cloud Storage IAM Management](https://cloud.google.com/storage/docs/access-control/iam#short_title_iam_management)
 | 
			
		||||
 * @see [Granting, Changing, and Revoking Access](https://cloud.google.com/iam/docs/granting-changing-revoking-access)
 | 
			
		||||
 * @see [IAM Roles](https://cloud.google.com/iam/docs/understanding-roles)
 | 
			
		||||
 *
 | 
			
		||||
 * @constructor Iam
 | 
			
		||||
 * @mixin
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Bucket} bucket The parent instance.
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const bucket = storage.bucket('my-bucket');
 | 
			
		||||
 * // bucket.iam
 | 
			
		||||
 */
 | 
			
		||||
class Iam {
 | 
			
		||||
    constructor(bucket) {
 | 
			
		||||
        this.request_ = bucket.request.bind(bucket);
 | 
			
		||||
        this.resourceId_ = 'buckets/' + bucket.getId();
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the IAM policy.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {GetPolicyRequest} [options] Request options.
 | 
			
		||||
     * @param {GetPolicyCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<GetPolicyResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Buckets: setIamPolicy API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/buckets/getIamPolicy}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('my-bucket');
 | 
			
		||||
     * bucket.iam.getPolicy(function(err, policy, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * bucket.iam.getPolicy().then(function(data) {
 | 
			
		||||
     *   const policy = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/iam.js</caption>
 | 
			
		||||
     * region_tag:storage_view_bucket_iam_members
 | 
			
		||||
     * Example of retrieving a bucket's IAM policy:
 | 
			
		||||
     */
 | 
			
		||||
    getPolicy(optionsOrCallback, callback) {
 | 
			
		||||
        const { options, callback: cb } = util_1.normalize(optionsOrCallback, callback);
 | 
			
		||||
        this.request_({
 | 
			
		||||
            uri: '/iam',
 | 
			
		||||
            qs: options,
 | 
			
		||||
        }, cb);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Set the IAM policy.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws {Error} If no policy is provided.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Policy} policy The policy.
 | 
			
		||||
     * @param {SetPolicyOptions} [options] Configuration opbject.
 | 
			
		||||
     * @param {SetPolicyCallback} callback Callback function.
 | 
			
		||||
     * @returns {Promise<SetPolicyResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Buckets: setIamPolicy API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/buckets/setIamPolicy}
 | 
			
		||||
     * @see [IAM Roles](https://cloud.google.com/iam/docs/understanding-roles)
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * const myPolicy = {
 | 
			
		||||
     *   bindings: [
 | 
			
		||||
     *     {
 | 
			
		||||
     *       role: 'roles/storage.admin',
 | 
			
		||||
     *       members:
 | 
			
		||||
     * ['serviceAccount:myotherproject@appspot.gserviceaccount.com']
 | 
			
		||||
     *     }
 | 
			
		||||
     *   ]
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * bucket.iam.setPolicy(myPolicy, function(err, policy, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * bucket.iam.setPolicy(myPolicy).then(function(data) {
 | 
			
		||||
     *   const policy = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/iam.js</caption>
 | 
			
		||||
     * region_tag:storage_add_bucket_iam_member
 | 
			
		||||
     * Example of adding to a bucket's IAM policy:
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/iam.js</caption>
 | 
			
		||||
     * region_tag:storage_remove_bucket_iam_member
 | 
			
		||||
     * Example of removing from a bucket's IAM policy:
 | 
			
		||||
     */
 | 
			
		||||
    setPolicy(policy, optionsOrCallback, callback) {
 | 
			
		||||
        if (policy === null || typeof policy !== 'object') {
 | 
			
		||||
            throw new Error('A policy object is required.');
 | 
			
		||||
        }
 | 
			
		||||
        const { options, callback: cb } = util_1.normalize(optionsOrCallback, callback);
 | 
			
		||||
        this.request_({
 | 
			
		||||
            method: 'PUT',
 | 
			
		||||
            uri: '/iam',
 | 
			
		||||
            json: Object.assign({
 | 
			
		||||
                resourceId: this.resourceId_,
 | 
			
		||||
            }, policy),
 | 
			
		||||
            qs: options,
 | 
			
		||||
        }, cb);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Test a set of permissions for a resource.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws {Error} If permissions are not provided.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string|string[]} permissions The permission(s) to test for.
 | 
			
		||||
     * @param {TestIamPermissionsOptions} [options] Configuration object.
 | 
			
		||||
     * @param {TestIamPermissionsCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<TestIamPermissionsResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Buckets: testIamPermissions API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/buckets/testIamPermissions}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const bucket = storage.bucket('my-bucket');
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Test a single permission.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const test = 'storage.buckets.delete';
 | 
			
		||||
     *
 | 
			
		||||
     * bucket.iam.testPermissions(test, function(err, permissions, apiResponse) {
 | 
			
		||||
     *   console.log(permissions);
 | 
			
		||||
     *   // {
 | 
			
		||||
     *   //   "storage.buckets.delete": true
 | 
			
		||||
     *   // }
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Test several permissions at once.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const tests = [
 | 
			
		||||
     *   'storage.buckets.delete',
 | 
			
		||||
     *   'storage.buckets.get'
 | 
			
		||||
     * ];
 | 
			
		||||
     *
 | 
			
		||||
     * bucket.iam.testPermissions(tests, function(err, permissions) {
 | 
			
		||||
     *   console.log(permissions);
 | 
			
		||||
     *   // {
 | 
			
		||||
     *   //   "storage.buckets.delete": false,
 | 
			
		||||
     *   //   "storage.buckets.get": true
 | 
			
		||||
     *   // }
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * bucket.iam.testPermissions(test).then(function(data) {
 | 
			
		||||
     *   const permissions = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    testPermissions(permissions, optionsOrCallback, callback) {
 | 
			
		||||
        if (!Array.isArray(permissions) && typeof permissions !== 'string') {
 | 
			
		||||
            throw new Error('Permissions are required.');
 | 
			
		||||
        }
 | 
			
		||||
        const { options, callback: cb } = util_1.normalize(optionsOrCallback, callback);
 | 
			
		||||
        const permissionsArray = arrify(permissions);
 | 
			
		||||
        const req = Object.assign({
 | 
			
		||||
            permissions: permissionsArray,
 | 
			
		||||
        }, options);
 | 
			
		||||
        this.request_({
 | 
			
		||||
            uri: '/iam/testPermissions',
 | 
			
		||||
            qs: req,
 | 
			
		||||
            useQuerystring: true,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                cb(err, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const availablePermissions = arrify(resp.permissions);
 | 
			
		||||
            const permissionsHash = permissionsArray.reduce((acc, permission) => {
 | 
			
		||||
                acc[permission] = availablePermissions.indexOf(permission) > -1;
 | 
			
		||||
                return acc;
 | 
			
		||||
            }, {});
 | 
			
		||||
            cb(null, permissionsHash, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.Iam = Iam;
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * All async methods (except for streams) will return a Promise in the event
 | 
			
		||||
 * that a callback is omitted.
 | 
			
		||||
 */
 | 
			
		||||
promisify_1.promisifyAll(Iam);
 | 
			
		||||
//# sourceMappingURL=iam.js.map
 | 
			
		||||
							
								
								
									
										54
									
								
								node_modules/@google-cloud/storage/build/src/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								node_modules/@google-cloud/storage/build/src/index.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * The `@google-cloud/storage` package has a single named export which is the
 | 
			
		||||
 * {@link Storage} (ES6) class, which should be instantiated with `new`.
 | 
			
		||||
 *
 | 
			
		||||
 * See {@link Storage} and {@link ClientConfig} for client methods and
 | 
			
		||||
 * configuration options.
 | 
			
		||||
 *
 | 
			
		||||
 * @module {Storage} @google-cloud/storage
 | 
			
		||||
 * @alias nodejs-storage
 | 
			
		||||
 *
 | 
			
		||||
 * @example <caption>Install the client library with <a
 | 
			
		||||
 * href="https://www.npmjs.com/">npm</a>:</caption> npm install --save
 | 
			
		||||
 * @google-cloud/storage
 | 
			
		||||
 *
 | 
			
		||||
 * @example <caption>Import the client library</caption>
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 *
 | 
			
		||||
 * @example <caption>Create a client that uses <a
 | 
			
		||||
 * href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application
 | 
			
		||||
 * Default Credentials (ADC)</a>:</caption> const storage = new Storage();
 | 
			
		||||
 *
 | 
			
		||||
 * @example <caption>Create a client with <a
 | 
			
		||||
 * href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit
 | 
			
		||||
 * credentials</a>:</caption> const storage = new Storage({ projectId:
 | 
			
		||||
 * 'your-project-id', keyFilename: '/path/to/keyfile.json'
 | 
			
		||||
 * });
 | 
			
		||||
 *
 | 
			
		||||
 * @example <caption>include:samples/quickstart.js</caption>
 | 
			
		||||
 * region_tag:storage_quickstart
 | 
			
		||||
 * Full quickstart example:
 | 
			
		||||
 */
 | 
			
		||||
export { AccessControlObject, AclOptions, AddAclCallback, AddAclOptions, AddAclResponse, GetAclCallback, GetAclOptions, GetAclResponse, RemoveAclCallback, RemoveAclOptions, RemoveAclResponse, UpdateAclCallback, UpdateAclOptions, UpdateAclResponse, } from './acl';
 | 
			
		||||
export { Bucket, BucketExistsCallback, BucketExistsOptions, BucketExistsResponse, BucketLockCallback, BucketLockResponse, CombineCallback, CombineOptions, CombineResponse, CreateChannelCallback, CreateChannelConfig, CreateChannelOptions, CreateChannelResponse, CreateNotificationCallback, CreateNotificationOptions, CreateNotificationResponse, DeleteBucketCallback, DeleteBucketOptions, DeleteBucketResponse, DeleteFilesCallback, DeleteFilesOptions, DeleteLabelsCallback, DeleteLabelsResponse, DisableRequesterPaysCallback, DisableRequesterPaysResponse, EnableRequesterPaysCallback, EnableRequesterPaysResponse, GetBucketCallback, GetBucketMetadataCallback, GetBucketMetadataOptions, GetBucketMetadataResponse, GetBucketOptions, GetBucketResponse, GetFilesCallback, GetFilesOptions, GetFilesResponse, GetLabelsCallback, GetLabelsOptions, GetLabelsResponse, GetNotificationsCallback, GetNotificationsOptions, GetNotificationsResponse, Labels, MakeBucketPrivateCallback, MakeBucketPrivateOptions, MakeBucketPrivateResponse, MakeBucketPublicCallback, MakeBucketPublicOptions, MakeBucketPublicResponse, SetBucketMetadataCallback, SetBucketMetadataOptions, SetBucketMetadataResponse, SetBucketStorageClassCallback, SetBucketStorageClassOptions, SetLabelsCallback, SetLabelsOptions, SetLabelsResponse, UploadCallback, UploadOptions, UploadResponse, } from './bucket';
 | 
			
		||||
export { Channel, StopCallback } from './channel';
 | 
			
		||||
export { CopyCallback, CopyOptions, CopyResponse, CreateReadStreamOptions, CreateResumableUploadCallback, CreateResumableUploadOptions, CreateResumableUploadResponse, CreateWriteStreamOptions, DeleteFileCallback, DeleteFileOptions, DeleteFileResponse, DownloadCallback, DownloadOptions, DownloadResponse, EncryptionKeyOptions, File, FileExistsCallback, FileExistsOptions, FileExistsResponse, FileOptions, GetExpirationDateCallback, GetExpirationDateResponse, GetFileCallback, GetFileMetadataCallback, GetFileMetadataOptions, GetFileMetadataResponse, GetFileOptions, GetFileResponse, GetSignedPolicyCallback, GetSignedPolicyOptions, GetSignedPolicyResponse, GetSignedUrlCallback, GetSignedUrlConfig, GetSignedUrlResponse, MakeFilePrivateCallback, MakeFilePrivateOptions, MakeFilePrivateResponse, MakeFilePublicCallback, MakeFilePublicResponse, MoveCallback, MoveOptions, MoveResponse, PolicyDocument, PredefinedAcl, RotateEncryptionKeyCallback, RotateEncryptionKeyOptions, RotateEncryptionKeyResponse, SaveCallback, SaveOptions, SetFileMetadataCallback, SetFileMetadataOptions, SetFileMetadataResponse, SetStorageClassCallback, SetStorageClassOptions, SetStorageClassResponse, } from './file';
 | 
			
		||||
export { HmacKey, HmacKeyMetadata, HmacKeyMetadataCallback, HmacKeyMetadataResponse, SetHmacKeyMetadata, SetHmacKeyMetadataOptions, } from './hmacKey';
 | 
			
		||||
export { GetPolicyCallback, GetPolicyOptions, GetPolicyResponse, Iam, Policy, SetPolicyCallback, SetPolicyOptions, SetPolicyResponse, TestIamPermissionsCallback, TestIamPermissionsOptions, TestIamPermissionsResponse, } from './iam';
 | 
			
		||||
export { DeleteNotificationCallback, DeleteNotificationOptions, GetNotificationCallback, GetNotificationMetadataCallback, GetNotificationMetadataOptions, GetNotificationMetadataResponse, GetNotificationOptions, GetNotificationResponse, Notification, } from './notification';
 | 
			
		||||
export { BucketCallback, BucketOptions, CreateBucketQuery, CreateBucketRequest, CreateBucketResponse, CreateHmacKeyCallback, CreateHmacKeyOptions, CreateHmacKeyResponse, GetBucketsCallback, GetBucketsRequest, GetBucketsResponse, GetHmacKeysCallback, GetHmacKeysOptions, GetHmacKeysResponse, GetServiceAccountCallback, GetServiceAccountOptions, GetServiceAccountResponse, HmacKeyResourceResponse, ServiceAccount, Storage, StorageOptions, } from './storage';
 | 
			
		||||
							
								
								
									
										32
									
								
								node_modules/@google-cloud/storage/build/src/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								node_modules/@google-cloud/storage/build/src/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var bucket_1 = require("./bucket");
 | 
			
		||||
exports.Bucket = bucket_1.Bucket;
 | 
			
		||||
var channel_1 = require("./channel");
 | 
			
		||||
exports.Channel = channel_1.Channel;
 | 
			
		||||
var file_1 = require("./file");
 | 
			
		||||
exports.File = file_1.File;
 | 
			
		||||
var hmacKey_1 = require("./hmacKey");
 | 
			
		||||
exports.HmacKey = hmacKey_1.HmacKey;
 | 
			
		||||
var iam_1 = require("./iam");
 | 
			
		||||
exports.Iam = iam_1.Iam;
 | 
			
		||||
var notification_1 = require("./notification");
 | 
			
		||||
exports.Notification = notification_1.Notification;
 | 
			
		||||
var storage_1 = require("./storage");
 | 
			
		||||
exports.Storage = storage_1.Storage;
 | 
			
		||||
//# sourceMappingURL=index.js.map
 | 
			
		||||
							
								
								
									
										110
									
								
								node_modules/@google-cloud/storage/build/src/notification.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								node_modules/@google-cloud/storage/build/src/notification.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,110 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
import { Metadata, MetadataCallback, ServiceObject } from '@google-cloud/common';
 | 
			
		||||
import { ResponseBody } from '@google-cloud/common/build/src/util';
 | 
			
		||||
import { Bucket } from './bucket';
 | 
			
		||||
export interface DeleteNotificationOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface GetNotificationMetadataOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {array} GetNotificationMetadataResponse
 | 
			
		||||
 * @property {object} 0 The notification metadata.
 | 
			
		||||
 * @property {object} 1 The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export declare type GetNotificationMetadataResponse = [ResponseBody, Metadata];
 | 
			
		||||
/**
 | 
			
		||||
 * @callback GetNotificationMetadataCallback
 | 
			
		||||
 * @param {?Error} err Request error, if any.
 | 
			
		||||
 * @param {object} files The notification metadata.
 | 
			
		||||
 * @param {object} apiResponse The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export interface GetNotificationMetadataCallback {
 | 
			
		||||
    (err: Error | null, metadata?: ResponseBody, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @typedef {array} GetNotificationResponse
 | 
			
		||||
 * @property {Notification} 0 The {@link Notification}
 | 
			
		||||
 * @property {object} 1 The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export declare type GetNotificationResponse = [Notification, Metadata];
 | 
			
		||||
export interface GetNotificationOptions {
 | 
			
		||||
    /**
 | 
			
		||||
     * Automatically create the object if it does not exist. Default: `false`.
 | 
			
		||||
     */
 | 
			
		||||
    autoCreate?: boolean;
 | 
			
		||||
    /**
 | 
			
		||||
     * The ID of the project which will be billed for the request.
 | 
			
		||||
     */
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @callback GetNotificationCallback
 | 
			
		||||
 * @param {?Error} err Request error, if any.
 | 
			
		||||
 * @param {Notification} notification The {@link Notification}.
 | 
			
		||||
 * @param {object} apiResponse The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export interface GetNotificationCallback {
 | 
			
		||||
    (err: Error | null, notification?: Notification | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * @callback DeleteNotificationCallback
 | 
			
		||||
 * @param {?Error} err Request error, if any.
 | 
			
		||||
 * @param {object} apiResponse The full API response.
 | 
			
		||||
 */
 | 
			
		||||
export interface DeleteNotificationCallback {
 | 
			
		||||
    (err: Error | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * A Notification object is created from your {@link Bucket} object using
 | 
			
		||||
 * {@link Bucket#notification}. Use it to interact with Cloud Pub/Sub
 | 
			
		||||
 * notifications.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Cloud Pub/Sub Notifications for Google Cloud Storage]{@link https://cloud.google.com/storage/docs/pubsub-notifications}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 * @hideconstructor
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Bucket} bucket The bucket instance this notification is attached to.
 | 
			
		||||
 * @param {string} id The ID of the notification.
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
 *
 | 
			
		||||
 * const notification = myBucket.notification('1');
 | 
			
		||||
 */
 | 
			
		||||
declare class Notification extends ServiceObject {
 | 
			
		||||
    constructor(bucket: Bucket, id: string);
 | 
			
		||||
    delete(options?: DeleteNotificationOptions): Promise<[Metadata]>;
 | 
			
		||||
    delete(options: DeleteNotificationOptions, callback: DeleteNotificationCallback): void;
 | 
			
		||||
    delete(callback: DeleteNotificationCallback): void;
 | 
			
		||||
    get(options?: GetNotificationOptions): Promise<GetNotificationResponse>;
 | 
			
		||||
    get(options: GetNotificationOptions, callback: GetNotificationCallback): void;
 | 
			
		||||
    get(callback: GetNotificationCallback): void;
 | 
			
		||||
    getMetadata(options?: GetNotificationMetadataOptions): Promise<GetNotificationMetadataResponse>;
 | 
			
		||||
    getMetadata(options: GetNotificationMetadataOptions, callback: MetadataCallback): void;
 | 
			
		||||
    getMetadata(callback: MetadataCallback): void;
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * Reference to the {@link Notification} class.
 | 
			
		||||
 * @name module:@google-cloud/storage.Notification
 | 
			
		||||
 * @see Notification
 | 
			
		||||
 */
 | 
			
		||||
export { Notification };
 | 
			
		||||
							
								
								
									
										291
									
								
								node_modules/@google-cloud/storage/build/src/notification.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										291
									
								
								node_modules/@google-cloud/storage/build/src/notification.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,291 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const common_1 = require("@google-cloud/common");
 | 
			
		||||
const promisify_1 = require("@google-cloud/promisify");
 | 
			
		||||
/**
 | 
			
		||||
 * A Notification object is created from your {@link Bucket} object using
 | 
			
		||||
 * {@link Bucket#notification}. Use it to interact with Cloud Pub/Sub
 | 
			
		||||
 * notifications.
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Cloud Pub/Sub Notifications for Google Cloud Storage]{@link https://cloud.google.com/storage/docs/pubsub-notifications}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 * @hideconstructor
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Bucket} bucket The bucket instance this notification is attached to.
 | 
			
		||||
 * @param {string} id The ID of the notification.
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
 *
 | 
			
		||||
 * const notification = myBucket.notification('1');
 | 
			
		||||
 */
 | 
			
		||||
class Notification extends common_1.ServiceObject {
 | 
			
		||||
    constructor(bucket, id) {
 | 
			
		||||
        const methods = {
 | 
			
		||||
            /**
 | 
			
		||||
             * Creates a notification subscription for the bucket.
 | 
			
		||||
             *
 | 
			
		||||
             * @see [Notifications: insert]{@link https://cloud.google.com/storage/docs/json_api/v1/notifications/insert}
 | 
			
		||||
             * @method Notification#exists
 | 
			
		||||
             *
 | 
			
		||||
             * @param {Topic|string} topic The Cloud PubSub topic to which this
 | 
			
		||||
             *     subscription publishes. If the project ID is omitted, the current
 | 
			
		||||
             *     project ID will be used.
 | 
			
		||||
             *
 | 
			
		||||
             *     Acceptable formats are:
 | 
			
		||||
             *     - `projects/grape-spaceship-123/topics/my-topic`
 | 
			
		||||
             *
 | 
			
		||||
             *     - `my-topic`
 | 
			
		||||
             * @param {CreateNotificationRequest} [options] Metadata to set for
 | 
			
		||||
             *     the notification.
 | 
			
		||||
             * @param {CreateNotificationCallback} [callback] Callback function.
 | 
			
		||||
             * @returns {Promise<CreateNotificationResponse>}
 | 
			
		||||
             * @throws {Error} If a valid topic is not provided.
 | 
			
		||||
             *
 | 
			
		||||
             * @example
 | 
			
		||||
             * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
             * const storage = new Storage();
 | 
			
		||||
             * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
             * const notification = myBucket.notification('1');
 | 
			
		||||
             *
 | 
			
		||||
             * notification.create(function(err, notification, apiResponse) {
 | 
			
		||||
             *   if (!err) {
 | 
			
		||||
             *     // The notification was created successfully.
 | 
			
		||||
             *   }
 | 
			
		||||
             * });
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
             * //-
 | 
			
		||||
             * notification.create().then(function(data) {
 | 
			
		||||
             *   const notification = data[0];
 | 
			
		||||
             *   const apiResponse = data[1];
 | 
			
		||||
             * });
 | 
			
		||||
             */
 | 
			
		||||
            create: true,
 | 
			
		||||
            /**
 | 
			
		||||
             * @typedef {array} NotificationExistsResponse
 | 
			
		||||
             * @property {boolean} 0 Whether the notification exists or not.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * @callback NotificationExistsCallback
 | 
			
		||||
             * @param {?Error} err Request error, if any.
 | 
			
		||||
             * @param {boolean} exists Whether the notification exists or not.
 | 
			
		||||
             */
 | 
			
		||||
            /**
 | 
			
		||||
             * Check if the notification exists.
 | 
			
		||||
             *
 | 
			
		||||
             * @method Notification#exists
 | 
			
		||||
             * @param {NotificationExistsCallback} [callback] Callback function.
 | 
			
		||||
             * @returns {Promise<NotificationExistsResponse>}
 | 
			
		||||
             *
 | 
			
		||||
             * @example
 | 
			
		||||
             * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
             * const storage = new Storage();
 | 
			
		||||
             * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
             * const notification = myBucket.notification('1');
 | 
			
		||||
             *
 | 
			
		||||
             * notification.exists(function(err, exists) {});
 | 
			
		||||
             *
 | 
			
		||||
             * //-
 | 
			
		||||
             * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
             * //-
 | 
			
		||||
             * notification.exists().then(function(data) {
 | 
			
		||||
             *   const exists = data[0];
 | 
			
		||||
             * });
 | 
			
		||||
             */
 | 
			
		||||
            exists: true,
 | 
			
		||||
        };
 | 
			
		||||
        super({
 | 
			
		||||
            parent: bucket,
 | 
			
		||||
            baseUrl: '/notificationConfigs',
 | 
			
		||||
            id: id.toString(),
 | 
			
		||||
            createMethod: bucket.createNotification.bind(bucket),
 | 
			
		||||
            methods,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} DeleteNotificationResponse
 | 
			
		||||
     * @property {object} 0 The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Permanently deletes a notification subscription.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Notifications: delete API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/notifications/delete}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object} [options] Configuration options.
 | 
			
		||||
     * @param {string} [options.userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @param {DeleteNotificationCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<DeleteNotificationResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const notification = myBucket.notification('1');
 | 
			
		||||
     *
 | 
			
		||||
     * notification.delete(function(err, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * notification.delete().then(function(data) {
 | 
			
		||||
     *   const apiResponse = data[0];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/notifications.js</caption>
 | 
			
		||||
     * region_tag:storage_delete_notification
 | 
			
		||||
     * Another example:
 | 
			
		||||
     */
 | 
			
		||||
    delete(optionsOrCallback, callback) {
 | 
			
		||||
        const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
 | 
			
		||||
        callback =
 | 
			
		||||
            typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
 | 
			
		||||
        this.request({
 | 
			
		||||
            method: 'DELETE',
 | 
			
		||||
            uri: '',
 | 
			
		||||
            qs: options,
 | 
			
		||||
        }, callback || common_1.util.noop);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a notification and its metadata if it exists.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Notifications: get API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object} [options] Configuration options.
 | 
			
		||||
     *     See {@link Bucket#createNotification} for create options.
 | 
			
		||||
     * @param {boolean} [options.autoCreate] Automatically create the object if
 | 
			
		||||
     *     it does not exist. Default: `false`.
 | 
			
		||||
     * @param {string} [options.userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @param {GetNotificationCallback} [callback] Callback function.
 | 
			
		||||
     * @return {Promise<GetNotificationCallback>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const notification = myBucket.notification('1');
 | 
			
		||||
     *
 | 
			
		||||
     * notification.get(function(err, notification, apiResponse) {
 | 
			
		||||
     *   // `notification.metadata` has been populated.
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * notification.get().then(function(data) {
 | 
			
		||||
     *   const notification = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    get(optionsOrCallback, callback) {
 | 
			
		||||
        const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
 | 
			
		||||
        callback =
 | 
			
		||||
            typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
 | 
			
		||||
        const autoCreate = options.autoCreate;
 | 
			
		||||
        delete options.autoCreate;
 | 
			
		||||
        const onCreate = (err, notification, apiResponse) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                if (err.code === 409) {
 | 
			
		||||
                    this.get(options, callback);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                callback(err, null, apiResponse);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            callback(null, notification, apiResponse);
 | 
			
		||||
        };
 | 
			
		||||
        this.getMetadata(options, (err, metadata) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                if (err.code === 404 && autoCreate) {
 | 
			
		||||
                    const args = [];
 | 
			
		||||
                    if (Object.keys(options).length > 0) {
 | 
			
		||||
                        args.push(options);
 | 
			
		||||
                    }
 | 
			
		||||
                    args.push(onCreate);
 | 
			
		||||
                    // tslint:disable-next-line no-any
 | 
			
		||||
                    this.create.apply(this, args);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                callback(err, null, metadata);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            callback(null, this, metadata);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the notification's metadata.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Notifications: get API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/notifications/get}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object} [options] Configuration options.
 | 
			
		||||
     * @param {string} [options.userProject] The ID of the project which will be
 | 
			
		||||
     *     billed for the request.
 | 
			
		||||
     * @param {GetNotificationMetadataCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<GetNotificationMetadataResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const myBucket = storage.bucket('my-bucket');
 | 
			
		||||
     * const notification = myBucket.notification('1');
 | 
			
		||||
     *
 | 
			
		||||
     * notification.getMetadata(function(err, metadata, apiResponse) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * notification.getMetadata().then(function(data) {
 | 
			
		||||
     *   const metadata = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/notifications.js</caption>
 | 
			
		||||
     * region_tag:storage_notifications_get_metadata
 | 
			
		||||
     * Another example:
 | 
			
		||||
     */
 | 
			
		||||
    getMetadata(optionsOrCallback, callback) {
 | 
			
		||||
        const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
 | 
			
		||||
        callback =
 | 
			
		||||
            typeof optionsOrCallback === 'function' ? optionsOrCallback : callback;
 | 
			
		||||
        this.request({
 | 
			
		||||
            uri: '',
 | 
			
		||||
            qs: options,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            this.metadata = resp;
 | 
			
		||||
            callback(null, this.metadata, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.Notification = Notification;
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * All async methods (except for streams) will return a Promise in the event
 | 
			
		||||
 * that a callback is omitted.
 | 
			
		||||
 */
 | 
			
		||||
promisify_1.promisifyAll(Notification);
 | 
			
		||||
//# sourceMappingURL=notification.js.map
 | 
			
		||||
							
								
								
									
										470
									
								
								node_modules/@google-cloud/storage/build/src/storage.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										470
									
								
								node_modules/@google-cloud/storage/build/src/storage.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,470 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
/// <reference types="node" />
 | 
			
		||||
import { GoogleAuthOptions, Metadata, Service } from '@google-cloud/common';
 | 
			
		||||
import { Readable } from 'stream';
 | 
			
		||||
import { Bucket } from './bucket';
 | 
			
		||||
import { Channel } from './channel';
 | 
			
		||||
import { File } from './file';
 | 
			
		||||
import { HmacKey, HmacKeyMetadata, HmacKeyOptions } from './hmacKey';
 | 
			
		||||
export interface GetServiceAccountOptions {
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface ServiceAccount {
 | 
			
		||||
    emailAddress?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetServiceAccountResponse = [ServiceAccount, Metadata];
 | 
			
		||||
export interface GetServiceAccountCallback {
 | 
			
		||||
    (err: Error | null, serviceAccount?: ServiceAccount, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateBucketQuery {
 | 
			
		||||
    project: string;
 | 
			
		||||
    userProject: string;
 | 
			
		||||
}
 | 
			
		||||
export interface StorageOptions extends GoogleAuthOptions {
 | 
			
		||||
    autoRetry?: boolean;
 | 
			
		||||
    maxRetries?: number;
 | 
			
		||||
    promise?: typeof Promise;
 | 
			
		||||
    /**
 | 
			
		||||
     * The API endpoint of the service used to make requests.
 | 
			
		||||
     * Defaults to `www.googleapis.com`.
 | 
			
		||||
     */
 | 
			
		||||
    apiEndpoint?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface BucketOptions {
 | 
			
		||||
    kmsKeyName?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateBucketRequest {
 | 
			
		||||
    coldline?: boolean;
 | 
			
		||||
    dra?: boolean;
 | 
			
		||||
    multiRegional?: boolean;
 | 
			
		||||
    nearline?: boolean;
 | 
			
		||||
    regional?: boolean;
 | 
			
		||||
    requesterPays?: boolean;
 | 
			
		||||
    retentionPolicy?: object;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
    location?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type CreateBucketResponse = [Bucket, Metadata];
 | 
			
		||||
export interface BucketCallback {
 | 
			
		||||
    (err: Error | null, bucket?: Bucket | null, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetBucketsResponse = [Bucket[], {}, Metadata];
 | 
			
		||||
export interface GetBucketsCallback {
 | 
			
		||||
    (err: Error | null, buckets: Bucket[], nextQuery?: {}, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetBucketsRequest {
 | 
			
		||||
    prefix?: string;
 | 
			
		||||
    project?: string;
 | 
			
		||||
    autoPaginate?: boolean;
 | 
			
		||||
    maxApiCalls?: number;
 | 
			
		||||
    maxResults?: number;
 | 
			
		||||
    pageToken?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface HmacKeyResourceResponse {
 | 
			
		||||
    metadata: HmacKeyMetadata;
 | 
			
		||||
    secret: string;
 | 
			
		||||
}
 | 
			
		||||
export declare type CreateHmacKeyResponse = [HmacKey, string, HmacKeyResourceResponse];
 | 
			
		||||
export interface CreateHmacKeyOptions {
 | 
			
		||||
    projectId?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface CreateHmacKeyCallback {
 | 
			
		||||
    (err: Error | null, hmacKey?: HmacKey | null, secret?: string | null, apiResponse?: HmacKeyResourceResponse): void;
 | 
			
		||||
}
 | 
			
		||||
export interface GetHmacKeysOptions {
 | 
			
		||||
    projectId?: string;
 | 
			
		||||
    serviceAccountEmail?: string;
 | 
			
		||||
    showDeletedKeys?: boolean;
 | 
			
		||||
    autoPaginate?: boolean;
 | 
			
		||||
    maxApiCalls?: number;
 | 
			
		||||
    maxResults?: number;
 | 
			
		||||
    pageToken?: string;
 | 
			
		||||
    userProject?: string;
 | 
			
		||||
}
 | 
			
		||||
export interface GetHmacKeysCallback {
 | 
			
		||||
    (err: Error | null, hmacKeys: HmacKey[] | null, nextQuery?: {}, apiResponse?: Metadata): void;
 | 
			
		||||
}
 | 
			
		||||
export declare type GetHmacKeysResponse = [HmacKey[]];
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * Invoke this method to create a new Storage object bound with pre-determined
 | 
			
		||||
 * configuration options. For each object that can be created (e.g., a bucket),
 | 
			
		||||
 * there is an equivalent static and instance method. While they are classes,
 | 
			
		||||
 * they can be instantiated without use of the `new` keyword.
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * <h4>ACLs</h4>
 | 
			
		||||
 * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
 * bucket access. ACLs are the mechanism you use to share files with other users
 | 
			
		||||
 * and allow other users to access your buckets and files.
 | 
			
		||||
 *
 | 
			
		||||
 * To learn more about ACLs, read this overview on
 | 
			
		||||
 * [Access Control](https://cloud.google.com/storage/docs/access-control).
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Cloud Storage overview]{@link https://cloud.google.com/storage/docs/overview}
 | 
			
		||||
 * @see [Access Control]{@link https://cloud.google.com/storage/docs/access-control}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 */
 | 
			
		||||
export declare class Storage extends Service {
 | 
			
		||||
    /**
 | 
			
		||||
     * {@link Bucket} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @name Storage.Bucket
 | 
			
		||||
     * @see Bucket
 | 
			
		||||
     * @type {Constructor}
 | 
			
		||||
     */
 | 
			
		||||
    static Bucket: typeof Bucket;
 | 
			
		||||
    /**
 | 
			
		||||
     * {@link Channel} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @name Storage.Channel
 | 
			
		||||
     * @see Channel
 | 
			
		||||
     * @type {Constructor}
 | 
			
		||||
     */
 | 
			
		||||
    static Channel: typeof Channel;
 | 
			
		||||
    /**
 | 
			
		||||
     * {@link File} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @name Storage.File
 | 
			
		||||
     * @see File
 | 
			
		||||
     * @type {Constructor}
 | 
			
		||||
     */
 | 
			
		||||
    static File: typeof File;
 | 
			
		||||
    /**
 | 
			
		||||
     * {@link HmacKey} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @name Storage.HmacKey
 | 
			
		||||
     * @see HmacKey
 | 
			
		||||
     * @type {Constructor}
 | 
			
		||||
     */
 | 
			
		||||
    static HmacKey: typeof HmacKey;
 | 
			
		||||
    /**
 | 
			
		||||
     * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
     * bucket access. ACLs are the mechanism you use to share objects with other
 | 
			
		||||
     * users and allow other users to access your buckets and objects.
 | 
			
		||||
     *
 | 
			
		||||
     * This object provides constants to refer to the three permission levels that
 | 
			
		||||
     * can be granted to an entity:
 | 
			
		||||
     *
 | 
			
		||||
     *   - `gcs.acl.OWNER_ROLE` - ("OWNER")
 | 
			
		||||
     *   - `gcs.acl.READER_ROLE` - ("READER")
 | 
			
		||||
     *   - `gcs.acl.WRITER_ROLE` - ("WRITER")
 | 
			
		||||
     *
 | 
			
		||||
     * @see [About Access Control Lists]{@link https://cloud.google.com/storage/docs/access-control/lists}
 | 
			
		||||
     *
 | 
			
		||||
     * @name Storage.acl
 | 
			
		||||
     * @type {object}
 | 
			
		||||
     * @property {string} OWNER_ROLE
 | 
			
		||||
     * @property {string} READER_ROLE
 | 
			
		||||
     * @property {string} WRITER_ROLE
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const albums = storage.bucket('albums');
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Make all of the files currently in a bucket publicly readable.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const options = {
 | 
			
		||||
     *   entity: 'allUsers',
 | 
			
		||||
     *   role: storage.acl.READER_ROLE
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * albums.acl.add(options, function(err, aclObject) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Make any new objects added to a bucket publicly readable.
 | 
			
		||||
     * //-
 | 
			
		||||
     * albums.acl.default.add(options, function(err, aclObject) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Grant a user ownership permissions to a bucket.
 | 
			
		||||
     * //-
 | 
			
		||||
     * albums.acl.add({
 | 
			
		||||
     *   entity: 'user-useremail@example.com',
 | 
			
		||||
     *   role: storage.acl.OWNER_ROLE
 | 
			
		||||
     * }, function(err, aclObject) {});
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * albums.acl.add(options).then(function(data) {
 | 
			
		||||
     *   const aclObject = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    static acl: {
 | 
			
		||||
        OWNER_ROLE: string;
 | 
			
		||||
        READER_ROLE: string;
 | 
			
		||||
        WRITER_ROLE: string;
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
     * Reference to {@link Storage.acl}.
 | 
			
		||||
     *
 | 
			
		||||
     * @name Storage#acl
 | 
			
		||||
     * @see Storage.acl
 | 
			
		||||
     */
 | 
			
		||||
    acl: typeof Storage.acl;
 | 
			
		||||
    /**
 | 
			
		||||
     * Get {@link Bucket} objects for all of the buckets in your project as
 | 
			
		||||
     * a readable object stream.
 | 
			
		||||
     *
 | 
			
		||||
     * @method Storage#getBucketsStream
 | 
			
		||||
     * @param {GetBucketsRequest} [query] Query object for listing buckets.
 | 
			
		||||
     * @returns {ReadableStream} A readable stream that emits {@link Bucket} instances.
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * storage.getBucketsStream()
 | 
			
		||||
     *   .on('error', console.error)
 | 
			
		||||
     *   .on('data', function(bucket) {
 | 
			
		||||
     *     // bucket is a Bucket object.
 | 
			
		||||
     *   })
 | 
			
		||||
     *   .on('end', function() {
 | 
			
		||||
     *     // All buckets retrieved.
 | 
			
		||||
     *   });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If you anticipate many results, you can end a stream early to prevent
 | 
			
		||||
     * // unnecessary processing and API requests.
 | 
			
		||||
     * //-
 | 
			
		||||
     * storage.getBucketsStream()
 | 
			
		||||
     *   .on('data', function(bucket) {
 | 
			
		||||
     *     this.end();
 | 
			
		||||
     *   });
 | 
			
		||||
     */
 | 
			
		||||
    getBucketsStream: () => Readable;
 | 
			
		||||
    /**
 | 
			
		||||
     * Get {@link HmacKey} objects for all of the HMAC keys in the project in
 | 
			
		||||
     * a readable object stream.
 | 
			
		||||
     *
 | 
			
		||||
     * @method Storage#getHmacKeysStream
 | 
			
		||||
     * @param {GetHmacKeysOptions} [options] Configuration options.
 | 
			
		||||
     * @returns {ReadableStream} A readable stream that emits {@link HmacKey} instances.
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * storage.getHmacKeysStream()
 | 
			
		||||
     *   .on('error', console.error)
 | 
			
		||||
     *   .on('data', function(hmacKey) {
 | 
			
		||||
     *     // hmacKey is an HmacKey object.
 | 
			
		||||
     *   })
 | 
			
		||||
     *   .on('end', function() {
 | 
			
		||||
     *     // All HmacKey retrieved.
 | 
			
		||||
     *   });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If you anticipate many results, you can end a stream early to prevent
 | 
			
		||||
     * // unnecessary processing and API requests.
 | 
			
		||||
     * //-
 | 
			
		||||
     * storage.getHmacKeysStream()
 | 
			
		||||
     *   .on('data', function(bucket) {
 | 
			
		||||
     *     this.end();
 | 
			
		||||
     *   });
 | 
			
		||||
     */
 | 
			
		||||
    getHmacKeysStream: () => Readable;
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} StorageOptions
 | 
			
		||||
     * @property {string} [projectId] The project ID from the Google Developer's
 | 
			
		||||
     *     Console, e.g. 'grape-spaceship-123'. We will also check the environment
 | 
			
		||||
     *     variable `GCLOUD_PROJECT` for your project ID. If your app is running
 | 
			
		||||
     * in an environment which supports {@link
 | 
			
		||||
     * https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application
 | 
			
		||||
     * Application Default Credentials}, your project ID will be detected
 | 
			
		||||
     * automatically.
 | 
			
		||||
     * @property {string} [keyFilename] Full path to the a .json, .pem, or .p12 key
 | 
			
		||||
     *     downloaded from the Google Developers Console. If you provide a path to
 | 
			
		||||
     * a JSON file, the `projectId` option above is not necessary. NOTE: .pem and
 | 
			
		||||
     *     .p12 require you to specify the `email` option as well.
 | 
			
		||||
     * @property {string} [email] Account email address. Required when using a .pem
 | 
			
		||||
     *     or .p12 keyFilename.
 | 
			
		||||
     * @property {object} [credentials] Credentials object.
 | 
			
		||||
     * @property {string} [credentials.client_email]
 | 
			
		||||
     * @property {string} [credentials.private_key]
 | 
			
		||||
     * @property {boolean} [autoRetry=true] Automatically retry requests if the
 | 
			
		||||
     *     response is related to rate limits or certain intermittent server
 | 
			
		||||
     * errors. We will exponentially backoff subsequent requests by default.
 | 
			
		||||
     * @property {number} [maxRetries=3] Maximum number of automatic retries
 | 
			
		||||
     *     attempted before returning the error.
 | 
			
		||||
     * @property {Constructor} [promise] Custom promise module to use instead of
 | 
			
		||||
     *     native Promises.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs the Storage client.
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>Create a client that uses Application Default Credentials
 | 
			
		||||
     * (ADC)</caption> const {Storage} = require('@google-cloud/storage'); const
 | 
			
		||||
     * storage = new Storage();
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>Create a client with explicit credentials</caption>
 | 
			
		||||
     * storage');/storage');
 | 
			
		||||
     * const storage = new Storage({
 | 
			
		||||
     *   projectId: 'your-project-id',
 | 
			
		||||
     *   keyFilename: '/path/to/keyfile.json'
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @param {StorageOptions} [options] Configuration options.
 | 
			
		||||
     */
 | 
			
		||||
    constructor(options?: StorageOptions);
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a reference to a Cloud Storage bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} name Name of the bucket.
 | 
			
		||||
     * @param {object} [options] Configuration object.
 | 
			
		||||
     * @param {string} [options.kmsKeyName] A Cloud KMS key that will be used to
 | 
			
		||||
     *     encrypt objects inserted into this bucket, if no encryption method is
 | 
			
		||||
     *     specified.
 | 
			
		||||
     * @param {string} [options.userProject] User project to be billed for all
 | 
			
		||||
     *     requests made from this Bucket object.
 | 
			
		||||
     * @returns {Bucket}
 | 
			
		||||
     * @see Bucket
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const albums = storage.bucket('albums');
 | 
			
		||||
     * const photos = storage.bucket('photos');
 | 
			
		||||
     */
 | 
			
		||||
    bucket(name: string, options?: BucketOptions): Bucket;
 | 
			
		||||
    /**
 | 
			
		||||
     * Reference a channel to receive notifications about changes to your bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} id The ID of the channel.
 | 
			
		||||
     * @param {string} resourceId The resource ID of the channel.
 | 
			
		||||
     * @returns {Channel}
 | 
			
		||||
     * @see Channel
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const channel = storage.channel('id', 'resource-id');
 | 
			
		||||
     */
 | 
			
		||||
    channel(id: string, resourceId: string): Channel;
 | 
			
		||||
    createBucket(name: string, metadata?: CreateBucketRequest): Promise<CreateBucketResponse>;
 | 
			
		||||
    createBucket(name: string, callback: BucketCallback): void;
 | 
			
		||||
    createBucket(name: string, metadata: CreateBucketRequest, callback: BucketCallback): void;
 | 
			
		||||
    createBucket(name: string, metadata: CreateBucketRequest, callback: BucketCallback): void;
 | 
			
		||||
    createHmacKey(serviceAccountEmail: string, options?: CreateHmacKeyOptions): Promise<CreateHmacKeyResponse>;
 | 
			
		||||
    createHmacKey(serviceAccountEmail: string, callback: CreateHmacKeyCallback): void;
 | 
			
		||||
    createHmacKey(serviceAccountEmail: string, options: CreateHmacKeyOptions, callback: CreateHmacKeyCallback): void;
 | 
			
		||||
    getBuckets(options?: GetBucketsRequest): Promise<GetBucketsResponse>;
 | 
			
		||||
    getBuckets(options: GetBucketsRequest, callback: GetBucketsCallback): void;
 | 
			
		||||
    getBuckets(callback: GetBucketsCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Query object for listing HMAC keys.
 | 
			
		||||
     *
 | 
			
		||||
     * @typedef {object} GetHmacKeysOptions
 | 
			
		||||
     * @property {string} [projectId] The project ID of the project that owns
 | 
			
		||||
     *     the service account of the requested HMAC key. If not provided,
 | 
			
		||||
     *     the project ID used to instantiate the Storage client will be used.
 | 
			
		||||
     * @property {string} [serviceAccountEmail] If present, only HMAC keys for the
 | 
			
		||||
     *     given service account are returned.
 | 
			
		||||
     * @property {boolean} [showDeletedKeys=false] If true, include keys in the DELETE
 | 
			
		||||
     *     state. Default is false.
 | 
			
		||||
     * @property {boolean} [autoPaginate=true] Have pagination handled
 | 
			
		||||
     *     automatically.
 | 
			
		||||
     * @property {number} [maxApiCalls] Maximum number of API calls to make.
 | 
			
		||||
     * @property {number} [maxResults] Maximum number of items plus prefixes to
 | 
			
		||||
     *     return.
 | 
			
		||||
     * @property {string} [pageToken] A previously-returned page token
 | 
			
		||||
     *     representing part of the larger set of results to view.
 | 
			
		||||
     * @property {string} [userProject] This parameter is currently ignored.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} GetHmacKeysResponse
 | 
			
		||||
     * @property {HmacKey[]} 0 Array of {@link HmacKey} instances.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback GetHmacKeysCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {HmacKey[]} hmacKeys Array of {@link HmacKey} instances.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Retrieves a list of HMAC keys matching the criteria.
 | 
			
		||||
     *
 | 
			
		||||
     * The authenticated user must have storage.hmacKeys.list permission for the project in which the key exists.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {GetHmacKeysOption} options Configuration options.
 | 
			
		||||
     * @param {GetHmacKeysCallback} callback Callback function.
 | 
			
		||||
     * @return {Promise<GetHmacKeysResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * storage.getHmacKeys(function(err, hmacKeys) {
 | 
			
		||||
     *   if (!err) {
 | 
			
		||||
     *     // hmacKeys is an array of HmacKey objects.
 | 
			
		||||
     *   }
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // To control how many API requests are made and page through the results
 | 
			
		||||
     * // manually, set `autoPaginate` to `false`.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const callback = function(err, hmacKeys, nextQuery, apiResponse) {
 | 
			
		||||
     *   if (nextQuery) {
 | 
			
		||||
     *     // More results exist.
 | 
			
		||||
     *     storage.getHmacKeys(nextQuery, callback);
 | 
			
		||||
     *   }
 | 
			
		||||
     *
 | 
			
		||||
     *   // The `metadata` property is populated for you with the metadata at the
 | 
			
		||||
     *   // time of fetching.
 | 
			
		||||
     *   hmacKeys[0].metadata;
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * storage.getHmacKeys({
 | 
			
		||||
     *   autoPaginate: false
 | 
			
		||||
     * }, callback);
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * storage.getHmacKeys().then(function(data) {
 | 
			
		||||
     *   const hmacKeys = data[0];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    getHmacKeys(options?: GetHmacKeysOptions): Promise<GetHmacKeysResponse>;
 | 
			
		||||
    getHmacKeys(callback: GetHmacKeysCallback): void;
 | 
			
		||||
    getHmacKeys(options: GetHmacKeysOptions, callback: GetHmacKeysCallback): void;
 | 
			
		||||
    getServiceAccount(options?: GetServiceAccountOptions): Promise<GetServiceAccountResponse>;
 | 
			
		||||
    getServiceAccount(options?: GetServiceAccountOptions): Promise<GetServiceAccountResponse>;
 | 
			
		||||
    getServiceAccount(options: GetServiceAccountOptions, callback: GetServiceAccountCallback): void;
 | 
			
		||||
    getServiceAccount(callback: GetServiceAccountCallback): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a reference to an HmacKey object.
 | 
			
		||||
     * Note: this does not fetch the HMAC key's metadata. Use HmacKey#get() to
 | 
			
		||||
     * retrieve and populate the metadata.
 | 
			
		||||
     *
 | 
			
		||||
     * To get a reference to an HMAC key that's not created for a service
 | 
			
		||||
     * account in the same project used to instantiate the Storage client,
 | 
			
		||||
     * supply the project's ID as `projectId` in the `options` argument.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} accessId The HMAC key's access ID.
 | 
			
		||||
     * @param {HmacKeyOptions} options HmacKey constructor owptions.
 | 
			
		||||
     * @returns {HmacKey}
 | 
			
		||||
     * @see HmacKey
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const hmacKey = storage.hmacKey('ACCESS_ID');
 | 
			
		||||
     */
 | 
			
		||||
    hmacKey(accessId: string, options?: HmacKeyOptions): HmacKey;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										735
									
								
								node_modules/@google-cloud/storage/build/src/storage.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										735
									
								
								node_modules/@google-cloud/storage/build/src/storage.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,735 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
const common_1 = require("@google-cloud/common");
 | 
			
		||||
const paginator_1 = require("@google-cloud/paginator");
 | 
			
		||||
const promisify_1 = require("@google-cloud/promisify");
 | 
			
		||||
const arrify = require("arrify");
 | 
			
		||||
const bucket_1 = require("./bucket");
 | 
			
		||||
const channel_1 = require("./channel");
 | 
			
		||||
const file_1 = require("./file");
 | 
			
		||||
const util_1 = require("./util");
 | 
			
		||||
const hmacKey_1 = require("./hmacKey");
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * Invoke this method to create a new Storage object bound with pre-determined
 | 
			
		||||
 * configuration options. For each object that can be created (e.g., a bucket),
 | 
			
		||||
 * there is an equivalent static and instance method. While they are classes,
 | 
			
		||||
 * they can be instantiated without use of the `new` keyword.
 | 
			
		||||
 */
 | 
			
		||||
/**
 | 
			
		||||
 * <h4>ACLs</h4>
 | 
			
		||||
 * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
 * bucket access. ACLs are the mechanism you use to share files with other users
 | 
			
		||||
 * and allow other users to access your buckets and files.
 | 
			
		||||
 *
 | 
			
		||||
 * To learn more about ACLs, read this overview on
 | 
			
		||||
 * [Access Control](https://cloud.google.com/storage/docs/access-control).
 | 
			
		||||
 *
 | 
			
		||||
 * @see [Cloud Storage overview]{@link https://cloud.google.com/storage/docs/overview}
 | 
			
		||||
 * @see [Access Control]{@link https://cloud.google.com/storage/docs/access-control}
 | 
			
		||||
 *
 | 
			
		||||
 * @class
 | 
			
		||||
 */
 | 
			
		||||
class Storage extends common_1.Service {
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} StorageOptions
 | 
			
		||||
     * @property {string} [projectId] The project ID from the Google Developer's
 | 
			
		||||
     *     Console, e.g. 'grape-spaceship-123'. We will also check the environment
 | 
			
		||||
     *     variable `GCLOUD_PROJECT` for your project ID. If your app is running
 | 
			
		||||
     * in an environment which supports {@link
 | 
			
		||||
     * https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application
 | 
			
		||||
     * Application Default Credentials}, your project ID will be detected
 | 
			
		||||
     * automatically.
 | 
			
		||||
     * @property {string} [keyFilename] Full path to the a .json, .pem, or .p12 key
 | 
			
		||||
     *     downloaded from the Google Developers Console. If you provide a path to
 | 
			
		||||
     * a JSON file, the `projectId` option above is not necessary. NOTE: .pem and
 | 
			
		||||
     *     .p12 require you to specify the `email` option as well.
 | 
			
		||||
     * @property {string} [email] Account email address. Required when using a .pem
 | 
			
		||||
     *     or .p12 keyFilename.
 | 
			
		||||
     * @property {object} [credentials] Credentials object.
 | 
			
		||||
     * @property {string} [credentials.client_email]
 | 
			
		||||
     * @property {string} [credentials.private_key]
 | 
			
		||||
     * @property {boolean} [autoRetry=true] Automatically retry requests if the
 | 
			
		||||
     *     response is related to rate limits or certain intermittent server
 | 
			
		||||
     * errors. We will exponentially backoff subsequent requests by default.
 | 
			
		||||
     * @property {number} [maxRetries=3] Maximum number of automatic retries
 | 
			
		||||
     *     attempted before returning the error.
 | 
			
		||||
     * @property {Constructor} [promise] Custom promise module to use instead of
 | 
			
		||||
     *     native Promises.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs the Storage client.
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>Create a client that uses Application Default Credentials
 | 
			
		||||
     * (ADC)</caption> const {Storage} = require('@google-cloud/storage'); const
 | 
			
		||||
     * storage = new Storage();
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>Create a client with explicit credentials</caption>
 | 
			
		||||
     * storage');/storage');
 | 
			
		||||
     * const storage = new Storage({
 | 
			
		||||
     *   projectId: 'your-project-id',
 | 
			
		||||
     *   keyFilename: '/path/to/keyfile.json'
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @param {StorageOptions} [options] Configuration options.
 | 
			
		||||
     */
 | 
			
		||||
    constructor(options = {}) {
 | 
			
		||||
        options.apiEndpoint = options.apiEndpoint || 'www.googleapis.com';
 | 
			
		||||
        const url = process.env.STORAGE_EMULATOR_HOST ||
 | 
			
		||||
            `https://${options.apiEndpoint}/storage/v1`;
 | 
			
		||||
        const config = {
 | 
			
		||||
            apiEndpoint: options.apiEndpoint,
 | 
			
		||||
            baseUrl: url,
 | 
			
		||||
            projectIdRequired: false,
 | 
			
		||||
            scopes: [
 | 
			
		||||
                'https://www.googleapis.com/auth/iam',
 | 
			
		||||
                'https://www.googleapis.com/auth/cloud-platform',
 | 
			
		||||
                'https://www.googleapis.com/auth/devstorage.full_control',
 | 
			
		||||
            ],
 | 
			
		||||
            packageJson: require('../../package.json'),
 | 
			
		||||
        };
 | 
			
		||||
        super(config, options);
 | 
			
		||||
        /**
 | 
			
		||||
         * Reference to {@link Storage.acl}.
 | 
			
		||||
         *
 | 
			
		||||
         * @name Storage#acl
 | 
			
		||||
         * @see Storage.acl
 | 
			
		||||
         */
 | 
			
		||||
        this.acl = Storage.acl;
 | 
			
		||||
        this.getBucketsStream = paginator_1.paginator.streamify('getBuckets');
 | 
			
		||||
        this.getHmacKeysStream = paginator_1.paginator.streamify('getHmacKeys');
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a reference to a Cloud Storage bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} name Name of the bucket.
 | 
			
		||||
     * @param {object} [options] Configuration object.
 | 
			
		||||
     * @param {string} [options.kmsKeyName] A Cloud KMS key that will be used to
 | 
			
		||||
     *     encrypt objects inserted into this bucket, if no encryption method is
 | 
			
		||||
     *     specified.
 | 
			
		||||
     * @param {string} [options.userProject] User project to be billed for all
 | 
			
		||||
     *     requests made from this Bucket object.
 | 
			
		||||
     * @returns {Bucket}
 | 
			
		||||
     * @see Bucket
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const albums = storage.bucket('albums');
 | 
			
		||||
     * const photos = storage.bucket('photos');
 | 
			
		||||
     */
 | 
			
		||||
    bucket(name, options) {
 | 
			
		||||
        if (!name) {
 | 
			
		||||
            throw new Error('A bucket name is needed to use Cloud Storage.');
 | 
			
		||||
        }
 | 
			
		||||
        return new bucket_1.Bucket(this, name, options);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Reference a channel to receive notifications about changes to your bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} id The ID of the channel.
 | 
			
		||||
     * @param {string} resourceId The resource ID of the channel.
 | 
			
		||||
     * @returns {Channel}
 | 
			
		||||
     * @see Channel
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const channel = storage.channel('id', 'resource-id');
 | 
			
		||||
     */
 | 
			
		||||
    channel(id, resourceId) {
 | 
			
		||||
        return new channel_1.Channel(this, id, resourceId);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} CreateBucketResponse
 | 
			
		||||
     * @property {Bucket} 0 The new {@link Bucket}.
 | 
			
		||||
     * @property {object} 1 The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback CreateBucketCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {Bucket} bucket The new {@link Bucket}.
 | 
			
		||||
     * @param {object} apiResponse The full API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Metadata to set for the bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * @typedef {object} CreateBucketRequest
 | 
			
		||||
     * @property {boolean} [coldline=false] Specify the storage class as Coldline.
 | 
			
		||||
     * @property {boolean} [dra=false] Specify the storage class as Durable Reduced
 | 
			
		||||
     *     Availability.
 | 
			
		||||
     * @property {boolean} [multiRegional=false] Specify the storage class as
 | 
			
		||||
     *     Multi-Regional.
 | 
			
		||||
     * @property {boolean} [nearline=false] Specify the storage class as Nearline.
 | 
			
		||||
     * @property {boolean} [regional=false] Specify the storage class as Regional.
 | 
			
		||||
     * @property {boolean} [requesterPays=false] **Early Access Testers Only**
 | 
			
		||||
     *     Force the use of the User Project metadata field to assign operational
 | 
			
		||||
     *     costs when an operation is made on a Bucket and its objects.
 | 
			
		||||
     * @property {string} [userProject] The ID of the project which will be billed
 | 
			
		||||
     *     for the request.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Create a bucket.
 | 
			
		||||
     *
 | 
			
		||||
     * Cloud Storage uses a flat namespace, so you can't create a bucket with
 | 
			
		||||
     * a name that is already in use. For more information, see
 | 
			
		||||
     * [Bucket Naming
 | 
			
		||||
     * Guidelines](https://cloud.google.com/storage/docs/bucketnaming.html#requirements).
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Buckets: insert API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/buckets/insert}
 | 
			
		||||
     * @see [Storage Classes]{@link https://cloud.google.com/storage/docs/storage-classes}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} name Name of the bucket to create.
 | 
			
		||||
     * @param {CreateBucketRequest} [metadata] Metadata to set for the bucket.
 | 
			
		||||
     * @param {CreateBucketCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<CreateBucketResponse>}
 | 
			
		||||
     * @throws {Error} If a name is not provided.
 | 
			
		||||
     * @see Bucket#create
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const callback = function(err, bucket, apiResponse) {
 | 
			
		||||
     *   // `bucket` is a Bucket object.
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * storage.createBucket('new-bucket', callback);
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Create a bucket in a specific location and region. <em>See the <a
 | 
			
		||||
     * // href="https://cloud.google.com/storage/docs/json_api/v1/buckets/insert">
 | 
			
		||||
     * // Official JSON API docs</a> for complete details on the `location`
 | 
			
		||||
     * option.
 | 
			
		||||
     * // </em>
 | 
			
		||||
     * //-
 | 
			
		||||
     * const metadata = {
 | 
			
		||||
     *   location: 'US-CENTRAL1',
 | 
			
		||||
     *   regional: true
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * storage.createBucket('new-bucket', metadata, callback);
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Create a bucket with a retention policy of 6 months.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const metadata = {
 | 
			
		||||
     *   retentionPolicy: {
 | 
			
		||||
     *     retentionPeriod: 15780000 // 6 months in seconds.
 | 
			
		||||
     *   }
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * storage.createBucket('new-bucket', metadata, callback);
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // Enable versioning on a new bucket.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const metadata = {
 | 
			
		||||
     *   versioning: {
 | 
			
		||||
     *     enabled: true
 | 
			
		||||
     *   }
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * storage.createBucket('new-bucket', metadata, callback);
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * storage.createBucket('new-bucket').then(function(data) {
 | 
			
		||||
     *   const bucket = data[0];
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/buckets.js</caption>
 | 
			
		||||
     * region_tag:storage_create_bucket
 | 
			
		||||
     * Another example:
 | 
			
		||||
     */
 | 
			
		||||
    createBucket(name, metadataOrCallback, callback) {
 | 
			
		||||
        if (!name) {
 | 
			
		||||
            throw new Error('A name is required to create a bucket.');
 | 
			
		||||
        }
 | 
			
		||||
        let metadata;
 | 
			
		||||
        if (!callback) {
 | 
			
		||||
            callback = metadataOrCallback;
 | 
			
		||||
            metadata = {};
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            metadata = metadataOrCallback;
 | 
			
		||||
        }
 | 
			
		||||
        const body = Object.assign({}, metadata, { name });
 | 
			
		||||
        const storageClasses = {
 | 
			
		||||
            coldline: 'COLDLINE',
 | 
			
		||||
            dra: 'DURABLE_REDUCED_AVAILABILITY',
 | 
			
		||||
            multiRegional: 'MULTI_REGIONAL',
 | 
			
		||||
            nearline: 'NEARLINE',
 | 
			
		||||
            regional: 'REGIONAL',
 | 
			
		||||
        };
 | 
			
		||||
        Object.keys(storageClasses).forEach(storageClass => {
 | 
			
		||||
            if (body[storageClass]) {
 | 
			
		||||
                body.storageClass = storageClasses[storageClass];
 | 
			
		||||
                delete body[storageClass];
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        if (body.requesterPays) {
 | 
			
		||||
            body.billing = {
 | 
			
		||||
                requesterPays: body.requesterPays,
 | 
			
		||||
            };
 | 
			
		||||
            delete body.requesterPays;
 | 
			
		||||
        }
 | 
			
		||||
        const query = {
 | 
			
		||||
            project: this.projectId,
 | 
			
		||||
        };
 | 
			
		||||
        if (body.userProject) {
 | 
			
		||||
            query.userProject = body.userProject;
 | 
			
		||||
            delete body.userProject;
 | 
			
		||||
        }
 | 
			
		||||
        this.request({
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            uri: '/b',
 | 
			
		||||
            qs: query,
 | 
			
		||||
            json: body,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const bucket = this.bucket(name);
 | 
			
		||||
            bucket.metadata = resp;
 | 
			
		||||
            callback(null, bucket, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} CreateHmacKeyOptions
 | 
			
		||||
     * @property {string} [projectId] The project ID of the project that owns
 | 
			
		||||
     *     the service account of the requested HMAC key. If not provided,
 | 
			
		||||
     *     the project ID used to instantiate the Storage client will be used.
 | 
			
		||||
     * @property {string} [userProject] This parameter is currently ignored.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {object} HmacKeyMetadata
 | 
			
		||||
     * @property {string} accessId The access id identifies which HMAC key was
 | 
			
		||||
     *     used to sign a request when authenticating with HMAC.
 | 
			
		||||
     * @property {string} etag Used to perform a read-modify-write of the key.
 | 
			
		||||
     * @property {string} id The resource name of the HMAC key.
 | 
			
		||||
     * @property {string} projectId The project ID.
 | 
			
		||||
     * @property {string} serviceAccountEmail The service account's email this
 | 
			
		||||
     *     HMAC key is created for.
 | 
			
		||||
     * @property {string} state The state of this HMAC key. One of "ACTIVE",
 | 
			
		||||
     *     "INACTIVE" or "DELETED".
 | 
			
		||||
     * @property {string} timeCreated The creation time of the HMAC key in
 | 
			
		||||
     *     RFC 3339 format.
 | 
			
		||||
     * @property {string} [updated] The time this HMAC key was last updated in
 | 
			
		||||
     *     RFC 3339 format.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} CreateHmacKeyResponse
 | 
			
		||||
     * @property {HmacKey} 0 The HmacKey instance created from API response.
 | 
			
		||||
     * @property {string} 1 The HMAC key's secret used to access the XML API.
 | 
			
		||||
     * @property {object} 3 The raw API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback CreateHmacKeyCallback Callback function.
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {HmacKey} hmacKey The HmacKey instance created from API response.
 | 
			
		||||
     * @param {string} secret The HMAC key's secret used to access the XML API.
 | 
			
		||||
     * @param {object} apiResponse The raw API response.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Create an HMAC key associated with an service account to authenticate
 | 
			
		||||
     * requests to the Cloud Storage XML API.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [HMAC keys documentation]{@link https://cloud.google.com/storage/docs/authentication/hmackeys}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} serviceAccountEmail The service account's email address
 | 
			
		||||
     *     with which the HMAC key is created for.
 | 
			
		||||
     * @param {CreateHmacKeyCallback} [callback] Callback function.
 | 
			
		||||
     * @return {Promise<CreateHmacKeyResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     *
 | 
			
		||||
     * // Replace with your service account's email address
 | 
			
		||||
     * const serviceAccountEmail =
 | 
			
		||||
     *   'my-service-account@appspot.gserviceaccount.com';
 | 
			
		||||
     *
 | 
			
		||||
     * storage.createHmacKey(serviceAccountEmail, function(err, hmacKey, secret) {
 | 
			
		||||
     *   if (!err) {
 | 
			
		||||
     *     // Securely store the secret for use with the XML API.
 | 
			
		||||
     *   }
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * storage.createHmacKey(serviceAccountEmail)
 | 
			
		||||
     *   .then((response) => {
 | 
			
		||||
     *     const hmacKey = response[0];
 | 
			
		||||
     *     const secret = response[1];
 | 
			
		||||
     *     // Securely store the secret for use with the XML API.
 | 
			
		||||
     *   });
 | 
			
		||||
     */
 | 
			
		||||
    createHmacKey(serviceAccountEmail, optionsOrCb, cb) {
 | 
			
		||||
        if (typeof serviceAccountEmail !== 'string') {
 | 
			
		||||
            throw new Error('The first argument must be a service account email to create an HMAC key.');
 | 
			
		||||
        }
 | 
			
		||||
        const { options, callback } = util_1.normalize(optionsOrCb, cb);
 | 
			
		||||
        const query = Object.assign({}, options, { serviceAccountEmail });
 | 
			
		||||
        const projectId = query.projectId || this.projectId;
 | 
			
		||||
        delete query.projectId;
 | 
			
		||||
        this.request({
 | 
			
		||||
            method: 'POST',
 | 
			
		||||
            uri: `/projects/${projectId}/hmacKeys`,
 | 
			
		||||
            qs: query,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const metadata = resp.metadata;
 | 
			
		||||
            const hmacKey = this.hmacKey(metadata.accessId, {
 | 
			
		||||
                projectId: metadata.projectId,
 | 
			
		||||
            });
 | 
			
		||||
            hmacKey.metadata = resp.metadata;
 | 
			
		||||
            callback(null, hmacKey, resp.secret, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Query object for listing buckets.
 | 
			
		||||
     *
 | 
			
		||||
     * @typedef {object} GetBucketsRequest
 | 
			
		||||
     * @property {boolean} [autoPaginate=true] Have pagination handled
 | 
			
		||||
     *     automatically.
 | 
			
		||||
     * @property {number} [maxApiCalls] Maximum number of API calls to make.
 | 
			
		||||
     * @property {number} [maxResults] Maximum number of items plus prefixes to
 | 
			
		||||
     *     return.
 | 
			
		||||
     * @property {string} [pageToken] A previously-returned page token
 | 
			
		||||
     *     representing part of the larger set of results to view.
 | 
			
		||||
     * @property {string} [userProject] The ID of the project which will be billed
 | 
			
		||||
     *     for the request.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} GetBucketsResponse
 | 
			
		||||
     * @property {Bucket[]} 0 Array of {@link Bucket} instances.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback GetBucketsCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {Bucket[]} buckets Array of {@link Bucket} instances.
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Get Bucket objects for all of the buckets in your project.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Buckets: list API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/buckets/list}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {GetBucketsRequest} [query] Query object for listing buckets.
 | 
			
		||||
     * @param {GetBucketsCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<GetBucketsResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * storage.getBuckets(function(err, buckets) {
 | 
			
		||||
     *   if (!err) {
 | 
			
		||||
     *     // buckets is an array of Bucket objects.
 | 
			
		||||
     *   }
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // To control how many API requests are made and page through the results
 | 
			
		||||
     * // manually, set `autoPaginate` to `false`.
 | 
			
		||||
     * //-
 | 
			
		||||
     * const callback = function(err, buckets, nextQuery, apiResponse) {
 | 
			
		||||
     *   if (nextQuery) {
 | 
			
		||||
     *     // More results exist.
 | 
			
		||||
     *     storage.getBuckets(nextQuery, callback);
 | 
			
		||||
     *   }
 | 
			
		||||
     *
 | 
			
		||||
     *   // The `metadata` property is populated for you with the metadata at the
 | 
			
		||||
     *   // time of fetching.
 | 
			
		||||
     *   buckets[0].metadata;
 | 
			
		||||
     *
 | 
			
		||||
     *   // However, in cases where you are concerned the metadata could have
 | 
			
		||||
     *   // changed, use the `getMetadata` method.
 | 
			
		||||
     *   buckets[0].getMetadata(function(err, metadata, apiResponse) {});
 | 
			
		||||
     * };
 | 
			
		||||
     *
 | 
			
		||||
     * storage.getBuckets({
 | 
			
		||||
     *   autoPaginate: false
 | 
			
		||||
     * }, callback);
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * storage.getBuckets().then(function(data) {
 | 
			
		||||
     *   const buckets = data[0];
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * @example <caption>include:samples/buckets.js</caption>
 | 
			
		||||
     * region_tag:storage_list_buckets
 | 
			
		||||
     * Another example:
 | 
			
		||||
     */
 | 
			
		||||
    getBuckets(optionsOrCallback, cb) {
 | 
			
		||||
        const { options, callback } = util_1.normalize(optionsOrCallback, cb);
 | 
			
		||||
        options.project = options.project || this.projectId;
 | 
			
		||||
        this.request({
 | 
			
		||||
            uri: '/b',
 | 
			
		||||
            qs: options,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const buckets = arrify(resp.items).map((bucket) => {
 | 
			
		||||
                const bucketInstance = this.bucket(bucket.id);
 | 
			
		||||
                bucketInstance.metadata = bucket;
 | 
			
		||||
                return bucketInstance;
 | 
			
		||||
            });
 | 
			
		||||
            const nextQuery = resp.nextPageToken
 | 
			
		||||
                ? Object.assign({}, options, { pageToken: resp.nextPageToken })
 | 
			
		||||
                : null;
 | 
			
		||||
            callback(null, buckets, nextQuery, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    getHmacKeys(optionsOrCb, cb) {
 | 
			
		||||
        const { options, callback } = util_1.normalize(optionsOrCb, cb);
 | 
			
		||||
        const query = Object.assign({}, options);
 | 
			
		||||
        const projectId = query.projectId || this.projectId;
 | 
			
		||||
        delete query.projectId;
 | 
			
		||||
        this.request({
 | 
			
		||||
            uri: `/projects/${projectId}/hmacKeys`,
 | 
			
		||||
            qs: query,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const hmacKeys = arrify(resp.items).map((hmacKey) => {
 | 
			
		||||
                const hmacKeyInstance = this.hmacKey(hmacKey.accessId, {
 | 
			
		||||
                    projectId: hmacKey.projectId,
 | 
			
		||||
                });
 | 
			
		||||
                hmacKeyInstance.metadata = hmacKey;
 | 
			
		||||
                return hmacKeyInstance;
 | 
			
		||||
            });
 | 
			
		||||
            const nextQuery = resp.nextPageToken
 | 
			
		||||
                ? Object.assign({}, options, { pageToken: resp.nextPageToken })
 | 
			
		||||
                : null;
 | 
			
		||||
            callback(null, hmacKeys, nextQuery, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @typedef {array} GetServiceAccountResponse
 | 
			
		||||
     * @property {object} 0 The service account resource.
 | 
			
		||||
     * @property {object} 1 The full
 | 
			
		||||
     * [API
 | 
			
		||||
     * response](https://cloud.google.com/storage/docs/json_api/v1/projects/serviceAccount#resource).
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * @callback GetServiceAccountCallback
 | 
			
		||||
     * @param {?Error} err Request error, if any.
 | 
			
		||||
     * @param {object} serviceAccount The serviceAccount resource.
 | 
			
		||||
     * @param {string} serviceAccount.emailAddress The service account email
 | 
			
		||||
     *     address.
 | 
			
		||||
     * @param {object} apiResponse The full
 | 
			
		||||
     * [API
 | 
			
		||||
     * response](https://cloud.google.com/storage/docs/json_api/v1/projects/serviceAccount#resource).
 | 
			
		||||
     */
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the email address of this project's Google Cloud Storage service
 | 
			
		||||
     * account.
 | 
			
		||||
     *
 | 
			
		||||
     * @see [Projects.serviceAccount: get API Documentation]{@link https://cloud.google.com/storage/docs/json_api/v1/projects/serviceAccount/get}
 | 
			
		||||
     * @see [Projects.serviceAccount Resource]{@link https://cloud.google.com/storage/docs/json_api/v1/projects/serviceAccount#resource}
 | 
			
		||||
     *
 | 
			
		||||
     * @param {object} [options] Configuration object.
 | 
			
		||||
     * @param {string} [options.userProject] User project to be billed for this
 | 
			
		||||
     *     request.
 | 
			
		||||
     * @param {GetServiceAccountCallback} [callback] Callback function.
 | 
			
		||||
     * @returns {Promise<GetServiceAccountResponse>}
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     *
 | 
			
		||||
     * storage.getServiceAccount(function(err, serviceAccount, apiResponse) {
 | 
			
		||||
     *   if (!err) {
 | 
			
		||||
     *     const serviceAccountEmail = serviceAccount.emailAddress;
 | 
			
		||||
     *   }
 | 
			
		||||
     * });
 | 
			
		||||
     *
 | 
			
		||||
     * //-
 | 
			
		||||
     * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
     * //-
 | 
			
		||||
     * storage.getServiceAccount().then(function(data) {
 | 
			
		||||
     *   const serviceAccountEmail = data[0].emailAddress;
 | 
			
		||||
     *   const apiResponse = data[1];
 | 
			
		||||
     * });
 | 
			
		||||
     */
 | 
			
		||||
    getServiceAccount(optionsOrCallback, cb) {
 | 
			
		||||
        const { options, callback } = util_1.normalize(optionsOrCallback, cb);
 | 
			
		||||
        this.request({
 | 
			
		||||
            uri: `/projects/${this.projectId}/serviceAccount`,
 | 
			
		||||
            qs: options,
 | 
			
		||||
        }, (err, resp) => {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                callback(err, null, resp);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const camelCaseResponse = {};
 | 
			
		||||
            for (const prop in resp) {
 | 
			
		||||
                if (resp.hasOwnProperty(prop)) {
 | 
			
		||||
                    const camelCaseProp = prop.replace(/_(\w)/g, (_, match) => match.toUpperCase());
 | 
			
		||||
                    camelCaseResponse[camelCaseProp] = resp[prop];
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            callback(null, camelCaseResponse, resp);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a reference to an HmacKey object.
 | 
			
		||||
     * Note: this does not fetch the HMAC key's metadata. Use HmacKey#get() to
 | 
			
		||||
     * retrieve and populate the metadata.
 | 
			
		||||
     *
 | 
			
		||||
     * To get a reference to an HMAC key that's not created for a service
 | 
			
		||||
     * account in the same project used to instantiate the Storage client,
 | 
			
		||||
     * supply the project's ID as `projectId` in the `options` argument.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {string} accessId The HMAC key's access ID.
 | 
			
		||||
     * @param {HmacKeyOptions} options HmacKey constructor owptions.
 | 
			
		||||
     * @returns {HmacKey}
 | 
			
		||||
     * @see HmacKey
 | 
			
		||||
     *
 | 
			
		||||
     * @example
 | 
			
		||||
     * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
     * const storage = new Storage();
 | 
			
		||||
     * const hmacKey = storage.hmacKey('ACCESS_ID');
 | 
			
		||||
     */
 | 
			
		||||
    hmacKey(accessId, options) {
 | 
			
		||||
        if (!accessId) {
 | 
			
		||||
            throw new Error('An access ID is needed to create an HmacKey object.');
 | 
			
		||||
        }
 | 
			
		||||
        return new hmacKey_1.HmacKey(this, accessId, options);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * {@link Bucket} class.
 | 
			
		||||
 *
 | 
			
		||||
 * @name Storage.Bucket
 | 
			
		||||
 * @see Bucket
 | 
			
		||||
 * @type {Constructor}
 | 
			
		||||
 */
 | 
			
		||||
Storage.Bucket = bucket_1.Bucket;
 | 
			
		||||
/**
 | 
			
		||||
 * {@link Channel} class.
 | 
			
		||||
 *
 | 
			
		||||
 * @name Storage.Channel
 | 
			
		||||
 * @see Channel
 | 
			
		||||
 * @type {Constructor}
 | 
			
		||||
 */
 | 
			
		||||
Storage.Channel = channel_1.Channel;
 | 
			
		||||
/**
 | 
			
		||||
 * {@link File} class.
 | 
			
		||||
 *
 | 
			
		||||
 * @name Storage.File
 | 
			
		||||
 * @see File
 | 
			
		||||
 * @type {Constructor}
 | 
			
		||||
 */
 | 
			
		||||
Storage.File = file_1.File;
 | 
			
		||||
/**
 | 
			
		||||
 * {@link HmacKey} class.
 | 
			
		||||
 *
 | 
			
		||||
 * @name Storage.HmacKey
 | 
			
		||||
 * @see HmacKey
 | 
			
		||||
 * @type {Constructor}
 | 
			
		||||
 */
 | 
			
		||||
Storage.HmacKey = hmacKey_1.HmacKey;
 | 
			
		||||
/**
 | 
			
		||||
 * Cloud Storage uses access control lists (ACLs) to manage object and
 | 
			
		||||
 * bucket access. ACLs are the mechanism you use to share objects with other
 | 
			
		||||
 * users and allow other users to access your buckets and objects.
 | 
			
		||||
 *
 | 
			
		||||
 * This object provides constants to refer to the three permission levels that
 | 
			
		||||
 * can be granted to an entity:
 | 
			
		||||
 *
 | 
			
		||||
 *   - `gcs.acl.OWNER_ROLE` - ("OWNER")
 | 
			
		||||
 *   - `gcs.acl.READER_ROLE` - ("READER")
 | 
			
		||||
 *   - `gcs.acl.WRITER_ROLE` - ("WRITER")
 | 
			
		||||
 *
 | 
			
		||||
 * @see [About Access Control Lists]{@link https://cloud.google.com/storage/docs/access-control/lists}
 | 
			
		||||
 *
 | 
			
		||||
 * @name Storage.acl
 | 
			
		||||
 * @type {object}
 | 
			
		||||
 * @property {string} OWNER_ROLE
 | 
			
		||||
 * @property {string} READER_ROLE
 | 
			
		||||
 * @property {string} WRITER_ROLE
 | 
			
		||||
 *
 | 
			
		||||
 * @example
 | 
			
		||||
 * const {Storage} = require('@google-cloud/storage');
 | 
			
		||||
 * const storage = new Storage();
 | 
			
		||||
 * const albums = storage.bucket('albums');
 | 
			
		||||
 *
 | 
			
		||||
 * //-
 | 
			
		||||
 * // Make all of the files currently in a bucket publicly readable.
 | 
			
		||||
 * //-
 | 
			
		||||
 * const options = {
 | 
			
		||||
 *   entity: 'allUsers',
 | 
			
		||||
 *   role: storage.acl.READER_ROLE
 | 
			
		||||
 * };
 | 
			
		||||
 *
 | 
			
		||||
 * albums.acl.add(options, function(err, aclObject) {});
 | 
			
		||||
 *
 | 
			
		||||
 * //-
 | 
			
		||||
 * // Make any new objects added to a bucket publicly readable.
 | 
			
		||||
 * //-
 | 
			
		||||
 * albums.acl.default.add(options, function(err, aclObject) {});
 | 
			
		||||
 *
 | 
			
		||||
 * //-
 | 
			
		||||
 * // Grant a user ownership permissions to a bucket.
 | 
			
		||||
 * //-
 | 
			
		||||
 * albums.acl.add({
 | 
			
		||||
 *   entity: 'user-useremail@example.com',
 | 
			
		||||
 *   role: storage.acl.OWNER_ROLE
 | 
			
		||||
 * }, function(err, aclObject) {});
 | 
			
		||||
 *
 | 
			
		||||
 * //-
 | 
			
		||||
 * // If the callback is omitted, we'll return a Promise.
 | 
			
		||||
 * //-
 | 
			
		||||
 * albums.acl.add(options).then(function(data) {
 | 
			
		||||
 *   const aclObject = data[0];
 | 
			
		||||
 *   const apiResponse = data[1];
 | 
			
		||||
 * });
 | 
			
		||||
 */
 | 
			
		||||
Storage.acl = {
 | 
			
		||||
    OWNER_ROLE: 'OWNER',
 | 
			
		||||
    READER_ROLE: 'READER',
 | 
			
		||||
    WRITER_ROLE: 'WRITER',
 | 
			
		||||
};
 | 
			
		||||
exports.Storage = Storage;
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * These methods can be auto-paginated.
 | 
			
		||||
 */
 | 
			
		||||
paginator_1.paginator.extend(Storage, ['getBuckets', 'getHmacKeys']);
 | 
			
		||||
/*! Developer Documentation
 | 
			
		||||
 *
 | 
			
		||||
 * All async methods (except for streams) will return a Promise in the event
 | 
			
		||||
 * that a callback is omitted.
 | 
			
		||||
 */
 | 
			
		||||
promisify_1.promisifyAll(Storage, {
 | 
			
		||||
    exclude: ['bucket', 'channel', 'hmacKey'],
 | 
			
		||||
});
 | 
			
		||||
//# sourceMappingURL=storage.js.map
 | 
			
		||||
							
								
								
									
										27
									
								
								node_modules/@google-cloud/storage/build/src/util.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								node_modules/@google-cloud/storage/build/src/util.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
export declare function normalize<T = {}, U = Function>(optionsOrCallback?: T | U, cb?: U): {
 | 
			
		||||
    options: T;
 | 
			
		||||
    callback: U;
 | 
			
		||||
};
 | 
			
		||||
/**
 | 
			
		||||
 * Flatten an object into an Array of arrays, [[key, value], ..].
 | 
			
		||||
 * Implements Object.entries() for Node.js <8
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
export declare function objectEntries<T>(obj: {
 | 
			
		||||
    [key: string]: T;
 | 
			
		||||
}): Array<[string, T]>;
 | 
			
		||||
							
								
								
									
										37
									
								
								node_modules/@google-cloud/storage/build/src/util.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								node_modules/@google-cloud/storage/build/src/util.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
/**
 | 
			
		||||
 * Copyright 2019 Google LLC
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *      http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
function normalize(optionsOrCallback, cb) {
 | 
			
		||||
    const options = (typeof optionsOrCallback === 'object'
 | 
			
		||||
        ? optionsOrCallback
 | 
			
		||||
        : {});
 | 
			
		||||
    const callback = (typeof optionsOrCallback === 'function'
 | 
			
		||||
        ? optionsOrCallback
 | 
			
		||||
        : cb);
 | 
			
		||||
    return { options, callback };
 | 
			
		||||
}
 | 
			
		||||
exports.normalize = normalize;
 | 
			
		||||
/**
 | 
			
		||||
 * Flatten an object into an Array of arrays, [[key, value], ..].
 | 
			
		||||
 * Implements Object.entries() for Node.js <8
 | 
			
		||||
 * @internal
 | 
			
		||||
 */
 | 
			
		||||
function objectEntries(obj) {
 | 
			
		||||
    return Object.keys(obj).map(key => [key, obj[key]]);
 | 
			
		||||
}
 | 
			
		||||
exports.objectEntries = objectEntries;
 | 
			
		||||
//# sourceMappingURL=util.js.map
 | 
			
		||||
							
								
								
									
										158
									
								
								node_modules/@google-cloud/storage/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										158
									
								
								node_modules/@google-cloud/storage/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,158 @@
 | 
			
		||||
{
 | 
			
		||||
  "_from": "@google-cloud/storage@^3.0.2",
 | 
			
		||||
  "_id": "@google-cloud/storage@3.2.1",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha512-129EwPGej6bXzY1u5nja2aeMDew6DIHaJn7ZV6nteQ74LQQSNv2jKrqTlyhndBsAwpuwQAxeghPTCoFT/H8Frg==",
 | 
			
		||||
  "_location": "/@google-cloud/storage",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "range",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "@google-cloud/storage@^3.0.2",
 | 
			
		||||
    "name": "@google-cloud/storage",
 | 
			
		||||
    "escapedName": "@google-cloud%2fstorage",
 | 
			
		||||
    "scope": "@google-cloud",
 | 
			
		||||
    "rawSpec": "^3.0.2",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "^3.0.2"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/firebase-admin"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-3.2.1.tgz",
 | 
			
		||||
  "_shasum": "6701fbc91b95304e0da88c0f193b1800c9ba4159",
 | 
			
		||||
  "_spec": "@google-cloud/storage@^3.0.2",
 | 
			
		||||
  "_where": "C:\\Users\\matia\\Documents\\GitHub\\FutoX-Musix\\node_modules\\firebase-admin",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Google Inc."
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/googleapis/nodejs-storage/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "bundleDependencies": false,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@google-cloud/common": "^2.1.1",
 | 
			
		||||
    "@google-cloud/paginator": "^2.0.0",
 | 
			
		||||
    "@google-cloud/promisify": "^1.0.0",
 | 
			
		||||
    "arrify": "^2.0.0",
 | 
			
		||||
    "compressible": "^2.0.12",
 | 
			
		||||
    "concat-stream": "^2.0.0",
 | 
			
		||||
    "date-and-time": "^0.9.0",
 | 
			
		||||
    "duplexify": "^3.5.0",
 | 
			
		||||
    "extend": "^3.0.2",
 | 
			
		||||
    "gaxios": "^2.0.1",
 | 
			
		||||
    "gcs-resumable-upload": "^2.0.0",
 | 
			
		||||
    "hash-stream-validation": "^0.2.1",
 | 
			
		||||
    "mime": "^2.2.0",
 | 
			
		||||
    "mime-types": "^2.0.8",
 | 
			
		||||
    "onetime": "^5.1.0",
 | 
			
		||||
    "p-limit": "^2.2.0",
 | 
			
		||||
    "pumpify": "^2.0.0",
 | 
			
		||||
    "snakeize": "^0.1.0",
 | 
			
		||||
    "stream-events": "^1.0.1",
 | 
			
		||||
    "through2": "^3.0.0",
 | 
			
		||||
    "xdg-basedir": "^4.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "Cloud Storage Client Library for Node.js",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@google-cloud/pubsub": "^0.31.0",
 | 
			
		||||
    "@grpc/proto-loader": "^0.5.1",
 | 
			
		||||
    "@types/compressible": "^2.0.0",
 | 
			
		||||
    "@types/concat-stream": "^1.6.0",
 | 
			
		||||
    "@types/configstore": "^4.0.0",
 | 
			
		||||
    "@types/date-and-time": "^0.6.0",
 | 
			
		||||
    "@types/extend": "^3.0.0",
 | 
			
		||||
    "@types/mime": "^2.0.0",
 | 
			
		||||
    "@types/mime-types": "^2.1.0",
 | 
			
		||||
    "@types/mocha": "^5.2.3",
 | 
			
		||||
    "@types/nock": "^10.0.0",
 | 
			
		||||
    "@types/node": "^11.13.4",
 | 
			
		||||
    "@types/node-fetch": "^2.1.3",
 | 
			
		||||
    "@types/proxyquire": "^1.3.28",
 | 
			
		||||
    "@types/pumpify": "^1.4.1",
 | 
			
		||||
    "@types/sinon": "^7.0.10",
 | 
			
		||||
    "@types/through2": "^2.0.33",
 | 
			
		||||
    "@types/tmp": "0.1.0",
 | 
			
		||||
    "@types/uuid": "^3.4.4",
 | 
			
		||||
    "@types/xdg-basedir": "^2.0.0",
 | 
			
		||||
    "codecov": "^3.0.0",
 | 
			
		||||
    "eslint": "^6.0.0",
 | 
			
		||||
    "eslint-config-prettier": "^6.0.0",
 | 
			
		||||
    "eslint-plugin-node": "^9.0.0",
 | 
			
		||||
    "eslint-plugin-prettier": "^3.0.0",
 | 
			
		||||
    "grpc": "^1.22.2",
 | 
			
		||||
    "gts": "^1.0.0",
 | 
			
		||||
    "intelli-espower-loader": "^1.0.1",
 | 
			
		||||
    "jsdoc": "^3.6.2",
 | 
			
		||||
    "jsdoc-fresh": "^1.0.1",
 | 
			
		||||
    "linkinator": "^1.5.0",
 | 
			
		||||
    "mocha": "^6.0.0",
 | 
			
		||||
    "nock": "~11.0.0",
 | 
			
		||||
    "node-fetch": "^2.2.0",
 | 
			
		||||
    "normalize-newline": "^3.0.0",
 | 
			
		||||
    "nyc": "^14.0.0",
 | 
			
		||||
    "power-assert": "^1.4.4",
 | 
			
		||||
    "prettier": "^1.7.0",
 | 
			
		||||
    "proxyquire": "^2.1.3",
 | 
			
		||||
    "sinon": "^7.3.0",
 | 
			
		||||
    "source-map-support": "^0.5.6",
 | 
			
		||||
    "tmp": "^0.1.0",
 | 
			
		||||
    "typescript": "~3.5.0",
 | 
			
		||||
    "uuid": "^3.1.0",
 | 
			
		||||
    "yargs": "^14.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">=8.10.0"
 | 
			
		||||
  },
 | 
			
		||||
  "files": [
 | 
			
		||||
    "build/src",
 | 
			
		||||
    "!build/src/**/*.map",
 | 
			
		||||
    "AUTHORS",
 | 
			
		||||
    "CONTRIBUTORS",
 | 
			
		||||
    "COPYING"
 | 
			
		||||
  ],
 | 
			
		||||
  "homepage": "https://github.com/googleapis/nodejs-storage#readme",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "google apis client",
 | 
			
		||||
    "google api client",
 | 
			
		||||
    "google apis",
 | 
			
		||||
    "google api",
 | 
			
		||||
    "google",
 | 
			
		||||
    "google cloud platform",
 | 
			
		||||
    "google cloud",
 | 
			
		||||
    "cloud",
 | 
			
		||||
    "google storage",
 | 
			
		||||
    "storage"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "Apache-2.0",
 | 
			
		||||
  "main": "./build/src/index.js",
 | 
			
		||||
  "name": "@google-cloud/storage",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://github.com/googleapis/nodejs-storage.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "all-test": "npm test && npm run system-test && npm run samples-test",
 | 
			
		||||
    "benchwrapper": "node bin/benchwrapper.js",
 | 
			
		||||
    "check": "gts check",
 | 
			
		||||
    "clean": "gts clean",
 | 
			
		||||
    "compile": "tsc -p .",
 | 
			
		||||
    "conformance-test": "mocha build/conformance-test",
 | 
			
		||||
    "docs": "jsdoc -c .jsdoc.js",
 | 
			
		||||
    "docs-test": "linkinator docs",
 | 
			
		||||
    "fix": "gts fix && eslint --fix '**/*.js'",
 | 
			
		||||
    "lint": "eslint samples/ && gts check",
 | 
			
		||||
    "preconformance-test": "npm run compile",
 | 
			
		||||
    "predocs": "npm run compile",
 | 
			
		||||
    "predocs-test": "npm run docs",
 | 
			
		||||
    "prepare": "npm run compile",
 | 
			
		||||
    "presystem-test": "npm run compile",
 | 
			
		||||
    "pretest": "npm run compile",
 | 
			
		||||
    "samples-test": "npm link && cd samples/ && npm link ../ && npm test && cd ../",
 | 
			
		||||
    "system-test": "mocha build/system-test --timeout 600000 --exit",
 | 
			
		||||
    "test": "nyc mocha build/test"
 | 
			
		||||
  },
 | 
			
		||||
  "types": "./build/src/index.d.ts",
 | 
			
		||||
  "version": "3.2.1"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user