Skip to content

Commit fdcd309

Browse files
authored
Hyrum's law breaks my heart (#943)
* Hyrum's law breaks my heart * Changelog
1 parent 7f4db13 commit fdcd309

40 files changed

+81
-103
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix an error that broke `firebase emulators:start` on older CLIs

spec/common/providers/https.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { expect } from 'chai';
22
import * as express from 'express';
33
import * as firebase from 'firebase-admin';
44

5+
import { apps as appsNamespace } from '../../../src/apps';
56
import * as https from '../../../src/common/providers/https';
6-
import { apps as appsNamespace } from '../../../src/v1/apps';
77
import * as mocks from '../../fixtures/credential/key.json';
88
import {
99
expectedResponseHeaders,

spec/v1/apps.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// SOFTWARE.
2222

2323
import { expect } from 'chai';
24-
import { apps as appsNamespace } from '../../src/v1/apps';
24+
import { apps as appsNamespace } from '../../src/apps';
2525

2626
import * as firebase from 'firebase-admin';
2727
import * as _ from 'lodash';

spec/v1/cloud-functions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
EventContext,
3030
makeCloudFunction,
3131
MakeCloudFunctionArgs,
32-
} from '../../src/v1/cloud-functions';
32+
} from '../../src/cloud-functions';
3333

3434
describe('makeCloudFunction', () => {
3535
const cloudFunctionArgs: MakeCloudFunctionArgs<any> = {

spec/v1/config.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import * as fs from 'fs';
2525
import * as process from 'process';
2626
import Sinon = require('sinon');
2727

28-
import * as config from '../../src/v1/config';
28+
import * as config from '../../src/config';
2929

3030
describe('config()', () => {
3131
let readFileSync: Sinon.SinonStub;

spec/v1/function-builder.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import { expect } from 'chai';
2424

25-
import * as functions from '../../src/v1';
25+
import * as functions from '../../src';
2626

2727
describe('FunctionBuilder', () => {
2828
before(() => {

spec/v1/providers/analytics.spec.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// SOFTWARE.
2222

2323
/* tslint:disable:max-line-length */
24-
import { AnalyticsEvent } from '../../../src/v1/providers/analytics';
24+
import { AnalyticsEvent } from '../../../src/providers/analytics';
2525

2626
// A payload, as it might arrive over the wire. Every possible field is filled out at least once.
2727
export const fullPayload = JSON.parse(`{

spec/v1/providers/analytics.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
import { expect } from 'chai';
2424

25-
import * as functions from '../../../src/v1';
26-
import { Event, EventContext } from '../../../src/v1/cloud-functions';
27-
import * as analytics from '../../../src/v1/providers/analytics';
25+
import * as functions from '../../../src';
26+
import { Event, EventContext } from '../../../src/cloud-functions';
27+
import * as analytics from '../../../src/providers/analytics';
2828
import * as analytics_spec_input from './analytics.spec.input';
2929

3030
describe('Analytics Functions', () => {

spec/v1/providers/auth.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
import { expect } from 'chai';
2424
import * as firebase from 'firebase-admin';
2525

26-
import * as functions from '../../../src/index';
2726
import {
2827
CloudFunction,
2928
Event,
3029
EventContext,
31-
} from '../../../src/v1/cloud-functions';
32-
import * as auth from '../../../src/v1/providers/auth';
30+
} from '../../../src/cloud-functions';
31+
import * as functions from '../../../src/index';
32+
import * as auth from '../../../src/providers/auth';
3333

3434
describe('Auth Functions', () => {
3535
const event: Event = {

spec/v1/providers/database.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
// SOFTWARE.
2222

2323
import { expect } from 'chai';
24-
import { apps as appsNamespace } from '../../../src/v1/apps';
25-
import * as config from '../../../src/v1/config';
26-
import * as functions from '../../../src/v1/index';
27-
import * as database from '../../../src/v1/providers/database';
28-
import { applyChange } from '../../../src/v1/utils';
24+
import { apps as appsNamespace } from '../../../src/apps';
25+
import * as config from '../../../src/config';
26+
import * as functions from '../../../src/index';
27+
import * as database from '../../../src/providers/database';
28+
import { applyChange } from '../../../src/utils';
2929

3030
describe('Database Functions', () => {
3131
describe('DatabaseBuilder', () => {

spec/v1/providers/firestore.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import * as admin from 'firebase-admin';
2525
import * as _ from 'lodash';
2626

2727
import * as functions from '../../../src/index';
28-
import * as firestore from '../../../src/v1/providers/firestore';
28+
import * as firestore from '../../../src/providers/firestore';
2929

3030
describe('Firestore Functions', () => {
3131
function constructValue(fields: any) {

spec/v1/providers/https.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { expect } from 'chai';
2424
import * as express from 'express';
2525
import * as _ from 'lodash';
2626
import * as functions from '../../../src/index';
27-
import * as https from '../../../src/v1/providers/https';
27+
import * as https from '../../../src/providers/https';
2828
import {
2929
expectedResponseHeaders,
3030
MockRequest,

spec/v1/providers/pubsub.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import { expect } from 'chai';
2424
import { Event } from '../../../src/index';
2525
import * as functions from '../../../src/index';
26-
import * as pubsub from '../../../src/v1/providers/pubsub';
26+
import * as pubsub from '../../../src/providers/pubsub';
2727

2828
describe('Pubsub Functions', () => {
2929
describe('pubsub.Message', () => {

spec/v1/providers/remoteConfig.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
import { expect } from 'chai';
2323
import * as _ from 'lodash';
2424

25-
import * as functions from '../../../src/index';
2625
import {
2726
CloudFunction,
2827
Event,
2928
EventContext,
3029
TriggerAnnotated,
31-
} from '../../../src/v1/cloud-functions';
32-
import * as remoteConfig from '../../../src/v1/providers/remoteConfig';
30+
} from '../../../src/cloud-functions';
31+
import * as functions from '../../../src/index';
32+
import * as remoteConfig from '../../../src/providers/remoteConfig';
3333

3434
describe('RemoteConfig Functions', () => {
3535
function constructVersion() {

spec/v1/providers/storage.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
// SOFTWARE.
2222

2323
import { expect } from 'chai';
24-
import { Event, EventContext } from '../../../src/v1';
25-
import * as functions from '../../../src/v1';
26-
import * as config from '../../../src/v1/config';
27-
import * as storage from '../../../src/v1/providers/storage';
24+
import { Event, EventContext } from '../../../src';
25+
import * as functions from '../../../src';
26+
import * as config from '../../../src/config';
27+
import * as storage from '../../../src/providers/storage';
2828

2929
describe('Storage Functions', () => {
3030
describe('ObjectBuilder', () => {

spec/v1/providers/testLab.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import { expect } from 'chai';
2424

25-
import * as testLab from '../../../src/v1/providers/testLab';
25+
import * as testLab from '../../../src/providers/testLab';
2626

2727
describe('Test Lab Functions', () => {
2828
describe('#onComplete', () => {

spec/v1/setup.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// SOFTWARE.
2222

2323
import { expect } from 'chai';
24-
import { setup } from '../../src/v1/setup';
24+
import { setup } from '../../src/setup';
2525

2626
describe('setup()', () => {
2727
afterEach(() => {

spec/v1/utils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// SOFTWARE.
2222

2323
import { expect } from 'chai';
24-
import { applyChange } from '../../src/v1/utils';
24+
import { applyChange } from '../../src/utils';
2525

2626
describe('utils', () => {
2727
describe('.applyChange(from: any, to: any): any', () => {
File renamed without changes.

src/v1/cloud-functions.ts renamed to src/cloud-functions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@
2222

2323
import { Request, Response } from 'express';
2424
import * as _ from 'lodash';
25-
import { warn } from '../logger';
2625
import {
2726
DEFAULT_FAILURE_POLICY,
2827
DeploymentOptions,
2928
FailurePolicy,
3029
Schedule,
3130
} from './function-configuration';
31+
import { warn } from './logger';
3232
export { Request, Response };
3333
import {
3434
convertIfPresent,
35+
convertInvoker,
3536
copyIfPresent,
3637
Duration,
3738
durationFromSeconds,
3839
serviceAccountFromShorthand,
39-
convertInvoker,
40-
} from '../common/encoding';
40+
} from './common/encoding';
4141

4242
/** @hidden */
4343
const WILDCARD_REGEX = new RegExp('{[^/{}]*}', 'g');

src/common/providers/https.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import * as logger from '../../logger';
2828

2929
// TODO(inlined): Decide whether we want to un-version apps or whether we want a
3030
// different strategy
31-
import { apps } from '../../v1/apps';
31+
import { apps } from '../../apps';
3232

3333
/** @hidden */
3434
export interface Request extends express.Request {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/index.ts

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// The MIT License (MIT)
22
//
3-
// Copyright (c) 2021 Firebase
3+
// Copyright (c) 2017 Firebase
44
//
55
// Permission is hereby granted, free of charge, to any person obtaining a copy
66
// of this software and associated documentation files (the "Software"), to deal
@@ -20,4 +20,43 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23-
export * from './v1';
23+
// Providers:
24+
import * as analytics from './providers/analytics';
25+
import * as auth from './providers/auth';
26+
import * as database from './providers/database';
27+
import * as firestore from './providers/firestore';
28+
import * as https from './providers/https';
29+
import * as pubsub from './providers/pubsub';
30+
import * as remoteConfig from './providers/remoteConfig';
31+
import * as storage from './providers/storage';
32+
import * as testLab from './providers/testLab';
33+
34+
import * as apps from './apps';
35+
import { handler } from './handler-builder';
36+
import * as logger from './logger';
37+
import { setup } from './setup';
38+
39+
const app = apps.apps();
40+
41+
export {
42+
analytics,
43+
app,
44+
auth,
45+
database,
46+
firestore,
47+
handler,
48+
https,
49+
pubsub,
50+
remoteConfig,
51+
storage,
52+
testLab,
53+
logger,
54+
};
55+
56+
// Exported root types:
57+
export * from './cloud-functions';
58+
export * from './config';
59+
export * from './function-builder';
60+
export * from './function-configuration';
61+
62+
setup();
File renamed without changes.
File renamed without changes.

src/v1/providers/database.ts renamed to src/providers/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import * as firebase from 'firebase-admin';
2424
import * as _ from 'lodash';
25-
import { joinPath, normalizePath, pathParts } from '../../utilities/path';
2625
import { apps } from '../apps';
2726
import {
2827
Change,
@@ -33,6 +32,7 @@ import {
3332
} from '../cloud-functions';
3433
import { firebaseConfig } from '../config';
3534
import { DeploymentOptions } from '../function-configuration';
35+
import { joinPath, normalizePath, pathParts } from '../utilities/path';
3636
import { applyChange } from '../utils';
3737

3838
/** @hidden */

src/v1/providers/firestore.ts renamed to src/providers/firestore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import * as firebase from 'firebase-admin';
2424
import * as _ from 'lodash';
2525

2626
import { posix } from 'path';
27-
import * as logger from '../../logger';
2827
import { apps } from '../apps';
2928
import {
3029
Change,
@@ -35,6 +34,7 @@ import {
3534
} from '../cloud-functions';
3635
import { dateToTimestampProto } from '../encoder';
3736
import { DeploymentOptions } from '../function-configuration';
37+
import * as logger from '../logger';
3838

3939
/** @hidden */
4040
export const provider = 'google.firestore';

src/v1/providers/https.ts renamed to src/providers/https.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
import * as express from 'express';
2424

25-
import * as common from '../../common/providers/https';
2625
import { HttpsFunction, optionsToTrigger, Runnable } from '../cloud-functions';
26+
import * as common from '../common/providers/https';
2727
import { DeploymentOptions } from '../function-configuration';
2828

2929
export type Request = common.Request;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/v1/setup.ts renamed to src/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
// SOFTWARE.
2222

2323
/** @hidden */
24-
import { warn } from '../logger';
2524
import { firebaseConfig } from './config';
25+
import { warn } from './logger';
2626

2727
// Set up for config and vars
2828
export function setup() {
File renamed without changes.

src/v1/index.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)