Skip to content

Commit 8f2a86c

Browse files
committed
chore: unify private member naming conventions
1 parent 4e8aea6 commit 8f2a86c

22 files changed

Lines changed: 173 additions & 173 deletions

File tree

packages/cli/src/lib/defaults/infra-modules/http/server/src/utils/zip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class Zip {
88
this._zip = new JSZip();
99
}
1010

11-
private generateNodeZip(filePath: string) {
11+
private _generateNodeZip(filePath: string) {
1212
return new Promise<boolean>((res, rej) => {
1313
this._zip.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
1414
.pipe(fse.createWriteStream(filePath))
@@ -25,6 +25,6 @@ export class Zip {
2525
fse.readdirSync(sourceDir).forEach(file => {
2626
this._zip.file(file, fse.readFileSync(`${sourceDir}/${file}`))
2727
})
28-
return this.generateNodeZip(outputPath);
28+
return this._generateNodeZip(outputPath);
2929
}
3030
}

packages/cli/src/lib/deploy/Deployer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ export class Deployer {
7777

7878
this._sanitizePackages(packageNames);
7979

80-
await this.cacheDeployModules(packageNames);
80+
await this._cacheDeployModules(packageNames);
8181

8282
const packageMapEntries = await Promise.all(
8383
packageNames.map(async (packageName) => {
84-
const deployerPackage = await this.getDeployModule(packageName);
84+
const deployerPackage = await this._getDeployModule(packageName);
8585
return [packageName, deployerPackage];
8686
})
8787
);
@@ -143,7 +143,7 @@ export class Deployer {
143143
}
144144
}
145145

146-
private async getDeployModule(
146+
private async _getDeployModule(
147147
moduleName: string
148148
): Promise<{
149149
deployModule: DeployModule;
@@ -171,7 +171,7 @@ export class Deployer {
171171
};
172172
}
173173

174-
private async cacheDeployModules(modules: string[]): Promise<void> {
174+
private async _cacheDeployModules(modules: string[]): Promise<void> {
175175
if (this._config.defaultModulesCached) {
176176
return;
177177
}

packages/cli/src/lib/infra/Infra.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ export class Infra {
276276
const packageDir = dependencyFetcher.getPackageDir(m.package);
277277
const packagePath = m.dockerComposePath
278278
? path.join(packageDir, m.dockerComposePath)
279-
: this.tryResolveComposeFile(
279+
: this._tryResolveComposeFile(
280280
packageDir,
281281
this._defaultModuleComposePaths
282282
);
@@ -353,7 +353,7 @@ export class Infra {
353353
isFile ? module.path : module.name
354354
);
355355
copySync(module.path, modulePath);
356-
const composePath = this.tryResolveComposeFile(
356+
const composePath = this._tryResolveComposeFile(
357357
modulePath,
358358
this._defaultModuleComposePaths
359359
);
@@ -386,7 +386,7 @@ export class Infra {
386386
return path.join(this._config.defaultInfraModulesPath, defaultModulePath);
387387
}
388388

389-
private tryResolveComposeFile(
389+
private _tryResolveComposeFile(
390390
moduleDir: string,
391391
pathsToTry: string[],
392392
triedPaths: string[] = []
@@ -405,7 +405,7 @@ export class Infra {
405405
return pathToTry;
406406
}
407407

408-
return this.tryResolveComposeFile(moduleDir, pathsToTry.slice(1), [
408+
return this._tryResolveComposeFile(moduleDir, pathsToTry.slice(1), [
409409
...triedPaths,
410410
pathToTry,
411411
]);

packages/cli/src/lib/system/file-lock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class FileLock {
1616
this._lockFilePath,
1717
"utf8"
1818
);
19-
const isRunning: boolean = this.isRunning(parseInt(lockPid));
19+
const isRunning: boolean = this._isRunning(parseInt(lockPid));
2020
// if process is not running and file exists, the lock is orphaned and can be destroyed
2121
if (!isRunning) {
2222
try {
@@ -53,7 +53,7 @@ export class FileLock {
5353
}
5454

5555
// check if process is running
56-
private isRunning(pid: number): boolean {
56+
private _isRunning(pid: number): boolean {
5757
try {
5858
process.kill(pid, 0);
5959
return true;

packages/cli/src/lib/workflow/JobRunner.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ import {
99
} from "@polywrap/client-config-builder-js";
1010

1111
export class JobRunner {
12-
private jobOutput: Map<string, JobResult>;
13-
private client: CoreClient;
12+
private _jobOutput: Map<string, JobResult>;
13+
private _client: CoreClient;
1414

1515
constructor(
16-
private configBuilder: IClientConfigBuilder,
17-
private onExecution?: (id: string, JobResult: JobResult) => MaybeAsync<void>
16+
private _configBuilder: IClientConfigBuilder,
17+
private _onExecution?: (id: string, JobResult: JobResult) => MaybeAsync<void>
1818
) {
19-
this.jobOutput = new Map();
20-
this.client = new PolywrapClient(this.configBuilder.buildCoreConfig(), {
19+
this._jobOutput = new Map();
20+
this._client = new PolywrapClient(this._configBuilder.buildCoreConfig(), {
2121
noDefaults: true,
2222
});
2323
}
2424

2525
async run(jobs: WorkflowJobs, ids: string[]): Promise<void> {
2626
const running = ids.map(async (absJobId) => {
27-
const jobId = this.getJobId(absJobId);
27+
const jobId = this._getJobId(absJobId);
2828

2929
const steps: Step[] | undefined = jobs[jobId].steps as Step[];
3030
if (steps) {
31-
await this.executeSteps(absJobId, steps);
31+
await this._executeSteps(absJobId, steps);
3232
}
3333

3434
const subJobs: WorkflowJobs | undefined = jobs[jobId].jobs;
@@ -40,15 +40,15 @@ export class JobRunner {
4040
await Promise.all(running);
4141
}
4242

43-
private getJobId(absJobId: string): string {
43+
private _getJobId(absJobId: string): string {
4444
const dotIdx = absJobId.lastIndexOf(".");
4545
if (dotIdx > -1) {
4646
return absJobId.substring(dotIdx + 1);
4747
}
4848
return absJobId;
4949
}
5050

51-
private followAccessors(
51+
private _followAccessors(
5252
jobResult: JobResult,
5353
accessors: string[],
5454
referenceId: string,
@@ -69,7 +69,7 @@ export class JobRunner {
6969
return val;
7070
}
7171

72-
private resolveReference(
72+
private _resolveReference(
7373
absJobId: string,
7474
stepId: number,
7575
reference: string
@@ -87,12 +87,12 @@ export class JobRunner {
8787

8888
// get reference job output
8989
const referenceId: string = reference.substring(1, dataOrErrorIdx);
90-
if (!this.jobOutput.has(referenceId)) {
90+
if (!this._jobOutput.has(referenceId)) {
9191
throw new Error(
9292
`Could not resolve reference id ${referenceId} for step ${absJobId}.${stepId}`
9393
);
9494
}
95-
const refJobResult = this.jobOutput.get(referenceId) as JobResult;
95+
const refJobResult = this._jobOutput.get(referenceId) as JobResult;
9696

9797
// parse and validate accessors
9898
const accessors: string[] = reference
@@ -119,7 +119,7 @@ export class JobRunner {
119119
}
120120

121121
// follow accessors through reference output to get requested data
122-
return this.followAccessors(
122+
return this._followAccessors(
123123
refJobResult,
124124
accessors,
125125
referenceId,
@@ -128,51 +128,51 @@ export class JobRunner {
128128
);
129129
}
130130

131-
private resolveRecord(
131+
private _resolveRecord(
132132
absJobId: string,
133133
stepId: number,
134134
record: Record<string, unknown>
135135
): Record<string, unknown> {
136136
const resolved: Record<string, unknown> = {};
137137
for (const [key, value] of Object.entries(record)) {
138-
resolved[key] = this.resolveValue(absJobId, stepId, value);
138+
resolved[key] = this._resolveValue(absJobId, stepId, value);
139139
}
140140
return resolved;
141141
}
142142

143-
private resolveArray(
143+
private _resolveArray(
144144
absJobId: string,
145145
stepId: number,
146146
array: Array<unknown>
147147
): Array<unknown> {
148-
return array.map((v) => this.resolveValue(absJobId, stepId, v));
148+
return array.map((v) => this._resolveValue(absJobId, stepId, v));
149149
}
150150

151-
private resolveValue(
151+
private _resolveValue(
152152
absJobId: string,
153153
stepId: number,
154154
value: unknown
155155
): unknown {
156-
if (this.isReference(value)) {
157-
return this.resolveReference(absJobId, stepId, value);
156+
if (this._isReference(value)) {
157+
return this._resolveReference(absJobId, stepId, value);
158158
} else if (Array.isArray(value)) {
159-
return this.resolveArray(absJobId, stepId, value);
160-
} else if (this.isRecord(value)) {
161-
return this.resolveRecord(absJobId, stepId, value);
159+
return this._resolveArray(absJobId, stepId, value);
160+
} else if (this._isRecord(value)) {
161+
return this._resolveRecord(absJobId, stepId, value);
162162
} else {
163163
return value;
164164
}
165165
}
166166

167-
private async execStep(
167+
private async _execStep(
168168
absJobId: string,
169169
stepId: number,
170170
step: Step
171171
): Promise<JobResult> {
172172
let args: Record<string, unknown> | undefined;
173173
if (step.args) {
174174
try {
175-
args = this.resolveRecord(absJobId, stepId, step.args);
175+
args = this._resolveRecord(absJobId, stepId, step.args);
176176
} catch (e) {
177177
return {
178178
error: e,
@@ -181,12 +181,12 @@ export class JobRunner {
181181
}
182182
}
183183

184-
let finalClient = this.client;
184+
let finalClient = this._client;
185185

186186
if (step.config) {
187187
const finalConfig = (step.config as Partial<CoreClientConfig>).resolver
188188
? (step.config as CoreClientConfig)
189-
: this.configBuilder
189+
: this._configBuilder
190190
.add(step.config as Partial<ClientConfig>)
191191
.buildCoreConfig();
192192

@@ -206,26 +206,26 @@ export class JobRunner {
206206
}
207207
}
208208

209-
private async executeSteps(absJobId: string, steps: Step[]) {
209+
private async _executeSteps(absJobId: string, steps: Step[]) {
210210
for (let i = 0; i < steps.length; i++) {
211211
const step = steps[i];
212212
const absId = `${absJobId}.${i}`;
213213

214-
const result: JobResult = await this.execStep(absJobId, i, step);
214+
const result: JobResult = await this._execStep(absJobId, i, step);
215215

216-
this.jobOutput.set(absId, result);
216+
this._jobOutput.set(absId, result);
217217

218-
if (this.onExecution) {
219-
await this.onExecution(absId, result);
218+
if (this._onExecution) {
219+
await this._onExecution(absId, result);
220220
}
221221
}
222222
}
223223

224-
private isReference(value: unknown): value is string {
224+
private _isReference(value: unknown): value is string {
225225
return typeof value === "string" && value.startsWith("$");
226226
}
227227

228-
private isRecord(value: unknown): value is Record<string, unknown> {
228+
private _isRecord(value: unknown): value is Record<string, unknown> {
229229
return typeof value === "object" && value !== null;
230230
}
231231
}

packages/js/client-config-builder/src/ClientConfigBuilder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { ExtendableUriResolver } from "@polywrap/uri-resolver-extensions-js";
1313

1414
export class ClientConfigBuilder extends BaseClientConfigBuilder {
1515
constructor(
16-
private readonly wrapperCache?: IWrapperCache,
17-
private readonly resolver?: IUriResolver<unknown>
16+
private readonly _wrapperCache?: IWrapperCache,
17+
private readonly _resolver?: IUriResolver<unknown>
1818
) {
1919
super();
2020
}
@@ -28,7 +28,7 @@ export class ClientConfigBuilder extends BaseClientConfigBuilder {
2828
envs: this.config.envs,
2929
interfaces: this.config.interfaces,
3030
resolver:
31-
this.resolver ??
31+
this._resolver ??
3232
RecursiveResolver.from(
3333
PackageToWrapperCacheResolver.from(
3434
[
@@ -40,7 +40,7 @@ export class ClientConfigBuilder extends BaseClientConfigBuilder {
4040
...this.config.resolvers,
4141
new ExtendableUriResolver(),
4242
],
43-
this.wrapperCache ?? new WrapperCache()
43+
this._wrapperCache ?? new WrapperCache()
4444
)
4545
),
4646
};

packages/js/core-client/src/PolywrapCoreClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class PolywrapCoreClient implements CoreClient {
4747

4848
Tracer.startSpan("PolywrapClient: constructor");
4949

50-
this._config = this.buildConfigFromPolywrapCoreClientConfig(config);
50+
this._config = this._buildConfigFromPolywrapCoreClientConfig(config);
5151

5252
Tracer.setAttribute("config", this._config);
5353
} catch (error) {
@@ -581,7 +581,7 @@ export class PolywrapCoreClient implements CoreClient {
581581
return ResultOk(true);
582582
}
583583

584-
private buildConfigFromPolywrapCoreClientConfig(
584+
private _buildConfigFromPolywrapCoreClientConfig(
585585
config: PolywrapCoreClientConfig
586586
): PolywrapCoreClientConfig<Uri> {
587587
return {

0 commit comments

Comments
 (0)