@passlock/node 0.9.22 → 0.9.24
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/README.md +7 -3
- package/README.template.md +55 -0
- package/dist/config/config.d.ts +0 -1
- package/dist/index.d.ts +34 -7
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/principal/principal.d.ts +12 -8
- package/dist/principal/principal.fixture.d.ts +1 -2
- package/dist/principal/principal.fixture.js +32 -8
- package/dist/principal/principal.fixture.js.map +1 -1
- package/dist/principal/principal.js +19 -9
- package/dist/principal/principal.js.map +1 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +32 -28
- package/src/index.ts +17 -11
- package/src/principal/principal.fixture.ts +39 -12
- package/src/principal/principal.test.ts +8 -6
- package/src/principal/principal.ts +39 -31
- package/src/version.ts +1 -0
- package/dist/config/config.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/principal/principal.d.ts.map +0 -1
- package/dist/principal/principal.fixture.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The pnpm script build:readme replaces tokens
|
|
3
|
+
in README.template.md and outputs to README.md
|
|
4
|
+
-->
|
|
1
5
|
<div align="center">
|
|
2
|
-
<a href="https://github.com/passlock-dev/
|
|
6
|
+
<a href="https://github.com/passlock-dev/passlock">
|
|
3
7
|
<img src="https://github.com/passlock-dev/passkeys-frontend/assets/208345/53ee00d3-8e6c-49ea-b43c-3f901450c73b" alt="Passlock logo" width="80" height="80">
|
|
4
8
|
</a>
|
|
5
9
|
</div>
|
|
@@ -11,9 +15,9 @@
|
|
|
11
15
|
<br />
|
|
12
16
|
<a href="https://passlock.dev"><strong>Project website »</strong></a>
|
|
13
17
|
<br />
|
|
14
|
-
<a href="https://github.com/passlock-dev/
|
|
18
|
+
<a href="https://github.com/passlock-dev/passlock">GitHub</a>
|
|
15
19
|
·
|
|
16
|
-
<a href="
|
|
20
|
+
<a href="">Demo</a>
|
|
17
21
|
·
|
|
18
22
|
<a href="https://docs.passlock.dev">Documentation</a>
|
|
19
23
|
·
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
The pnpm script build:readme replaces tokens
|
|
3
|
+
in README.template.md and outputs to README.md
|
|
4
|
+
-->
|
|
5
|
+
<div align="center">
|
|
6
|
+
<a href="#{GITHUB_REPO}#">
|
|
7
|
+
<img src="#{PASSLOCK_LOGO}#" alt="Passlock logo" width="80" height="80">
|
|
8
|
+
</a>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div>
|
|
12
|
+
<h1 align="center">Passkeys, Social Login & more <br /> for Node.js apps</h1>
|
|
13
|
+
<p align="center">
|
|
14
|
+
Node SDK for Passkey authentication, Social Login using Apple, Google and more...
|
|
15
|
+
<br />
|
|
16
|
+
<a href="#{PASSLOCK_SITE}#"><strong>Project website »</strong></a>
|
|
17
|
+
<br />
|
|
18
|
+
<a href="#{GITHUB_REPO}#">GitHub</a>
|
|
19
|
+
·
|
|
20
|
+
<a href="#{DEMO_SITE}#">Demo</a>
|
|
21
|
+
·
|
|
22
|
+
<a href="#{DOCS}#">Documentation</a>
|
|
23
|
+
·
|
|
24
|
+
<a href="#{TUTORIAL}#">Tutorial</a>
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<br />
|
|
29
|
+
|
|
30
|
+
## See also
|
|
31
|
+
|
|
32
|
+
For frontend usage please see the accompanying [@passlock/client][client] package
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
Node 16+
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
Generate a secure token in your frontend then use this API to obtain the passkey registration or authentication details:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { Passlock } from '@passlock/node'
|
|
44
|
+
|
|
45
|
+
const passlock = new Passlock({ tenancyId, apiKey })
|
|
46
|
+
|
|
47
|
+
// token comes from your frontend
|
|
48
|
+
const principal = await passlock.fetchPrincipal({ token })
|
|
49
|
+
|
|
50
|
+
// get the user id
|
|
51
|
+
console.log(principal.user.id)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
[contact]: https://passlock.dev/contact
|
|
55
|
+
[client]: https://www.npmjs.com/package/@passlock/client
|
package/dist/config/config.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -17,17 +17,31 @@ export declare class PasslockUnsafe {
|
|
|
17
17
|
});
|
|
18
18
|
private readonly runPromise;
|
|
19
19
|
fetchPrincipal: (request: PrincipalRequest) => Promise<{
|
|
20
|
+
readonly givenName?: string;
|
|
21
|
+
readonly familyName?: string;
|
|
22
|
+
readonly email?: string;
|
|
23
|
+
readonly emailVerified?: boolean;
|
|
24
|
+
readonly iss: string;
|
|
25
|
+
readonly aud: string;
|
|
26
|
+
readonly sub: string;
|
|
27
|
+
readonly iat: Date;
|
|
28
|
+
readonly nbf: Date;
|
|
29
|
+
readonly exp: Date;
|
|
30
|
+
readonly jti: string;
|
|
20
31
|
readonly token: string;
|
|
21
|
-
readonly
|
|
32
|
+
readonly userVerified: boolean;
|
|
33
|
+
readonly authType: "email" | "apple" | "google" | "passkey";
|
|
34
|
+
readonly authId: string;
|
|
35
|
+
readonly user?: {
|
|
22
36
|
readonly id: string;
|
|
37
|
+
readonly email: string;
|
|
23
38
|
readonly givenName: string;
|
|
24
39
|
readonly familyName: string;
|
|
25
|
-
readonly email: string;
|
|
26
40
|
readonly emailVerified: boolean;
|
|
27
41
|
};
|
|
28
42
|
readonly authStatement: {
|
|
29
|
-
readonly authType: "email" | "apple" | "google" | "passkey";
|
|
30
43
|
readonly userVerified: boolean;
|
|
44
|
+
readonly authType: "email" | "apple" | "google" | "passkey";
|
|
31
45
|
readonly authTimestamp: Date;
|
|
32
46
|
};
|
|
33
47
|
readonly expireAt: Date;
|
|
@@ -42,20 +56,33 @@ export declare class Passlock {
|
|
|
42
56
|
});
|
|
43
57
|
private readonly runPromise;
|
|
44
58
|
fetchPrincipal: (request: PrincipalRequest) => Promise<{
|
|
59
|
+
readonly givenName?: string;
|
|
60
|
+
readonly familyName?: string;
|
|
61
|
+
readonly email?: string;
|
|
62
|
+
readonly emailVerified?: boolean;
|
|
63
|
+
readonly iss: string;
|
|
64
|
+
readonly aud: string;
|
|
65
|
+
readonly sub: string;
|
|
66
|
+
readonly iat: Date;
|
|
67
|
+
readonly nbf: Date;
|
|
68
|
+
readonly exp: Date;
|
|
69
|
+
readonly jti: string;
|
|
45
70
|
readonly token: string;
|
|
46
|
-
readonly
|
|
71
|
+
readonly userVerified: boolean;
|
|
72
|
+
readonly authType: "email" | "apple" | "google" | "passkey";
|
|
73
|
+
readonly authId: string;
|
|
74
|
+
readonly user?: {
|
|
47
75
|
readonly id: string;
|
|
76
|
+
readonly email: string;
|
|
48
77
|
readonly givenName: string;
|
|
49
78
|
readonly familyName: string;
|
|
50
|
-
readonly email: string;
|
|
51
79
|
readonly emailVerified: boolean;
|
|
52
80
|
};
|
|
53
81
|
readonly authStatement: {
|
|
54
|
-
readonly authType: "email" | "apple" | "google" | "passkey";
|
|
55
82
|
readonly userVerified: boolean;
|
|
83
|
+
readonly authType: "email" | "apple" | "google" | "passkey";
|
|
56
84
|
readonly authTimestamp: Date;
|
|
57
85
|
};
|
|
58
86
|
readonly expireAt: Date;
|
|
59
87
|
} | PasslockError>;
|
|
60
88
|
}
|
|
61
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorCode, Forbidden, InternalServerError, NotFound, Unauthorized, } from '@passlock/shared/dist/error/error.js';
|
|
2
1
|
import { Effect as E, Layer as L, Runtime, Scope, pipe } from 'effect';
|
|
2
|
+
import { ErrorCode } from '@passlock/shared/dist/error/error.js';
|
|
3
3
|
import { Config } from './config/config.js';
|
|
4
4
|
import { PrincipalService, PrincipalServiceLive, StreamResponseLive, } from './principal/principal.js';
|
|
5
5
|
export { ErrorCode } from '@passlock/shared/dist/error/error.js';
|
|
@@ -38,6 +38,7 @@ const transformErrors = (effect) => {
|
|
|
38
38
|
: E.succeed(new PasslockError('Sorry, something went wrong', ErrorCode.InternalServerError));
|
|
39
39
|
},
|
|
40
40
|
Interrupt: () => {
|
|
41
|
+
console.error('Interrupt');
|
|
41
42
|
return E.succeed(new PasslockError('Operation aborted', ErrorCode.InternalBrowserError));
|
|
42
43
|
},
|
|
43
44
|
Sequential: errors => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAQhE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAEhE,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,GAAG,eAAe,CAAA;IACtB,IAAI,CAAW;IAExB,YAAY,OAAe,EAAE,IAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,MAAM,CAAU,OAAO,GAAG,CAAC,KAAc,EAA0B,EAAE;QACnE,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;YACzB,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CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAC9B,CAAA;QACD,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;QACrC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC5E,CAAC;IAEgB,UAAU,GAAG,CAC5B,MAAsC,EACtC,EAAE;QACF,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC1F,CAAC,CAAA;IAED,cAAc,GAAG,CAAC,OAAyB,EAAE,EAAE,CAC7C,IAAI,CACF,gBAAgB,EAChB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACrD,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAClC,CAAA;CACJ"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
import * as https from 'https';
|
|
2
|
+
import { Context, Effect as E, Layer, Stream } from 'effect';
|
|
1
3
|
import { Forbidden, InternalServerError, NotFound, Unauthorized } from '@passlock/shared/dist/error/error.js';
|
|
2
4
|
import { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
3
|
-
import { Context, Effect as E, Layer, Stream } from 'effect';
|
|
4
|
-
import * as https from 'https';
|
|
5
5
|
import { Config } from '../config/config.js';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
declare const StreamResponse_base: Context.TagClass<StreamResponse, "@services/StreamResponse", {
|
|
7
|
+
streamResponse: (options: https.RequestOptions) => Stream.Stream<Buffer, PrincipalErrors>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare class StreamResponse extends StreamResponse_base {
|
|
10
|
+
}
|
|
8
11
|
export type PrincipalErrors = NotFound | Unauthorized | Forbidden | InternalServerError;
|
|
9
12
|
export type PrincipalRequest = {
|
|
10
13
|
token: string;
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
declare const PrincipalService_base: Context.TagClass<PrincipalService, "@services/PrincipalService", {
|
|
13
16
|
fetchPrincipal: (request: PrincipalRequest) => E.Effect<Principal, PrincipalErrors>;
|
|
14
|
-
}
|
|
15
|
-
export declare
|
|
17
|
+
}>;
|
|
18
|
+
export declare class PrincipalService extends PrincipalService_base {
|
|
19
|
+
}
|
|
16
20
|
export declare const buildError: (res: {
|
|
17
21
|
statusCode?: number | undefined;
|
|
18
22
|
statusMessage?: string | undefined;
|
|
@@ -20,4 +24,4 @@ export declare const buildError: (res: {
|
|
|
20
24
|
export declare const fetchPrincipal: (request: PrincipalRequest) => E.Effect<Principal, PrincipalErrors, StreamResponse | Config>;
|
|
21
25
|
export declare const StreamResponseLive: Layer.Layer<StreamResponse, never, never>;
|
|
22
26
|
export declare const PrincipalServiceLive: Layer.Layer<PrincipalService, never, Config | StreamResponse>;
|
|
23
|
-
|
|
27
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
2
1
|
import { Context, Effect as E, Layer as L, Ref } from 'effect';
|
|
3
2
|
import type { RequestOptions } from 'https';
|
|
3
|
+
import { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
4
4
|
import { Config } from '../config/config.js';
|
|
5
5
|
import { type PrincipalService } from './principal.js';
|
|
6
6
|
export declare const principal: Principal;
|
|
@@ -13,4 +13,3 @@ export declare class State extends State_base {
|
|
|
13
13
|
export declare const buildEffect: <A, E>(assertions: E.Effect<A, E, PrincipalService | State>) => E.Effect<void, E>;
|
|
14
14
|
export declare const buildErrorEffect: (statusCode: number) => <A>(assertions: E.Effect<void, A, PrincipalService>) => E.Effect<void, A>;
|
|
15
15
|
export {};
|
|
16
|
-
//# sourceMappingURL=principal.fixture.d.ts.map
|
|
@@ -1,13 +1,32 @@
|
|
|
1
|
+
import * as S from '@effect/schema/Schema';
|
|
1
2
|
import { Context, Effect as E, Layer as L, LogLevel, Logger, Ref, Stream, pipe } from 'effect';
|
|
3
|
+
import { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
2
4
|
import { Config } from '../config/config.js';
|
|
3
5
|
import { PrincipalServiceLive, StreamResponse, buildError, } from './principal.js';
|
|
4
6
|
export const principal = {
|
|
7
|
+
jti: 'token',
|
|
5
8
|
token: 'token',
|
|
9
|
+
sub: 'user-1',
|
|
10
|
+
iss: 'idp.passlock.dev',
|
|
11
|
+
aud: 'tenancy_id',
|
|
12
|
+
// must be at least 1 second
|
|
13
|
+
// as it's truncated to seconds
|
|
14
|
+
iat: new Date(60 * 1000),
|
|
15
|
+
nbf: new Date(120 * 100),
|
|
16
|
+
exp: new Date(180 * 1000),
|
|
17
|
+
email: 'john.doe@gmail.com',
|
|
18
|
+
givenName: 'john',
|
|
19
|
+
familyName: 'doe',
|
|
20
|
+
emailVerified: false,
|
|
21
|
+
authType: 'passkey',
|
|
22
|
+
authId: 'auth-1',
|
|
23
|
+
userVerified: true,
|
|
24
|
+
// legacy
|
|
6
25
|
user: {
|
|
7
|
-
id: '1',
|
|
8
|
-
email: 'john.doe@gmail.com',
|
|
26
|
+
id: 'user-1',
|
|
9
27
|
givenName: 'john',
|
|
10
28
|
familyName: 'doe',
|
|
29
|
+
email: 'john.doe@gmail.com',
|
|
11
30
|
emailVerified: false,
|
|
12
31
|
},
|
|
13
32
|
authStatement: {
|
|
@@ -23,19 +42,24 @@ export const configTest = L.succeed(Config, Config.of({ tenancyId, apiKey }));
|
|
|
23
42
|
export class State extends Context.Tag('State')() {
|
|
24
43
|
}
|
|
25
44
|
export const buildEffect = (assertions) => {
|
|
26
|
-
const
|
|
45
|
+
const streamResponseTest = L.effect(StreamResponse, E.gen(function* (_) {
|
|
27
46
|
const ref = yield* _(State);
|
|
28
|
-
const
|
|
29
|
-
|
|
47
|
+
const res = S.encodeSync(Principal)(principal);
|
|
48
|
+
const buff = Buffer.from(JSON.stringify(res));
|
|
49
|
+
return {
|
|
50
|
+
streamResponse: options => pipe(Stream.fromEffect(Ref.set(ref, options)), Stream.zipRight(Stream.make(buff))),
|
|
51
|
+
};
|
|
30
52
|
}));
|
|
31
|
-
const service = pipe(PrincipalServiceLive, L.provide(
|
|
53
|
+
const service = pipe(PrincipalServiceLive, L.provide(streamResponseTest), L.provide(configTest));
|
|
32
54
|
const args = L.effect(State, Ref.make(undefined));
|
|
33
55
|
const effect = pipe(E.provide(assertions, service), E.provide(args), Logger.withMinimumLogLevel(LogLevel.None));
|
|
34
56
|
return effect;
|
|
35
57
|
};
|
|
36
58
|
export const buildErrorEffect = (statusCode) => (assertions) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
59
|
+
const streamResponseTest = L.succeed(StreamResponse, StreamResponse.of({
|
|
60
|
+
streamResponse: () => Stream.fail(buildError({ statusCode })),
|
|
61
|
+
}));
|
|
62
|
+
const service = pipe(PrincipalServiceLive, L.provide(streamResponseTest), L.provide(configTest));
|
|
39
63
|
const args = L.effect(State, Ref.make(undefined));
|
|
40
64
|
const effect = pipe(E.provide(assertions, service), E.provide(args), Logger.withMinimumLogLevel(LogLevel.None));
|
|
41
65
|
return effect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principal.fixture.js","sourceRoot":"","sources":["../../src/principal/principal.fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"principal.fixture.js","sourceRoot":"","sources":["../../src/principal/principal.fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,QAAQ,EAAE,MAA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AAE,OAAO,CAAC,EAC9B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EACf,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC1C,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAC3B,CAAC,UAAkB,EAAE,EAAE,CACvB,CAAI,UAA+C,EAAqB,EAAE;IACxE,MAAM,kBAAkB,GAAG,CAAC,CAAC,OAAO,CAClC,cAAc,EACd,cAAc,CAAC,EAAE,CAAC;QAChB,cAAc,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;KAC9D,CAAC,CACH,CAAA;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;IAEhG,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAA6B,SAAS,CAAC,CAAC,CAAA;IAE7E,MAAM,MAAM,GAAG,IAAI,CACjB,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAC9B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EACf,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAC1C,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import * as https from 'https';
|
|
2
|
+
import { Chunk, Console, Context, Effect as E, Layer, Option, Stream, flow, pipe } from 'effect';
|
|
1
3
|
import { Forbidden, InternalServerError, NotFound, Unauthorized, } from '@passlock/shared/dist/error/error.js';
|
|
2
|
-
import { Principal
|
|
4
|
+
import { Principal } from '@passlock/shared/dist/schema/principal.js';
|
|
3
5
|
import { createParser } from '@passlock/shared/dist/schema/utils.js';
|
|
4
|
-
import { Chunk, Console, Context, Effect as E, Layer, Option, Stream, flow, pipe } from 'effect';
|
|
5
|
-
import * as https from 'https';
|
|
6
6
|
import { Config } from '../config/config.js';
|
|
7
|
-
|
|
7
|
+
import { PASSLOCK_CLIENT_VERSION } from '../version.js';
|
|
8
|
+
/* Dependencies */
|
|
9
|
+
export class StreamResponse extends Context.Tag('@services/StreamResponse')() {
|
|
10
|
+
}
|
|
11
|
+
/* Service */
|
|
8
12
|
const parsePrincipal = createParser(Principal);
|
|
9
|
-
export
|
|
13
|
+
export class PrincipalService extends Context.Tag('@services/PrincipalService')() {
|
|
14
|
+
}
|
|
15
|
+
/* Effects */
|
|
10
16
|
const buildHostname = (endpoint) => {
|
|
11
17
|
return new URL(endpoint || 'https://api.passlock.dev').hostname;
|
|
12
18
|
};
|
|
@@ -18,6 +24,7 @@ const buildOptions = (token) => pipe(Config, E.map(({ endpoint, tenancyId, apiKe
|
|
|
18
24
|
headers: {
|
|
19
25
|
'Accept': 'application/json',
|
|
20
26
|
'Authorization': `Bearer ${apiKey}`,
|
|
27
|
+
'X-PASSLOCK-CLIENT-VERSION': PASSLOCK_CLIENT_VERSION,
|
|
21
28
|
},
|
|
22
29
|
})));
|
|
23
30
|
export const buildError = (res) => {
|
|
@@ -38,7 +45,7 @@ export const buildError = (res) => {
|
|
|
38
45
|
const fail = (error) => E.fail(Option.some(error));
|
|
39
46
|
const succeed = (data) => E.succeed(Chunk.of(data));
|
|
40
47
|
const close = E.fail(Option.none());
|
|
41
|
-
const buildStream = (token) => pipe(Stream.fromEffect(buildOptions(token)), Stream.zip(StreamResponse), Stream.flatMap(([options, streamResponse]) => streamResponse(options)));
|
|
48
|
+
const buildStream = (token) => pipe(Stream.fromEffect(buildOptions(token)), Stream.zip(StreamResponse), Stream.flatMap(([options, { streamResponse }]) => streamResponse(options)));
|
|
42
49
|
export const fetchPrincipal = (request) => {
|
|
43
50
|
const stream = buildStream(request.token);
|
|
44
51
|
const json = pipe(Stream.runCollect(stream), E.map(Chunk.toReadonlyArray), E.map(buffers => Buffer.concat(buffers)), E.flatMap(buffer => E.try({
|
|
@@ -56,8 +63,10 @@ export const fetchPrincipal = (request) => {
|
|
|
56
63
|
})), E.flatMap(json => pipe(parsePrincipal(json), E.tapError(error => Console.error(error.detail)), E.mapError(() => new InternalServerError({ message: 'Unable to parse response as Principal' })))));
|
|
57
64
|
return json;
|
|
58
65
|
};
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
/* Live */
|
|
67
|
+
/* v8 ignore start */
|
|
68
|
+
export const StreamResponseLive = Layer.succeed(StreamResponse, {
|
|
69
|
+
streamResponse: options => Stream.async((emit) => {
|
|
61
70
|
https
|
|
62
71
|
.request(options, res => {
|
|
63
72
|
if (200 !== res.statusCode)
|
|
@@ -67,7 +76,7 @@ export const StreamResponseLive = Layer.succeed(StreamResponse, options => {
|
|
|
67
76
|
res.on('error', e => void emit(fail(new InternalServerError({ message: e.message }))));
|
|
68
77
|
})
|
|
69
78
|
.end();
|
|
70
|
-
})
|
|
79
|
+
}),
|
|
71
80
|
});
|
|
72
81
|
export const PrincipalServiceLive = Layer.effect(PrincipalService, E.gen(function* (_) {
|
|
73
82
|
const context = yield* _(E.context());
|
|
@@ -75,4 +84,5 @@ export const PrincipalServiceLive = Layer.effect(PrincipalService, E.gen(functio
|
|
|
75
84
|
fetchPrincipal: flow(fetchPrincipal, E.provide(context)),
|
|
76
85
|
});
|
|
77
86
|
}));
|
|
87
|
+
/* v8 ignore stop */
|
|
78
88
|
//# sourceMappingURL=principal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principal.js","sourceRoot":"","sources":["../../src/principal/principal.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"principal.js","sourceRoot":"","sources":["../../src/principal/principal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,O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AI,CAAC,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACxF,CAAC,CAAC;aACD,GAAG,EAAE,CAAA;IACV,CAAC,CAAC;CACL,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAC9C,gBAAgB,EAChB,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;IAChB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAA2B,CAAC,CAAA;IAC9D,OAAO,gBAAgB,CAAC,EAAE,CAAC;QACzB,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACzD,CAAC,CAAA;AACJ,CAAC,CAAC,CACH,CAAA;AACD,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PASSLOCK_CLIENT_VERSION = "0.9.24";
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@passlock/node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.9.24",
|
|
5
|
+
"description": "Passkey authentication and social login for node.js/express apps",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"passkey",
|
|
8
8
|
"passkeys",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"email": "toby@passlock.dev"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"homepage": "https://
|
|
18
|
+
"homepage": "https://passlock.dev",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git+https://github.com/passlock-dev/ts-clients.git",
|
|
@@ -38,42 +38,46 @@
|
|
|
38
38
|
"!dist/**/*.spec.*"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"effect": "3.4
|
|
42
|
-
"@passlock/shared": "0.9.
|
|
41
|
+
"effect": "3.6.4",
|
|
42
|
+
"@passlock/shared": "0.9.24"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@typescript
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"eslint": "^8.
|
|
45
|
+
"@effect/schema": "0.71.0",
|
|
46
|
+
"@qetza/replacetokens": "^1.7.0",
|
|
47
|
+
"@total-typescript/tsconfig": "^1.0.4",
|
|
48
|
+
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
49
|
+
"@tsconfig/node20": "^20.1.4",
|
|
50
|
+
"@types/node": "^22.4.0",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
|
52
|
+
"@typescript-eslint/parser": "^8.1.0",
|
|
53
|
+
"@vitest/coverage-v8": "^2.0.5",
|
|
54
|
+
"@vitest/ui": "^2.0.5",
|
|
55
|
+
"eslint": "^9.9.0",
|
|
52
56
|
"eslint-config-prettier": "^9.1.0",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"vitest": "^2.0.3"
|
|
57
|
+
"globals": "^15.9.0",
|
|
58
|
+
"prettier": "^3.3.3",
|
|
59
|
+
"publint": "^0.2.10",
|
|
60
|
+
"rimraf": "^6.0.1",
|
|
61
|
+
"tsx": "^4.17.0",
|
|
62
|
+
"typescript": "^5.5.4",
|
|
63
|
+
"vite": "^5.4.1",
|
|
64
|
+
"vitest": "^2.0.5"
|
|
62
65
|
},
|
|
63
66
|
"scripts": {
|
|
64
|
-
"clean": "
|
|
67
|
+
"clean": "rimraf ./dist",
|
|
65
68
|
"typecheck": "tsc --noEmit",
|
|
66
69
|
"test": "vitest run",
|
|
67
70
|
"test:watch": "vitest dev",
|
|
68
71
|
"test:ui": "vitest --coverage.enabled=true --ui",
|
|
69
72
|
"test:coverage": "vitest run --coverage",
|
|
70
|
-
"build": "tsc --build
|
|
73
|
+
"build": "tsc --build",
|
|
71
74
|
"build:clean": "pnpm run clean && pnpm run build",
|
|
72
|
-
"build:
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
+
"build:readme": "LATEST=${npm_package_version} tsx ../shared/scripts/replace-readme-tokens.ts ./packages/node",
|
|
76
|
+
"replaceTokens": "LATEST=${npm_package_version} tsx ../shared/scripts/replace-tokens.ts ./packages/node",
|
|
77
|
+
"build:production": "pnpm run build:clean && pnpm run replaceTokens && echo '' && publint",
|
|
78
|
+
"format": "prettier --write \"(src|scripts)/**/*.+(js|ts|json)\"",
|
|
79
|
+
"lint": "eslint ./src",
|
|
75
80
|
"lint:fix": "pnpm run lint --fix",
|
|
76
|
-
"
|
|
77
|
-
"ncu:save": "ncu --peer -x @effect/* -x effect -u"
|
|
81
|
+
"upgrade:deps": "ncu --peer -x effect -x @effect/* -i -u"
|
|
78
82
|
}
|
|
79
83
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ErrorCode,
|
|
3
|
-
Forbidden,
|
|
4
|
-
InternalServerError,
|
|
5
|
-
NotFound,
|
|
6
|
-
Unauthorized,
|
|
7
|
-
} from '@passlock/shared/dist/error/error.js'
|
|
8
1
|
import { Effect as E, Layer as L, Runtime, Scope, pipe } from 'effect'
|
|
2
|
+
|
|
3
|
+
import { ErrorCode } from '@passlock/shared/dist/error/error.js'
|
|
4
|
+
import type {
|
|
5
|
+
Forbidden,
|
|
6
|
+
InternalServerError,
|
|
7
|
+
NotFound,
|
|
8
|
+
Unauthorized,
|
|
9
|
+
} from '@passlock/shared/dist/error/error.js'
|
|
10
|
+
|
|
9
11
|
import { Config } from './config/config.js'
|
|
10
12
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type PrincipalRequest,
|
|
14
|
+
PrincipalService,
|
|
15
|
+
PrincipalServiceLive,
|
|
16
|
+
StreamResponseLive,
|
|
15
17
|
} from './principal/principal.js'
|
|
16
18
|
|
|
17
19
|
export type { PrincipalRequest } from './principal/principal.js'
|
|
@@ -69,11 +71,14 @@ const transformErrors = <A, R>(
|
|
|
69
71
|
},
|
|
70
72
|
|
|
71
73
|
Interrupt: () => {
|
|
74
|
+
console.error('Interrupt')
|
|
75
|
+
|
|
72
76
|
return E.succeed(new PasslockError('Operation aborted', ErrorCode.InternalBrowserError))
|
|
73
77
|
},
|
|
74
78
|
|
|
75
79
|
Sequential: errors => {
|
|
76
80
|
console.error(errors)
|
|
81
|
+
|
|
77
82
|
return E.succeed(
|
|
78
83
|
new PasslockError('Sorry, something went wrong', ErrorCode.InternalServerError),
|
|
79
84
|
)
|
|
@@ -81,6 +86,7 @@ const transformErrors = <A, R>(
|
|
|
81
86
|
|
|
82
87
|
Parallel: errors => {
|
|
83
88
|
console.error(errors)
|
|
89
|
+
|
|
84
90
|
return E.succeed(
|
|
85
91
|
new PasslockError('Sorry, something went wrong', ErrorCode.InternalServerError),
|
|
86
92
|
)
|
|
@@ -1,21 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as S from '@effect/schema/Schema'
|
|
2
2
|
import { Context, Effect as E, Layer as L, LogLevel, Logger, Ref, Stream, pipe } from 'effect'
|
|
3
3
|
import type { RequestOptions } from 'https'
|
|
4
|
+
|
|
5
|
+
import { Principal } from '@passlock/shared/dist/schema/principal.js'
|
|
6
|
+
|
|
4
7
|
import { Config } from '../config/config.js'
|
|
5
8
|
import {
|
|
9
|
+
type PrincipalService,
|
|
6
10
|
PrincipalServiceLive,
|
|
7
11
|
StreamResponse,
|
|
8
12
|
buildError,
|
|
9
|
-
type PrincipalService,
|
|
10
13
|
} from './principal.js'
|
|
11
14
|
|
|
12
15
|
export const principal: Principal = {
|
|
16
|
+
jti: 'token',
|
|
13
17
|
token: 'token',
|
|
18
|
+
sub: 'user-1',
|
|
19
|
+
iss: 'idp.passlock.dev',
|
|
20
|
+
aud: 'tenancy_id',
|
|
21
|
+
// must be at least 1 second
|
|
22
|
+
// as it's truncated to seconds
|
|
23
|
+
iat: new Date(60 * 1000),
|
|
24
|
+
nbf: new Date(120 * 100),
|
|
25
|
+
exp: new Date(180 * 1000),
|
|
26
|
+
email: 'john.doe@gmail.com',
|
|
27
|
+
givenName: 'john',
|
|
28
|
+
familyName: 'doe',
|
|
29
|
+
emailVerified: false,
|
|
30
|
+
authType: 'passkey',
|
|
31
|
+
authId: 'auth-1',
|
|
32
|
+
userVerified: true,
|
|
33
|
+
// legacy
|
|
14
34
|
user: {
|
|
15
|
-
id: '1',
|
|
16
|
-
email: 'john.doe@gmail.com',
|
|
35
|
+
id: 'user-1',
|
|
17
36
|
givenName: 'john',
|
|
18
37
|
familyName: 'doe',
|
|
38
|
+
email: 'john.doe@gmail.com',
|
|
19
39
|
emailVerified: false,
|
|
20
40
|
},
|
|
21
41
|
authStatement: {
|
|
@@ -36,17 +56,21 @@ export class State extends Context.Tag('State')<State, Ref.Ref<RequestOptions |
|
|
|
36
56
|
export const buildEffect = <A, E>(
|
|
37
57
|
assertions: E.Effect<A, E, PrincipalService | State>,
|
|
38
58
|
): E.Effect<void, E> => {
|
|
39
|
-
const
|
|
59
|
+
const streamResponseTest = L.effect(
|
|
40
60
|
StreamResponse,
|
|
41
61
|
E.gen(function* (_) {
|
|
42
62
|
const ref = yield* _(State)
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
63
|
+
const res = S.encodeSync(Principal)(principal)
|
|
64
|
+
const buff = Buffer.from(JSON.stringify(res))
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
streamResponse: options =>
|
|
68
|
+
pipe(Stream.fromEffect(Ref.set(ref, options)), Stream.zipRight(Stream.make(buff))),
|
|
69
|
+
}
|
|
46
70
|
}),
|
|
47
71
|
)
|
|
48
72
|
|
|
49
|
-
const service = pipe(PrincipalServiceLive, L.provide(
|
|
73
|
+
const service = pipe(PrincipalServiceLive, L.provide(streamResponseTest), L.provide(configTest))
|
|
50
74
|
|
|
51
75
|
const args = L.effect(State, Ref.make<RequestOptions | undefined>(undefined))
|
|
52
76
|
|
|
@@ -62,11 +86,14 @@ export const buildEffect = <A, E>(
|
|
|
62
86
|
export const buildErrorEffect =
|
|
63
87
|
(statusCode: number) =>
|
|
64
88
|
<A>(assertions: E.Effect<void, A, PrincipalService>): E.Effect<void, A> => {
|
|
65
|
-
const
|
|
66
|
-
|
|
89
|
+
const streamResponseTest = L.succeed(
|
|
90
|
+
StreamResponse,
|
|
91
|
+
StreamResponse.of({
|
|
92
|
+
streamResponse: () => Stream.fail(buildError({ statusCode })),
|
|
93
|
+
}),
|
|
67
94
|
)
|
|
68
95
|
|
|
69
|
-
const service = pipe(PrincipalServiceLive, L.provide(
|
|
96
|
+
const service = pipe(PrincipalServiceLive, L.provide(streamResponseTest), L.provide(configTest))
|
|
70
97
|
|
|
71
98
|
const args = L.effect(State, Ref.make<RequestOptions | undefined>(undefined))
|
|
72
99
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Forbidden,
|
|
3
|
-
InternalServerError,
|
|
4
|
-
NotFound,
|
|
5
|
-
Unauthorized,
|
|
6
|
-
} from '@passlock/shared/dist/error/error.js'
|
|
7
1
|
import { Effect as E, Effect, Ref } from 'effect'
|
|
8
2
|
import { describe, expect, test } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Forbidden,
|
|
6
|
+
InternalServerError,
|
|
7
|
+
NotFound,
|
|
8
|
+
Unauthorized,
|
|
9
|
+
} from '@passlock/shared/dist/error/error.js'
|
|
10
|
+
|
|
9
11
|
import * as Fixture from './principal.fixture.js'
|
|
10
12
|
import { PrincipalService } from './principal.js'
|
|
11
13
|
|
|
@@ -1,22 +1,27 @@
|
|
|
1
|
+
import * as https from 'https'
|
|
2
|
+
import type { StreamEmit } from 'effect'
|
|
3
|
+
import { Chunk, Console, Context, Effect as E, Layer, Option, Stream, flow, pipe } from 'effect'
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
6
|
Forbidden,
|
|
3
7
|
InternalServerError,
|
|
4
8
|
NotFound,
|
|
5
9
|
Unauthorized,
|
|
6
10
|
} from '@passlock/shared/dist/error/error.js'
|
|
7
|
-
import { Principal
|
|
11
|
+
import { Principal } from '@passlock/shared/dist/schema/principal.js'
|
|
8
12
|
import { createParser } from '@passlock/shared/dist/schema/utils.js'
|
|
9
|
-
|
|
10
|
-
import { Chunk, Console, Context, Effect as E, Layer, Option, Stream, flow, pipe } from 'effect'
|
|
11
|
-
import * as https from 'https'
|
|
13
|
+
|
|
12
14
|
import { Config } from '../config/config.js'
|
|
15
|
+
import { PASSLOCK_CLIENT_VERSION } from '../version.js'
|
|
13
16
|
|
|
14
17
|
/* Dependencies */
|
|
15
18
|
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
export class StreamResponse extends Context.Tag('@services/StreamResponse')<
|
|
20
|
+
StreamResponse,
|
|
21
|
+
{
|
|
22
|
+
streamResponse: (options: https.RequestOptions) => Stream.Stream<Buffer, PrincipalErrors>
|
|
23
|
+
}
|
|
24
|
+
>() {}
|
|
20
25
|
|
|
21
26
|
/* Service */
|
|
22
27
|
|
|
@@ -25,16 +30,17 @@ const parsePrincipal = createParser(Principal)
|
|
|
25
30
|
export type PrincipalErrors = NotFound | Unauthorized | Forbidden | InternalServerError
|
|
26
31
|
export type PrincipalRequest = { token: string }
|
|
27
32
|
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
export class PrincipalService extends Context.Tag('@services/PrincipalService')<
|
|
34
|
+
PrincipalService,
|
|
35
|
+
{
|
|
36
|
+
fetchPrincipal: (request: PrincipalRequest) => E.Effect<Principal, PrincipalErrors>
|
|
37
|
+
}
|
|
38
|
+
>() {}
|
|
33
39
|
|
|
34
40
|
/* Effects */
|
|
35
41
|
|
|
36
|
-
const buildHostname = (endpoint: string | undefined) => {
|
|
37
|
-
return new URL(endpoint || 'https://api.passlock.dev').hostname
|
|
42
|
+
const buildHostname = (endpoint: string | undefined) => {
|
|
43
|
+
return new URL(endpoint || 'https://api.passlock.dev').hostname
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
const buildOptions = (token: string) =>
|
|
@@ -48,6 +54,7 @@ const buildOptions = (token: string) =>
|
|
|
48
54
|
headers: {
|
|
49
55
|
'Accept': 'application/json',
|
|
50
56
|
'Authorization': `Bearer ${apiKey}`,
|
|
57
|
+
'X-PASSLOCK-CLIENT-VERSION': PASSLOCK_CLIENT_VERSION,
|
|
51
58
|
},
|
|
52
59
|
})),
|
|
53
60
|
)
|
|
@@ -62,10 +69,10 @@ export const buildError = (res: {
|
|
|
62
69
|
|
|
63
70
|
if (res.statusCode && res.statusMessage)
|
|
64
71
|
return new InternalServerError({ message: `${String(res.statusCode)} - ${res.statusMessage}` })
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
|
|
73
|
+
if (res.statusCode) return new InternalServerError({ message: String(res.statusCode) })
|
|
74
|
+
|
|
75
|
+
if (res.statusMessage) return new InternalServerError({ message: res.statusMessage })
|
|
69
76
|
|
|
70
77
|
return new InternalServerError({ message: 'Received non 200 response' })
|
|
71
78
|
}
|
|
@@ -78,7 +85,7 @@ const buildStream = (token: string) =>
|
|
|
78
85
|
pipe(
|
|
79
86
|
Stream.fromEffect(buildOptions(token)),
|
|
80
87
|
Stream.zip(StreamResponse),
|
|
81
|
-
Stream.flatMap(([options, streamResponse]) => streamResponse(options)),
|
|
88
|
+
Stream.flatMap(([options, { streamResponse }]) => streamResponse(options)),
|
|
82
89
|
)
|
|
83
90
|
|
|
84
91
|
export const fetchPrincipal = (
|
|
@@ -127,17 +134,18 @@ export const fetchPrincipal = (
|
|
|
127
134
|
/* Live */
|
|
128
135
|
|
|
129
136
|
/* v8 ignore start */
|
|
130
|
-
export const StreamResponseLive = Layer.succeed(StreamResponse,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
export const StreamResponseLive = Layer.succeed(StreamResponse, {
|
|
138
|
+
streamResponse: options =>
|
|
139
|
+
Stream.async((emit: StreamEmit.Emit<never, PrincipalErrors, Buffer, void>) => {
|
|
140
|
+
https
|
|
141
|
+
.request(options, res => {
|
|
142
|
+
if (200 !== res.statusCode) void emit(fail(buildError(res)))
|
|
143
|
+
res.on('data', (data: Buffer) => void emit(succeed(data)))
|
|
144
|
+
res.on('close', () => void emit(close))
|
|
145
|
+
res.on('error', e => void emit(fail(new InternalServerError({ message: e.message }))))
|
|
146
|
+
})
|
|
147
|
+
.end()
|
|
148
|
+
}),
|
|
141
149
|
})
|
|
142
150
|
|
|
143
151
|
export const PrincipalServiceLive = Layer.effect(
|
package/src/version.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PASSLOCK_CLIENT_VERSION = '#{LATEST}#'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;;wBAKR,MAAM;qBACT,MAAM;wBACH,MAAM;;AAL9B,qBAAa,MAAO,SAAQ,WAOzB;CAAG"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EAKZ,MAAM,sCAAsC,CAAA;AAG7C,OAAO,EAIH,KAAK,gBAAgB,EACxB,MAAM,0BAA0B,CAAA;AAEjC,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAEhE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAEhE,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,mBAAkB;IAC/B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;gBAEZ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;IAK5C,MAAM,CAAC,QAAQ,CAAC,OAAO,UAAW,OAAO,KAAG,KAAK,IAAI,aAAa,CAOjE;CACF;AAyDD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;gBAE3C,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAW5E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAQ1B;IAED,cAAc,YAAa,gBAAgB;;;;;;;;;;;;;;;OAKxC;CACJ;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;gBAE3C,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;IAW5E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAI1B;IAED,cAAc,YAAa,gBAAgB;;;;;;;;;;;;;;;uBAKxC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"principal.d.ts","sourceRoot":"","sources":["../../src/principal/principal.ts"],"names":[],"mappings":"AAAA,OA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