@firebase/functions-compat
Advanced tools
Comparing version 0.0.900-exp.f919db6a9 to 0.1.0-202171919375
@@ -1,4 +0,3 @@ | ||
import firebase, { firebase as firebase$1 } from '@firebase/app-compat'; | ||
import { httpsCallable, useFunctionsEmulator } from '@firebase/functions'; | ||
import '@firebase/functions-types'; | ||
import firebase from '@firebase/app-compat'; | ||
import { httpsCallable, connectFunctionsEmulator } from '@firebase/functions'; | ||
import { FirebaseError } from '@firebase/util'; | ||
@@ -8,3 +7,3 @@ import { Component } from '@firebase/component'; | ||
const name = "@firebase/functions-compat"; | ||
const version = "0.0.900"; | ||
const version = "0.1.0-202171919375"; | ||
@@ -28,10 +27,10 @@ /** | ||
class FunctionsService { | ||
constructor(app, _functionsInstance) { | ||
constructor(app, _delegate) { | ||
this.app = app; | ||
this._functionsInstance = _functionsInstance; | ||
this._region = this._functionsInstance.region; | ||
this._customDomain = this._functionsInstance.customDomain; | ||
this._delegate = _delegate; | ||
this._region = this._delegate.region; | ||
this._customDomain = this._delegate.customDomain; | ||
} | ||
httpsCallable(name, options) { | ||
return httpsCallable(this._functionsInstance, name, options); | ||
return httpsCallable(this._delegate, name, options); | ||
} | ||
@@ -52,6 +51,6 @@ /** | ||
} | ||
return useFunctionsEmulator(this._functionsInstance, match[1], Number(match[2])); | ||
return connectFunctionsEmulator(this._delegate, match[1], Number(match[2])); | ||
} | ||
useEmulator(host, port) { | ||
return useFunctionsEmulator(this._functionsInstance, host, port); | ||
return connectFunctionsEmulator(this._delegate, host, port); | ||
} | ||
@@ -76,9 +75,10 @@ } | ||
*/ | ||
const factory = (container, regionOrCustomDomain) => { | ||
const DEFAULT_REGION = 'us-central1'; | ||
const factory = (container, { instanceIdentifier: regionOrCustomDomain }) => { | ||
// Dependencies | ||
const app = container.getProvider('app-compat').getImmediate(); | ||
const functionsServiceExp = container | ||
.getProvider('functions-exp') | ||
.getProvider('functions') | ||
.getImmediate({ | ||
identifier: regionOrCustomDomain | ||
identifier: regionOrCustomDomain !== null && regionOrCustomDomain !== void 0 ? regionOrCustomDomain : DEFAULT_REGION | ||
}); | ||
@@ -89,3 +89,2 @@ return new FunctionsService(app, functionsServiceExp); | ||
const namespaceExports = { | ||
// no-inline | ||
Functions: FunctionsService | ||
@@ -115,3 +114,3 @@ }; | ||
registerFunctions(); | ||
firebase$1.registerVersion(name, version); | ||
firebase.registerVersion(name, version); | ||
//# sourceMappingURL=index.esm2017.js.map |
@@ -1,4 +0,3 @@ | ||
import firebase, { firebase as firebase$1 } from '@firebase/app-compat'; | ||
import { httpsCallable, useFunctionsEmulator } from '@firebase/functions'; | ||
import '@firebase/functions-types'; | ||
import firebase from '@firebase/app-compat'; | ||
import { httpsCallable, connectFunctionsEmulator } from '@firebase/functions'; | ||
import { FirebaseError } from '@firebase/util'; | ||
@@ -8,3 +7,3 @@ import { Component } from '@firebase/component'; | ||
var name = "@firebase/functions-compat"; | ||
var version = "0.0.900"; | ||
var version = "0.1.0-202171919375"; | ||
@@ -28,10 +27,10 @@ /** | ||
var FunctionsService = /** @class */ (function () { | ||
function FunctionsService(app, _functionsInstance) { | ||
function FunctionsService(app, _delegate) { | ||
this.app = app; | ||
this._functionsInstance = _functionsInstance; | ||
this._region = this._functionsInstance.region; | ||
this._customDomain = this._functionsInstance.customDomain; | ||
this._delegate = _delegate; | ||
this._region = this._delegate.region; | ||
this._customDomain = this._delegate.customDomain; | ||
} | ||
FunctionsService.prototype.httpsCallable = function (name, options) { | ||
return httpsCallable(this._functionsInstance, name, options); | ||
return httpsCallable(this._delegate, name, options); | ||
}; | ||
@@ -52,6 +51,6 @@ /** | ||
} | ||
return useFunctionsEmulator(this._functionsInstance, match[1], Number(match[2])); | ||
return connectFunctionsEmulator(this._delegate, match[1], Number(match[2])); | ||
}; | ||
FunctionsService.prototype.useEmulator = function (host, port) { | ||
return useFunctionsEmulator(this._functionsInstance, host, port); | ||
return connectFunctionsEmulator(this._delegate, host, port); | ||
}; | ||
@@ -77,9 +76,11 @@ return FunctionsService; | ||
*/ | ||
var factory = function (container, regionOrCustomDomain) { | ||
var DEFAULT_REGION = 'us-central1'; | ||
var factory = function (container, _a) { | ||
var regionOrCustomDomain = _a.instanceIdentifier; | ||
// Dependencies | ||
var app = container.getProvider('app-compat').getImmediate(); | ||
var functionsServiceExp = container | ||
.getProvider('functions-exp') | ||
.getProvider('functions') | ||
.getImmediate({ | ||
identifier: regionOrCustomDomain | ||
identifier: regionOrCustomDomain !== null && regionOrCustomDomain !== void 0 ? regionOrCustomDomain : DEFAULT_REGION | ||
}); | ||
@@ -90,3 +91,2 @@ return new FunctionsService(app, functionsServiceExp); | ||
var namespaceExports = { | ||
// no-inline | ||
Functions: FunctionsService | ||
@@ -116,3 +116,3 @@ }; | ||
registerFunctions(); | ||
firebase$1.registerVersion(name, version); | ||
firebase.registerVersion(name, version); | ||
//# sourceMappingURL=index.esm5.js.map |
@@ -5,3 +5,2 @@ 'use strict'; | ||
var functions = require('@firebase/functions'); | ||
require('@firebase/functions-types'); | ||
var util = require('@firebase/util'); | ||
@@ -15,3 +14,3 @@ var component = require('@firebase/component'); | ||
var name = "@firebase/functions-compat"; | ||
var version = "0.0.900"; | ||
var version = "0.1.0-202171919375"; | ||
@@ -35,10 +34,10 @@ /** | ||
var FunctionsService = /** @class */ (function () { | ||
function FunctionsService(app, _functionsInstance) { | ||
function FunctionsService(app, _delegate) { | ||
this.app = app; | ||
this._functionsInstance = _functionsInstance; | ||
this._region = this._functionsInstance.region; | ||
this._customDomain = this._functionsInstance.customDomain; | ||
this._delegate = _delegate; | ||
this._region = this._delegate.region; | ||
this._customDomain = this._delegate.customDomain; | ||
} | ||
FunctionsService.prototype.httpsCallable = function (name, options) { | ||
return functions.httpsCallable(this._functionsInstance, name, options); | ||
return functions.httpsCallable(this._delegate, name, options); | ||
}; | ||
@@ -59,6 +58,6 @@ /** | ||
} | ||
return functions.useFunctionsEmulator(this._functionsInstance, match[1], Number(match[2])); | ||
return functions.connectFunctionsEmulator(this._delegate, match[1], Number(match[2])); | ||
}; | ||
FunctionsService.prototype.useEmulator = function (host, port) { | ||
return functions.useFunctionsEmulator(this._functionsInstance, host, port); | ||
return functions.connectFunctionsEmulator(this._delegate, host, port); | ||
}; | ||
@@ -84,9 +83,11 @@ return FunctionsService; | ||
*/ | ||
var factory = function (container, regionOrCustomDomain) { | ||
var DEFAULT_REGION = 'us-central1'; | ||
var factory = function (container, _a) { | ||
var regionOrCustomDomain = _a.instanceIdentifier; | ||
// Dependencies | ||
var app = container.getProvider('app-compat').getImmediate(); | ||
var functionsServiceExp = container | ||
.getProvider('functions-exp') | ||
.getProvider('functions') | ||
.getImmediate({ | ||
identifier: regionOrCustomDomain | ||
identifier: regionOrCustomDomain !== null && regionOrCustomDomain !== void 0 ? regionOrCustomDomain : DEFAULT_REGION | ||
}); | ||
@@ -97,3 +98,2 @@ return new FunctionsService(app, functionsServiceExp); | ||
var namespaceExports = { | ||
// no-inline | ||
Functions: FunctionsService | ||
@@ -100,0 +100,0 @@ }; |
@@ -17,2 +17,21 @@ /** | ||
*/ | ||
export {}; | ||
import * as types from '@firebase/functions-types'; | ||
declare module '@firebase/app-compat' { | ||
interface FirebaseNamespace { | ||
functions: { | ||
(app?: FirebaseApp): types.FirebaseFunctions; | ||
Functions: typeof types.FirebaseFunctions; | ||
}; | ||
} | ||
interface FirebaseApp { | ||
functions(regionOrCustomDomain?: string): types.FirebaseFunctions; | ||
} | ||
} | ||
import { FirebaseApp as FirebaseAppCompat } from "@firebase/app-compat"; | ||
import { Functions, HttpsCallableOptions, HttpsCallable } from "@firebase/functions"; | ||
declare module "@firebase/functions" { | ||
function connectFunctionsEmulator(functionsInstance: types.FirebaseFunctions, host: string, port: number): void; | ||
function getFunctions(app?: FirebaseAppCompat, regionOrCustomDomain?: string): Functions; | ||
function httpsCallable<RequestData = unknown, ResponseData = unknown>(functionsInstance: types.FirebaseFunctions, name: string, options?: HttpsCallableOptions): HttpsCallable<RequestData, ResponseData>; | ||
} |
@@ -17,12 +17,2 @@ /** | ||
*/ | ||
import { FunctionsService } from './service'; | ||
import { FirebaseApp } from '@firebase/app-types'; | ||
import { Functions as FunctionsServiceExp } from "@firebase/functions-types"; | ||
declare module '@firebase/component' { | ||
interface NameServiceMapping { | ||
'app-compat': FirebaseApp; | ||
'functions-compat': FunctionsService; | ||
'functions-exp': FunctionsServiceExp; | ||
} | ||
} | ||
export declare function registerFunctions(): void; |
@@ -18,7 +18,7 @@ /** | ||
import { FirebaseFunctions, HttpsCallable } from '@firebase/functions-types'; | ||
import { HttpsCallableOptions, Functions as FunctionsServiceExp } from "@firebase/functions-types"; | ||
import { FirebaseApp } from '@firebase/app-types'; | ||
export declare class FunctionsService implements FirebaseFunctions { | ||
import { HttpsCallableOptions, Functions as FunctionsServiceExp } from '@firebase/functions'; | ||
import { FirebaseApp, _FirebaseService } from '@firebase/app-compat'; | ||
export declare class FunctionsService implements FirebaseFunctions, _FirebaseService { | ||
app: FirebaseApp; | ||
private _functionsInstance; | ||
readonly _delegate: FunctionsServiceExp; | ||
/** | ||
@@ -34,3 +34,3 @@ * For testing. | ||
_customDomain: string | null; | ||
constructor(app: FirebaseApp, _functionsInstance: FunctionsServiceExp); | ||
constructor(app: FirebaseApp, _delegate: FunctionsServiceExp); | ||
httpsCallable(name: string, options?: HttpsCallableOptions): HttpsCallable; | ||
@@ -37,0 +37,0 @@ /** |
@@ -17,4 +17,4 @@ /** | ||
*/ | ||
import { FirebaseApp } from '@firebase/app-types'; | ||
import { FirebaseApp } from '@firebase/app-compat'; | ||
import { FunctionsService } from '../src/service'; | ||
export declare function createTestService(app: FirebaseApp, regionOrCustomDomain?: string): FunctionsService; |
{ | ||
"name": "@firebase/functions-compat", | ||
"version": "0.0.900-exp.f919db6a9", | ||
"version": "0.1.0-202171919375", | ||
"description": "", | ||
"private": false, | ||
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"main": "dist/index.node.cjs.js", | ||
"browser": "dist/index.esm5.js", | ||
"module": "dist/index.esm5.js", | ||
"esm2017": "dist/index.esm2017.js", | ||
"browser": "dist/index.esm2017.js", | ||
"module": "dist/index.esm2017.js", | ||
"files": [ | ||
@@ -16,13 +14,13 @@ "dist" | ||
"peerDependencies": { | ||
"@firebase/app-compat": "0.0.900-exp.f919db6a9" | ||
"@firebase/app-compat": "0.1.0-202171919375" | ||
}, | ||
"devDependencies": { | ||
"@firebase/app-compat": "0.0.900", | ||
"rollup": "2.35.1", | ||
"@firebase/app-compat": "0.1.0-202171919375", | ||
"rollup": "2.52.2", | ||
"@rollup/plugin-json": "4.1.0", | ||
"rollup-plugin-typescript2": "0.29.0", | ||
"typescript": "4.0.5" | ||
"rollup-plugin-typescript2": "0.30.0", | ||
"typescript": "4.2.2" | ||
}, | ||
"repository": { | ||
"directory": "packages-exp/functions-compat", | ||
"directory": "packages/functions-compat", | ||
"type": "git", | ||
@@ -39,3 +37,3 @@ "url": "https://github.com/firebase/firebase-js-sdk.git" | ||
"build:deps": "lerna run --scope @firebase/functions-compat --include-dependencies build", | ||
"build:release": "rollup -c rollup.config.release.js", | ||
"build:release": "rollup -c rollup.config.release.js && yarn add-compat-overloads", | ||
"dev": "rollup -c -w", | ||
@@ -48,12 +46,13 @@ "test": "run-p lint test:all", | ||
"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_HOST=http://localhost FIREBASE_FUNCTIONS_PORT=5005 run-p test:node" | ||
"test:emulator": "env FIREBASE_FUNCTIONS_HOST=http://localhost FIREBASE_FUNCTIONS_PORT=5005 run-p test:node", | ||
"add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../functions/dist/functions-public.d.ts -o dist/src/index.d.ts -a -r Functions:types.FirebaseFunctions -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/functions" | ||
}, | ||
"typings": "dist/functions-compat-public.d.ts", | ||
"typings": "dist/src/index.d.ts", | ||
"dependencies": { | ||
"@firebase/component": "0.1.21", | ||
"@firebase/functions": "0.0.900-exp.f919db6a9", | ||
"@firebase/functions-types": "0.0.900-exp.f919db6a9", | ||
"@firebase/messaging-types": "0.5.0", | ||
"@firebase/util": "0.3.4", | ||
"tslib": "^1.11.1" | ||
"@firebase/component": "0.5.6-202171919375", | ||
"@firebase/functions": "0.7.0-202171919375", | ||
"@firebase/functions-types": "0.5.0-202171919375", | ||
"@firebase/messaging-types": "0.6.0-202171919375", | ||
"@firebase/util": "1.3.0-202171919375", | ||
"tslib": "^2.1.0" | ||
}, | ||
@@ -65,3 +64,4 @@ "nyc": { | ||
"reportDir": "./coverage/node" | ||
} | ||
} | ||
}, | ||
"esm5": "dist/index.esm5.js" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
42978
458
+ Added@firebase/app@0.7.0-202171919375(transitive)
+ Added@firebase/app-check-interop-types@0.1.0(transitive)
+ Added@firebase/app-compat@0.1.0-202171919375(transitive)
+ Added@firebase/auth-interop-types@0.1.6(transitive)
+ Added@firebase/component@0.5.6-202171919375(transitive)
+ Added@firebase/functions@0.7.0-202171919375(transitive)
+ Added@firebase/functions-types@0.5.0-202171919375(transitive)
+ Added@firebase/messaging-types@0.6.0-202171919375(transitive)
+ Added@firebase/util@1.10.31.3.0-202171919375(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@firebase/app@0.0.900-exp.f919db6a9(transitive)
- Removed@firebase/app-compat@0.0.900-exp.f919db6a9(transitive)
- Removed@firebase/app-types@0.0.900-exp.f919db6a9(transitive)
- Removed@firebase/component@0.1.21(transitive)
- Removed@firebase/functions@0.0.900-exp.f919db6a9(transitive)
- Removed@firebase/functions-types@0.0.900-exp.f919db6a9(transitive)
- Removed@firebase/messaging-types@0.5.0(transitive)
- Removed@firebase/util@0.3.4(transitive)
- Removeddom-storage@2.1.0(transitive)
- Removedtslib@1.14.1(transitive)
- Removedxmlhttprequest@1.8.0(transitive)
Updatedtslib@^2.1.0