@bloque/sdk-identity 0.0.21 → 0.0.22

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.
@@ -1,7 +1,5 @@
1
- import type { HttpClient } from '@bloque/sdk-core';
1
+ import { BaseClient } from '@bloque/sdk-core';
2
2
  import type { Alias } from './types';
3
- export declare class AliasesClient {
4
- private readonly httpClient;
5
- constructor(httpClient: HttpClient);
3
+ export declare class AliasesClient extends BaseClient {
6
4
  get(alias: string): Promise<Alias>;
7
5
  }
package/dist/client.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { HttpClient } from '@bloque/sdk-core';
2
2
  import { AliasesClient } from './aliases/client';
3
3
  import { OriginsClient } from './origins/client';
4
+ import type { CreateIdentityParams } from './types';
4
5
  export declare class IdentityClient {
5
6
  private readonly httpClient;
6
7
  readonly aliases: AliasesClient;
7
8
  readonly origins: OriginsClient;
8
9
  constructor(httpClient: HttpClient);
10
+ create(params: CreateIdentityParams): Promise<import(".").RegisterResult>;
9
11
  }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{OriginClient:()=>OriginClient,AliasesClient:()=>AliasesClient,IdentityClient:()=>IdentityClient,OriginsClient:()=>OriginsClient});class AliasesClient{httpClient;constructor(e){this.httpClient=e}async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${e}`})}}class OriginClient{httpClient;origin;constructor(e,t){this.httpClient=e,this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class OriginsClient{whatsapp;email;httpClient;constructor(e){this.httpClient=e,this.whatsapp=new OriginClient(e,"bloque-whatsapp"),this.email=new OriginClient(e,"bloque-email")}custom(e){return new OriginClient(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t){let i,r=t.assertionResult,n="API_KEY"===r.challengeType?{alias:r.alias,challengeType:"API_KEY",value:{api_key:r.value.apiKey,alias:r.value.alias},originalChallengeParams:r.originalChallengeParams}:{alias:r.alias,challengeType:r.challengeType,value:r.value,originalChallengeParams:r.originalChallengeParams};return i="individual"===t.type?{assertion_result:n,extra_context:t.extraContext,type:"individual",profile:this._mapUserProfile(t.profile)}:{assertion_result:n,extra_context:t.extraContext,type:"business",profile:this._mapBusinessProfile(t.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${e}/register`,body:i})).result.access_token}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class IdentityClient{httpClient;aliases;origins;constructor(e){this.httpClient=e,this.aliases=new AliasesClient(this.httpClient),this.origins=new OriginsClient(this.httpClient)}}for(var __rspack_i in exports.AliasesClient=__webpack_exports__.AliasesClient,exports.IdentityClient=__webpack_exports__.IdentityClient,exports.OriginClient=__webpack_exports__.OriginClient,exports.OriginsClient=__webpack_exports__.OriginsClient,__webpack_exports__)-1===["AliasesClient","IdentityClient","OriginClient","OriginsClient"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{OriginClient:()=>OriginClient,AliasesClient:()=>AliasesClient,IdentityClient:()=>IdentityClient,OriginsClient:()=>OriginsClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class AliasesClient extends sdk_core_namespaceObject.BaseClient{async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${e}`})}}class OriginClient extends sdk_core_namespaceObject.BaseClient{origin;constructor(e,t){super(e),this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class OriginsClient extends sdk_core_namespaceObject.BaseClient{whatsapp;email;constructor(e){super(e),this.whatsapp=new OriginClient(e,"bloque-whatsapp"),this.email=new OriginClient(e,"bloque-email")}custom(e){return new OriginClient(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t){let i,r=t.assertionResult,a="API_KEY"===r.challengeType?{alias:r.alias,challengeType:"API_KEY",value:{api_key:r.value.apiKey,alias:r.value.alias},originalChallengeParams:r.originalChallengeParams}:{alias:r.alias,challengeType:r.challengeType,value:r.value,originalChallengeParams:r.originalChallengeParams};return i="individual"===t.type?{assertion_result:a,extra_context:t.extraContext,type:"individual",profile:this._mapUserProfile(t.profile)}:{assertion_result:a,extra_context:t.extraContext,type:"business",profile:this._mapBusinessProfile(t.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${e}/register`,body:i})).result.access_token}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class IdentityClient{httpClient;aliases;origins;constructor(e){this.httpClient=e,this.aliases=new AliasesClient(this.httpClient),this.origins=new OriginsClient(this.httpClient)}async create(e){let t=this.httpClient.config.origin,i=e.alias;return Reflect.deleteProperty(e,"alias"),e.extraContext||(e.extraContext={}),this.origins.register(t,{assertionResult:{alias:i,challengeType:"API_KEY",value:{apiKey:"apiKey"===this.httpClient.config.auth.type?this.httpClient.config.auth.apiKey:"",alias:i}},...e})}}for(var __rspack_i in exports.AliasesClient=__webpack_exports__.AliasesClient,exports.IdentityClient=__webpack_exports__.IdentityClient,exports.OriginClient=__webpack_exports__.OriginClient,exports.OriginsClient=__webpack_exports__.OriginsClient,__webpack_exports__)-1===["AliasesClient","IdentityClient","OriginClient","OriginsClient"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- class e{httpClient;constructor(e){this.httpClient=e}async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${e}`})}}class t{httpClient;origin;constructor(e,t){this.httpClient=e,this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class i{whatsapp;email;httpClient;constructor(e){this.httpClient=e,this.whatsapp=new t(e,"bloque-whatsapp"),this.email=new t(e,"bloque-email")}custom(e){return new t(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t){let i,a=t.assertionResult,n="API_KEY"===a.challengeType?{alias:a.alias,challengeType:"API_KEY",value:{api_key:a.value.apiKey,alias:a.value.alias},originalChallengeParams:a.originalChallengeParams}:{alias:a.alias,challengeType:a.challengeType,value:a.value,originalChallengeParams:a.originalChallengeParams};return i="individual"===t.type?{assertion_result:n,extra_context:t.extraContext,type:"individual",profile:this._mapUserProfile(t.profile)}:{assertion_result:n,extra_context:t.extraContext,type:"business",profile:this._mapBusinessProfile(t.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${e}/register`,body:i})).result.access_token}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class a{httpClient;aliases;origins;constructor(t){this.httpClient=t,this.aliases=new e(this.httpClient),this.origins=new i(this.httpClient)}}export{e as AliasesClient,a as IdentityClient,t as OriginClient,i as OriginsClient};
1
+ import{BaseClient as e}from"@bloque/sdk-core";class t extends e{async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${e}`})}}class a extends e{origin;constructor(e,t){super(e),this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class i extends e{whatsapp;email;constructor(e){super(e),this.whatsapp=new a(e,"bloque-whatsapp"),this.email=new a(e,"bloque-email")}custom(e){return new a(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t){let a,i=t.assertionResult,s="API_KEY"===i.challengeType?{alias:i.alias,challengeType:"API_KEY",value:{api_key:i.value.apiKey,alias:i.value.alias},originalChallengeParams:i.originalChallengeParams}:{alias:i.alias,challengeType:i.challengeType,value:i.value,originalChallengeParams:i.originalChallengeParams};return a="individual"===t.type?{assertion_result:s,extra_context:t.extraContext,type:"individual",profile:this._mapUserProfile(t.profile)}:{assertion_result:s,extra_context:t.extraContext,type:"business",profile:this._mapBusinessProfile(t.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${e}/register`,body:a})).result.access_token}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class s{httpClient;aliases;origins;constructor(e){this.httpClient=e,this.aliases=new t(this.httpClient),this.origins=new i(this.httpClient)}async create(e){let t=this.httpClient.config.origin,a=e.alias;return Reflect.deleteProperty(e,"alias"),e.extraContext||(e.extraContext={}),this.origins.register(t,{assertionResult:{alias:a,challengeType:"API_KEY",value:{apiKey:"apiKey"===this.httpClient.config.auth.type?this.httpClient.config.auth.apiKey:"",alias:a}},...e})}}export{t as AliasesClient,s as IdentityClient,a as OriginClient,i as OriginsClient};
@@ -1,11 +1,11 @@
1
1
  import type { HttpClient } from '@bloque/sdk-core';
2
+ import { BaseClient } from '@bloque/sdk-core';
2
3
  import type { Origin, OTPAssertion, OTPAssertionEmail, OTPAssertionWhatsApp } from '../api-types';
3
4
  import { OriginClient } from './origin';
4
5
  import type { RegisterParams, RegisterResult } from './types';
5
- export declare class OriginsClient {
6
+ export declare class OriginsClient extends BaseClient {
6
7
  readonly whatsapp: OriginClient<OTPAssertionWhatsApp>;
7
8
  readonly email: OriginClient<OTPAssertionEmail>;
8
- private readonly httpClient;
9
9
  constructor(httpClient: HttpClient);
10
10
  custom(origin: string): OriginClient<OTPAssertion>;
11
11
  /**
@@ -1,6 +1,6 @@
1
1
  import type { HttpClient } from '@bloque/sdk-core';
2
- export declare class OriginClient<TAssertion> {
3
- private readonly httpClient;
2
+ import { BaseClient } from '@bloque/sdk-core';
3
+ export declare class OriginClient<TAssertion> extends BaseClient {
4
4
  private readonly origin;
5
5
  constructor(httpClient: HttpClient, origin: string);
6
6
  assert(alias: string): Promise<TAssertion>;
@@ -0,0 +1,4 @@
1
+ import type { BusinessRegisterParams, IndividualRegisterParams } from './origins/types';
2
+ export type CreateIdentityParams = (Pick<IndividualRegisterParams, 'extraContext' | 'type' | 'profile'> | Pick<BusinessRegisterParams, 'extraContext' | 'type' | 'profile'>) & {
3
+ alias: string;
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloque/sdk-identity",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "bloque",
@@ -34,6 +34,6 @@
34
34
  "node": ">=22"
35
35
  },
36
36
  "dependencies": {
37
- "@bloque/sdk-core": "0.0.21"
37
+ "@bloque/sdk-core": "0.0.22"
38
38
  }
39
39
  }