1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-07-01 10:43:38 +00:00
This commit is contained in:
MatteZ02
2019-10-10 16:43:04 +03:00
parent 6f6ac8a6fa
commit 50b9bed483
9432 changed files with 1988816 additions and 167 deletions

5
node_modules/@firebase/messaging/README.md generated vendored Normal file
View File

@ -0,0 +1,5 @@
# @firebase/messaging
This is the Firebase Cloud Messaging 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.**

2076
node_modules/@firebase/messaging/dist/index.cjs.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

34
node_modules/@firebase/messaging/dist/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,34 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { _FirebaseNamespace } from '@firebase/app-types/private';
import { FirebaseMessaging } from '@firebase/messaging-types';
export declare function registerMessaging(instance: _FirebaseNamespace): void;
/**
* Define extension behavior of `registerMessaging`
*/
declare module '@firebase/app-types' {
interface FirebaseNamespace {
messaging: {
(app?: FirebaseApp): FirebaseMessaging;
isSupported(): boolean;
};
}
interface FirebaseApp {
messaging(): FirebaseMessaging;
}
}
export declare function isSupported(): boolean;

2069
node_modules/@firebase/messaging/dist/index.esm.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1725
node_modules/@firebase/messaging/dist/index.esm2017.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,95 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { FirebaseApp } from '@firebase/app-types';
import { FirebaseServiceInternals } from '@firebase/app-types/private';
import { FirebaseMessaging } from '@firebase/messaging-types';
import { CompleteFn, ErrorFn, NextFn, Observer, Unsubscribe } from '@firebase/util';
import { MessagePayload } from '../interfaces/message-payload';
import { IidModel } from '../models/iid-model';
import { TokenDetailsModel } from '../models/token-details-model';
import { VapidDetailsModel } from '../models/vapid-details-model';
export declare type BgMessageHandler = (payload: MessagePayload) => Promise<unknown> | void;
export declare const TOKEN_EXPIRATION_MILLIS: number;
export declare abstract class BaseController implements FirebaseMessaging {
app: FirebaseApp;
INTERNAL: FirebaseServiceInternals;
private readonly messagingSenderId;
private readonly tokenDetailsModel;
private readonly vapidDetailsModel;
private readonly iidModel;
/**
* An interface of the Messaging Service API
*/
constructor(app: FirebaseApp);
/**
* @export
*/
getToken(): Promise<string | null>;
/**
* manageExistingToken is triggered if there's an existing FCM token in the
* database and it can take 3 different actions:
* 1) Retrieve the existing FCM token from the database.
* 2) If VAPID details have changed: Delete the existing token and create a
* new one with the new VAPID key.
* 3) If the database cache is invalidated: Send a request to FCM to update
* the token, and to check if the token is still valid on FCM-side.
*/
private manageExistingToken;
private updateToken;
private getNewToken;
/**
* This method deletes tokens that the token manager looks after,
* unsubscribes the token from FCM and then unregisters the push
* subscription if it exists. It returns a promise that indicates
* whether or not the unsubscribe request was processed successfully.
*/
deleteToken(token: string): Promise<boolean>;
/**
* This method will delete the token from the client database, and make a
* call to FCM to remove it from the server DB. Does not temper with the
* push subscription.
*/
private deleteTokenFromDB;
abstract getSWRegistration_(): Promise<ServiceWorkerRegistration>;
abstract getPublicVapidKey_(): Promise<Uint8Array>;
/**
* Gets a PushSubscription for the current user.
*/
getPushSubscription(swRegistration: ServiceWorkerRegistration, publicVapidKey: Uint8Array): Promise<PushSubscription>;
/**
* @deprecated Use Notification.requestPermission() instead.
* https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission
*/
requestPermission(): Promise<void>;
useServiceWorker(_registration: ServiceWorkerRegistration): void;
usePublicVapidKey(_b64PublicKey: string): void;
onMessage(_nextOrObserver: NextFn<object> | Observer<object>, _error?: ErrorFn, _completed?: CompleteFn): Unsubscribe;
onTokenRefresh(_nextOrObserver: NextFn<object> | Observer<object>, _error?: ErrorFn, _completed?: CompleteFn): Unsubscribe;
setBackgroundMessageHandler(_callback: BgMessageHandler): void;
/**
* This method is required to adhere to the Firebase interface.
* It closes any currently open indexdb database connections.
*/
delete(): Promise<void>;
/**
* Returns the current Notification Permission state.
*/
getNotificationPermission_(): NotificationPermission;
getTokenDetailsModel(): TokenDetailsModel;
getVapidDetailsModel(): VapidDetailsModel;
getIidModel(): IidModel;
}

View File

@ -0,0 +1,95 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 './sw-types';
import { FirebaseApp } from '@firebase/app-types';
import { MessagePayload, NotificationDetails } from '../interfaces/message-payload';
import { InternalMessage } from '../models/worker-page-message';
import { BaseController, BgMessageHandler } from './base-controller';
export declare class SwController extends BaseController {
private bgMessageHandler;
constructor(app: FirebaseApp);
onPush(event: PushEvent): void;
onSubChange(event: PushSubscriptionChangeEvent): void;
onNotificationClick(event: NotificationEvent): void;
/**
* A handler for push events that shows notifications based on the content of
* the payload.
*
* The payload must be a JSON-encoded Object with a `notification` key. The
* value of the `notification` property will be used as the NotificationOptions
* object passed to showNotification. Additionally, the `title` property of the
* notification object will be used as the title.
*
* If there is no notification data in the payload then no notification will be
* shown.
*/
private onPush_;
private onSubChange_;
private onNotificationClick_;
getNotificationData_(msgPayload: MessagePayload): NotificationDetails | undefined;
/**
* Calling setBackgroundMessageHandler will opt in to some specific
* behaviours.
* 1.) If a notification doesn't need to be shown due to a window already
* being visible, then push messages will be sent to the page.
* 2.) If a notification needs to be shown, and the message contains no
* notification data this method will be called
* and the promise it returns will be passed to event.waitUntil.
* If you do not set this callback then all push messages will let and the
* developer can handle them in a their own 'push' event callback
*
* @param callback The callback to be called when a push message is received
* and a notification must be shown. The callback will be given the data from
* the push message.
*/
setBackgroundMessageHandler(callback: BgMessageHandler): void;
/**
* @param url The URL to look for when focusing a client.
* @return Returns an existing window client or a newly opened WindowClient.
*/
getWindowClient_(url: string): Promise<WindowClient | null>;
/**
* This message will attempt to send the message to a window client.
* @param client The WindowClient to send the message to.
* @param message The message to send to the client.
* @returns Returns a promise that resolves after sending the message. This
* does not guarantee that the message was successfully received.
*/
attemptToMessageClient_(client: WindowClient, message: InternalMessage): Promise<void>;
/**
* @returns If there is currently a visible WindowClient, this method will
* resolve to true, otherwise false.
*/
hasVisibleClients_(): Promise<boolean>;
/**
* @param msgPayload The data from the push event that should be sent to all
* available pages.
* @returns Returns a promise that resolves once the message has been sent to
* all WindowClients.
*/
sendMessageToWindowClients_(msgPayload: MessagePayload): Promise<void>;
/**
* This will register the default service worker and return the registration.
* @return he service worker registration to be used for the push service.
*/
getSWRegistration_(): Promise<ServiceWorkerRegistration>;
/**
* This will return the default VAPID key or the uint8array version of the
* public VAPID key provided by the developer.
*/
getPublicVapidKey_(): Promise<Uint8Array>;
}

View File

@ -0,0 +1,91 @@
/**
* @license
* Copyright 2018 Google Inc.
*
* 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.
*/
/**
* Subset of Web Worker types from lib.webworker.d.ts
* https://github.com/Microsoft/TypeScript/blob/master/lib/lib.webworker.d.ts
*
* Since it's not possible to have both "dom" and "webworker" libs in a single
* project, we have to manually declare the web worker types we need.
*/
interface ServiceWorkerGlobalScope {
readonly location: WorkerLocation;
readonly clients: Clients;
readonly registration: ServiceWorkerRegistration;
addEventListener<K extends keyof ServiceWorkerGlobalScopeEventMap>(type: K, listener: (this: ServiceWorkerGlobalScope, ev: ServiceWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
}
interface ServiceWorkerGlobalScopeEventMap {
notificationclick: NotificationEvent;
push: PushEvent;
pushsubscriptionchange: PushSubscriptionChangeEvent;
}
interface Client {
readonly id: string;
readonly reserved: boolean;
readonly type: ClientTypes;
readonly url: string;
postMessage(message: any, transfer?: any[]): void;
}
interface ClientQueryOptions {
includeReserved?: boolean;
includeUncontrolled?: boolean;
type?: ClientTypes;
}
interface WindowClient extends Client {
readonly ancestorOrigins: readonly string[];
readonly focused: boolean;
readonly visibilityState: VisibilityState;
focus(): Promise<WindowClient>;
navigate(url: string): Promise<WindowClient>;
}
interface Clients {
claim(): Promise<void>;
get(id: string): Promise<any>;
matchAll(options?: ClientQueryOptions): Promise<Client[]>;
openWindow(url: string): Promise<WindowClient | null>;
}
interface ExtendableEvent extends Event {
waitUntil(f: Promise<any>): void;
}
interface NotificationEvent extends ExtendableEvent {
readonly action: string;
readonly notification: Notification;
}
interface PushMessageData {
arrayBuffer(): ArrayBuffer;
blob(): Blob;
json(): any;
text(): string;
}
interface PushEvent extends ExtendableEvent {
readonly data: PushMessageData | null;
}
interface PushSubscriptionChangeEvent extends ExtendableEvent {
readonly newSubscription: PushSubscription | null;
readonly oldSubscription: PushSubscription | null;
}
interface WorkerLocation {
readonly hash: string;
readonly host: string;
readonly hostname: string;
readonly href: string;
readonly origin: string;
readonly pathname: string;
readonly port: string;
readonly protocol: string;
readonly search: string;
toString(): string;
}

View File

@ -0,0 +1,95 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { FirebaseApp } from '@firebase/app-types';
import { CompleteFn, ErrorFn, NextFn, Observer, Unsubscribe } from '@firebase/util';
import { BaseController } from './base-controller';
export declare class WindowController extends BaseController {
private registrationToUse;
private publicVapidKeyToUse;
private messageObserver;
private tokenRefreshObserver;
private readonly onMessageInternal;
private readonly onTokenRefreshInternal;
/**
* A service that provides a MessagingService instance.
*/
constructor(app: FirebaseApp);
/**
* Request permission if it is not currently granted
*
* @return Resolves if the permission was granted, otherwise rejects
*
* @deprecated Use Notification.requestPermission() instead.
* https://developer.mozilla.org/en-US/docs/Web/API/Notification/requestPermission
*/
requestPermission(): Promise<void>;
/**
* This method allows a developer to override the default service worker and
* instead use a custom service worker.
*
* @param registration The service worker registration that should be used to
* receive the push messages.
*/
useServiceWorker(registration: ServiceWorkerRegistration): void;
/**
* This method allows a developer to override the default vapid key
* and instead use a custom VAPID public key.
*
* @param publicKey A URL safe base64 encoded string.
*/
usePublicVapidKey(publicKey: string): void;
/**
* @export
* @param nextOrObserver An observer object or a function triggered on
* message.
* @param error A function triggered on message error.
* @param completed function triggered when the observer is removed.
* @return The unsubscribe function for the observer.
*/
onMessage(nextOrObserver: NextFn<object> | Observer<object>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
/**
* @param nextOrObserver An observer object or a function triggered on token
* refresh.
* @param error A function triggered on token refresh error.
* @param completed function triggered when the observer is removed.
* @return The unsubscribe function for the observer.
*/
onTokenRefresh(nextOrObserver: NextFn<object> | Observer<object>, error?: ErrorFn, completed?: CompleteFn): Unsubscribe;
/**
* Given a registration, wait for the service worker it relates to
* become activer
* @param registration Registration to wait for service worker to become active
* @return Wait for service worker registration to become active
*/
waitForRegistrationToActivate_(registration: ServiceWorkerRegistration): Promise<ServiceWorkerRegistration>;
/**
* This will register the default service worker and return the registration
* @return The service worker registration to be used for the push service.
*/
getSWRegistration_(): Promise<ServiceWorkerRegistration>;
/**
* This will return the default VAPID key or the uint8array version of the public VAPID key
* provided by the developer.
*/
getPublicVapidKey_(): Promise<Uint8Array>;
/**
* This method will set up a message listener to handle
* events from the service worker that should trigger
* events in the page.
*/
setupSWMessageListener_(): void;
}

View File

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
export declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer | Uint8Array): string;

View File

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
export declare function base64ToArrayBuffer(base64String: string): Uint8Array;

View File

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2018 Google Inc.
*
* 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.
*/
export declare function isArrayBufferEqual(a: ArrayBufferLike | undefined | null, b: ArrayBufferLike | undefined | null): boolean;

View File

@ -0,0 +1,28 @@
/**
* @license
* Copyright 2018 Google Inc.
*
* 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.
*/
export interface NotificationDetails extends NotificationOptions {
title: string;
click_action?: string;
}
export interface FcmOptions {
link?: string;
}
export interface MessagePayload {
fcmOptions?: FcmOptions;
notification?: NotificationDetails;
data?: object;
}

View File

@ -0,0 +1,27 @@
/**
* @license
* Copyright 2018 Google Inc.
*
* 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.
*/
export interface TokenDetails {
fcmToken: string;
swScope: string;
vapidKey: Uint8Array;
fcmSenderId: string;
fcmPushSet: string;
endpoint: string;
auth: ArrayBufferLike;
p256dh: ArrayBufferLike;
createTime: number;
}

View File

@ -0,0 +1,20 @@
/**
* @license
* Copyright 2018 Google Inc.
*
* 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.
*/
export interface VapidDetails {
swScope: string;
vapidKey: Uint8Array;
}

View File

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
export declare function cleanV1(): void;

View File

@ -0,0 +1,49 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
export declare abstract class DbInterface {
private dbPromise;
protected abstract readonly dbName: string;
protected abstract readonly dbVersion: number;
protected abstract readonly objectStoreName: string;
/**
* Database initialization.
*
* This function should create and update object stores.
*/
protected abstract onDbUpgrade(request: IDBOpenDBRequest, event: IDBVersionChangeEvent): void;
/** Gets record(s) from the objectStore that match the given key. */
get<T>(key: IDBValidKey): Promise<T | undefined>;
/** Gets record(s) from the objectStore that match the given index. */
getIndex<T>(index: string, key: IDBValidKey): Promise<T | undefined>;
/** Assigns or overwrites the record for the given value. */
put(value: unknown): Promise<void>;
/** Deletes record(s) from the objectStore that match the given key. */
delete(key: IDBValidKey | IDBKeyRange): Promise<void>;
/**
* Close the currently open database.
*/
closeDatabase(): Promise<void>;
/**
* Creates an IndexedDB Transaction and passes its objectStore to the
* runRequest function, which runs the database request.
*
* @return Promise that resolves with the result of the runRequest function
*/
private createTransaction;
/** Gets the cached db connection or opens a new one. */
private getDb;
}

View File

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
export declare const DEFAULT_SW_PATH = "/firebase-messaging-sw.js";
export declare const DEFAULT_SW_SCOPE = "/firebase-cloud-messaging-push-scope";

View File

@ -0,0 +1,77 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { ErrorFactory, ErrorMap } from '@firebase/util';
export declare const enum ErrorCode {
AVAILABLE_IN_WINDOW = "only-available-in-window",
AVAILABLE_IN_SW = "only-available-in-sw",
SHOULD_BE_INHERITED = "should-be-overriden",
BAD_SENDER_ID = "bad-sender-id",
PERMISSION_DEFAULT = "permission-default",
PERMISSION_BLOCKED = "permission-blocked",
UNSUPPORTED_BROWSER = "unsupported-browser",
NOTIFICATIONS_BLOCKED = "notifications-blocked",
FAILED_DEFAULT_REGISTRATION = "failed-serviceworker-registration",
SW_REGISTRATION_EXPECTED = "sw-registration-expected",
GET_SUBSCRIPTION_FAILED = "get-subscription-failed",
INVALID_SAVED_TOKEN = "invalid-saved-token",
SW_REG_REDUNDANT = "sw-reg-redundant",
TOKEN_SUBSCRIBE_FAILED = "token-subscribe-failed",
TOKEN_SUBSCRIBE_NO_TOKEN = "token-subscribe-no-token",
TOKEN_SUBSCRIBE_NO_PUSH_SET = "token-subscribe-no-push-set",
TOKEN_UNSUBSCRIBE_FAILED = "token-unsubscribe-failed",
TOKEN_UPDATE_FAILED = "token-update-failed",
TOKEN_UPDATE_NO_TOKEN = "token-update-no-token",
USE_SW_BEFORE_GET_TOKEN = "use-sw-before-get-token",
INVALID_DELETE_TOKEN = "invalid-delete-token",
DELETE_TOKEN_NOT_FOUND = "delete-token-not-found",
DELETE_SCOPE_NOT_FOUND = "delete-scope-not-found",
BG_HANDLER_FUNCTION_EXPECTED = "bg-handler-function-expected",
NO_WINDOW_CLIENT_TO_MSG = "no-window-client-to-msg",
UNABLE_TO_RESUBSCRIBE = "unable-to-resubscribe",
NO_FCM_TOKEN_FOR_RESUBSCRIBE = "no-fcm-token-for-resubscribe",
FAILED_TO_DELETE_TOKEN = "failed-to-delete-token",
NO_SW_IN_REG = "no-sw-in-reg",
BAD_SCOPE = "bad-scope",
BAD_VAPID_KEY = "bad-vapid-key",
BAD_SUBSCRIPTION = "bad-subscription",
BAD_TOKEN = "bad-token",
BAD_PUSH_SET = "bad-push-set",
FAILED_DELETE_VAPID_KEY = "failed-delete-vapid-key",
INVALID_PUBLIC_VAPID_KEY = "invalid-public-vapid-key",
USE_PUBLIC_KEY_BEFORE_GET_TOKEN = "use-public-key-before-get-token",
PUBLIC_KEY_DECRYPTION_FAILED = "public-vapid-key-decryption-failed"
}
export declare const ERROR_MAP: ErrorMap<ErrorCode>;
interface ErrorParams {
[ErrorCode.FAILED_DEFAULT_REGISTRATION]: {
browserErrorMessage: string;
};
[ErrorCode.TOKEN_SUBSCRIBE_FAILED]: {
errorInfo: string;
};
[ErrorCode.TOKEN_UNSUBSCRIBE_FAILED]: {
errorInfo: string;
};
[ErrorCode.TOKEN_UPDATE_FAILED]: {
errorInfo: string;
};
[ErrorCode.UNABLE_TO_RESUBSCRIBE]: {
errorInfo: string;
};
}
export declare const errorFactory: ErrorFactory<ErrorCode, ErrorParams>;
export {};

View File

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
export declare const DEFAULT_PUBLIC_VAPID_KEY: Uint8Array;
export declare const SUBSCRIPTION_DETAILS: {
userVisibleOnly: boolean;
applicationServerKey: Uint8Array;
};
export declare const ENDPOINT = "https://fcm.googleapis.com";

View File

@ -0,0 +1,31 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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.
*/
export interface IidDetails {
token: string;
pushSet: string;
}
export declare class IidModel {
getToken(senderId: string, subscription: PushSubscription, publicVapidKey: Uint8Array): Promise<IidDetails>;
/**
* Update the underlying token details for fcmToken.
*/
updateToken(senderId: string, fcmToken: string, fcmPushSet: string, subscription: PushSubscription, publicVapidKey: Uint8Array): Promise<string>;
/**
* Given a fcmToken, pushSet and messagingSenderId, delete an FCM token.
*/
deleteToken(senderId: string, fcmToken: string, fcmPushSet: string): Promise<void>;
}

View File

@ -0,0 +1,48 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { TokenDetails } from '../interfaces/token-details';
import { DbInterface } from './db-interface';
export declare class TokenDetailsModel extends DbInterface {
protected readonly dbName: string;
protected readonly dbVersion: number;
protected readonly objectStoreName: string;
protected onDbUpgrade(request: IDBOpenDBRequest, event: IDBVersionChangeEvent): void;
/**
* Given a token, this method will look up the details in indexedDB.
*/
getTokenDetailsFromToken(fcmToken: string): Promise<TokenDetails | undefined>;
/**
* Given a service worker scope, this method will look up the details in
* indexedDB.
* @return The details associated with that token.
*/
getTokenDetailsFromSWScope(swScope: string): Promise<TokenDetails | undefined>;
/**
* Save the details for the fcm token for re-use at a later date.
* @param input A plain js object containing args to save.
*/
saveTokenDetails(tokenDetails: TokenDetails): Promise<void>;
/**
* This method deletes details of the current FCM token.
* It's returning a promise in case we need to move to an async
* method for deleting at a later date.
*
* @return Resolves once the FCM token details have been deleted and returns
* the deleted details.
*/
deleteToken(token: string): Promise<TokenDetails>;
}

View File

@ -0,0 +1,38 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { DbInterface } from './db-interface';
export declare class VapidDetailsModel extends DbInterface {
protected readonly dbName: string;
protected readonly dbVersion: number;
protected readonly objectStoreName: string;
protected onDbUpgrade(request: IDBOpenDBRequest): void;
/**
* Given a service worker scope, this method will look up the vapid key
* in indexedDB.
*/
getVapidFromSWScope(swScope: string): Promise<Uint8Array | undefined>;
/**
* Save a vapid key against a swScope for later date.
*/
saveVapidDetails(swScope: string, vapidKey: Uint8Array): Promise<void>;
/**
* This method deletes details of the current FCM VAPID key for a SW scope.
* Resolves once the scope/vapid details have been deleted and returns the
* deleted vapid key.
*/
deleteVapidDetails(swScope: string): Promise<Uint8Array>;
}

View File

@ -0,0 +1,29 @@
/**
* @license
* Copyright 2017 Google Inc.
*
* 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 { MessagePayload } from '../interfaces/message-payload';
export declare enum MessageParameter {
TYPE_OF_MSG = "firebase-messaging-msg-type",
DATA = "firebase-messaging-msg-data"
}
export declare enum MessageType {
PUSH_MSG_RECEIVED = "push-msg-received",
NOTIFICATION_CLICKED = "notification-clicked"
}
export interface InternalMessage {
[MessageParameter.TYPE_OF_MSG]: MessageType;
[MessageParameter.DATA]: MessagePayload;
}

100
node_modules/@firebase/messaging/package.json generated vendored Normal file
View File

@ -0,0 +1,100 @@
{
"_from": "@firebase/messaging@0.4.10",
"_id": "@firebase/messaging@0.4.10",
"_inBundle": false,
"_integrity": "sha512-WqtSqlulV2ix4MZ3r1HwGAEj0DiEWtpNCSPh5wOXZsj8Kd01Q2QPTLUtUWmwXSV9WCQWnowfE2x8wjq5388ixw==",
"_location": "/@firebase/messaging",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@firebase/messaging@0.4.10",
"name": "@firebase/messaging",
"escapedName": "@firebase%2fmessaging",
"scope": "@firebase",
"rawSpec": "0.4.10",
"saveSpec": null,
"fetchSpec": "0.4.10"
},
"_requiredBy": [
"/firebase"
],
"_resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.4.10.tgz",
"_shasum": "a4bfcab558bd4480d14331f8b9e1e7106731fe58",
"_spec": "@firebase/messaging@0.4.10",
"_where": "C:\\Users\\matia\\Documents\\GitHub\\FutoX-Musix\\node_modules\\firebase",
"author": {
"name": "Firebase",
"email": "firebase-support@google.com",
"url": "https://firebase.google.com/"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"bundleDependencies": false,
"dependencies": {
"@firebase/messaging-types": "0.3.2",
"@firebase/util": "0.2.27",
"tslib": "1.10.0"
},
"deprecated": false,
"description": "This is the Firebase Cloud Messaging component of the Firebase JS SDK.",
"devDependencies": {
"@types/chai": "4.2.0",
"@types/mocha": "5.2.7",
"@types/sinon": "7.0.13",
"@typescript-eslint/eslint-plugin": "2.0.0",
"@typescript-eslint/eslint-plugin-tslint": "2.0.0",
"@typescript-eslint/parser": "2.0.0",
"chai": "4.2.0",
"eslint": "5.16.0",
"eslint-plugin-import": "2.18.2",
"karma": "4.3.0",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-firefox-launcher": "1.2.0",
"karma-mocha": "1.3.0",
"karma-safari-launcher": "1.0.0",
"karma-sauce-launcher": "1.2.0",
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.32",
"mocha": "6.2.0",
"npm-run-all": "4.1.5",
"rollup": "1.20.3",
"rollup-plugin-typescript2": "0.24.0",
"sinon": "7.4.1",
"tslint": "5.19.0",
"typescript": "3.5.3"
},
"esm2017": "dist/index.esm2017.js",
"files": [
"dist"
],
"homepage": "https://github.com/firebase/firebase-js-sdk#readme",
"license": "Apache-2.0",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"name": "@firebase/messaging",
"peerDependencies": {
"@firebase/app": "0.x",
"@firebase/app-types": "0.x"
},
"repository": {
"directory": "packages/messaging",
"type": "git",
"url": "git+https://github.com/firebase/firebase-js-sdk.git"
},
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"lint": "eslint -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
"prepare": "yarn build",
"test": "run-p test:karma type-check lint",
"test:debug": "karma start --browsers=Chrome --auto-watch",
"test:karma": "karma start --single-run",
"type-check": "tsc --noEmit"
},
"typings": "dist/index.d.ts",
"version": "0.4.10"
}