-
Notifications
You must be signed in to change notification settings - Fork 875
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,882 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## API Report File for "@firebase/functions-exp" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
```ts | ||
|
||
import { FirebaseApp } from '@firebase/app-types-exp'; | ||
import { Functions } from '@firebase/functions-types-exp'; | ||
import { HttpsCallable } from '@firebase/functions-types-exp'; | ||
import { HttpsCallableOptions } from '@firebase/functions-types-exp'; | ||
|
||
// @public | ||
export function getFunctions(app: FirebaseApp, region?: string): Functions; | ||
|
||
// @public | ||
export function httpsCallable(functionsInstance: Functions, name: string, options?: HttpsCallableOptions): HttpsCallable; | ||
|
||
// @public | ||
export function useFunctionsEmulator(functionsInstance: Functions, origin: string): void; | ||
|
||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable @typescript-eslint/no-require-imports */ | ||
/** | ||
* @license | ||
* Copyright 2020 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. | ||
*/ | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
extends: '../../config/.eslintrc.js', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
// to make vscode-eslint work with monorepo | ||
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250 | ||
tsconfigRootDir: __dirname | ||
}, | ||
rules: { | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
'packageDir': [path.resolve(__dirname, '../../'), __dirname], | ||
devDependencies: true | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# `@firebase/functions` | ||
|
||
This is the Firebase Functions component of the Firebase JS SDK. | ||
|
||
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../config/api-extractor.json", | ||
// Point it to your entry point d.ts file. | ||
"mainEntryPointFilePath": "<projectFolder>/dist/src/index.d.ts", | ||
"dtsRollup": { | ||
"enabled": true, | ||
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts", | ||
"publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* @license | ||
* Copyright 2017 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. | ||
*/ | ||
|
||
const karmaBase = require('../../config/karma.base'); | ||
|
||
const files = [`src/**/*.test.ts`]; | ||
|
||
module.exports = function(config) { | ||
const karmaConfig = Object.assign({}, karmaBase, { | ||
// files to load into karma | ||
files, | ||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['mocha'] | ||
}); | ||
|
||
config.set(karmaConfig); | ||
}; | ||
|
||
module.exports.files = files; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"name": "@firebase/functions-exp", | ||
"version": "0.0.800", | ||
"description": "", | ||
"private": true, | ||
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"main": "dist/index.node.cjs.js", | ||
"browser": "dist/index.esm.js", | ||
"module": "dist/index.esm.js", | ||
"esm2017": "dist/index.esm2017.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", | ||
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", | ||
"build": "rollup -c && yarn api-report", | ||
"build:deps": "lerna run --scope @firebase/functions-exp --include-dependencies build", | ||
"dev": "rollup -c -w", | ||
"test": "yarn type-check && run-p lint test:browser test:node", | ||
"test:ci": "node ../../scripts/run_tests_in_ci.js", | ||
"type-check": "tsc -p . --noEmit", | ||
"test:browser": "karma start --single-run", | ||
"test:browser:debug": "karma start --browsers=Chrome --auto-watch", | ||
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'src/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js", | ||
"test:emulator": "env FIREBASE_FUNCTIONS_EMULATOR_ORIGIN=http://localhost:5005 run-p test:node", | ||
"prepare": "yarn build", | ||
"api-report": "api-extractor run --local --verbose", | ||
"predoc": "node ../../scripts/exp/remove-exp.js temp", | ||
"doc": "api-documenter markdown --input temp --output docs", | ||
"build:doc": "yarn build && yarn doc" | ||
}, | ||
"license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@firebase/app-exp": "0.x", | ||
"@firebase/app-types-exp": "0.x" | ||
}, | ||
"devDependencies": { | ||
"@firebase/app-exp": "0.0.800", | ||
"rollup": "2.7.6", | ||
"rollup-plugin-typescript2": "0.27.0", | ||
"typescript": "3.8.3" | ||
}, | ||
"repository": { | ||
"directory": "packages/functions", | ||
"type": "git", | ||
"url": "https://github.com/firebase/firebase-js-sdk.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/firebase/firebase-js-sdk/issues" | ||
}, | ||
"typings": "dist/index.d.ts", | ||
"dependencies": { | ||
"@firebase/component": "0.1.14", | ||
"@firebase/functions-types-exp": "0.0.800", | ||
"@firebase/messaging": "0.6.18", | ||
"@firebase/messaging-types": "0.4.5", | ||
"@firebase/util": "0.2.49", | ||
"isomorphic-fetch": "2.2.1", | ||
"tslib": "1.11.1" | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
], | ||
"reportDir": "./coverage/node" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 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 json from 'rollup-plugin-json'; | ||
import typescriptPlugin from 'rollup-plugin-typescript2'; | ||
import typescript from 'typescript'; | ||
import pkg from './package.json'; | ||
|
||
const deps = Object.keys( | ||
Object.assign({}, pkg.peerDependencies, pkg.dependencies) | ||
); | ||
|
||
/** | ||
* ES5 Builds | ||
*/ | ||
const es5BuildPlugins = [ | ||
typescriptPlugin({ | ||
typescript | ||
}), | ||
json() | ||
]; | ||
|
||
const es5Builds = [ | ||
/** | ||
* Browser Builds | ||
*/ | ||
{ | ||
input: 'src/index.ts', | ||
output: [ | ||
{ file: pkg.browser, format: 'cjs', sourcemap: true }, | ||
{ file: pkg.module, format: 'es', sourcemap: true } | ||
], | ||
plugins: es5BuildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
}, | ||
/** | ||
* Node.js Build | ||
*/ | ||
{ | ||
input: 'src/index.node.ts', | ||
output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], | ||
plugins: es5BuildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
} | ||
]; | ||
|
||
const es2017BuildPlugins = [ | ||
typescriptPlugin({ | ||
typescript, | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
target: 'es2017' | ||
} | ||
} | ||
}), | ||
json({ preferConst: true }) | ||
]; | ||
|
||
/** | ||
* ES2017 Builds | ||
*/ | ||
const es2017Builds = [ | ||
{ | ||
/** | ||
* Browser Build | ||
*/ | ||
input: 'src/index.ts', | ||
output: { | ||
file: pkg.esm2017, | ||
format: 'es', | ||
sourcemap: true | ||
}, | ||
plugins: es2017BuildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
} | ||
]; | ||
|
||
export default [...es5Builds, ...es2017Builds]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 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 { _getProvider } from '@firebase/app-exp'; | ||
import { FirebaseApp } from '@firebase/app-types-exp'; | ||
import { FUNCTIONS_TYPE } from './constants'; | ||
|
||
import { Provider } from '@firebase/component'; | ||
import { | ||
Functions, | ||
HttpsCallableOptions, | ||
HttpsCallable | ||
} from '@firebase/functions-types-exp'; | ||
import { | ||
FunctionsService, | ||
DEFAULT_REGION, | ||
useFunctionsEmulator as _useFunctionsEmulator, | ||
httpsCallable as _httpsCallable | ||
} from './service'; | ||
|
||
/** | ||
* Returns a Functions instance for the given app. | ||
* @param app - The FirebaseApp to use. | ||
* @param region - The region the callable functions are located in. | ||
* @public | ||
*/ | ||
export function getFunctions( | ||
app: FirebaseApp, | ||
region: string = DEFAULT_REGION | ||
): Functions { | ||
// Dependencies | ||
const functionsProvider: Provider<'functions'> = _getProvider( | ||
app, | ||
FUNCTIONS_TYPE | ||
); | ||
const functionsInstance = functionsProvider.getImmediate({ | ||
identifier: region | ||
}); | ||
return functionsInstance; | ||
} | ||
|
||
/** | ||
* Changes this instance to point to a Cloud Functions emulator running | ||
* locally. See https://firebase.google.com/docs/functions/local-emulator | ||
* | ||
* @param origin - The origin of the local emulator, such as | ||
* "http://localhost:5005". | ||
* @public | ||
*/ | ||
export function useFunctionsEmulator( | ||
functionsInstance: Functions, | ||
origin: string | ||
): void { | ||
_useFunctionsEmulator(functionsInstance as FunctionsService, origin); | ||
} | ||
|
||
/** | ||
* Returns a reference to the callable https trigger with the given name. | ||
* @param name - The name of the trigger. | ||
* @public | ||
*/ | ||
export function httpsCallable( | ||
functionsInstance: Functions, | ||
name: string, | ||
options?: HttpsCallableOptions | ||
): HttpsCallable { | ||
return _httpsCallable(functionsInstance as FunctionsService, name, options); | ||
} |
Oops, something went wrong.