Skip to content

Commit

Permalink
Rename newSQLJSPackageDB to createSQLJSPackageDB (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoesel authored Dec 17, 2024
1 parent c8e754b commit 84cca1b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion src/db/SQLJSPackageDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ export class SQLJSPackageDB implements PackageDB {
}
}

export async function newSQLJSPackageDB(): Promise<SQLJSPackageDB> {
export async function createSQLJSPackageDB(): Promise<SQLJSPackageDB> {
const packageDB = new SQLJSPackageDB();
await packageDB.initialize();
return packageDB;
Expand Down
4 changes: 2 additions & 2 deletions src/loader/DefaultPackageLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions test/db/SQLJSPackageDB.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('SQLJSPackageDB', () => {
};

beforeEach(async () => {
packageDb = await newSQLJSPackageDB();
packageDb = await createSQLJSPackageDB();
packageDb.savePackageInfo({
name: 'CookiePackage',
version: '3.2.2',
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('SQLJSPackageDB', () => {
};

beforeEach(async () => {
packageDb = await newSQLJSPackageDB();
packageDb = await createSQLJSPackageDB();
packageDb.savePackageInfo({
name: 'CookiePackage',
version: '4.5.6',
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -501,7 +501,7 @@ describe('SQLJSPackageDB', () => {
};

beforeEach(async () => {
packageDb = await newSQLJSPackageDB();
packageDb = await createSQLJSPackageDB();
packageDb.saveResourceInfo(patientProfile);
packageDb.saveResourceInfo(observationProfile);
packageDb.saveResourceInfo(specialExtension);
Expand Down Expand Up @@ -829,7 +829,7 @@ describe('SQLJSPackageDB', () => {
};

beforeEach(async () => {
packageDb = await newSQLJSPackageDB();
packageDb = await createSQLJSPackageDB();
packageDb.saveResourceInfo(specialExtension);
packageDb.saveResourceInfo(valueSetThree);
packageDb.saveResourceInfo(valueSetFour);
Expand Down Expand Up @@ -995,7 +995,7 @@ describe('SQLJSPackageDB', () => {
};

beforeEach(async () => {
packageDb = await newSQLJSPackageDB();
packageDb = await createSQLJSPackageDB();
packageDb.savePackageInfo({
name: 'CookiePackage',
version: '3.2.2',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 84cca1b

Please sign in to comment.