Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"nexpect": "^0.6.0",
"node-gyp-build": "^4.4.0",
"nodemon": "^3.0.1",
"polykey": "^1.2.1-alpha.45",
"polykey": "^1.2.1-alpha.46",
"prettier": "^3.0.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ErrorPolykeyCLIUnhandledRejection<T> extends ErrorPolykeyCLI<T> {
}

/**
* Asychronous deadlocks is a logic error.
* Asynchronous deadlocks is a logic error.
* If these exceptions occur, there is a bug.
*/
class ErrorPolykeyCLIAsynchronousDeadlock<T> extends ErrorPolykeyCLI<T> {
Expand Down
13 changes: 7 additions & 6 deletions src/nodes/CommandFind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ class CommandFind extends CommandPolykey {
},
logger: this.logger.getChild(PolykeyClient.name),
});
const result = {
const result: {
success: boolean;
message: string;
id: string;
address?: { host: Host | Hostname; port: Port };
} = {
success: false,
message: '',
id: '',
address: {
host: '',
port: 0,
},
};
let foundAddress:
| {
Expand Down Expand Up @@ -111,7 +112,7 @@ class CommandFind extends CommandPolykey {
});
}
process.stdout.write(outputFormatted);
// Like ping it should error when failing to find node for automation reasons.
// Like ping, it should error when failing to find node for automation reasons.
if (!result.success) {
throw new errors.ErrorPolykeyCLINodeFindFailed(result.message);
}
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/CommandPing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CommandPing extends CommandPolykey {
},
logger: this.logger.getChild(PolykeyClient.name),
});
let error;
let error: any;
const statusMessage = await binUtils.retryAuthentication(
(auth) =>
pkClient.rpcClient.methods.nodesPing({
Expand Down
2 changes: 1 addition & 1 deletion src/secrets/CommandEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CommandEdit extends CommandPolykey {
secretName: secretPath[1],
secretContent: content.toString('binary'),
});
await this.fs.promises.rmdir(tmpDir, { recursive: true });
await this.fs.promises.rm(tmpDir, { recursive: true, force: true });
// Windows
// TODO: complete windows impl
} finally {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type AgentStatusLiveData = Omit<StatusLive['data'], 'nodeId'> & {
};

/**
* PolykeyAgent Starting Input when Backgrounded
* PolykeyAgent Starting Input when backgrounded
* When using advanced serialization, rich structures like
* Map, Set and more can be passed over IPC
* However traditional classes cannot be
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ExitHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as errors from '../errors';

class ExitHandlers {
/**
* Mutate this array to control handlers
* Handlers will be executed in reverse order
* Mutate this array to control handlers.
* Handlers will be executed in reverse order.
*/
public handlers: Array<(signal?: NodeJS.Signals) => Promise<void>>;
protected _exiting: boolean = false;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function outputFormatterList(items: Array<string>): string {
* @param options
* @param options.columns - Can either be an `Array<string>` or `Record<string, number>`.
* If it is `Record<string, number>`, the `number` values will be used as the initial padding lengths.
* The object is also mutated if any cells exceed the inital padding lengths.
* The object is also mutated if any cells exceed the initial padding lengths.
* This parameter can also be supplied to filter the columns that will be displayed.
* @param options.includeHeaders - Defaults to `True`
* @param options.includeRowCount - Defaults to `False`.
Expand Down
12 changes: 6 additions & 6 deletions tests/TestProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ class TestProvider extends Provider {
authIdentityId: IdentityId,
identityId: IdentityId,
): Promise<IdentityData | undefined> {
let providerToken = await this.getToken(authIdentityId);
const providerToken = await this.getToken(authIdentityId);
if (!providerToken) {
throw new identitiesErrors.ErrorProviderUnauthenticated(
`${authIdentityId} has not been authenticated`,
);
}
providerToken = await this.checkToken(providerToken, authIdentityId);
await this.checkToken(providerToken, authIdentityId);
const user = this.users[identityId];
if (!user) {
return;
Expand All @@ -106,13 +106,13 @@ class TestProvider extends Provider {
authIdentityId: IdentityId,
searchTerms: Array<string> = [],
): AsyncGenerator<IdentityData> {
let providerToken = await this.getToken(authIdentityId);
const providerToken = await this.getToken(authIdentityId);
if (!providerToken) {
throw new identitiesErrors.ErrorProviderUnauthenticated(
`${authIdentityId} has not been authenticated`,
);
}
providerToken = await this.checkToken(providerToken, authIdentityId);
await this.checkToken(providerToken, authIdentityId);
for (const [k, v] of Object.entries(this.users) as Array<
[
IdentityId,
Expand Down Expand Up @@ -152,8 +152,8 @@ class TestProvider extends Provider {
await this.checkToken(providerToken, authIdentityId);
const linkId = this.linkIdCounter.toString() as ProviderIdentityClaimId;
this.linkIdCounter++;
const identityClainEncoded = tokenUtils.generateSignedToken(identityClaim);
this.links[linkId] = JSON.stringify(identityClainEncoded);
const identityClaimEncoded = tokenUtils.generateSignedToken(identityClaim);
this.links[linkId] = JSON.stringify(identityClaimEncoded);
this.userLinks[authIdentityId] = this.userLinks[authIdentityId]
? this.userLinks[authIdentityId]
: [];
Expand Down
15 changes: 7 additions & 8 deletions tests/agent/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ describe('start', () => {
]);
// These will be the last line of STDERR
// The readline library will automatically trim off newlines
let stdErrLine1;
let stdErrLine2;
let stdErrLine1: string;
let stdErrLine2: string;
const rlErr1 = readline.createInterface(agentProcess1.stderr!);
const rlErr2 = readline.createInterface(agentProcess2.stderr!);
const agentStartedProm1 = promise<[number, string]>();
Expand Down Expand Up @@ -310,8 +310,7 @@ describe('start', () => {
},
globalThis.defaultTimeout * 2,
);
// FIXME: disabled for now, both are succeeding when 1 should fail
test.skip(
test(
'concurrent with bootstrap results in 1 success',
async () => {
const password = 'abc123';
Expand Down Expand Up @@ -360,8 +359,8 @@ describe('start', () => {
]);
// These will be the last line of STDERR
// The readline library will automatically trim off newlines
let stdErrLine1;
let stdErrLine2;
let stdErrLine1: string;
let stdErrLine2: string;
const rlErr1 = readline.createInterface(agentProcess.stderr!);
const rlErr2 = readline.createInterface(bootstrapProcess.stderr!);
const agentStartedProm1 = promise<[number, string]>();
Expand Down Expand Up @@ -679,7 +678,7 @@ describe('start', () => {
);
const statusInfo2 = await status.waitFor('LIVE');
expect(statusInfo2.status).toBe('LIVE');
// Node Id hasn't changed
// Node ID hasn't changed
expect(statusInfo1.data.nodeId).toStrictEqual(statusInfo2.data.nodeId);
agentProcess2.kill('SIGTERM');
await testUtils.processExit(agentProcess2);
Expand Down Expand Up @@ -874,7 +873,7 @@ describe('start', () => {
globalThis.defaultTimeout * 2,
);
describe('start with global agent', () => {
let agentDataDir;
let agentDataDir: string;
let agent1Status: StatusLive;
let agent1Close: () => Promise<void>;
let agent2Status: StatusLive;
Expand Down
8 changes: 4 additions & 4 deletions tests/agent/status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('status', () => {
logger,
);
await status.waitFor('STARTING');
let exitCode, stdout;
let exitCode: number, stdout: string;
({ exitCode, stdout } = await testUtils.pkExec(
['agent', 'status', '--format', 'json'],
{
Expand Down Expand Up @@ -132,9 +132,9 @@ describe('status', () => {
});
});
describe('status with global agent', () => {
let agentDir;
let agentPassword;
let agentClose;
let agentDir: string;
let agentPassword: string;
let agentClose: () => Promise<void>;
beforeEach(async () => {
({ agentDir, agentPassword, agentClose } =
await testUtils.setupTestAgent(logger));
Expand Down
8 changes: 4 additions & 4 deletions tests/agent/unlock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ describe('unlock', () => {
const logger = new Logger('unlock test', LogLevel.WARN, [
new StreamHandler(),
]);
let agentDir;
let agentPassword;
let agentClose;
let agentDir: string;
let agentPassword: string;
let agentClose: () => Promise<void>;
beforeEach(async () => {
({ agentDir, agentPassword, agentClose } =
await testUtils.setupTestAgent(logger));
Expand All @@ -27,7 +27,7 @@ describe('unlock', () => {
logger,
fresh: true,
});
let exitCode, stdout;
let exitCode: number, stdout: string;
({ exitCode } = await testUtils.pkExec(['agent', 'unlock'], {
env: {
PK_NODE_PATH: agentDir,
Expand Down
Loading