New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

workers-firebase

Package Overview
Dependencies
Maintainers
2
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.23 to 0.0.24

src/test.ts

6

dist/auth/types.d.ts

@@ -54,5 +54,5 @@ export interface TokenPayload {

}
export type AccountQuerySort = 'SORT_BY_FIELD_UNSPECIFIED' | 'USER_ID' | 'NAME' | 'CREATED_AT' | 'LAST_LOGIN_AT' | 'USER_EMAIL';
export type AccountQueryOrder = 'ORDER_UNSPECIFIED' | 'ASC' | 'DESC';
export type AccountQueryExpression = {
export declare type AccountQuerySort = 'SORT_BY_FIELD_UNSPECIFIED' | 'USER_ID' | 'NAME' | 'CREATED_AT' | 'LAST_LOGIN_AT' | 'USER_EMAIL';
export declare type AccountQueryOrder = 'ORDER_UNSPECIFIED' | 'ASC' | 'DESC';
export declare type AccountQueryExpression = {
email: string;

@@ -59,0 +59,0 @@ } | {

@@ -20,5 +20,5 @@ import { api } from './types';

enterField(field: string): void;
leaveField(): void;
leaveField(addMask: boolean): void;
removeField(): void;
}
//# sourceMappingURL=field-value.d.ts.map
import { encodeValue } from './serializer';
export class FieldValue {
constructor(transform, value) {
this.transform = transform;
this.value = value;
}
static serverTimestamp() {

@@ -21,6 +25,2 @@ return new FieldValue('setToServerValue', 'REQUEST_TIME');

}
constructor(transform, value) {
this.transform = transform;
this.value = value;
}
encode(fieldPath) {

@@ -42,5 +42,6 @@ const value = fieldPath === 'setToServerValue' ? this.value : encodeValue(this.value);

this.paths.push(field);
this.mask.fieldPaths.push(this.paths.join('.'));
}
leaveField() {
leaveField(addMask) {
if (addMask)
this.mask.fieldPaths.push(this.paths.join('.'));
this.paths.pop();

@@ -47,0 +48,0 @@ }

/// <reference types="@cloudflare/workers-types" />
import type { Settings, HTTPMethod } from '../types';
import type { api, ConsistencyOptions } from './types';
import { FirebaseService } from '../service';
import type { HTTPMethod, Settings } from '../types';
import { DocumentSnapshot } from './document';
import { CollectionReference, DocumentReference } from './reference';
import { DocumentSnapshot } from './document';
import { transactionSymbol, writesSymbol } from './symbols';
import type { ConsistencyOptions, api } from './types';
import { WriteBatch } from './write-batch';
import { FirebaseService } from '../service';
import { transactionSymbol, writesSymbol } from './symbols';
export declare class Firestore extends FirebaseService {
basePath: string;
getToken: () => Promise<string>;
[transactionSymbol]: string;

@@ -13,0 +12,0 @@ [writesSymbol]: api.Write[];

var _a, _b;
import { createId } from 'crypto-id';
import { FirebaseService } from '../service';
import { DocumentSnapshot } from './document';
import { CollectionReference, DocumentReference } from './reference';
import { DocumentSnapshot } from './document';
import { transactionSymbol, writesSymbol } from './symbols';
import { WriteBatch } from './write-batch';
import { FirebaseService } from '../service';
import { transactionSymbol, writesSymbol } from './symbols';
import { createId } from 'crypto-id';
export class Firestore extends FirebaseService {

@@ -9,0 +9,0 @@ constructor(settings, apiKey) {

@@ -1,4 +0,4 @@

import type { api, DocumentData } from './types';
import { UpdateCollector } from './field-value';
import { Firestore } from './firestore';
import type { DocumentData, api } from './types';
export declare function encode(map: DocumentData, collector?: UpdateCollector): api.MapValue;

@@ -5,0 +5,0 @@ export declare function encodeValue(value: any, collector?: UpdateCollector): any;

@@ -10,3 +10,4 @@ import { FieldValue } from './field-value';

fields[key] = encodeValue(value, collector);
collector?.leaveField();
const shouldAddMask = !fields[key] || !(fields[key].arrayValue || fields[key].mapValue);
collector?.leaveField(shouldAddMask);
});

@@ -41,5 +42,5 @@ return fields;

if (Array.isArray(value))
return { arrayValue: { values: value.map(v => encodeValue(v)) } };
return { arrayValue: { values: value.map(v => encodeValue(v, collector)) } };
if (typeof value === 'object')
return { mapValue: { fields: encode(value) } };
return { mapValue: { fields: encode(value, collector) } };
throw new Error(`Unsupported value type: ${typeof value}`);

@@ -46,0 +47,0 @@ }

@@ -5,3 +5,3 @@ /**

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

@@ -13,3 +13,3 @@ };

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

@@ -21,3 +21,3 @@ } : never);

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

@@ -39,7 +39,7 @@ } : never);

*/
export type UpdateData<T> = T extends Primitive ? T : T extends {} ? {
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;
/**

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

*/
export type NestedUpdateFields<T extends Record<string, unknown>> = UnionToIntersection<{
export declare type NestedUpdateFields<T extends Record<string, unknown>> = UnionToIntersection<{
[K in keyof T & string]: ChildUpdateFields<K, T[K]>;

@@ -64,3 +64,3 @@ }[keyof T & string]>;

*/
export type ChildUpdateFields<K extends string, V> = V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never;
export declare type ChildUpdateFields<K extends string, V> = V extends Record<string, unknown> ? AddPrefixToKeys<K, UpdateData<V>> : never;
/**

@@ -70,3 +70,3 @@ * 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>> = {
export declare type AddPrefixToKeys<Prefix extends string, T extends Record<string, unknown>> = {
[K in keyof T & string as `${Prefix}.${K}`]+?: T[K];

@@ -84,4 +84,4 @@ };

*/
export type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
export type FieldValue = {
export declare type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
export declare type FieldValue = {
/**

@@ -146,7 +146,7 @@ * Returns a sentinel used with set(), create() or update() to include a

};
export type SetOptions = {
export declare type SetOptions = {
readonly merge?: boolean;
};
export type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'not-in' | 'array-contains-any';
export type OrderByDirection = 'desc' | 'asc';
export declare type WhereFilterOp = '<' | '<=' | '==' | '!=' | '>=' | '>' | 'array-contains' | 'in' | 'not-in' | 'array-contains-any';
export declare type OrderByDirection = 'desc' | 'asc';
export interface ReadTransactionOptions {

@@ -153,0 +153,0 @@ transaction?: string;

@@ -1,5 +0,5 @@

import type { api, DocumentData, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue } from './types';
import { Firestore } from './firestore';
import { DocumentReference } from './reference';
import { updateSymbol, writesSymbol } from './symbols';
import type { DocumentData, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue, api } from './types';
export declare class WriteBatch {

@@ -6,0 +6,0 @@ readonly firestore: Firestore;

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 {

@@ -18,3 +18,3 @@ projectId: string;

}
export type Settings = ServiceAccount | UserAccount;
export declare type Settings = ServiceAccount | UserAccount;
//# sourceMappingURL=types.d.ts.map
{
"name": "workers-firebase",
"version": "0.0.23",
"version": "0.0.24",
"scripts": {

@@ -5,0 +5,0 @@ "start": "tsc --watch",

@@ -49,6 +49,6 @@ import { encodeValue } from './serializer';

this.paths.push(field);
this.mask.fieldPaths.push(this.paths.join('.'));
}
leaveField() {
leaveField(addMask: boolean) {
if (addMask) this.mask.fieldPaths.push(this.paths.join('.'));
this.paths.pop();

@@ -55,0 +55,0 @@ }

@@ -1,9 +0,9 @@

import type { Settings, HTTPMethod } from '../types';
import type { api, ConsistencyOptions } from './types';
import { createId } from 'crypto-id';
import { FirebaseService } from '../service';
import type { HTTPMethod, Settings } from '../types';
import { DocumentSnapshot } from './document';
import { CollectionReference, DocumentReference } from './reference';
import { DocumentSnapshot } from './document';
import { transactionSymbol, writesSymbol } from './symbols';
import type { ConsistencyOptions, api } from './types';
import { WriteBatch } from './write-batch';
import { FirebaseService } from '../service';
import { transactionSymbol, writesSymbol } from './symbols';
import { createId } from 'crypto-id';

@@ -13,3 +13,2 @@

basePath: string;
getToken: () => Promise<string>;
[transactionSymbol]: string = undefined;

@@ -16,0 +15,0 @@ [writesSymbol]: api.Write[] = undefined;

@@ -1,5 +0,5 @@

import type { api, DocumentData } from './types';
import { FieldValue, UpdateCollector } from './field-value';
import { Firestore } from './firestore';
import { Reference } from './reference';
import type { DocumentData, api } from './types';
const RESOURCE_PATH_RE = /^projects\/([^/]+)\/databases\/([^/]+)(?:\/documents\/)?/;

@@ -12,3 +12,4 @@

if (value !== undefined) fields[key] = encodeValue(value, collector);
collector?.leaveField();
const shouldAddMask = !fields[key] || !(fields[key].arrayValue || fields[key].mapValue);
collector?.leaveField(shouldAddMask);
});

@@ -33,4 +34,4 @@ return fields;

if (typeof value === 'object' && 'latitude' in value && 'longitude' in value && Object.keys(value).length === 2) return { geoPointValue: value };
if (Array.isArray(value)) return { arrayValue: { values: value.map(v => encodeValue(v)) } };
if (typeof value === 'object') return { mapValue: { fields: encode(value) }};
if (Array.isArray(value)) return { arrayValue: { values: value.map(v => encodeValue(v, collector)) } };
if (typeof value === 'object') return { mapValue: { fields: encode(value, collector) }};
throw new Error(`Unsupported value type: ${typeof value}`);

@@ -37,0 +38,0 @@ }

@@ -1,2 +0,1 @@

import type { api, DocumentData, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue } from './types';
import { UpdateCollector } from './field-value';

@@ -7,2 +6,3 @@ import { Firestore } from './firestore';

import { updateSymbol, writesSymbol } from './symbols';
import type { DocumentData, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue, api } from './types';

@@ -9,0 +9,0 @@

@@ -21,3 +21,3 @@ {

"include": ["src/**/*"],
"exclude": ["src/__getToken.ts"]
"exclude": ["src/__getToken.ts", "src/test.ts"]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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