@milaboratories/pl-client 2.16.16 → 2.16.17
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/core/unauth_client.cjs +2 -2
- package/dist/core/unauth_client.cjs.map +1 -1
- package/dist/core/unauth_client.d.ts +4 -1
- package/dist/core/unauth_client.d.ts.map +1 -1
- package/dist/core/unauth_client.js +2 -2
- package/dist/core/unauth_client.js.map +1 -1
- package/package.json +3 -3
- package/src/core/unauth_client.ts +3 -3
|
@@ -10,8 +10,8 @@ class UnauthenticatedPlClient {
|
|
|
10
10
|
constructor(ll) {
|
|
11
11
|
this.ll = ll;
|
|
12
12
|
}
|
|
13
|
-
static async build(configOrAddress) {
|
|
14
|
-
const ll = await ll_client.LLPlClient.build(configOrAddress);
|
|
13
|
+
static async build(configOrAddress, ops) {
|
|
14
|
+
const ll = await ll_client.LLPlClient.build(configOrAddress, ops);
|
|
15
15
|
return new UnauthenticatedPlClient(ll);
|
|
16
16
|
}
|
|
17
17
|
async ping() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauth_client.cjs","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n private constructor(ll: LLPlClient) {\n this.ll = ll;\n }\n\n public static async build(configOrAddress: PlClientConfig | string): Promise<UnauthenticatedPlClient> {\n const ll = await LLPlClient.build(configOrAddress);\n return new UnauthenticatedPlClient(ll);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return await this.ll.ping();\n }\n\n public async authMethods(): Promise<AuthAPI_ListMethods_Response> {\n return await this.ll.authMethods();\n }\n\n public async requireAuth(): Promise<boolean> {\n return (await this.authMethods()).methods.length > 0;\n }\n\n public async login(user: string, password: string): Promise<AuthInformation> {\n try {\n const token = await this.ll.getJwtToken(\n BigInt(this.ll.conf.authTTLSeconds),\n { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') },\n );\n const jwtToken = notEmpty(token);\n if (jwtToken === '') throw new Error('empty token');\n return { jwtToken };\n } catch (e: any) {\n if (e.code === 'UNAUTHENTICATED') throw new UnauthenticatedError(e.message);\n throw new Error(e);\n }\n }\n}\n"],"names":["LLPlClient","notEmpty","UnauthenticatedError"],"mappings":";;;;;;AASA;MACa,uBAAuB,CAAA;AAClB,IAAA,EAAE;AAElB,IAAA,WAAA,CAAoB,EAAc,EAAA;AAChC,QAAA,IAAI,CAAC,EAAE,GAAG,EAAE;IACd;AAEO,IAAA,aAAa,KAAK,CAAC,eAAwC,EAAA;
|
|
1
|
+
{"version":3,"file":"unauth_client.cjs","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { type MiLogger, notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n private constructor(ll: LLPlClient) {\n this.ll = ll;\n }\n\n public static async build(configOrAddress: PlClientConfig | string, ops?: { logger?: MiLogger }): Promise<UnauthenticatedPlClient> {\n const ll = await LLPlClient.build(configOrAddress, ops);\n return new UnauthenticatedPlClient(ll);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return await this.ll.ping();\n }\n\n public async authMethods(): Promise<AuthAPI_ListMethods_Response> {\n return await this.ll.authMethods();\n }\n\n public async requireAuth(): Promise<boolean> {\n return (await this.authMethods()).methods.length > 0;\n }\n\n public async login(user: string, password: string): Promise<AuthInformation> {\n try {\n const token = await this.ll.getJwtToken(\n BigInt(this.ll.conf.authTTLSeconds),\n { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') },\n );\n const jwtToken = notEmpty(token);\n if (jwtToken === '') throw new Error('empty token');\n return { jwtToken };\n } catch (e: any) {\n if (e.code === 'UNAUTHENTICATED') throw new UnauthenticatedError(e.message);\n throw new Error(e);\n }\n }\n}\n"],"names":["LLPlClient","notEmpty","UnauthenticatedError"],"mappings":";;;;;;AASA;MACa,uBAAuB,CAAA;AAClB,IAAA,EAAE;AAElB,IAAA,WAAA,CAAoB,EAAc,EAAA;AAChC,QAAA,IAAI,CAAC,EAAE,GAAG,EAAE;IACd;AAEO,IAAA,aAAa,KAAK,CAAC,eAAwC,EAAE,GAA2B,EAAA;QAC7F,MAAM,EAAE,GAAG,MAAMA,oBAAU,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC;AACvD,QAAA,OAAO,IAAI,uBAAuB,CAAC,EAAE,CAAC;IACxC;AAEO,IAAA,MAAM,IAAI,GAAA;AACf,QAAA,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE;IAC7B;AAEO,IAAA,MAAM,WAAW,GAAA;AACtB,QAAA,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE;IACpC;AAEO,IAAA,MAAM,WAAW,GAAA;AACtB,QAAA,OAAO,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC;IACtD;AAEO,IAAA,MAAM,KAAK,CAAC,IAAY,EAAE,QAAgB,EAAA;AAC/C,QAAA,IAAI;AACF,YAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CACrC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,EACnC,EAAE,aAAa,EAAE,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CACpF;AACD,YAAA,MAAM,QAAQ,GAAGC,kBAAQ,CAAC,KAAK,CAAC;YAChC,IAAI,QAAQ,KAAK,EAAE;AAAE,gBAAA,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC;YACnD,OAAO,EAAE,QAAQ,EAAE;QACrB;QAAE,OAAO,CAAM,EAAE;AACf,YAAA,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB;AAAE,gBAAA,MAAM,IAAIC,2BAAoB,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3E,YAAA,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC;QACpB;IACF;AACD;;;;"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { AuthInformation, PlClientConfig } from './config';
|
|
2
2
|
import type { AuthAPI_ListMethods_Response, MaintenanceAPI_Ping_Response } from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';
|
|
3
3
|
import { LLPlClient } from './ll_client';
|
|
4
|
+
import { type MiLogger } from '@milaboratories/ts-helpers';
|
|
4
5
|
/** Primarily used for initial authentication (login) */
|
|
5
6
|
export declare class UnauthenticatedPlClient {
|
|
6
7
|
readonly ll: LLPlClient;
|
|
7
8
|
private constructor();
|
|
8
|
-
static build(configOrAddress: PlClientConfig | string
|
|
9
|
+
static build(configOrAddress: PlClientConfig | string, ops?: {
|
|
10
|
+
logger?: MiLogger;
|
|
11
|
+
}): Promise<UnauthenticatedPlClient>;
|
|
9
12
|
ping(): Promise<MaintenanceAPI_Ping_Response>;
|
|
10
13
|
authMethods(): Promise<AuthAPI_ListMethods_Response>;
|
|
11
14
|
requireAuth(): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauth_client.d.ts","sourceRoot":"","sources":["../../src/core/unauth_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"unauth_client.d.ts","sourceRoot":"","sources":["../../src/core/unauth_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,+DAA+D,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,QAAQ,EAAY,MAAM,4BAA4B,CAAC;AAGrE,wDAAwD;AACxD,qBAAa,uBAAuB;IAClC,SAAgB,EAAE,EAAE,UAAU,CAAC;IAE/B,OAAO;WAIa,KAAK,CAAC,eAAe,EAAE,cAAc,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAKrH,IAAI,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAI7C,WAAW,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAIpD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAc7E"}
|
|
@@ -8,8 +8,8 @@ class UnauthenticatedPlClient {
|
|
|
8
8
|
constructor(ll) {
|
|
9
9
|
this.ll = ll;
|
|
10
10
|
}
|
|
11
|
-
static async build(configOrAddress) {
|
|
12
|
-
const ll = await LLPlClient.build(configOrAddress);
|
|
11
|
+
static async build(configOrAddress, ops) {
|
|
12
|
+
const ll = await LLPlClient.build(configOrAddress, ops);
|
|
13
13
|
return new UnauthenticatedPlClient(ll);
|
|
14
14
|
}
|
|
15
15
|
async ping() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauth_client.js","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n private constructor(ll: LLPlClient) {\n this.ll = ll;\n }\n\n public static async build(configOrAddress: PlClientConfig | string): Promise<UnauthenticatedPlClient> {\n const ll = await LLPlClient.build(configOrAddress);\n return new UnauthenticatedPlClient(ll);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return await this.ll.ping();\n }\n\n public async authMethods(): Promise<AuthAPI_ListMethods_Response> {\n return await this.ll.authMethods();\n }\n\n public async requireAuth(): Promise<boolean> {\n return (await this.authMethods()).methods.length > 0;\n }\n\n public async login(user: string, password: string): Promise<AuthInformation> {\n try {\n const token = await this.ll.getJwtToken(\n BigInt(this.ll.conf.authTTLSeconds),\n { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') },\n );\n const jwtToken = notEmpty(token);\n if (jwtToken === '') throw new Error('empty token');\n return { jwtToken };\n } catch (e: any) {\n if (e.code === 'UNAUTHENTICATED') throw new UnauthenticatedError(e.message);\n throw new Error(e);\n }\n }\n}\n"],"names":[],"mappings":";;;;AASA;MACa,uBAAuB,CAAA;AAClB,IAAA,EAAE;AAElB,IAAA,WAAA,CAAoB,EAAc,EAAA;AAChC,QAAA,IAAI,CAAC,EAAE,GAAG,EAAE;IACd;AAEO,IAAA,aAAa,KAAK,CAAC,eAAwC,EAAA;
|
|
1
|
+
{"version":3,"file":"unauth_client.js","sources":["../../src/core/unauth_client.ts"],"sourcesContent":["import type { AuthInformation, PlClientConfig } from './config';\nimport type {\n AuthAPI_ListMethods_Response,\n MaintenanceAPI_Ping_Response,\n} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';\nimport { LLPlClient } from './ll_client';\nimport { type MiLogger, notEmpty } from '@milaboratories/ts-helpers';\nimport { UnauthenticatedError } from './errors';\n\n/** Primarily used for initial authentication (login) */\nexport class UnauthenticatedPlClient {\n public readonly ll: LLPlClient;\n\n private constructor(ll: LLPlClient) {\n this.ll = ll;\n }\n\n public static async build(configOrAddress: PlClientConfig | string, ops?: { logger?: MiLogger }): Promise<UnauthenticatedPlClient> {\n const ll = await LLPlClient.build(configOrAddress, ops);\n return new UnauthenticatedPlClient(ll);\n }\n\n public async ping(): Promise<MaintenanceAPI_Ping_Response> {\n return await this.ll.ping();\n }\n\n public async authMethods(): Promise<AuthAPI_ListMethods_Response> {\n return await this.ll.authMethods();\n }\n\n public async requireAuth(): Promise<boolean> {\n return (await this.authMethods()).methods.length > 0;\n }\n\n public async login(user: string, password: string): Promise<AuthInformation> {\n try {\n const token = await this.ll.getJwtToken(\n BigInt(this.ll.conf.authTTLSeconds),\n { authorization: 'Basic ' + Buffer.from(user + ':' + password).toString('base64') },\n );\n const jwtToken = notEmpty(token);\n if (jwtToken === '') throw new Error('empty token');\n return { jwtToken };\n } catch (e: any) {\n if (e.code === 'UNAUTHENTICATED') throw new UnauthenticatedError(e.message);\n throw new Error(e);\n }\n }\n}\n"],"names":[],"mappings":";;;;AASA;MACa,uBAAuB,CAAA;AAClB,IAAA,EAAE;AAElB,IAAA,WAAA,CAAoB,EAAc,EAAA;AAChC,QAAA,IAAI,CAAC,EAAE,GAAG,EAAE;IACd;AAEO,IAAA,aAAa,KAAK,CAAC,eAAwC,EAAE,GAA2B,EAAA;QAC7F,MAAM,EAAE,GAAG,MAAM,UAA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pl-client",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.17",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22.19.0"
|
|
6
6
|
},
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"undici": "~7.16.0",
|
|
36
36
|
"utility-types": "^3.11.0",
|
|
37
37
|
"yaml": "^2.8.0",
|
|
38
|
-
"@milaboratories/pl-http": "1.2.0",
|
|
39
38
|
"@milaboratories/pl-model-common": "1.21.10",
|
|
39
|
+
"@milaboratories/pl-http": "1.2.0",
|
|
40
40
|
"@milaboratories/ts-helpers": "1.5.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"eslint": "^9.25.1",
|
|
50
50
|
"typescript": "~5.6.3",
|
|
51
51
|
"@milaboratories/build-configs": "1.2.1",
|
|
52
|
-
"@milaboratories/ts-builder": "1.2.1",
|
|
53
52
|
"@milaboratories/ts-configs": "1.2.0",
|
|
53
|
+
"@milaboratories/ts-builder": "1.2.1",
|
|
54
54
|
"@milaboratories/eslint-config": "1.0.5"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
MaintenanceAPI_Ping_Response,
|
|
5
5
|
} from '../proto-grpc/github.com/milaboratory/pl/plapi/plapiproto/api';
|
|
6
6
|
import { LLPlClient } from './ll_client';
|
|
7
|
-
import { notEmpty } from '@milaboratories/ts-helpers';
|
|
7
|
+
import { type MiLogger, notEmpty } from '@milaboratories/ts-helpers';
|
|
8
8
|
import { UnauthenticatedError } from './errors';
|
|
9
9
|
|
|
10
10
|
/** Primarily used for initial authentication (login) */
|
|
@@ -15,8 +15,8 @@ export class UnauthenticatedPlClient {
|
|
|
15
15
|
this.ll = ll;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
public static async build(configOrAddress: PlClientConfig | string): Promise<UnauthenticatedPlClient> {
|
|
19
|
-
const ll = await LLPlClient.build(configOrAddress);
|
|
18
|
+
public static async build(configOrAddress: PlClientConfig | string, ops?: { logger?: MiLogger }): Promise<UnauthenticatedPlClient> {
|
|
19
|
+
const ll = await LLPlClient.build(configOrAddress, ops);
|
|
20
20
|
return new UnauthenticatedPlClient(ll);
|
|
21
21
|
}
|
|
22
22
|
|