Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

workers-firebase

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workers-firebase - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

dist/auth/types.d.ts.map

84

dist/auth/types.d.ts

@@ -1,60 +0,52 @@

export interface TokenPayload {
// Custom data
user_id: string;
name: string;
email: string;
email_verified: boolean;
iss: string; // Issuer
aud: string; // Audience
auth_time: string; // Time when auth occurred
sub: string; // Subject (uid)
iat: number; // Issued At
exp: number; // Expiration
user_id: string;
name: string;
email: string;
email_verified: boolean;
iss: string;
aud: string;
auth_time: string;
sub: string;
iat: number;
exp: number;
}
export interface TokenResponse {
user_id: string;
id_token: string;
refresh_token: string;
user_id: string;
id_token: string;
refresh_token: string;
}
export interface SignInFirebaseResponse {
idToken: string; // A Firebase Auth ID token for the authenticated user.
email: string; // The email for the authenticated user.
refreshToken: string; // A Firebase Auth refresh token for the authenticated user.
expiresIn: string; // The number of seconds in which the ID token expires.
localId: string; // The uid of the authenticated user.
idToken: string;
email: string;
refreshToken: string;
expiresIn: string;
localId: string;
}
export interface Tokens {
idToken: string; // A Firebase Auth ID token for the authenticated user.
refreshToken: string; // A Firebase Auth refresh token for the authenticated user.
customToken?: string; // Signin by token token.
idToken: string;
refreshToken: string;
customToken?: string;
}
export interface SignInResponse {
user: User;
tokens: Tokens;
user: User;
tokens: Tokens;
}
export interface RequestCode {
requestType: string;
email?: string;
idToken?: string;
requestType: string;
email?: string;
idToken?: string;
}
export interface User {
uid: string;
name: string;
email: string;
emailVerified: boolean;
photoUrl: string;
passwordUpdatedAt: number;
validSince: number;
claims: Record<string, any>;
disabled: boolean;
lastLoginAt: number;
createdAt: number;
uid: string;
name: string;
email: string;
emailVerified: boolean;
photoUrl: string;
passwordUpdatedAt: number;
validSince: number;
claims: Record<string, any>;
disabled: boolean;
lastLoginAt: number;
createdAt: number;
}
//# sourceMappingURL=types.d.ts.map

@@ -5,4 +5,5 @@ /**

*/
export type DocumentData = {[field: string]: any};
export declare type DocumentData = {
[field: string]: any;
};
/**

@@ -12,10 +13,5 @@ * Similar to Typescript's `Partial<T>`, but allows nested fields to be

*/
export type PartialWithFieldValue<T> =
| Partial<T>
| (T extends Primitive
? T
: T extends {}
? {[K in keyof T]?: PartialWithFieldValue<T[K]> | FieldValue}
: never);
export declare type PartialWithFieldValue<T> = Partial<T> | (T extends Primitive ? T : T extends {} ? {
[K in keyof T]?: PartialWithFieldValue<T[K]> | FieldValue;
} : never);
/**

@@ -25,10 +21,5 @@ * Allows FieldValues to be passed in as a property value while maintaining

*/
export type WithFieldValue<T> =
| T
| (T extends Primitive
? T
: T extends {}
? {[K in keyof T]: WithFieldValue<T[K]> | FieldValue}
: never);
export declare type WithFieldValue<T> = T | (T extends Primitive ? T : T extends {} ? {
[K in keyof T]: WithFieldValue<T[K]> | FieldValue;
} : never);
/**

@@ -48,11 +39,7 @@ * Update data (for use with [update]{@link DocumentReference#update})

*/
export type UpdateData<T> = T extends Primitive
? T
: T extends {}
? {[K in keyof T]?: UpdateData<T[K]> | FieldValue} & NestedUpdateFields<T>
: Partial<T>;
export declare type UpdateData<T> = T extends Primitive ? T : T extends {} ? {
[K in keyof T]?: UpdateData<T[K]> | FieldValue;
} & NestedUpdateFields<T> : Partial<T>;
/** Primitive types. */
export type Primitive = string | number | boolean | undefined | null;
export declare type Primitive = string | number | boolean | undefined | null;
/**

@@ -63,9 +50,5 @@ * For each field (e.g. 'bar'), find all nested keys (e.g. {'bar.baz': T1,

*/
export type NestedUpdateFields<T extends Record<string, unknown>> =
UnionToIntersection<
{
[K in keyof T & string]: ChildUpdateFields<K, T[K]>;
}[keyof T & string] // Also include the generated prefix-string keys.
>;
export declare type NestedUpdateFields<T extends Record<string, unknown>> = UnionToIntersection<{
[K in keyof T & string]: ChildUpdateFields<K, T[K]>;
}[keyof T & string]>;
/**

@@ -81,11 +64,3 @@ * Helper for calculating the nested fields for a given type T1. This is needed

*/
export type ChildUpdateFields<K extends string, V> =
// Only allow nesting for map values
V extends Record<string, unknown>
? // Recurse into the map and add the prefix in front of each key
// (e.g. Prefix 'bar.' to create: 'bar.baz' and 'bar.qux'.
AddPrefixToKeys<K, UpdateData<V>>
: // UpdateData is always a map of values.
never;
export declare type ChildUpdateFields<K extends string, V> = V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never;
/**

@@ -95,9 +70,5 @@ * Returns a new map where every key is prefixed with the outer key appended

*/
export type AddPrefixToKeys<
Prefix extends string,
T extends Record<string, unknown>
> =
// Remap K => Prefix.K. See https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#key-remapping-via-as
{[K in keyof T & string as `${Prefix}.${K}`]+?: T[K]};
export declare type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
[K in keyof T & string as `${Prefix}.${K}`]+?: T[K];
};
/**

@@ -113,360 +84,279 @@ * Given a union type `U = T1 | T2 | ...`, returns an intersected type

*/
export type UnionToIntersection<U> = (
U extends unknown ? (k: U) => void : never
) extends (k: infer I) => void
? I
: never;
export class FieldValue {
private constructor();
/**
* Returns a sentinel used with set(), create() or update() to include a
* server-generated timestamp in the written data.
*
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
static serverTimestamp(): FieldValue;
/**
* Returns a sentinel for use with update() or set() with {merge:true} to
* mark a field for deletion.
*
* @return The FieldValue sentinel for use in a call to set() or update().
*/
static delete(): FieldValue;
/**
* Returns a special value that can be used with set(), create() or update()
* that tells the server to increment the field's current value by the given
* value.
*
* If either current field value or the operand uses floating point
* precision, both values will be interpreted as floating point numbers and
* all arithmetic will follow IEEE 754 semantics. Otherwise, integer
* precision is kept and the result is capped between -2^63 and 2^63-1.
*
* If the current field value is not of type 'number', or if the field does
* not yet exist, the transformation will set the field to the given value.
*
* @param n The value to increment by.
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
static increment(n: number): FieldValue;
/**
* Returns a special value that can be used with set(), create() or update()
* that tells the server to union the given elements with any array value
* that already exists on the server. Each specified element that doesn't
* already exist in the array will be added to the end. If the field being
* modified is not already an array it will be overwritten with an array
* containing exactly the specified elements.
*
* @param elements The elements to union into the array.
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
static arrayUnion(...elements: any[]): FieldValue;
/**
* Returns a special value that can be used with set(), create() or update()
* that tells the server to remove the given elements from any array value
* that already exists on the server. All instances of each element
* specified will be removed from the array. If the field being modified is
* not already an array it will be overwritten with an empty array.
*
* @param elements The elements to remove from the array.
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
static arrayRemove(...elements: any[]): FieldValue;
/**
* Returns true if this `FieldValue` is equal to the provided one.
*
* @param other The `FieldValue` to compare against.
* @return true if this `FieldValue` is equal to the provided one.
*/
isEqual(other: FieldValue): boolean;
}
export type SetOptions = { readonly merge?: boolean };
export type WhereFilterOp =
| '<'
| '<='
| '=='
| '!='
| '>='
| '>'
| 'array-contains'
| 'in'
| 'not-in'
| 'array-contains-any';
export type OrderByDirection = 'desc' | 'asc';
export declare type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
export declare type FieldValue = {
/**
* Returns a sentinel used with set(), create() or update() to include a
* server-generated timestamp in the written data.
*
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
serverTimestamp(): FieldValue;
/**
* Returns a sentinel for use with update() or set() with {merge:true} to
* mark a field for deletion.
*
* @return The FieldValue sentinel for use in a call to set() or update().
*/
delete(): FieldValue;
/**
* Returns a special value that can be used with set(), create() or update()
* that tells the server to increment the field's current value by the given
* value.
*
* If either current field value or the operand uses floating point
* precision, both values will be interpreted as floating point numbers and
* all arithmetic will follow IEEE 754 semantics. Otherwise, integer
* precision is kept and the result is capped between -2^63 and 2^63-1.
*
* If the current field value is not of type 'number', or if the field does
* not yet exist, the transformation will set the field to the given value.
*
* @param n The value to increment by.
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
increment(n: number): FieldValue;
/**
* Returns a special value that can be used with set(), create() or update()
* that tells the server to union the given elements with any array value
* that already exists on the server. Each specified element that doesn't
* already exist in the array will be added to the end. If the field being
* modified is not already an array it will be overwritten with an array
* containing exactly the specified elements.
*
* @param elements The elements to union into the array.
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
arrayUnion(...elements: any[]): FieldValue;
/**
* Returns a special value that can be used with set(), create() or update()
* that tells the server to remove the given elements from any array value
* that already exists on the server. All instances of each element
* specified will be removed from the array. If the field being modified is
* not already an array it will be overwritten with an empty array.
*
* @param elements The elements to remove from the array.
* @return The FieldValue sentinel for use in a call to set(), create() or
* update().
*/
arrayRemove(...elements: any[]): FieldValue;
};
export declare type SetOptions = {
readonly merge?: boolean;
};
export declare type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'not-in' | 'array-contains-any';
export declare type OrderByDirection = 'desc' | 'asc';
export interface ReadTransactionOptions {
transaction?: string;
readTime?: string;
transaction?: string;
readTime?: string;
}
export interface ReadOptions {
readonly fieldMask?: string[];
readonly fieldMask?: string[];
}
export interface ConsistencyOptions {
transaction?: string;
newTransaction?: api.TransactionOptions;
readTime?: string;
}
export namespace api {
interface FieldsMapValue {
fields: MapValue;
}
interface Value {
nullValue?: null;
booleanValue?: boolean;
integerValue?: string;
doubleValue?: number;
timestampValue?: string;
stringValue?: string;
bytesValue?: string;
referenceValue?: string;
geoPointValue?: LatLng;
arrayValue?: ArrayValue;
mapValue?: FieldsMapValue;
}
interface ArrayValue {
values: Value[];
}
interface MapValue {
[key: string]: Value;
}
interface LatLng {
latitude: number;
longitude: number;
}
interface BatchGetRequest {
documents: string[];
mask?: DocumentMask;
// Union field consistency_selector can be only one of the following:
transaction?: string;
newTransaction?: TransactionOptions;
newTransaction?: api.TransactionOptions;
readTime?: string;
// End of list of possible types for union field consistency_selector.
}
interface BatchGetResponse {
transaction?: string,
readTime: string,
found?: Document;
missing?: string;
}
interface BatchWriteRequest {
writes: Write[];
labels?: {[key: string]: string};
}
interface BatchWriteResponse {
writeResults: WriteResult[];
status: Status[];
}
interface BeginTransactionRequest {
options: TransactionOptions;
}
interface BeginTransactionResponse {
transaction: string;
}
interface CommitRequest {
writes: Write[];
transaction: string;
}
interface CommitResponse {
writeResults: WriteResult[];
commitTime: string;
}
interface Write {
updateMask?: DocumentMask;
updateTransforms?: FieldTransform[];
currentDocument?: Precondition;
// Union field operation can be only one of the following:
update?: Document;
delete?: string;
transform?: DocumentTransform;
// End of list of possible types for union field operation.
}
interface FieldTransform {
fieldPath: string;
// Union field transform_type can be only one of the following:
setToServerValue?: ServerValue;
increment?: Value;
maximum?: Value;
minimum?: Value;
appendMissingElements?: ArrayValue;
removeAllFromArray?: ArrayValue;
// End of list of possible types for union field transform_type.
}
interface FieldReference {
fieldPath?: string;
}
interface Filter {
compositeFilter?: CompositeFilter;
fieldFilter?: FieldFilter;
unaryFilter?: UnaryFilter;
}
interface CompositeFilter {
op?: CompositeFilterOperator;
filters?: Filter[];
}
interface FieldFilter {
field?: FieldReference;
op?: FieldFilterOperator;
value?: Value;
}
interface UnaryFilter {
op?: UnaryFilterOperator;
field?: FieldReference;
}
interface CollectionSelector {
collectionId: string,
allDescendants?: boolean
}
interface Cursor {
values: Value[];
before?: boolean;
}
interface StructuredQuery {
select?: StructuredQueryProjection;
from?: [CollectionSelector],
where?: Filter;
orderBy?: StructuredQueryOrder[],
startAt?: Cursor;
endAt?: Cursor;
offset?: number;
limit?: number;
}
interface StructuredQueryOrder {
field?: FieldReference;
direction?: StructuredQueryDirection;
}
interface StructuredQueryProjection {
fields?: FieldReference[];
}
interface StructuredQueryOrder {
field?: FieldReference;
direction?: StructuredQueryDirection;
}
type CompositeFilterOperator = 'OPERATOR_UNSPECIFIED'| 'AND';
type FieldFilterOperator = 'OPERATOR_UNSPECIFIED'| 'LESS_THAN'| 'LESS_THAN_OR_EQUAL'| 'GREATER_THAN'| 'GREATER_THAN_OR_EQUAL'| 'EQUAL'| 'NOT_EQUAL'| 'ARRAY_CONTAINS'| 'IN'| 'ARRAY_CONTAINS_ANY'| 'NOT_IN';
type UnaryFilterOperator = 'OPERATOR_UNSPECIFIED'| 'IS_NAN'| 'IS_NULL'| 'IS_NOT_NAN'| 'IS_NOT_NULL';
type StructuredQueryDirection = 'DIRECTION_UNSPECIFIED'| 'ASCENDING'| 'DESCENDING';
enum ServerValue {
SERVER_VALUE_UNSPECIFIED = 'SERVER_VALUE_UNSPECIFIED',
REQUEST_TIME = 'REQUEST_TIME',
}
interface Document {
name: string,
fields: MapValue,
createTime?: string,
updateTime?: string
}
interface DocumentMask {
fieldPaths: string[];
}
interface TransactionOptions {
// Union field mode can be only one of the following:
readOnly?: ReadOnly;
readWrite?: ReadWrite;
// End of list of possible types for union field mode.
}
interface ReadOnly {
readTime: string;
}
interface ReadWrite {
retryTransaction: string;
}
interface Precondition {
// Union field condition_type can be only one of the following:
exists?: boolean;
updateTime?: string;
// End of list of possible types for union field condition_type.
}
interface DocumentTransform {
document: string;
fieldTransforms: FieldTransform[];
}
interface WriteResult {
updateTime?: string;
transformResults?: Value[];
}
interface ListCollectionIdsResponse {
collectionIds: string[];
nextPageToken?: string;
}
interface ListDocumentsResponse {
documents: Document[];
nextPageToken?: string;
}
interface RunQueryResponse {
error?: { code: number; message: string; status: string; };
transaction?: string;
document?: Document;
readTime: string;
skippedResults?: number;
done?: boolean;
}
interface Status {
code: number;
message: string;
details:{
'@type': string;
[key: string]: any;
}[];
}
}
export declare namespace api {
interface FieldsMapValue {
fields: MapValue;
}
interface Value {
nullValue?: null;
booleanValue?: boolean;
integerValue?: string;
doubleValue?: number;
timestampValue?: string;
stringValue?: string;
bytesValue?: string;
referenceValue?: string;
geoPointValue?: LatLng;
arrayValue?: ArrayValue;
mapValue?: FieldsMapValue;
}
interface ArrayValue {
values: Value[];
}
interface MapValue {
[key: string]: Value;
}
interface LatLng {
latitude: number;
longitude: number;
}
interface BatchGetRequest {
documents: string[];
mask?: DocumentMask;
transaction?: string;
newTransaction?: TransactionOptions;
readTime?: string;
}
interface BatchGetResponse {
transaction?: string;
readTime: string;
found?: Document;
missing?: string;
}
interface BatchWriteRequest {
writes: Write[];
labels?: {
[key: string]: string;
};
}
interface BatchWriteResponse {
writeResults: WriteResult[];
status: Status[];
}
interface BeginTransactionRequest {
options: TransactionOptions;
}
interface BeginTransactionResponse {
transaction: string;
}
interface CommitRequest {
writes: Write[];
transaction: string;
}
interface CommitResponse {
writeResults: WriteResult[];
commitTime: string;
}
interface Write {
updateMask?: DocumentMask;
updateTransforms?: FieldTransform[];
currentDocument?: Precondition;
update?: Document;
delete?: string;
transform?: DocumentTransform;
}
interface FieldTransform {
fieldPath: string;
setToServerValue?: ServerValue;
increment?: Value;
maximum?: Value;
minimum?: Value;
appendMissingElements?: ArrayValue;
removeAllFromArray?: ArrayValue;
}
interface FieldReference {
fieldPath?: string;
}
interface Filter {
compositeFilter?: CompositeFilter;
fieldFilter?: FieldFilter;
unaryFilter?: UnaryFilter;
}
interface CompositeFilter {
op?: CompositeFilterOperator;
filters?: Filter[];
}
interface FieldFilter {
field?: FieldReference;
op?: FieldFilterOperator;
value?: Value;
}
interface UnaryFilter {
op?: UnaryFilterOperator;
field?: FieldReference;
}
interface CollectionSelector {
collectionId: string;
allDescendants?: boolean;
}
interface Cursor {
values: Value[];
before?: boolean;
}
interface StructuredQuery {
select?: StructuredQueryProjection;
from?: [CollectionSelector];
where?: Filter;
orderBy?: StructuredQueryOrder[];
startAt?: Cursor;
endAt?: Cursor;
offset?: number;
limit?: number;
}
interface StructuredQueryOrder {
field?: FieldReference;
direction?: StructuredQueryDirection;
}
interface StructuredQueryProjection {
fields?: FieldReference[];
}
interface StructuredQueryOrder {
field?: FieldReference;
direction?: StructuredQueryDirection;
}
type CompositeFilterOperator = 'OPERATOR_UNSPECIFIED' | 'AND';
type FieldFilterOperator = 'OPERATOR_UNSPECIFIED' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'EQUAL' | 'NOT_EQUAL' | 'ARRAY_CONTAINS' | 'IN' | 'ARRAY_CONTAINS_ANY' | 'NOT_IN';
type UnaryFilterOperator = 'OPERATOR_UNSPECIFIED' | 'IS_NAN' | 'IS_NULL' | 'IS_NOT_NAN' | 'IS_NOT_NULL';
type StructuredQueryDirection = 'DIRECTION_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
enum ServerValue {
SERVER_VALUE_UNSPECIFIED = "SERVER_VALUE_UNSPECIFIED",
REQUEST_TIME = "REQUEST_TIME"
}
interface Document {
name: string;
fields: MapValue;
createTime?: string;
updateTime?: string;
}
interface DocumentMask {
fieldPaths: string[];
}
interface TransactionOptions {
readOnly?: ReadOnly;
readWrite?: ReadWrite;
}
interface ReadOnly {
readTime: string;
}
interface ReadWrite {
retryTransaction: string;
}
interface Precondition {
exists?: boolean;
updateTime?: string;
}
interface DocumentTransform {
document: string;
fieldTransforms: FieldTransform[];
}
interface WriteResult {
updateTime?: string;
transformResults?: Value[];
}
interface ListCollectionIdsResponse {
collectionIds: string[];
nextPageToken?: string;
}
interface ListDocumentsResponse {
documents: Document[];
nextPageToken?: string;
}
interface RunQueryResponse {
error?: {
code: number;
message: string;
status: string;
};
transaction?: string;
document?: Document;
readTime: string;
skippedResults?: number;
done?: boolean;
}
interface Status {
code: number;
message: string;
details: {
'@type': string;
[key: string]: any;
}[];
}
}
//# sourceMappingURL=types.d.ts.map
export * from './auth/types';
export * from './firestore/types';
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
export type TokenGetter = (claims?: object) => Promise<string>;
export declare type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
export declare type TokenGetter = (claims?: object) => Promise<string>;
export interface ServiceAccount {
projectId: string;
databaseId?: string;
privateKeyId: string;
privateKey: string;
clientEmail: string;
clientId: string;
projectId: string;
databaseId?: string;
privateKeyId: string;
privateKey: string;
clientEmail: string;
clientId: string;
}
export interface UserAccount {
getToken: TokenGetter;
projectId: string;
databaseId?: string;
getToken: TokenGetter;
projectId: string;
databaseId?: string;
}
export type Settings = ServiceAccount | UserAccount;
export declare type Settings = ServiceAccount | UserAccount;
//# sourceMappingURL=types.d.ts.map
{
"name": "workers-firebase",
"version": "0.0.9",
"version": "0.0.10",
"scripts": {
"start": "tsc --watch",
"build": "tsc && copyfiles -u 1 \"src/**/*.d.ts\" dist",
"build": "tsc",
"prepare": "npm run build"

@@ -16,5 +16,4 @@ },

"@cloudflare/workers-types": "^3.4.0",
"copyfiles": "^2.4.1",
"typescript": "^4.6.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc