Skip to content

Hyrum's law breaks my heart #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix an error that broke `firebase emulators:start` on older CLIs
2 changes: 1 addition & 1 deletion spec/common/providers/https.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { expect } from 'chai';
import * as express from 'express';
import * as firebase from 'firebase-admin';

import { apps as appsNamespace } from '../../../src/apps';
import * as https from '../../../src/common/providers/https';
import { apps as appsNamespace } from '../../../src/v1/apps';
import * as mocks from '../../fixtures/credential/key.json';
import {
expectedResponseHeaders,
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/apps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// SOFTWARE.

import { expect } from 'chai';
import { apps as appsNamespace } from '../../src/v1/apps';
import { apps as appsNamespace } from '../../src/apps';

import * as firebase from 'firebase-admin';
import * as _ from 'lodash';
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/cloud-functions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
EventContext,
makeCloudFunction,
MakeCloudFunctionArgs,
} from '../../src/v1/cloud-functions';
} from '../../src/cloud-functions';

describe('makeCloudFunction', () => {
const cloudFunctionArgs: MakeCloudFunctionArgs<any> = {
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import * as fs from 'fs';
import * as process from 'process';
import Sinon = require('sinon');

import * as config from '../../src/v1/config';
import * as config from '../../src/config';

describe('config()', () => {
let readFileSync: Sinon.SinonStub;
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/function-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import { expect } from 'chai';

import * as functions from '../../src/v1';
import * as functions from '../../src';

describe('FunctionBuilder', () => {
before(() => {
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/providers/analytics.spec.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// SOFTWARE.

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

// A payload, as it might arrive over the wire. Every possible field is filled out at least once.
export const fullPayload = JSON.parse(`{
Expand Down
6 changes: 3 additions & 3 deletions spec/v1/providers/analytics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

import { expect } from 'chai';

import * as functions from '../../../src/v1';
import { Event, EventContext } from '../../../src/v1/cloud-functions';
import * as analytics from '../../../src/v1/providers/analytics';
import * as functions from '../../../src';
import { Event, EventContext } from '../../../src/cloud-functions';
import * as analytics from '../../../src/providers/analytics';
import * as analytics_spec_input from './analytics.spec.input';

describe('Analytics Functions', () => {
Expand Down
6 changes: 3 additions & 3 deletions spec/v1/providers/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
import { expect } from 'chai';
import * as firebase from 'firebase-admin';

import * as functions from '../../../src/index';
import {
CloudFunction,
Event,
EventContext,
} from '../../../src/v1/cloud-functions';
import * as auth from '../../../src/v1/providers/auth';
} from '../../../src/cloud-functions';
import * as functions from '../../../src/index';
import * as auth from '../../../src/providers/auth';

describe('Auth Functions', () => {
const event: Event = {
Expand Down
10 changes: 5 additions & 5 deletions spec/v1/providers/database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
// SOFTWARE.

import { expect } from 'chai';
import { apps as appsNamespace } from '../../../src/v1/apps';
import * as config from '../../../src/v1/config';
import * as functions from '../../../src/v1/index';
import * as database from '../../../src/v1/providers/database';
import { applyChange } from '../../../src/v1/utils';
import { apps as appsNamespace } from '../../../src/apps';
import * as config from '../../../src/config';
import * as functions from '../../../src/index';
import * as database from '../../../src/providers/database';
import { applyChange } from '../../../src/utils';

describe('Database Functions', () => {
describe('DatabaseBuilder', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/providers/firestore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import * as admin from 'firebase-admin';
import * as _ from 'lodash';

import * as functions from '../../../src/index';
import * as firestore from '../../../src/v1/providers/firestore';
import * as firestore from '../../../src/providers/firestore';

describe('Firestore Functions', () => {
function constructValue(fields: any) {
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/providers/https.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { expect } from 'chai';
import * as express from 'express';
import * as _ from 'lodash';
import * as functions from '../../../src/index';
import * as https from '../../../src/v1/providers/https';
import * as https from '../../../src/providers/https';
import {
expectedResponseHeaders,
MockRequest,
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/providers/pubsub.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import { expect } from 'chai';
import { Event } from '../../../src/index';
import * as functions from '../../../src/index';
import * as pubsub from '../../../src/v1/providers/pubsub';
import * as pubsub from '../../../src/providers/pubsub';

describe('Pubsub Functions', () => {
describe('pubsub.Message', () => {
Expand Down
6 changes: 3 additions & 3 deletions spec/v1/providers/remoteConfig.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import { expect } from 'chai';
import * as _ from 'lodash';

import * as functions from '../../../src/index';
import {
CloudFunction,
Event,
EventContext,
TriggerAnnotated,
} from '../../../src/v1/cloud-functions';
import * as remoteConfig from '../../../src/v1/providers/remoteConfig';
} from '../../../src/cloud-functions';
import * as functions from '../../../src/index';
import * as remoteConfig from '../../../src/providers/remoteConfig';

describe('RemoteConfig Functions', () => {
function constructVersion() {
Expand Down
8 changes: 4 additions & 4 deletions spec/v1/providers/storage.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
// SOFTWARE.

import { expect } from 'chai';
import { Event, EventContext } from '../../../src/v1';
import * as functions from '../../../src/v1';
import * as config from '../../../src/v1/config';
import * as storage from '../../../src/v1/providers/storage';
import { Event, EventContext } from '../../../src';
import * as functions from '../../../src';
import * as config from '../../../src/config';
import * as storage from '../../../src/providers/storage';

describe('Storage Functions', () => {
describe('ObjectBuilder', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/providers/testLab.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import { expect } from 'chai';

import * as testLab from '../../../src/v1/providers/testLab';
import * as testLab from '../../../src/providers/testLab';

describe('Test Lab Functions', () => {
describe('#onComplete', () => {
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// SOFTWARE.

import { expect } from 'chai';
import { setup } from '../../src/v1/setup';
import { setup } from '../../src/setup';

describe('setup()', () => {
afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion spec/v1/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// SOFTWARE.

import { expect } from 'chai';
import { applyChange } from '../../src/v1/utils';
import { applyChange } from '../../src/utils';

describe('utils', () => {
describe('.applyChange(from: any, to: any): any', () => {
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/v1/cloud-functions.ts → src/cloud-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@

import { Request, Response } from 'express';
import * as _ from 'lodash';
import { warn } from '../logger';
import {
DEFAULT_FAILURE_POLICY,
DeploymentOptions,
FailurePolicy,
Schedule,
} from './function-configuration';
import { warn } from './logger';
export { Request, Response };
import {
convertIfPresent,
convertInvoker,
copyIfPresent,
Duration,
durationFromSeconds,
serviceAccountFromShorthand,
convertInvoker,
} from '../common/encoding';
} from './common/encoding';

/** @hidden */
const WILDCARD_REGEX = new RegExp('{[^/{}]*}', 'g');
Expand Down
2 changes: 1 addition & 1 deletion src/common/providers/https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as logger from '../../logger';

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

/** @hidden */
export interface Request extends express.Request {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 41 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Firebase
// Copyright (c) 2017 Firebase
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -20,4 +20,43 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

export * from './v1';
// Providers:
import * as analytics from './providers/analytics';
import * as auth from './providers/auth';
import * as database from './providers/database';
import * as firestore from './providers/firestore';
import * as https from './providers/https';
import * as pubsub from './providers/pubsub';
import * as remoteConfig from './providers/remoteConfig';
import * as storage from './providers/storage';
import * as testLab from './providers/testLab';

import * as apps from './apps';
import { handler } from './handler-builder';
import * as logger from './logger';
import { setup } from './setup';

const app = apps.apps();

export {
analytics,
app,
auth,
database,
firestore,
handler,
https,
pubsub,
remoteConfig,
storage,
testLab,
logger,
};

// Exported root types:
export * from './cloud-functions';
export * from './config';
export * from './function-builder';
export * from './function-configuration';

setup();
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/v1/providers/database.ts → src/providers/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import * as firebase from 'firebase-admin';
import * as _ from 'lodash';
import { joinPath, normalizePath, pathParts } from '../../utilities/path';
import { apps } from '../apps';
import {
Change,
Expand All @@ -33,6 +32,7 @@ import {
} from '../cloud-functions';
import { firebaseConfig } from '../config';
import { DeploymentOptions } from '../function-configuration';
import { joinPath, normalizePath, pathParts } from '../utilities/path';
import { applyChange } from '../utils';

/** @hidden */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import * as firebase from 'firebase-admin';
import * as _ from 'lodash';

import { posix } from 'path';
import * as logger from '../../logger';
import { apps } from '../apps';
import {
Change,
Expand All @@ -35,6 +34,7 @@ import {
} from '../cloud-functions';
import { dateToTimestampProto } from '../encoder';
import { DeploymentOptions } from '../function-configuration';
import * as logger from '../logger';

/** @hidden */
export const provider = 'google.firestore';
Expand Down
2 changes: 1 addition & 1 deletion src/v1/providers/https.ts → src/providers/https.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import * as express from 'express';

import * as common from '../../common/providers/https';
import { HttpsFunction, optionsToTrigger, Runnable } from '../cloud-functions';
import * as common from '../common/providers/https';
import { DeploymentOptions } from '../function-configuration';

export type Request = common.Request;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/v1/setup.ts → src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
// SOFTWARE.

/** @hidden */
import { warn } from '../logger';
import { firebaseConfig } from './config';
import { warn } from './logger';

// Set up for config and vars
export function setup() {
Expand Down
File renamed without changes.
62 changes: 0 additions & 62 deletions src/v1/index.ts

This file was deleted.

Loading