@northflank/js-client 0.9.1 → 0.9.3-beta.0
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 +38 -12
- package/dist/cjs/api-client.js +901 -1
- package/dist/esm/api-client.d.ts +38 -12
- package/dist/esm/api-client.js +887 -1
- package/package.json +1 -1
package/dist/cjs/api-client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
|
|
5
6
|
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
|
|
6
7
|
declare abstract class ApiClientContextProvider {
|
|
@@ -419,6 +420,9 @@ declare class NorthflankPortForwarder extends EventEmitter {
|
|
|
419
420
|
}
|
|
420
421
|
|
|
421
422
|
interface ExecCommand extends EventEmitter {
|
|
423
|
+
readonly stdOut: stream.PassThrough;
|
|
424
|
+
readonly stdErr: stream.PassThrough;
|
|
425
|
+
readonly stdIn: stream.PassThrough;
|
|
422
426
|
on(event: 'auth-success', listener: () => any): any;
|
|
423
427
|
on(event: 'command-started', listener: () => any): any;
|
|
424
428
|
on(event: 'command-completed', listener: () => any): any;
|
|
@@ -429,8 +433,15 @@ interface ExecCommand extends EventEmitter {
|
|
|
429
433
|
on(event: 'error', listener: (error: any) => any): any;
|
|
430
434
|
on(event: 'std-out-data', listener: (data: any) => any): any;
|
|
431
435
|
on(event: 'std-err-data', listener: (data: any) => any): any;
|
|
436
|
+
waitForCommandResult: () => Promise<CommandResult>;
|
|
437
|
+
start: () => Promise<CommandResult>;
|
|
438
|
+
resizeTerminal: (size: {
|
|
439
|
+
rows?: number;
|
|
440
|
+
columns?: number;
|
|
441
|
+
}) => Promise<void>;
|
|
432
442
|
}
|
|
433
|
-
|
|
443
|
+
declare const VALID_EXEC_LOCATIONS: readonly ["us", "eu", "asia"];
|
|
444
|
+
type ValidExecLocations = (typeof VALID_EXEC_LOCATIONS)[number];
|
|
434
445
|
type ExecConfig = {
|
|
435
446
|
teamId?: string;
|
|
436
447
|
projectId: string;
|
|
@@ -446,7 +457,10 @@ type ExecConfig = {
|
|
|
446
457
|
tty?: boolean;
|
|
447
458
|
ttyRows?: number;
|
|
448
459
|
ttyColumns?: number;
|
|
460
|
+
execLocationHint?: ValidExecLocations | undefined;
|
|
461
|
+
execLocationOverride?: string | undefined;
|
|
449
462
|
};
|
|
463
|
+
|
|
450
464
|
declare class ExecCommandStandard extends EventEmitter implements ExecCommand {
|
|
451
465
|
private readonly baseUrl;
|
|
452
466
|
readonly execConfig: ExecConfig;
|
|
@@ -456,7 +470,7 @@ declare class ExecCommandStandard extends EventEmitter implements ExecCommand {
|
|
|
456
470
|
readonly stdErr: stream.PassThrough;
|
|
457
471
|
readonly stdIn: stream.PassThrough;
|
|
458
472
|
private remote;
|
|
459
|
-
|
|
473
|
+
protected currentCommand: Promise<CommandResult> | undefined;
|
|
460
474
|
private duplex;
|
|
461
475
|
constructor(baseUrl: string, execConfig: ExecConfig, token: string, // readonly timeout: number = 120 // Timeout in seconds
|
|
462
476
|
agent: any, stdOut?: stream.PassThrough, stdErr?: stream.PassThrough, stdIn?: stream.PassThrough);
|
|
@@ -486,6 +500,8 @@ type ExecCommandData = {
|
|
|
486
500
|
shell?: string;
|
|
487
501
|
user?: string | number;
|
|
488
502
|
group?: string | number;
|
|
503
|
+
execLocationHint?: ValidExecLocations | undefined;
|
|
504
|
+
execLocationOverride?: string | undefined;
|
|
489
505
|
};
|
|
490
506
|
type ExecCommandDataAddon = ExecCommandData & {
|
|
491
507
|
instanceName: string;
|
|
@@ -505,7 +521,15 @@ type CommandInfo = {
|
|
|
505
521
|
declare class NorthflankExecCommand {
|
|
506
522
|
private readonly contextProvider;
|
|
507
523
|
private readonly agent?;
|
|
508
|
-
|
|
524
|
+
protected sessionRegistry: Partial<Record<ValidExecLocations, ClientHttp2Session>>;
|
|
525
|
+
constructor(contextProvider: ApiClientContextProvider, agent?: any | undefined, prewarmExecLocations?: ValidExecLocations[]);
|
|
526
|
+
protected http2Session(opts: {
|
|
527
|
+
execLocationHint: ValidExecLocations;
|
|
528
|
+
execLocationOverride?: never;
|
|
529
|
+
} | {
|
|
530
|
+
execLocationOverride: string;
|
|
531
|
+
execLocationHint?: never;
|
|
532
|
+
}): any;
|
|
509
533
|
/**
|
|
510
534
|
* Runs command on a Northflank service and waits for completion returning command result and
|
|
511
535
|
* standard output and standard error emitted during commmand execution.
|
|
@@ -528,7 +552,7 @@ declare class NorthflankExecCommand {
|
|
|
528
552
|
teamId?: string;
|
|
529
553
|
projectId: string;
|
|
530
554
|
serviceId: string;
|
|
531
|
-
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<
|
|
555
|
+
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<ExecCommand>;
|
|
532
556
|
/**
|
|
533
557
|
* Runs command on a Northflank job and waits for completion returning command result and
|
|
534
558
|
* standard output and standard error emitted during commmand execution.
|
|
@@ -551,7 +575,7 @@ declare class NorthflankExecCommand {
|
|
|
551
575
|
teamId?: string;
|
|
552
576
|
projectId: string;
|
|
553
577
|
jobId: string;
|
|
554
|
-
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<
|
|
578
|
+
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<ExecCommand>;
|
|
555
579
|
/**
|
|
556
580
|
* Runs command on a Northflank job and waits for completion returning command result and
|
|
557
581
|
* standard output and standard error emitted during commmand execution.
|
|
@@ -574,7 +598,7 @@ declare class NorthflankExecCommand {
|
|
|
574
598
|
teamId?: string;
|
|
575
599
|
projectId: string;
|
|
576
600
|
addonId: string;
|
|
577
|
-
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<
|
|
601
|
+
}, data?: ExecSessionData, commandInitCompletedCallback?: (commandInfo: CommandInfo) => void): Promise<ExecCommand>;
|
|
578
602
|
private execCommand;
|
|
579
603
|
private shellSession;
|
|
580
604
|
private getCommandRunner;
|
|
@@ -594,6 +618,7 @@ type DownloadOptions = {
|
|
|
594
618
|
containerName?: string;
|
|
595
619
|
instanceName?: string;
|
|
596
620
|
ignoreList?: string[];
|
|
621
|
+
execLocationHint?: ValidExecLocations;
|
|
597
622
|
};
|
|
598
623
|
type UploadOptions = {
|
|
599
624
|
localPath: string;
|
|
@@ -601,6 +626,7 @@ type UploadOptions = {
|
|
|
601
626
|
containerName?: string;
|
|
602
627
|
instanceName?: string;
|
|
603
628
|
ignoreList?: string[];
|
|
629
|
+
execLocationHint?: ValidExecLocations;
|
|
604
630
|
};
|
|
605
631
|
declare class NorthflankFileCopy {
|
|
606
632
|
private readonly exec;
|
|
@@ -12813,7 +12839,7 @@ type CreateAddonResult = {
|
|
|
12813
12839
|
'infrastructure'?: {
|
|
12814
12840
|
'architecture'?: 'x86' | 'arm';
|
|
12815
12841
|
};
|
|
12816
|
-
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest`, the addon will be created with the most recent minor version belonging to that major version. Example: "latest" */
|
|
12842
|
+
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest` or `14.5-latest`, the addon will be created with the most recent minor/patch version belonging to that major version. Example: "latest" */
|
|
12817
12843
|
'version': string;
|
|
12818
12844
|
'billing': {
|
|
12819
12845
|
/** The ID of the deployment plan to use. Example: "nf-compute-20" */
|
|
@@ -13005,7 +13031,7 @@ type CreateAddonData = {
|
|
|
13005
13031
|
'infrastructure'?: {
|
|
13006
13032
|
'architecture'?: 'x86' | 'arm';
|
|
13007
13033
|
};
|
|
13008
|
-
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest`, the addon will be created with the most recent minor version belonging to that major version. Example: "latest" */
|
|
13034
|
+
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest` or `14.5-latest`, the addon will be created with the most recent minor/patch version belonging to that major version. Example: "latest" */
|
|
13009
13035
|
'version': string;
|
|
13010
13036
|
'billing': {
|
|
13011
13037
|
/** The ID of the deployment plan to use. Example: "nf-compute-20" */
|
|
@@ -13150,7 +13176,7 @@ type PutAddonResult = {
|
|
|
13150
13176
|
'infrastructure'?: {
|
|
13151
13177
|
'architecture'?: 'x86' | 'arm';
|
|
13152
13178
|
};
|
|
13153
|
-
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest`, the addon will be created with the most recent minor version belonging to that major version. Example: "latest" */
|
|
13179
|
+
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest` or `14.5-latest`, the addon will be created with the most recent minor/patch version belonging to that major version. Example: "latest" */
|
|
13154
13180
|
'version': string;
|
|
13155
13181
|
'billing': {
|
|
13156
13182
|
/** The ID of the deployment plan to use. Example: "nf-compute-20" */
|
|
@@ -13342,7 +13368,7 @@ type PutAddonData = {
|
|
|
13342
13368
|
'infrastructure'?: {
|
|
13343
13369
|
'architecture'?: 'x86' | 'arm';
|
|
13344
13370
|
};
|
|
13345
|
-
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest`, the addon will be created with the most recent minor version belonging to that major version. Example: "latest" */
|
|
13371
|
+
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. e.g. `14-latest` or `14.5-latest`, the addon will be created with the most recent minor/patch version belonging to that major version. Example: "latest" */
|
|
13346
13372
|
'version': string;
|
|
13347
13373
|
'billing': {
|
|
13348
13374
|
/** The ID of the deployment plan to use. Example: "nf-compute-20" */
|
|
@@ -13582,7 +13608,7 @@ type PatchAddonResult = {
|
|
|
13582
13608
|
'infrastructure'?: {
|
|
13583
13609
|
'architecture'?: 'x86' | 'arm';
|
|
13584
13610
|
};
|
|
13585
|
-
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest`, the addon will be created with the most recent minor version belonging to that major version. Example: "latest" */
|
|
13611
|
+
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest` or `14.5-latest`, the addon will be created with the most recent minor/patch version belonging to that major version. Example: "latest" */
|
|
13586
13612
|
'version': string;
|
|
13587
13613
|
'billing': {
|
|
13588
13614
|
/** The ID of the deployment plan to use. Example: "nf-compute-20" */
|
|
@@ -13769,7 +13795,7 @@ type PatchAddonData = {
|
|
|
13769
13795
|
'stageId'?: string | null;
|
|
13770
13796
|
/** An array of previously defined tags to help identify and group the resource. */
|
|
13771
13797
|
'tags'?: string[];
|
|
13772
|
-
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. `14-latest`, the addon will be created with the most recent minor version belonging to that major version. Example: "latest" */
|
|
13798
|
+
/** The version of the addon type to use. If set to `latest`, the addon will be created with the most recent addon version. If set to a major version appended with `-latest`, e.g. e.g. `14-latest` or `14.5-latest`, the addon will be created with the most recent minor/patch version belonging to that major version. Example: "latest" */
|
|
13773
13799
|
'version'?: string;
|
|
13774
13800
|
'billing'?: {
|
|
13775
13801
|
/** The ID of the deployment plan to use. Example: "nf-compute-20" */
|