@bloque/sdk-identity 0.0.3 → 0.0.6

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 ADDED
@@ -0,0 +1,113 @@
1
+ # @bloque/sdk-identity
2
+
3
+ Identity and aliases API client for the Bloque SDK.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @bloque/sdk-identity
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ This package is typically used through the main `@bloque/sdk` package, but can be used standalone:
14
+
15
+ ```typescript
16
+ import { HttpClient } from '@bloque/sdk-core';
17
+ import { IdentityClient } from '@bloque/sdk-identity';
18
+
19
+ const httpClient = new HttpClient({
20
+ apiKey: process.env.BLOQUE_API_KEY!,
21
+ mode: 'production',
22
+ });
23
+
24
+ const identity = new IdentityClient(httpClient);
25
+
26
+ // Get alias information
27
+ const alias = await identity.aliases.get('user@example.com');
28
+ console.log('User URN:', alias.urn);
29
+ console.log('Alias status:', alias.status);
30
+ ```
31
+
32
+ ## API Reference
33
+
34
+ ### Get Alias
35
+
36
+ Retrieve alias information by the alias value (email or phone):
37
+
38
+ ```typescript
39
+ const alias = await identity.aliases.get('user@example.com');
40
+ ```
41
+
42
+ **Response**:
43
+
44
+ ```typescript
45
+ interface Alias {
46
+ id: string; // Unique alias ID
47
+ alias: string; // Alias value
48
+ type: 'phone' | 'email' | string; // Alias type
49
+ urn: string; // Associated user URN
50
+ origin: string; // Origin identifier
51
+ details: {
52
+ phone?: string; // Phone details (if applicable)
53
+ };
54
+ metadata: {
55
+ alias: string; // Alias in metadata
56
+ [key: string]: unknown; // Additional metadata
57
+ };
58
+ status: 'active' | 'inactive' | 'revoked'; // Alias status
59
+ is_public: boolean; // Whether alias is public
60
+ is_primary: boolean; // Whether this is the primary alias
61
+ created_at: string; // Creation timestamp (ISO 8601)
62
+ updated_at: string; // Last update timestamp (ISO 8601)
63
+ }
64
+ ```
65
+
66
+ ## Examples
67
+
68
+ ### Get Email Alias
69
+
70
+ ```typescript
71
+ try {
72
+ const alias = await identity.aliases.get('user@example.com');
73
+
74
+ if (alias.status === 'active') {
75
+ console.log('Active user:', alias.urn);
76
+ }
77
+ } catch (error) {
78
+ console.error('Failed to get alias:', error);
79
+ }
80
+ ```
81
+
82
+ ### Get Phone Alias
83
+
84
+ ```typescript
85
+ try {
86
+ const phoneAlias = await identity.aliases.get('+1234567890');
87
+
88
+ console.log('Phone details:', phoneAlias.details.phone);
89
+ console.log('User URN:', phoneAlias.urn);
90
+ } catch (error) {
91
+ console.error('Failed to get phone alias:', error);
92
+ }
93
+ ```
94
+
95
+ ## Development
96
+
97
+ ```bash
98
+ # Build the package
99
+ bun run build
100
+
101
+ # Watch mode
102
+ bun run dev
103
+
104
+ # Type checking
105
+ bun run typecheck
106
+
107
+ # Code quality checks
108
+ bun run check
109
+ ```
110
+
111
+ ## License
112
+
113
+ [MIT](../../LICENSE)
@@ -17,24 +17,3 @@ export type AliasResponse = {
17
17
  created_at: string;
18
18
  updated_at: string;
19
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 {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloque/sdk-identity",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "bloque",
@@ -34,6 +34,7 @@
34
34
  "node": ">=22"
35
35
  },
36
36
  "scripts": {
37
+ "publish": "bun publish",
37
38
  "build": "rslib build",
38
39
  "dev": "rslib build --watch",
39
40
  "clean": "rm -rf node_modules && rm -rf dist",
@@ -41,12 +42,12 @@
41
42
  "typecheck": "tsgo --noEmit"
42
43
  },
43
44
  "dependencies": {
44
- "@bloque/sdk-core": "workspace:*"
45
+ "@bloque/sdk-core": "0.0.2"
45
46
  },
46
47
  "devDependencies": {
47
- "@rslib/core": "catalog:",
48
- "@types/node": "catalog:",
49
- "@typescript/native-preview": "catalog:",
50
- "typescript": "catalog:"
48
+ "@rslib/core": "^0.18.4",
49
+ "@types/node": "^24.10.1",
50
+ "@typescript/native-preview": "latest",
51
+ "typescript": "^5.9.3"
51
52
  }
52
53
  }
@@ -1,12 +0,0 @@
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
- }
@@ -1,7 +0,0 @@
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
- }
@@ -1,2 +0,0 @@
1
- import type { AliasResponse } from '../api-types';
2
- export type Alias = AliasResponse;