@bloque/sdk-identity 0.0.3

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.
@@ -0,0 +1,7 @@
1
+ import type { HttpClient } from '@bloque/sdk-core';
2
+ import type { Alias } from './types';
3
+ export declare class AliasesClient {
4
+ private readonly httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ get(alias: string): Promise<Alias>;
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { AliasResponse } from '../api-types';
2
+ export type Alias = AliasResponse;
@@ -0,0 +1,40 @@
1
+ export type AliasResponse = {
2
+ id: string;
3
+ alias: string;
4
+ type: 'phone' | 'email' | string;
5
+ urn: string;
6
+ origin: string;
7
+ details: {
8
+ phone?: string;
9
+ };
10
+ metadata: {
11
+ alias: string;
12
+ [key: string]: unknown;
13
+ };
14
+ status: 'active' | 'inactive' | 'revoked';
15
+ is_public: boolean;
16
+ is_primary: boolean;
17
+ created_at: string;
18
+ updated_at: string;
19
+ };
20
+ interface OTPBase {
21
+ type: 'OTP';
22
+ params: {
23
+ attempts_remaining: number;
24
+ };
25
+ value: {
26
+ expires_at: number;
27
+ };
28
+ }
29
+ export interface OTPAssertionEmail extends OTPBase {
30
+ value: OTPBase['value'] & {
31
+ email: string;
32
+ };
33
+ }
34
+ export interface OTPAssertionWhatsApp extends OTPBase {
35
+ value: OTPBase['value'] & {
36
+ phone: string;
37
+ };
38
+ }
39
+ export type OTPAssertion = OTPAssertionEmail | OTPAssertionWhatsApp;
40
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { HttpClient } from '@bloque/sdk-core';
2
+ import { AliasesClient } from './aliases/client';
3
+ export declare class IdentityClient {
4
+ private readonly httpClient;
5
+ readonly aliases: AliasesClient;
6
+ constructor(httpClient: HttpClient);
7
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ AliasesClient: ()=>AliasesClient,
28
+ IdentityClient: ()=>IdentityClient
29
+ });
30
+ class AliasesClient {
31
+ httpClient;
32
+ constructor(httpClient){
33
+ this.httpClient = httpClient;
34
+ }
35
+ async get(alias) {
36
+ const response = await this.httpClient.request({
37
+ method: 'GET',
38
+ path: `/api/aliases?alias=${alias}`
39
+ });
40
+ return response;
41
+ }
42
+ }
43
+ class IdentityClient {
44
+ httpClient;
45
+ aliases;
46
+ constructor(httpClient){
47
+ this.httpClient = httpClient;
48
+ this.aliases = new AliasesClient(this.httpClient);
49
+ }
50
+ }
51
+ exports.AliasesClient = __webpack_exports__.AliasesClient;
52
+ exports.IdentityClient = __webpack_exports__.IdentityClient;
53
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
54
+ "AliasesClient",
55
+ "IdentityClient"
56
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
57
+ Object.defineProperty(exports, '__esModule', {
58
+ value: true
59
+ });
@@ -0,0 +1,3 @@
1
+ export * from './aliases/client';
2
+ export * from './aliases/types';
3
+ export * from './client';
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ class AliasesClient {
2
+ httpClient;
3
+ constructor(httpClient){
4
+ this.httpClient = httpClient;
5
+ }
6
+ async get(alias) {
7
+ const response = await this.httpClient.request({
8
+ method: 'GET',
9
+ path: `/api/aliases?alias=${alias}`
10
+ });
11
+ return response;
12
+ }
13
+ }
14
+ class IdentityClient {
15
+ httpClient;
16
+ aliases;
17
+ constructor(httpClient){
18
+ this.httpClient = httpClient;
19
+ this.aliases = new AliasesClient(this.httpClient);
20
+ }
21
+ }
22
+ export { AliasesClient, IdentityClient };
@@ -0,0 +1,12 @@
1
+ import type { HttpClient } from '@bloque/sdk-core';
2
+ import type { OTPAssertion, OTPAssertionEmail, OTPAssertionWhatsApp } from '../api-types';
3
+ import { OriginClient } from './origin';
4
+ import type { Alias } from './types';
5
+ export declare class OriginsClient {
6
+ readonly whatsapp: OriginClient<OTPAssertionWhatsApp>;
7
+ readonly email: OriginClient<OTPAssertionEmail>;
8
+ private readonly httpClient;
9
+ constructor(httpClient: HttpClient);
10
+ get(alias: string): Promise<Alias>;
11
+ custom(origin: string): OriginClient<OTPAssertion>;
12
+ }
@@ -0,0 +1,7 @@
1
+ import type { HttpClient } from '@bloque/sdk-core';
2
+ export declare class OriginClient<TAssertion> {
3
+ private readonly httpClient;
4
+ private readonly origin;
5
+ constructor(httpClient: HttpClient, origin: string);
6
+ assert(alias: string): Promise<TAssertion>;
7
+ }
@@ -0,0 +1,2 @@
1
+ import type { AliasResponse } from '../api-types';
2
+ export type Alias = AliasResponse;
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@bloque/sdk-identity",
3
+ "version": "0.0.3",
4
+ "type": "module",
5
+ "keywords": [
6
+ "bloque",
7
+ "sdk",
8
+ "api"
9
+ ],
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "provenance": true
14
+ },
15
+ "homepage": "git+https://github.com/bloque-app/sdk.git#readme",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/bloque-app/sdk.git",
19
+ "directory": "packages/identity"
20
+ },
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js",
25
+ "require": "./dist/index.cjs"
26
+ }
27
+ },
28
+ "main": "./dist/index.cjs",
29
+ "types": "./dist/index.d.ts",
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "engines": {
34
+ "node": ">=22"
35
+ },
36
+ "scripts": {
37
+ "build": "rslib build",
38
+ "dev": "rslib build --watch",
39
+ "clean": "rm -rf node_modules && rm -rf dist",
40
+ "check": "biome check --write",
41
+ "typecheck": "tsgo --noEmit"
42
+ },
43
+ "dependencies": {
44
+ "@bloque/sdk-core": "workspace:*"
45
+ },
46
+ "devDependencies": {
47
+ "@rslib/core": "catalog:",
48
+ "@types/node": "catalog:",
49
+ "@typescript/native-preview": "catalog:",
50
+ "typescript": "catalog:"
51
+ }
52
+ }