@bloque/sdk 0.0.49 → 0.1.1
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/accounts.d.ts +1 -1
- package/dist/bloque.d.ts +5 -1
- package/dist/identity.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/orgs.d.ts +1 -1
- package/dist/swap.d.ts +1 -1
- package/package.json +1 -1
package/dist/accounts.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { CardAccount, CreateCardParams, } from '@bloque/sdk-accounts';
|
|
1
|
+
export type { CardAccount, CreateCardParams, TokenizeAppleParams, TokenizeAppleResult, TokenizeGoogleParams, TokenizeGoogleResult, UpdateCardParams, } from '@bloque/sdk-accounts';
|
|
2
2
|
import { AccountsClient } from '@bloque/sdk-accounts';
|
|
3
3
|
export declare const Accounts: AccountsClient;
|
package/dist/bloque.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class SDK {
|
|
|
9
9
|
private readonly identity;
|
|
10
10
|
constructor(config: BloqueSDKConfig);
|
|
11
11
|
private buildClients;
|
|
12
|
-
private
|
|
12
|
+
private getOriginKey;
|
|
13
13
|
private buildUrn;
|
|
14
14
|
private requireOrigin;
|
|
15
15
|
private buildOtpValue;
|
|
@@ -44,6 +44,10 @@ export declare class SDK {
|
|
|
44
44
|
urn: string | undefined;
|
|
45
45
|
readonly accessToken: string;
|
|
46
46
|
}>;
|
|
47
|
+
connect(): Promise<ReturnType<SDK['buildClients']>>;
|
|
48
|
+
connect(options: {
|
|
49
|
+
scopes?: string[];
|
|
50
|
+
}): Promise<ReturnType<SDK['buildClients']>>;
|
|
47
51
|
connect(alias: string): Promise<ReturnType<SDK['buildClients']>>;
|
|
48
52
|
connect(origin: string, alias: string, code: string): Promise<ReturnType<SDK['buildClients']>>;
|
|
49
53
|
}
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { Alias, IdentityMe, IdentityMeProfile, } from '@bloque/sdk-identity';
|
|
1
|
+
export type { Alias, ApiKeyInfo, ApiKeyStatus, CreateApiKeyParams, CreateApiKeyResult, ExchangeApiKeyParams, ExchangeApiKeyResult, IdentityAlias, IdentityMe, IdentityMeProfile, RotateApiKeyResult, UpdateIdentityParams, } from '@bloque/sdk-identity';
|
|
2
2
|
import { IdentityClient } from '@bloque/sdk-identity';
|
|
3
3
|
export declare const Identity: IdentityClient;
|
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 r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__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__,{BloqueInsufficientFundsError:()=>sdk_core_namespaceObject.BloqueInsufficientFundsError,BloqueAuthenticationError:()=>sdk_core_namespaceObject.BloqueAuthenticationError,BloqueNetworkError:()=>sdk_core_namespaceObject.BloqueNetworkError,BloqueRateLimitError:()=>sdk_core_namespaceObject.BloqueRateLimitError,BloqueAPIError:()=>sdk_core_namespaceObject.BloqueAPIError,BloqueConfigError:()=>sdk_core_namespaceObject.BloqueConfigError,BloqueValidationError:()=>sdk_core_namespaceObject.BloqueValidationError,SDK:()=>SDK,BloqueNotFoundError:()=>sdk_core_namespaceObject.BloqueNotFoundError,BloqueTimeoutError:()=>sdk_core_namespaceObject.BloqueTimeoutError});const sdk_core_namespaceObject=require("@bloque/sdk-core"),sdk_accounts_namespaceObject=require("@bloque/sdk-accounts"),sdk_compliance_namespaceObject=require("@bloque/sdk-compliance"),sdk_identity_namespaceObject=require("@bloque/sdk-identity"),sdk_orgs_namespaceObject=require("@bloque/sdk-orgs"),sdk_swap_namespaceObject=require("@bloque/sdk-swap");class SDK{httpClient;identity;constructor(e){this.httpClient=new sdk_core_namespaceObject.HttpClient(e),this.identity=new sdk_identity_namespaceObject.IdentityClient(this.httpClient)}buildClients(e){return{accounts:new sdk_accounts_namespaceObject.AccountsClient(this.httpClient),compliance:new sdk_compliance_namespaceObject.ComplianceClient(this.httpClient),identity:this.identity,orgs:new sdk_orgs_namespaceObject.OrgsClient(this.httpClient),swap:new sdk_swap_namespaceObject.SwapClient(this.httpClient),urn:this.httpClient.urn,get accessToken(){return e}}}
|
|
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 r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__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__,{BloqueInsufficientFundsError:()=>sdk_core_namespaceObject.BloqueInsufficientFundsError,BloqueAuthenticationError:()=>sdk_core_namespaceObject.BloqueAuthenticationError,BloqueNetworkError:()=>sdk_core_namespaceObject.BloqueNetworkError,BloqueRateLimitError:()=>sdk_core_namespaceObject.BloqueRateLimitError,BloqueAPIError:()=>sdk_core_namespaceObject.BloqueAPIError,BloqueConfigError:()=>sdk_core_namespaceObject.BloqueConfigError,BloqueValidationError:()=>sdk_core_namespaceObject.BloqueValidationError,SDK:()=>SDK,BloqueNotFoundError:()=>sdk_core_namespaceObject.BloqueNotFoundError,BloqueTimeoutError:()=>sdk_core_namespaceObject.BloqueTimeoutError});const sdk_core_namespaceObject=require("@bloque/sdk-core"),sdk_accounts_namespaceObject=require("@bloque/sdk-accounts"),sdk_compliance_namespaceObject=require("@bloque/sdk-compliance"),sdk_identity_namespaceObject=require("@bloque/sdk-identity"),sdk_orgs_namespaceObject=require("@bloque/sdk-orgs"),sdk_swap_namespaceObject=require("@bloque/sdk-swap");class SDK{httpClient;identity;constructor(e){this.httpClient=new sdk_core_namespaceObject.HttpClient(e),this.identity=new sdk_identity_namespaceObject.IdentityClient(this.httpClient)}buildClients(e){return{accounts:new sdk_accounts_namespaceObject.AccountsClient(this.httpClient),compliance:new sdk_compliance_namespaceObject.ComplianceClient(this.httpClient),identity:this.identity,orgs:new sdk_orgs_namespaceObject.OrgsClient(this.httpClient),swap:new sdk_swap_namespaceObject.SwapClient(this.httpClient),urn:this.httpClient.urn,get accessToken(){return e}}}getOriginKey(){let{auth:e}=this.httpClient;return"originKey"===e.type?e.originKey:""}buildUrn(e){let t=this.httpClient.origin;if(!t)throw Error("Origin is required to build a urn");return`did:bloque:${t}:${e}`}requireOrigin(){let e=this.httpClient.origin;if(!e)throw Error("Origin is required for this operation");return e}buildOtpValue(e,t){let r=e.trim();return r.includes("@")?{code:t,email:r}:{code:t,phone:r}}assertJwtAuth(){if("jwt"!==this.httpClient.auth.type)throw Error("This operation is only available for JWT auth")}async assert(e,t){return this.assertJwtAuth(),await this.httpClient.request({path:`/api/origins/${e}/assert?alias=${encodeURIComponent(t)}`,method:"GET"})}async authenticate(){let{auth:e}=this.httpClient;if("jwt"!==e.type)throw Error("authenticate is only available for JWT auth");let t=await this.identity.me();return this.httpClient.setOrigin(t.origin),this.httpClient.setUrn(t.urn),this.buildClients(this.httpClient.getJwtToken()??"")}async me(){return await this.identity.me()}async register(e,t){if("originKey"!==this.httpClient.auth.type)throw Error("register() is only available for originKey auth");t.extraContext||(t.extraContext={});let r=this.buildUrn(e),i=this.requireOrigin(),o=await this.identity.origins.register(e,i,{assertionResult:{alias:e,challengeType:"API_KEY",value:{apiKey:this.getOriginKey(),alias:e}},...t});return this.httpClient.setAccessToken(o.accessToken),this.httpClient.setUrn(r),this.buildClients(o.accessToken)}async connect(e,t,r){let i=this.httpClient.auth.type;if("apiKey"===i){if("string"==typeof e)throw Error("connect() takes no alias for apiKey auth. Use connect() or connect({ scopes })");await this.httpClient.ensureExchanged();let t=await this.identity.me();return this.httpClient.setOrigin(t.origin),this.httpClient.setUrn(t.urn),this.buildClients(this.httpClient.accessToken??"")}if("originKey"===i){if(!e||"string"!=typeof e)throw Error("connect(alias) is required for originKey auth");let t=this.buildUrn(e),r=this.requireOrigin(),i=await this.httpClient.request({path:`/api/origins/${r}/connect`,method:"POST",body:{assertion_result:{challengeType:"API_KEY",value:{api_key:this.getOriginKey(),alias:e}},extra_context:{}}});return this.httpClient.setAccessToken(i.result.access_token),this.httpClient.setUrn(t),this.buildClients(i.result.access_token)}if(this.assertJwtAuth(),!e||"string"!=typeof e||!t||!r)throw Error("connect(origin, alias, code) is required for JWT auth");let o=await this.httpClient.request({path:`/api/origins/${e}/connect`,method:"POST",body:{assertion_result:{challengeType:"OTP",alias:t,value:this.buildOtpValue(t,r)},extra_context:{}}}),n=`did:bloque:${e}:${t}`;return this.httpClient.setJwtToken(o.result.access_token),this.httpClient.setOrigin(e),this.httpClient.setUrn(n),this.buildClients(o.result.access_token)}}for(var __rspack_i in exports.BloqueAPIError=__webpack_exports__.BloqueAPIError,exports.BloqueAuthenticationError=__webpack_exports__.BloqueAuthenticationError,exports.BloqueConfigError=__webpack_exports__.BloqueConfigError,exports.BloqueInsufficientFundsError=__webpack_exports__.BloqueInsufficientFundsError,exports.BloqueNetworkError=__webpack_exports__.BloqueNetworkError,exports.BloqueNotFoundError=__webpack_exports__.BloqueNotFoundError,exports.BloqueRateLimitError=__webpack_exports__.BloqueRateLimitError,exports.BloqueTimeoutError=__webpack_exports__.BloqueTimeoutError,exports.BloqueValidationError=__webpack_exports__.BloqueValidationError,exports.SDK=__webpack_exports__.SDK,__webpack_exports__)-1===["BloqueAPIError","BloqueAuthenticationError","BloqueConfigError","BloqueInsufficientFundsError","BloqueNetworkError","BloqueNotFoundError","BloqueRateLimitError","BloqueTimeoutError","BloqueValidationError","SDK"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BloqueAPIError as t,BloqueAuthenticationError as e,BloqueConfigError as i,BloqueInsufficientFundsError as r,BloqueNetworkError as n,BloqueNotFoundError as s,BloqueRateLimitError as o,BloqueTimeoutError as
|
|
1
|
+
import{BloqueAPIError as t,BloqueAuthenticationError as e,BloqueConfigError as i,BloqueInsufficientFundsError as r,BloqueNetworkError as n,BloqueNotFoundError as s,BloqueRateLimitError as o,BloqueTimeoutError as h,BloqueValidationError as l,HttpClient as a}from"@bloque/sdk-core";import{AccountsClient as u}from"@bloque/sdk-accounts";import{ComplianceClient as p}from"@bloque/sdk-compliance";import{IdentityClient as c}from"@bloque/sdk-identity";import{OrgsClient as d}from"@bloque/sdk-orgs";import{SwapClient as g}from"@bloque/sdk-swap";class y{httpClient;identity;constructor(t){this.httpClient=new a(t),this.identity=new c(this.httpClient)}buildClients(t){return{accounts:new u(this.httpClient),compliance:new p(this.httpClient),identity:this.identity,orgs:new d(this.httpClient),swap:new g(this.httpClient),urn:this.httpClient.urn,get accessToken(){return t}}}getOriginKey(){let{auth:t}=this.httpClient;return"originKey"===t.type?t.originKey:""}buildUrn(t){let e=this.httpClient.origin;if(!e)throw Error("Origin is required to build a urn");return`did:bloque:${e}:${t}`}requireOrigin(){let t=this.httpClient.origin;if(!t)throw Error("Origin is required for this operation");return t}buildOtpValue(t,e){let i=t.trim();return i.includes("@")?{code:e,email:i}:{code:e,phone:i}}assertJwtAuth(){if("jwt"!==this.httpClient.auth.type)throw Error("This operation is only available for JWT auth")}async assert(t,e){return this.assertJwtAuth(),await this.httpClient.request({path:`/api/origins/${t}/assert?alias=${encodeURIComponent(e)}`,method:"GET"})}async authenticate(){let{auth:t}=this.httpClient;if("jwt"!==t.type)throw Error("authenticate is only available for JWT auth");let e=await this.identity.me();return this.httpClient.setOrigin(e.origin),this.httpClient.setUrn(e.urn),this.buildClients(this.httpClient.getJwtToken()??"")}async me(){return await this.identity.me()}async register(t,e){if("originKey"!==this.httpClient.auth.type)throw Error("register() is only available for originKey auth");e.extraContext||(e.extraContext={});let i=this.buildUrn(t),r=this.requireOrigin(),n=await this.identity.origins.register(t,r,{assertionResult:{alias:t,challengeType:"API_KEY",value:{apiKey:this.getOriginKey(),alias:t}},...e});return this.httpClient.setAccessToken(n.accessToken),this.httpClient.setUrn(i),this.buildClients(n.accessToken)}async connect(t,e,i){let r=this.httpClient.auth.type;if("apiKey"===r){if("string"==typeof t)throw Error("connect() takes no alias for apiKey auth. Use connect() or connect({ scopes })");await this.httpClient.ensureExchanged();let e=await this.identity.me();return this.httpClient.setOrigin(e.origin),this.httpClient.setUrn(e.urn),this.buildClients(this.httpClient.accessToken??"")}if("originKey"===r){if(!t||"string"!=typeof t)throw Error("connect(alias) is required for originKey auth");let e=this.buildUrn(t),i=this.requireOrigin(),r=await this.httpClient.request({path:`/api/origins/${i}/connect`,method:"POST",body:{assertion_result:{challengeType:"API_KEY",value:{api_key:this.getOriginKey(),alias:t}},extra_context:{}}});return this.httpClient.setAccessToken(r.result.access_token),this.httpClient.setUrn(e),this.buildClients(r.result.access_token)}if(this.assertJwtAuth(),!t||"string"!=typeof t||!e||!i)throw Error("connect(origin, alias, code) is required for JWT auth");let n=await this.httpClient.request({path:`/api/origins/${t}/connect`,method:"POST",body:{assertion_result:{challengeType:"OTP",alias:e,value:this.buildOtpValue(e,i)},extra_context:{}}}),s=`did:bloque:${t}:${e}`;return this.httpClient.setJwtToken(n.result.access_token),this.httpClient.setOrigin(t),this.httpClient.setUrn(s),this.buildClients(n.result.access_token)}}export{t as BloqueAPIError,e as BloqueAuthenticationError,i as BloqueConfigError,r as BloqueInsufficientFundsError,n as BloqueNetworkError,s as BloqueNotFoundError,o as BloqueRateLimitError,h as BloqueTimeoutError,l as BloqueValidationError,y as SDK};
|
package/dist/orgs.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { CreateOrgParams, CreateOrgResponse, Organization, OrgProfile, OrgStatus, OrgType, Place, } from '@bloque/sdk-orgs';
|
|
1
|
+
export type { CreateInviteParams, CreateOrgParams, CreateOrgResponse, Invite, InviteChannel, InviteStatus, InviteType, ListInvitesParams, ListInvitesResult, Member, Organization, OrgProfile, OrgStatus, OrgType, Place, Team, TeamMember, UpdateMemberParams, UpdateTeamMemberParams, UpdateTeamParams, VerifySlugResult, } from '@bloque/sdk-orgs';
|
|
2
2
|
import { OrgsClient } from '@bloque/sdk-orgs';
|
|
3
3
|
export declare const Orgs: OrgsClient;
|
package/dist/swap.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { Bank, Fee, FeeComponent, FeeComponentType, FindRatesParams, FindRatesResult, ListBanksResult, RateLimits, RateTuple, SwapRate, } from '@bloque/sdk-swap';
|
|
1
|
+
export type { Bank, Fee, FeeComponent, FeeComponentType, FindRatesParams, FindRatesResult, ListBanksResult, ListOrdersParams, ListOrdersResult, OrderStatus, RateLimits, RateTuple, SwapOrder, SwapRate, } from '@bloque/sdk-swap';
|
|
2
2
|
import { SwapClient } from '@bloque/sdk-swap';
|
|
3
3
|
export declare const Swap: SwapClient;
|