Skip to content

Commit

Permalink
chore: format with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kumavis committed Jan 23, 2024
1 parent b871135 commit e597bbf
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
3 changes: 2 additions & 1 deletion packages/daemon/src/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ const makeEndoBootstrap = (
formulaIdentifier,
terminator,
) => {
const { type: formulaType, number: formulaNumber } = parseFormulaIdentifier(formulaIdentifier);
const { type: formulaType, number: formulaNumber } =
parseFormulaIdentifier(formulaIdentifier);
if (formulaIdentifier === 'pet-store') {
const external = petStorePowers.makeOwnPetStore(
'pet-store',
Expand Down
2 changes: 1 addition & 1 deletion packages/daemon/src/formula-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ export const parseFormulaIdentifier = formulaIdentifier => {
const type = formulaIdentifier.slice(0, delimiterIndex);
const number = formulaIdentifier.slice(delimiterIndex + 1);
return { type, number };
}
};
8 changes: 7 additions & 1 deletion packages/daemon/src/guest.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ export const makeGuestMaker = ({
terminator,
});

const { has, list, follow: followNames, listEntries, followEntries } = petStore;
const {
has,
list,
follow: followNames,
listEntries,
followEntries,
} = petStore;

/** @type {import('@endo/eventual-send').ERef<import('./types.js').EndoGuest>} */
const guest = Far('EndoGuest', {
Expand Down
8 changes: 7 additions & 1 deletion packages/daemon/src/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,13 @@ export const makeHostMaker = ({
return value;
};

const { has, list, follow: followNames, listEntries, followEntries } = petStore;
const {
has,
list,
follow: followNames,
listEntries,
followEntries,
} = petStore;

/** @type {import('./types.js').EndoHost} */
const host = Far('EndoHost', {
Expand Down
23 changes: 12 additions & 11 deletions packages/daemon/src/pet-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ export const makePetStoreMaker = (filePowers, locator) => {
const petNameText = `${formulaIdentifier}\n`;
await filePowers.writeFileText(petNamePath, petNameText);
const formularIdentifierPair = parseFormulaIdentifier(formulaIdentifier);
changesTopic.publisher.next({ add: petName, value: formularIdentifierPair });
changesTopic.publisher.next({
add: petName,
value: formularIdentifierPair,
});
};

/**
Expand All @@ -116,9 +119,7 @@ export const makePetStoreMaker = (filePowers, locator) => {
const formulaIdentifierPairForPetname = petName => {
const formulaIdentifier = petNames.get(petName);
if (formulaIdentifier === undefined) {
throw new Error(
`Formula does not exist for pet name ${q(petName)}`,
);
throw new Error(`Formula does not exist for pet name ${q(petName)}`);
}
const { type, number } = parseFormulaIdentifier(formulaIdentifier);
return {
Expand All @@ -135,7 +136,8 @@ export const makePetStoreMaker = (filePowers, locator) => {
(async function* currentAndSubsequentNames() {
const changes = changesTopic.subscribe();
for (const name of [...petNames.keys()].sort()) {
const formularIdentifierPair = formulaIdentifierPairForPetname(name);
const formularIdentifierPair =
formulaIdentifierPairForPetname(name);
yield {
add: name,
value: formularIdentifierPair,
Expand All @@ -147,13 +149,12 @@ export const makePetStoreMaker = (filePowers, locator) => {

// Returns in Object.fromEntries format.
/** @returns {Array<[string, import('./types.js').FormulaIdentifierPair]>} */
const listEntries = () => harden(
[...petNames.keys()]
.sort()
.map(name => {
return [name, formulaIdentifierPairForPetname(name)]
const listEntries = () =>
harden(
[...petNames.keys()].sort().map(name => {
return [name, formulaIdentifierPairForPetname(name)];
}),
);
);
// Provided as an alias for follow, with naming symmetry to listEntries.
const followEntries = follow;

Expand Down
6 changes: 5 additions & 1 deletion packages/daemon/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ export interface PetStore {
list(): Array<string>;
follow(): Promise<FarRef<String<{ add: string } | { remove: string }>>>;
listEntries(): Array<[string, FormulaIdentifierPair]>;
followEntries(): Promise<FarRef<String<{ add: string, value: FormulaIdentifierPair } | { remove: string }>>>;
followEntries(): Promise<
FarRef<
String<{ add: string; value: FormulaIdentifierPair } | { remove: string }>
>
>;
write(petName: string, formulaIdentifier: string): Promise<void>;
remove(petName: string);
rename(fromPetName: string, toPetName: string);
Expand Down

0 comments on commit e597bbf

Please sign in to comment.