Skip to content

Commit d70d089

Browse files
committed
feat: 不要な関数とインポートを削除し、FirestoreのURL生成を修正
1 parent 81c6eb2 commit d70d089

5 files changed

Lines changed: 6 additions & 56 deletions

File tree

src/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
convertToFirestoreDocument,
66
convertToFirestoreValue,
77
} from "./utils/converter";
8-
import { getFirestoreBasePath, getFirestoreCollectionPath } from "./utils/path";
8+
import { getFirestoreBasePath } from "./utils/path";
99
import { formatPrivateKey } from "./utils/config";
1010
import { FirestorePath, createFirestorePath } from "./utils/path";
1111

@@ -615,9 +615,9 @@ export class FirestoreClient {
615615

616616
const url = `${getFirestoreBasePath(
617617
this.config.projectId,
618-
collectionName,
619-
this.config.databaseId
620-
)}/${documentId}`;
618+
this.config.databaseId,
619+
this.config
620+
)}/${collectionName}/${documentId}`;
621621

622622
const firestoreData = convertToFirestoreDocument(data);
623623

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export {
2323
convertFromFirestoreDocument,
2424
} from "./utils/converter";
2525
export { getFirestoreBasePath, getDocumentId } from "./utils/path";
26-
export { formatPrivateKey, formatConfig } from "./utils/config";
26+
export { formatPrivateKey } from "./utils/config";
2727

2828
// クライアント関連のエクスポート
2929
export {

src/utils/config.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,3 @@ export function formatPrivateKey(privateKey: string): string {
1212
return privateKey;
1313
}
1414

15-
/**
16-
* FirestoreConfigオブジェクトの秘密鍵をフォーマットする
17-
* @param config 元のconfigオブジェクト
18-
* @returns 秘密鍵をフォーマットしたconfigオブジェクト
19-
*/
20-
export function formatConfig(config: FirestoreConfig): FirestoreConfig {
21-
return {
22-
...config,
23-
privateKey: formatPrivateKey(config.privateKey),
24-
};
25-
}

src/utils/path.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class FirestorePath {
141141
*/
142142
getRunQueryPath(collectionPath: string): string {
143143
// コレクションパス情報を取得
144-
const { url, collectionId, parentPath } = this.getQueryPath(collectionPath);
144+
const { collectionId, parentPath } = this.getQueryPath(collectionPath);
145145

146146
// parentPathがある場合は、親ドキュメントパスを使用してURLを作成
147147
if (parentPath) {
@@ -209,26 +209,6 @@ export function getFirestoreBasePath(
209209
}/documents`;
210210
}
211211

212-
/**
213-
* Get Firestore URL with collection path
214-
* @param projectId Project ID
215-
* @param collectionPath Collection path
216-
* @param databaseId Database ID (defaults to default)
217-
* @param config Firestore configuration (for emulator settings)
218-
* @returns Firestore URL with collection path
219-
*/
220-
export function getFirestoreCollectionPath(
221-
projectId: string,
222-
collectionPath: string,
223-
databaseId?: string,
224-
config?: FirestoreConfig
225-
): string {
226-
// Remove leading and trailing slashes
227-
const cleanPath = collectionPath.replace(/^\/+|\/+$/g, '');
228-
229-
// ベースパスを取得して、コレクションパスを追加
230-
return `${getFirestoreBasePath(projectId, databaseId, config)}/${cleanPath}`;
231-
}
232212

233213
/**
234214
* Extract document ID from document path

test/helpers.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,3 @@ export function getTestCollectionName(prefix: string = "test"): string {
6262
return `${prefix}_${timestamp}_${random}`;
6363
}
6464

65-
/**
66-
* Cleanup process for test data
67-
* @param client FirestoreClient
68-
* @param collectionName Collection name
69-
* @param docIds Array of document IDs
70-
*/
71-
export async function cleanupTestData(
72-
client: any,
73-
collectionName: string,
74-
docIds: string[]
75-
): Promise<void> {
76-
for (const id of docIds) {
77-
try {
78-
await client.delete(collectionName, id);
79-
} catch (err) {
80-
console.error(`Clean up failed for document ${id}: ${err}`);
81-
}
82-
}
83-
}

0 commit comments

Comments
 (0)