firebase-rest-firestore 1.1.2 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cjs/client.d.ts +417 -0
  2. package/dist/cjs/client.js +1078 -0
  3. package/dist/{index.d.ts → cjs/index.d.ts} +1 -1
  4. package/dist/{index.js → cjs/index.js} +1 -2
  5. package/dist/{types.d.ts → cjs/types.d.ts} +4 -0
  6. package/dist/cjs/utils/auth.d.ts +13 -0
  7. package/dist/{utils → cjs/utils}/auth.js +14 -10
  8. package/dist/cjs/utils/config.d.ts +6 -0
  9. package/dist/{utils → cjs/utils}/config.js +0 -12
  10. package/dist/cjs/utils/path.d.ts +73 -0
  11. package/dist/cjs/utils/path.js +176 -0
  12. package/dist/esm/client.d.ts +417 -0
  13. package/dist/esm/client.js +1066 -0
  14. package/dist/esm/index.d.ts +7 -0
  15. package/dist/esm/index.js +11 -0
  16. package/dist/esm/types.d.ts +69 -0
  17. package/dist/esm/types.js +1 -0
  18. package/dist/esm/utils/auth.d.ts +13 -0
  19. package/dist/esm/utils/auth.js +57 -0
  20. package/dist/esm/utils/config.d.ts +6 -0
  21. package/dist/esm/utils/config.js +11 -0
  22. package/dist/esm/utils/converter.d.ts +27 -0
  23. package/dist/esm/utils/converter.js +107 -0
  24. package/dist/esm/utils/path.d.ts +73 -0
  25. package/dist/esm/utils/path.js +169 -0
  26. package/dist/types/client.d.ts +417 -0
  27. package/dist/types/index.d.ts +7 -0
  28. package/dist/types/types.d.ts +69 -0
  29. package/dist/types/utils/auth.d.ts +13 -0
  30. package/dist/types/utils/config.d.ts +6 -0
  31. package/dist/types/utils/converter.d.ts +27 -0
  32. package/dist/types/utils/path.d.ts +73 -0
  33. package/package.json +18 -5
  34. package/dist/client.d.ts +0 -381
  35. package/dist/client.js +0 -878
  36. package/dist/utils/auth.d.ts +0 -13
  37. package/dist/utils/config.d.ts +0 -13
  38. package/dist/utils/path.d.ts +0 -14
  39. package/dist/utils/path.js +0 -27
  40. /package/dist/{types.js → cjs/types.js} +0 -0
  41. /package/dist/{utils → cjs/utils}/converter.d.ts +0 -0
  42. /package/dist/{utils → cjs/utils}/converter.js +0 -0
@@ -0,0 +1,417 @@
1
+ import { FirestoreConfig, QueryOptions } from "./types";
2
+ /**
3
+ * Firestore client class
4
+ */
5
+ export declare class FirestoreClient {
6
+ private token;
7
+ private tokenExpiry;
8
+ private config;
9
+ private configChecked;
10
+ private debug;
11
+ private pathUtil;
12
+ /**
13
+ * Constructor
14
+ * @param config Firestore configuration object
15
+ */
16
+ constructor(config: FirestoreConfig);
17
+ /**
18
+ * Check configuration parameters
19
+ * @private
20
+ */
21
+ private checkConfig;
22
+ /**
23
+ * Get authentication token (with caching)
24
+ */
25
+ private getToken;
26
+ /**
27
+ * Prepare request headers
28
+ * @param additionalHeaders Additional headers
29
+ * @returns Prepared headers object
30
+ * @private
31
+ */
32
+ private prepareHeaders;
33
+ /**
34
+ * Get collection reference
35
+ * @param path Collection path
36
+ * @returns CollectionReference instance
37
+ */
38
+ collection(path: string): CollectionReference;
39
+ /**
40
+ * Get document reference
41
+ * @param path Document path
42
+ * @returns DocumentReference instance
43
+ */
44
+ doc(path: string): DocumentReference;
45
+ /**
46
+ * Get collection group reference
47
+ * @param path Collection group ID
48
+ * @returns CollectionGroup instance
49
+ */
50
+ collectionGroup(path: string): CollectionGroup;
51
+ /**
52
+ * Add document to Firestore
53
+ * @param collectionName Collection name
54
+ * @param data Data to add
55
+ * @returns Added document
56
+ */
57
+ add(collectionName: string, data: Record<string, any>): Promise<Record<string, any> & {
58
+ id: string;
59
+ }>;
60
+ /**
61
+ * Get document
62
+ * @param collectionName Collection name
63
+ * @param documentId Document ID
64
+ * @returns Retrieved document (null if it doesn't exist)
65
+ */
66
+ get(collectionName: string, documentId: string): Promise<(Record<string, any> & {
67
+ id: string;
68
+ }) | null>;
69
+ /**
70
+ * Update document
71
+ * @param collectionName Collection name
72
+ * @param documentId Document ID
73
+ * @param data Data to update
74
+ * @returns Updated document
75
+ */
76
+ update(collectionName: string, documentId: string, data: Record<string, any>): Promise<Record<string, any> & {
77
+ id: string;
78
+ }>;
79
+ /**
80
+ * Delete document
81
+ * @param collectionName Collection name
82
+ * @param documentId Document ID
83
+ * @returns true if deletion successful
84
+ */
85
+ delete(collectionName: string, documentId: string): Promise<boolean>;
86
+ /**
87
+ * Query documents in a collection
88
+ * @param collectionPath Collection path
89
+ * @param options Query options
90
+ * @param allDescendants Whether to include descendant collections
91
+ * @returns Array of documents matching the query
92
+ */
93
+ query(collectionPath: string, options?: QueryOptions, allDescendants?: boolean): Promise<(Record<string, any> & {
94
+ id: string;
95
+ })[]>;
96
+ /**
97
+ * ドキュメントを作成または上書き
98
+ * @param collectionName コレクション名
99
+ * @param documentId ドキュメントID
100
+ * @param data ドキュメントデータ
101
+ * @returns 作成されたドキュメントのリファレンス
102
+ */
103
+ createWithId(collectionName: string, documentId: string, data: Record<string, any>): Promise<Record<string, any> & {
104
+ id: string;
105
+ }>;
106
+ }
107
+ /**
108
+ * Collection reference class
109
+ */
110
+ export declare class CollectionReference {
111
+ private client;
112
+ private _path;
113
+ private _queryConstraints;
114
+ constructor(client: FirestoreClient, path: string);
115
+ /**
116
+ * Get collection path
117
+ */
118
+ get path(): string;
119
+ /**
120
+ * Whether to include all descendant collections
121
+ */
122
+ get allDescendants(): boolean;
123
+ /**
124
+ * Get document reference
125
+ * @param documentPath Document ID (auto-generated if omitted)
126
+ * @returns DocumentReference instance
127
+ */
128
+ doc(documentPath?: string): DocumentReference;
129
+ /**
130
+ * Add document (ID is auto-generated)
131
+ * @param data Document data
132
+ * @returns Reference to the created document
133
+ */
134
+ add(data: Record<string, any>): Promise<DocumentReference>;
135
+ /**
136
+ * Add filter condition
137
+ * @param fieldPath Field path
138
+ * @param opStr Operator
139
+ * @param value Value
140
+ * @returns Query instance
141
+ */
142
+ where(fieldPath: string, opStr: string, value: any): Query;
143
+ /**
144
+ * Add sorting condition
145
+ * @param fieldPath Field path
146
+ * @param directionStr Sort direction ('asc' or 'desc')
147
+ * @returns Query instance
148
+ */
149
+ orderBy(fieldPath: string, directionStr?: "asc" | "desc"): Query;
150
+ /**
151
+ * Set limit on number of results
152
+ * @param limit Maximum number
153
+ * @returns Query instance
154
+ */
155
+ limit(limit: number): Query;
156
+ /**
157
+ * Set number of documents to skip
158
+ * @param offset Number to skip
159
+ * @returns Query instance
160
+ */
161
+ offset(offset: number): Query;
162
+ /**
163
+ * Execute query
164
+ * @returns QuerySnapshot instance
165
+ */
166
+ get(): Promise<QuerySnapshot>;
167
+ /**
168
+ * Generate random ID
169
+ * @returns Random ID
170
+ */
171
+ private _generateId;
172
+ }
173
+ /**
174
+ * Document reference class
175
+ */
176
+ export declare class DocumentReference {
177
+ private client;
178
+ private collectionPath;
179
+ private docId;
180
+ constructor(client: FirestoreClient, collectionPath: string, docId: string);
181
+ /**
182
+ * Get document ID
183
+ */
184
+ get id(): string;
185
+ /**
186
+ * Get document path
187
+ */
188
+ get path(): string;
189
+ /**
190
+ * Get parent collection reference
191
+ */
192
+ get parent(): CollectionReference;
193
+ /**
194
+ * Get subcollection
195
+ * @param collectionPath Subcollection name
196
+ * @returns CollectionReference instance
197
+ */
198
+ collection(collectionPath: string): CollectionReference;
199
+ /**
200
+ * Get document
201
+ * @returns DocumentSnapshot instance
202
+ */
203
+ get(): Promise<DocumentSnapshot>;
204
+ /**
205
+ * Create or overwrite document
206
+ * @param data Document data
207
+ * @param options Options (merge is not currently supported)
208
+ * @returns WriteResult instance
209
+ */
210
+ set(data: Record<string, any>, options?: {
211
+ merge?: boolean;
212
+ }): Promise<WriteResult>;
213
+ /**
214
+ * Update document
215
+ * @param data Update data
216
+ * @returns WriteResult instance
217
+ */
218
+ update(data: Record<string, any>): Promise<WriteResult>;
219
+ /**
220
+ * Delete document
221
+ * @returns WriteResult instance
222
+ */
223
+ delete(): Promise<WriteResult>;
224
+ }
225
+ /**
226
+ * Collection group
227
+ */
228
+ export declare class CollectionGroup {
229
+ private client;
230
+ private path;
231
+ private _queryConstraints;
232
+ constructor(client: FirestoreClient, path: string);
233
+ /**
234
+ * Whether to include all descendant collections
235
+ */
236
+ get allDescendants(): boolean;
237
+ /**
238
+ * Add filter condition
239
+ * @param fieldPath Field path
240
+ * @param opStr Operator
241
+ * @param value Value
242
+ * @returns Query instance
243
+ */
244
+ where(fieldPath: string, opStr: string, value: any): Query;
245
+ /**
246
+ * Add sorting condition
247
+ * @param fieldPath Field path
248
+ * @param directionStr Sort direction ('asc' or 'desc')
249
+ * @returns Query instance
250
+ */
251
+ orderBy(fieldPath: string, directionStr?: "asc" | "desc"): Query;
252
+ /**
253
+ * Set limit on number of results
254
+ * @param limit Maximum number
255
+ * @returns Query instance
256
+ */
257
+ limit(limit: number): Query;
258
+ /**
259
+ * Set number of documents to skip
260
+ * @param offset Number to skip
261
+ * @returns Query instance
262
+ */
263
+ offset(offset: number): Query;
264
+ /**
265
+ * Execute query
266
+ * @returns QuerySnapshot instance
267
+ */
268
+ get(): Promise<QuerySnapshot>;
269
+ }
270
+ /**
271
+ * Query class
272
+ */
273
+ export declare class Query {
274
+ private client;
275
+ private collectionPath;
276
+ private allDescendants;
277
+ _queryConstraints: {
278
+ where: Array<{
279
+ field: string;
280
+ op: string;
281
+ value: any;
282
+ }>;
283
+ orderBy?: string;
284
+ orderDirection?: string;
285
+ limit?: number;
286
+ offset?: number;
287
+ };
288
+ constructor(client: FirestoreClient, collectionPath: string, constraints: {
289
+ where: Array<{
290
+ field: string;
291
+ op: string;
292
+ value: any;
293
+ }>;
294
+ orderBy?: string;
295
+ orderDirection?: string;
296
+ limit?: number;
297
+ offset?: number;
298
+ }, allDescendants: boolean);
299
+ /**
300
+ * Add filter condition
301
+ * @param fieldPath Field path
302
+ * @param opStr Operator
303
+ * @param value Value
304
+ * @returns Query instance
305
+ */
306
+ where(fieldPath: string, opStr: string, value: any): Query;
307
+ /**
308
+ * Add sorting condition
309
+ * @param fieldPath Field path
310
+ * @param directionStr Sort direction ('asc' or 'desc')
311
+ * @returns Query instance
312
+ */
313
+ orderBy(fieldPath: string, directionStr?: "asc" | "desc"): Query;
314
+ /**
315
+ * Set limit on number of results
316
+ * @param limit Maximum number
317
+ * @returns Query instance
318
+ */
319
+ limit(limit: number): Query;
320
+ /**
321
+ * Set number of documents to skip
322
+ * @param offset Number to skip
323
+ * @returns Query instance
324
+ */
325
+ offset(offset: number): Query;
326
+ /**
327
+ * Execute query
328
+ * @returns QuerySnapshot instance
329
+ */
330
+ get(): Promise<QuerySnapshot>;
331
+ }
332
+ /**
333
+ * Query result class
334
+ */
335
+ export declare class QuerySnapshot {
336
+ private _docs;
337
+ constructor(results: Array<Record<string, any>>);
338
+ /**
339
+ * Array of documents in the result
340
+ */
341
+ get docs(): DocumentSnapshot[];
342
+ /**
343
+ * Whether the result is empty
344
+ */
345
+ get empty(): boolean;
346
+ /**
347
+ * Number of results
348
+ */
349
+ get size(): number;
350
+ /**
351
+ * Execute callback for each document
352
+ * @param callback Callback function to execute for each document
353
+ */
354
+ forEach(callback: (result: DocumentSnapshot) => void): void;
355
+ }
356
+ /**
357
+ * Document snapshot class
358
+ */
359
+ export declare class DocumentSnapshot {
360
+ private _id;
361
+ private _data;
362
+ constructor(id: string, data: Record<string, any> | null);
363
+ /**
364
+ * Document ID
365
+ */
366
+ get id(): string;
367
+ /**
368
+ * Whether the document exists
369
+ */
370
+ get exists(): boolean;
371
+ /**
372
+ * Get document data
373
+ * @returns Document data (undefined if it doesn't exist)
374
+ */
375
+ data(): Record<string, any> | undefined;
376
+ }
377
+ /**
378
+ * Write result class
379
+ */
380
+ export declare class WriteResult {
381
+ /**
382
+ * Write timestamp
383
+ */
384
+ readonly writeTime: Date;
385
+ constructor();
386
+ }
387
+ /**
388
+ * Create a new Firestore client instance
389
+ * @param config Firestore configuration object
390
+ * @returns FirestoreClient instance
391
+ *
392
+ * @example
393
+ * // Connect to default database
394
+ * const db = createFirestoreClient({
395
+ * projectId: 'your-project-id',
396
+ * privateKey: 'your-private-key',
397
+ * clientEmail: 'your-client-email'
398
+ * });
399
+ *
400
+ * // Connect to a different named database
401
+ * const customDb = createFirestoreClient({
402
+ * projectId: 'your-project-id',
403
+ * privateKey: 'your-private-key',
404
+ * clientEmail: 'your-client-email',
405
+ * databaseId: 'your-database-id'
406
+ * });
407
+ *
408
+ * // Connect to local emulator (no auth required)
409
+ * const emulatorDb = createFirestoreClient({
410
+ * projectId: 'demo-project',
411
+ * useEmulator: true,
412
+ * emulatorHost: '127.0.',
413
+ * emulatorPort: 8080,
414
+ * debug: true // Optional: enables detailed logging
415
+ * });
416
+ */
417
+ export declare function createFirestoreClient(config: FirestoreConfig): FirestoreClient;
@@ -0,0 +1,7 @@
1
+ export * from "./types";
2
+ import { FirestoreClient, createFirestoreClient, CollectionReference, DocumentReference, CollectionGroup, Query, QuerySnapshot, DocumentSnapshot, WriteResult } from "./client";
3
+ export { getFirestoreToken } from "./utils/auth";
4
+ export { convertToFirestoreValue, convertFromFirestoreValue, convertToFirestoreDocument, convertFromFirestoreDocument, } from "./utils/converter";
5
+ export { getFirestoreBasePath, getDocumentId } from "./utils/path";
6
+ export { formatPrivateKey } from "./utils/config";
7
+ export { FirestoreClient, createFirestoreClient, CollectionReference, DocumentReference, CollectionGroup, Query, QuerySnapshot, DocumentSnapshot, WriteResult, };
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Firestoreクライアントの設定インターフェース
3
+ */
4
+ export interface FirestoreConfig {
5
+ projectId: string;
6
+ privateKey: string;
7
+ clientEmail: string;
8
+ databaseId?: string;
9
+ debug?: boolean;
10
+ useEmulator?: boolean;
11
+ emulatorHost?: string;
12
+ emulatorPort?: number;
13
+ }
14
+ /**
15
+ * Firestoreの値型定義
16
+ */
17
+ export type FirestoreFieldValue = {
18
+ stringValue: string;
19
+ } | {
20
+ integerValue: number;
21
+ } | {
22
+ doubleValue: number;
23
+ } | {
24
+ booleanValue: boolean;
25
+ } | {
26
+ nullValue: null;
27
+ } | {
28
+ timestampValue: string;
29
+ } | {
30
+ mapValue: {
31
+ fields: Record<string, FirestoreFieldValue>;
32
+ };
33
+ } | {
34
+ arrayValue: {
35
+ values: FirestoreFieldValue[];
36
+ };
37
+ };
38
+ /**
39
+ * Firestoreドキュメント型
40
+ */
41
+ export interface FirestoreDocument {
42
+ name?: string;
43
+ fields: Record<string, FirestoreFieldValue>;
44
+ createTime?: string;
45
+ updateTime?: string;
46
+ }
47
+ /**
48
+ * Firestoreレスポンス型
49
+ */
50
+ export interface FirestoreResponse {
51
+ name: string;
52
+ fields?: Record<string, FirestoreFieldValue>;
53
+ createTime?: string;
54
+ updateTime?: string;
55
+ }
56
+ /**
57
+ * クエリオプション型
58
+ */
59
+ export interface QueryOptions {
60
+ where?: Array<{
61
+ field: string;
62
+ op: string;
63
+ value: any;
64
+ }>;
65
+ orderBy?: string;
66
+ orderDirection?: string;
67
+ limit?: number;
68
+ offset?: number;
69
+ }
@@ -0,0 +1,13 @@
1
+ import { FirestoreConfig } from "../types";
2
+ /**
3
+ * Function to create a JWT (JSON Web Token)
4
+ * @param config Firestore configuration
5
+ * @returns JWT string
6
+ */
7
+ export declare function createJWT(config: FirestoreConfig): Promise<string>;
8
+ /**
9
+ * Function to get Firestore authentication token
10
+ * @param config Firestore configuration
11
+ * @returns Access token
12
+ */
13
+ export declare function getFirestoreToken(config: FirestoreConfig): Promise<string>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 秘密鍵の文字列内にある改行コードのエスケープシーケンスを実際の改行に変換する
3
+ * @param privateKey 変換する秘密鍵文字列
4
+ * @returns 変換後の秘密鍵文字列
5
+ */
6
+ export declare function formatPrivateKey(privateKey: string): string;
@@ -0,0 +1,27 @@
1
+ import { FirestoreDocument, FirestoreFieldValue, FirestoreResponse } from "../types";
2
+ /**
3
+ * JSの値をFirestore形式に変換する
4
+ * @param value 変換する値
5
+ * @returns Firestore形式の値
6
+ */
7
+ export declare function convertToFirestoreValue(value: any): FirestoreFieldValue;
8
+ /**
9
+ * Firestore形式からJSの値に変換する
10
+ * @param firestoreValue Firestore形式の値
11
+ * @returns JS形式の値
12
+ */
13
+ export declare function convertFromFirestoreValue(firestoreValue: FirestoreFieldValue): any;
14
+ /**
15
+ * オブジェクトをFirestoreドキュメント形式に変換
16
+ * @param data 変換するオブジェクト
17
+ * @returns Firestoreドキュメント
18
+ */
19
+ export declare function convertToFirestoreDocument(data: Record<string, any>): FirestoreDocument;
20
+ /**
21
+ * Firestoreドキュメントをオブジェクトに変換
22
+ * @param doc Firestoreレスポンス
23
+ * @returns 変換されたオブジェクト(idプロパティ付き)
24
+ */
25
+ export declare function convertFromFirestoreDocument(doc: FirestoreResponse): Record<string, any> & {
26
+ id: string;
27
+ };
@@ -0,0 +1,73 @@
1
+ import { FirestoreConfig } from "../types";
2
+ /**
3
+ * Utility class for constructing Firestore URIs
4
+ * Consistently handles different types of paths and operations
5
+ */
6
+ export declare class FirestorePath {
7
+ private projectId;
8
+ private databaseId;
9
+ private useEmulator;
10
+ private emulatorHost;
11
+ private emulatorPort;
12
+ private debug;
13
+ /**
14
+ * Constructor
15
+ */
16
+ constructor(config: FirestoreConfig, debug?: boolean);
17
+ /**
18
+ * Get Firestore base URL (without document path)
19
+ */
20
+ getBasePath(): string;
21
+ /**
22
+ * Get base URL + collection path for a collection root
23
+ * @param path Collection path (ex: "users" or "users/uid/posts")
24
+ */
25
+ getCollectionPath(path: string): string;
26
+ /**
27
+ * Get the complete URL for a document
28
+ * @param collectionPath Collection path
29
+ * @param documentId Document ID
30
+ */
31
+ getDocumentPath(collectionPath: string, documentId: string): string;
32
+ /**
33
+ * Get URL for query execution
34
+ * @param path Collection path (ex: "users" or "users/uid/posts")
35
+ * @returns URL for query execution, collection ID, and parent path (if needed)
36
+ */
37
+ getQueryPath(path: string): {
38
+ url: string;
39
+ collectionId: string;
40
+ parentPath?: string;
41
+ };
42
+ /**
43
+ * Get reference path for parent document (for query construction)
44
+ * @param parentPath Parent document path
45
+ */
46
+ getParentReference(parentPath: string): string;
47
+ /**
48
+ * Get URL for runQuery
49
+ * @param collectionPath Collection path
50
+ * @returns URL for executing runQuery
51
+ */
52
+ getRunQueryPath(collectionPath: string): string;
53
+ }
54
+ /**
55
+ * Create an instance of FirestorePath class
56
+ * @param config Firestore configuration
57
+ * @param debug Debug mode
58
+ */
59
+ export declare function createFirestorePath(config: FirestoreConfig, debug?: boolean): FirestorePath;
60
+ /**
61
+ * Get Firestore base path URL (without path)
62
+ * @param projectId Project ID
63
+ * @param databaseId Database ID (defaults to default)
64
+ * @param config Firestore configuration (for emulator settings)
65
+ * @returns Firestore base path URL (without path)
66
+ */
67
+ export declare function getFirestoreBasePath(projectId: string, databaseId?: string, config?: FirestoreConfig): string;
68
+ /**
69
+ * Extract document ID from document path
70
+ * @param path Document path
71
+ * @returns Document ID
72
+ */
73
+ export declare function getDocumentId(path: string): string;
package/package.json CHANGED
@@ -1,17 +1,29 @@
1
1
  {
2
2
  "name": "firebase-rest-firestore",
3
- "version": "1.1.2",
3
+ "version": "1.5.0",
4
4
  "description": "Firebase Firestore REST API client for Edge runtime environments",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/types/index.d.ts",
7
8
  "files": [
8
9
  "dist",
9
10
  "README.md"
10
11
  ],
11
12
  "scripts": {
12
- "build": "tsc",
13
+ "build": "npm run build:esm && npm run build:cjs && npm run build:types",
14
+ "build:esm": "tsc -p tsconfig.esm.json",
15
+ "build:cjs": "tsc -p tsconfig.cjs.json",
16
+ "build:types": "tsc -p tsconfig.json --emitDeclarationOnly --declarationDir dist/types",
17
+ "watch": "concurrently \"npm run watch:esm\" \"npm run watch:cjs\" \"npm run watch:types\"",
18
+ "watch:esm": "tsc -p tsconfig.esm.json --watch",
19
+ "watch:cjs": "tsc -p tsconfig.cjs.json --watch",
20
+ "watch:types": "tsc -p tsconfig.json --emitDeclarationOnly --declarationDir dist/types --watch",
13
21
  "prepublishOnly": "npm run build",
14
- "test": "vitest"
22
+ "setup:local:env": "cp .env.local.example .env && echo 'Created .env file from local example.'",
23
+ "emulator:start": "cd test/emulator && firebase emulators:start -P demo-test-project",
24
+ "emulator:stop": "npx kill-port -y 4089 8089 9089",
25
+ "test": "vitest",
26
+ "test:emulator": "bash test/scripts/test-with-emulator.sh"
15
27
  },
16
28
  "keywords": [
17
29
  "firebase",
@@ -32,6 +44,7 @@
32
44
  "@semantic-release/changelog": "^6.0.3",
33
45
  "@semantic-release/git": "^10.0.1",
34
46
  "@types/node": "^18.16.0",
47
+ "concurrently": "^8.2.2",
35
48
  "dotenv": "^16.4.7",
36
49
  "semantic-release": "^24.2.3",
37
50
  "typescript": "^5.0.4",