Skip to content

Commit

Permalink
mostly cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Gabriel Neyer committed Oct 19, 2022
1 parent 00228f9 commit 1aeda60
Show file tree
Hide file tree
Showing 8 changed files with 953 additions and 643 deletions.
442 changes: 315 additions & 127 deletions events/events.ts

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions src/cloudevent.ts
Expand Up @@ -16,8 +16,7 @@
* The object interface for a CloudEvent.
* @see https://github.com/cloudevents/spec/blob/v1.0/spec.md
*/
export interface CloudEvent<T=unknown> {

export interface CloudEvent<T = unknown> {
/**
* Identifier for the event.
*/
Expand Down
16 changes: 10 additions & 6 deletions src/index.ts
Expand Up @@ -12,17 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { google, GoogleCloudEvent, GoogleCloudEventsUnion, GoogleCloudEventTypes, GoogleCloudEventTypesToDataType } from '../events/events';
import {
google,
GoogleCloudEvent,
GoogleCloudEventsUnion,
GoogleCloudEventTypes,
GoogleCloudEventTypesToDataType,
} from '../events/events';

/**
* Check if a given a CloudEvent is a known GoogleCloudEvent.
*
* @param event the CloudEvent to check the type of
* @returns true if this event is a GoogleCloudEvent of the provided type, false otherwise
*/
export function isGoogleEvent(
event: any,
): event is GoogleCloudEventsUnion;
export function isGoogleEvent(event: any): event is GoogleCloudEventsUnion;
/**
* Check if a given a CloudEvent is a known Google CloudEvent of a given type.
*
Expand All @@ -48,5 +52,5 @@ export function isGoogleEvent(
return GoogleCloudEventTypes.has(event.type);
}

export { CloudEvent } from './cloudevent';
export { GoogleCloudEvent, GoogleCloudEventsUnion, google };
export {CloudEvent} from './cloudevent';
export {GoogleCloudEvent, GoogleCloudEventsUnion, google};
31 changes: 18 additions & 13 deletions tests/index.ts
Expand Up @@ -251,19 +251,24 @@ const DATABASE_DATA: google.events.firebase.database.v1.ReferenceEventData = {
},
},
};
const REMOTE_CONFIG_DATA: google.events.firebase.remoteconfig.v1.RemoteConfigEventData = {
updateOrigin: google.events.firebase.remoteconfig.v1.RemoteConfigUpdateOriginEnum.CONSOLE,
updateTime: '2020-11-16T16:35:33.569229Z',
updateType: google.events.firebase.remoteconfig.v1.RemoteConfigUpdateTypeEnum.INCREMENTAL_UPDATE,
updateUser: {
name: 'Ut ad aute',
email: 'test@nowhere.com',
imageUrl: 'http://google.com/favicon.ico',
},
versionNumber: 5,
rollbackSource: 75404139,
description: 'minim reprehenderit Lorem qui proident',
};
const REMOTE_CONFIG_DATA: google.events.firebase.remoteconfig.v1.RemoteConfigEventData =
{
updateOrigin:
google.events.firebase.remoteconfig.v1.RemoteConfigUpdateOriginEnum
.CONSOLE,
updateTime: '2020-11-16T16:35:33.569229Z',
updateType:
google.events.firebase.remoteconfig.v1.RemoteConfigUpdateTypeEnum
.INCREMENTAL_UPDATE,
updateUser: {
name: 'Ut ad aute',
email: 'test@nowhere.com',
imageUrl: 'http://google.com/favicon.ico',
},
versionNumber: 5,
rollbackSource: 75404139,
description: 'minim reprehenderit Lorem qui proident',
};

describe('Event Types', () => {
describe('cloud', () => {
Expand Down

0 comments on commit 1aeda60

Please sign in to comment.