@northflank/js-client 0.8.13-beta.4 → 0.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api-client.d.ts +10 -17
- package/dist/cjs/api-client.js +1 -1
- package/dist/esm/api-client.d.ts +10 -17
- package/dist/esm/api-client.js +1 -1
- package/package.json +2 -2
package/dist/esm/api-client.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
2
|
import * as stream from 'node:stream';
|
|
3
3
|
import { Stream } from 'node:stream';
|
|
4
|
-
import { ClientHttp2Session } from 'node:http2';
|
|
5
4
|
|
|
6
5
|
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
|
|
7
6
|
declare abstract class ApiClientContextProvider {
|
|
@@ -57,6 +56,7 @@ type PortForwardingInfo = {
|
|
|
57
56
|
address: string;
|
|
58
57
|
port: number;
|
|
59
58
|
portName?: string;
|
|
59
|
+
portRemote?: number;
|
|
60
60
|
protocol?: 'HTTP' | 'TCP' | 'UDP';
|
|
61
61
|
hostnames: string[];
|
|
62
62
|
ipOnly: boolean;
|
|
@@ -75,7 +75,7 @@ interface PortTunnel extends EventEmitter {
|
|
|
75
75
|
on(event: 'connection-accept', listener: () => any): any;
|
|
76
76
|
on(event: 'connection-close', listener: () => any): any;
|
|
77
77
|
on(event: 'connection-error', listener: (error: any) => any): any;
|
|
78
|
-
open(): Promise<{
|
|
78
|
+
open(randomPortFallback: boolean): Promise<{
|
|
79
79
|
address: string;
|
|
80
80
|
port: number;
|
|
81
81
|
}>;
|
|
@@ -354,11 +354,14 @@ declare class NorthflankPortForwarder extends EventEmitter {
|
|
|
354
354
|
withServiceForwarding<T = any>(parameters: {
|
|
355
355
|
projectId: string;
|
|
356
356
|
serviceId: string;
|
|
357
|
+
instanceId?: string;
|
|
358
|
+
portsFilter?: number[];
|
|
357
359
|
}, func: (p: PortForwardingResult[]) => Promise<T>, ipOnly?: boolean): Promise<T>;
|
|
358
360
|
forwardService(parameters: {
|
|
359
361
|
projectId: string;
|
|
360
362
|
serviceId: string;
|
|
361
363
|
instanceId?: string;
|
|
364
|
+
portsFilter?: number[];
|
|
362
365
|
}, ipOnly?: boolean): Promise<PortForwardingResult[]>;
|
|
363
366
|
withAddonForwarding<T = any>(parameters: {
|
|
364
367
|
projectId: string;
|
|
@@ -371,6 +374,7 @@ declare class NorthflankPortForwarder extends EventEmitter {
|
|
|
371
374
|
private allocateIpAddress;
|
|
372
375
|
private forwardPort;
|
|
373
376
|
private determineSocketAddress;
|
|
377
|
+
private consistentHostnameToPortHashing;
|
|
374
378
|
private registerHostnames;
|
|
375
379
|
private unregisterHostnames;
|
|
376
380
|
private modifyHostsFile;
|
|
@@ -396,9 +400,6 @@ declare class NorthflankPortForwarder extends EventEmitter {
|
|
|
396
400
|
}
|
|
397
401
|
|
|
398
402
|
interface ExecCommand extends EventEmitter {
|
|
399
|
-
readonly stdOut: stream.PassThrough;
|
|
400
|
-
readonly stdErr: stream.PassThrough;
|
|
401
|
-
readonly stdIn: stream.PassThrough;
|
|
402
403
|
on(event: 'auth-success', listener: () => any): any;
|
|
403
404
|
on(event: 'command-started', listener: () => any): any;
|
|
404
405
|
on(event: 'command-completed', listener: () => any): any;
|
|
@@ -409,8 +410,6 @@ interface ExecCommand extends EventEmitter {
|
|
|
409
410
|
on(event: 'error', listener: (error: any) => any): any;
|
|
410
411
|
on(event: 'std-out-data', listener: (data: any) => any): any;
|
|
411
412
|
on(event: 'std-err-data', listener: (data: any) => any): any;
|
|
412
|
-
waitForCommandResult: () => Promise<CommandResult>;
|
|
413
|
-
start: () => Promise<CommandResult>;
|
|
414
413
|
}
|
|
415
414
|
|
|
416
415
|
type ExecConfig = {
|
|
@@ -427,7 +426,6 @@ type ExecConfig = {
|
|
|
427
426
|
tty?: boolean;
|
|
428
427
|
ttyRows?: number;
|
|
429
428
|
ttyColumns?: number;
|
|
430
|
-
execLocationHint?: ValidExecLocations | undefined;
|
|
431
429
|
};
|
|
432
430
|
declare class ExecCommandStandard extends EventEmitter implements ExecCommand {
|
|
433
431
|
private readonly baseUrl;
|
|
@@ -438,7 +436,7 @@ declare class ExecCommandStandard extends EventEmitter implements ExecCommand {
|
|
|
438
436
|
readonly stdErr: stream.PassThrough;
|
|
439
437
|
readonly stdIn: stream.PassThrough;
|
|
440
438
|
private remote;
|
|
441
|
-
|
|
439
|
+
private currentCommand;
|
|
442
440
|
private duplex;
|
|
443
441
|
constructor(baseUrl: string, execConfig: ExecConfig, token: string, // readonly timeout: number = 120 // Timeout in seconds
|
|
444
442
|
agent: any, stdOut?: stream.PassThrough, stdErr?: stream.PassThrough, stdIn?: stream.PassThrough);
|
|
@@ -456,8 +454,6 @@ declare class ExecCommandStandard extends EventEmitter implements ExecCommand {
|
|
|
456
454
|
private reset;
|
|
457
455
|
}
|
|
458
456
|
|
|
459
|
-
declare const VALID_EXEC_LOCATIONS: readonly ["us", "eu", "asia"];
|
|
460
|
-
type ValidExecLocations = (typeof VALID_EXEC_LOCATIONS)[number];
|
|
461
457
|
type CommandResult = {
|
|
462
458
|
exitCode: number;
|
|
463
459
|
status: 'Success' | 'Failure' | 'Unknown';
|
|
@@ -470,7 +466,6 @@ type ExecCommandData = {
|
|
|
470
466
|
shell?: string;
|
|
471
467
|
user?: string | number;
|
|
472
468
|
group?: string | number;
|
|
473
|
-
execLocationHint?: ValidExecLocations | undefined;
|
|
474
469
|
};
|
|
475
470
|
type ExecCommandDataAddon = ExecCommandData & {
|
|
476
471
|
instanceName: string;
|
|
@@ -490,9 +485,7 @@ type CommandInfo = {
|
|
|
490
485
|
declare class NorthflankExecCommand {
|
|
491
486
|
private readonly contextProvider;
|
|
492
487
|
private readonly agent?;
|
|
493
|
-
protected sessionRegistry: Partial<Record<ValidExecLocations, ClientHttp2Session>>;
|
|
494
488
|
constructor(contextProvider: ApiClientContextProvider, agent?: any | undefined);
|
|
495
|
-
protected http2Session(execLocationHint: ValidExecLocations): ClientHttp2Session;
|
|
496
489
|
/**
|
|
497
490
|
* Runs command on a Northflank service and waits for completion returning command result and
|
|
498
491
|
* standard output and standard error emitted during commmand execution.
|
|
@@ -513,7 +506,7 @@ declare class NorthflankExecCommand {
|
|
|
513
506
|
execServiceSession(parameters: {
|
|
514
507
|
projectId: string;
|
|
515
508
|
serviceId: string;
|
|
516
|
-
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<
|
|
509
|
+
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<ExecCommandStandard>;
|
|
517
510
|
/**
|
|
518
511
|
* Runs command on a Northflank job and waits for completion returning command result and
|
|
519
512
|
* standard output and standard error emitted during commmand execution.
|
|
@@ -534,7 +527,7 @@ declare class NorthflankExecCommand {
|
|
|
534
527
|
execJobSession(parameters: {
|
|
535
528
|
projectId: string;
|
|
536
529
|
jobId: string;
|
|
537
|
-
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<
|
|
530
|
+
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<ExecCommandStandard>;
|
|
538
531
|
/**
|
|
539
532
|
* Runs command on a Northflank job and waits for completion returning command result and
|
|
540
533
|
* standard output and standard error emitted during commmand execution.
|
|
@@ -555,7 +548,7 @@ declare class NorthflankExecCommand {
|
|
|
555
548
|
execAddonSession(parameters: {
|
|
556
549
|
projectId: string;
|
|
557
550
|
addonId: string;
|
|
558
|
-
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<
|
|
551
|
+
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<ExecCommandStandard>;
|
|
559
552
|
private execCommand;
|
|
560
553
|
private shellSession;
|
|
561
554
|
private getCommandRunner;
|