From 84cca1b03176061ff2b3c11d178eb1805e4858e0 Mon Sep 17 00:00:00 2001 From: Chris Moesel Date: Tue, 17 Dec 2024 11:42:48 -0500 Subject: [PATCH] Rename newSQLJSPackageDB to createSQLJSPackageDB (#47) --- src/app.ts | 4 ++-- src/db/SQLJSPackageDB.ts | 2 +- src/loader/DefaultPackageLoader.ts | 4 ++-- test/db/SQLJSPackageDB.test.ts | 22 +++++++++++----------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/app.ts b/src/app.ts index 3b915fd..ecfe7cb 100644 --- a/src/app.ts +++ b/src/app.ts @@ -5,7 +5,7 @@ import { Command, OptionValues } from 'commander'; import fs from 'fs-extra'; import { DiskBasedPackageCache } from './cache'; import { BuildDotFhirDotOrgClient } from './current'; -import { newSQLJSPackageDB } from './db'; +import { createSQLJSPackageDB } from './db'; import { BasePackageLoader } from './loader'; import { DefaultRegistryClient } from './registry'; import { logger } from './utils'; @@ -32,7 +32,7 @@ async function install(fhirPackages: string[], options: OptionValues) { logger.log(level, message); }; - const packageDB = await newSQLJSPackageDB(); + const packageDB = await createSQLJSPackageDB(); const fhirCache = options.cachePath ?? path.join(os.homedir(), '.fhir', 'packages'); const packageCache = new DiskBasedPackageCache(fhirCache, { log }); const registryClient = new DefaultRegistryClient({ log }); diff --git a/src/db/SQLJSPackageDB.ts b/src/db/SQLJSPackageDB.ts index 96a3d99..8babcb6 100644 --- a/src/db/SQLJSPackageDB.ts +++ b/src/db/SQLJSPackageDB.ts @@ -444,7 +444,7 @@ export class SQLJSPackageDB implements PackageDB { } } -export async function newSQLJSPackageDB(): Promise { +export async function createSQLJSPackageDB(): Promise { const packageDB = new SQLJSPackageDB(); await packageDB.initialize(); return packageDB; diff --git a/src/loader/DefaultPackageLoader.ts b/src/loader/DefaultPackageLoader.ts index 04f87e0..3e60013 100644 --- a/src/loader/DefaultPackageLoader.ts +++ b/src/loader/DefaultPackageLoader.ts @@ -2,12 +2,12 @@ import os from 'os'; import path from 'path'; import { DiskBasedPackageCache } from '../cache/DiskBasedPackageCache'; import { BuildDotFhirDotOrgClient } from '../current'; -import { newSQLJSPackageDB } from '../db'; +import { createSQLJSPackageDB } from '../db'; import { DefaultRegistryClient } from '../registry'; import { BasePackageLoader, BasePackageLoaderOptions } from './BasePackageLoader'; export async function defaultPackageLoader(options: BasePackageLoaderOptions) { - const packageDB = await newSQLJSPackageDB(); + const packageDB = await createSQLJSPackageDB(); const fhirCache = path.join(os.homedir(), '.fhir', 'packages'); const packageCache = new DiskBasedPackageCache(fhirCache, { log: options.log diff --git a/test/db/SQLJSPackageDB.test.ts b/test/db/SQLJSPackageDB.test.ts index b85b343..0ae0f5b 100644 --- a/test/db/SQLJSPackageDB.test.ts +++ b/test/db/SQLJSPackageDB.test.ts @@ -1,5 +1,5 @@ import initSqlJs from 'sql.js'; -import { newSQLJSPackageDB, SQLJSPackageDB } from '../../src/db/SQLJSPackageDB'; +import { createSQLJSPackageDB, SQLJSPackageDB } from '../../src/db/SQLJSPackageDB'; import { ResourceInfo } from '../../src/package'; import { byLoadOrder, byType } from '../../src/sort'; import { loggerSpy } from '../testhelpers'; @@ -60,7 +60,7 @@ describe('SQLJSPackageDB', () => { }; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.savePackageInfo({ name: 'CookiePackage', version: '3.2.2', @@ -109,7 +109,7 @@ describe('SQLJSPackageDB', () => { }; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.savePackageInfo({ name: 'CookiePackage', version: '4.5.6', @@ -138,7 +138,7 @@ describe('SQLJSPackageDB', () => { let packageDb: SQLJSPackageDB; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); }); it('should throw if the db has not been initialized', () => { @@ -220,7 +220,7 @@ describe('SQLJSPackageDB', () => { let packageDb: SQLJSPackageDB; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); }); it('should throw if the db has not been initialized', () => { @@ -322,7 +322,7 @@ describe('SQLJSPackageDB', () => { let packageDb: SQLJSPackageDB; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.savePackageInfo({ name: 'CookiePackage', version: '1.0.0', @@ -402,7 +402,7 @@ describe('SQLJSPackageDB', () => { let packageDb: SQLJSPackageDB; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.savePackageInfo({ name: 'CookiePackage', version: '1.0.0', @@ -501,7 +501,7 @@ describe('SQLJSPackageDB', () => { }; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.saveResourceInfo(patientProfile); packageDb.saveResourceInfo(observationProfile); packageDb.saveResourceInfo(specialExtension); @@ -829,7 +829,7 @@ describe('SQLJSPackageDB', () => { }; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.saveResourceInfo(specialExtension); packageDb.saveResourceInfo(valueSetThree); packageDb.saveResourceInfo(valueSetFour); @@ -995,7 +995,7 @@ describe('SQLJSPackageDB', () => { }; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.savePackageInfo({ name: 'CookiePackage', version: '3.2.2', @@ -1041,7 +1041,7 @@ describe('SQLJSPackageDB', () => { describe('#exportDB', () => { let packageDb: SQLJSPackageDB; beforeEach(async () => { - packageDb = await newSQLJSPackageDB(); + packageDb = await createSQLJSPackageDB(); packageDb.savePackageInfo({ name: 'CookiePackage', version: '3.2.2',