@bloque/sdk 0.0.22 → 0.0.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 +436 -1038
- package/dist/bloque.d.ts +14 -5
- package/dist/config.d.ts +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/init.d.ts +2 -2
- package/package.json +6 -6
package/dist/bloque.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { AccountsClient } from '@bloque/sdk-accounts';
|
|
2
2
|
import { ComplianceClient } from '@bloque/sdk-compliance';
|
|
3
|
-
import { type
|
|
4
|
-
import { IdentityClient } from '@bloque/sdk-identity';
|
|
3
|
+
import { type BloqueSDKConfig } from '@bloque/sdk-core';
|
|
4
|
+
import { type CreateIdentityParams, IdentityClient } from '@bloque/sdk-identity';
|
|
5
5
|
import { OrgsClient } from '@bloque/sdk-orgs';
|
|
6
6
|
export declare class SDK {
|
|
7
7
|
private readonly httpClient;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
private readonly identity;
|
|
9
|
+
constructor(config: BloqueSDKConfig);
|
|
10
|
+
private buildClients;
|
|
11
|
+
private getApiKey;
|
|
12
|
+
private buildUrn;
|
|
13
|
+
register(alias: string, params: CreateIdentityParams): Promise<{
|
|
14
|
+
accounts: AccountsClient;
|
|
15
|
+
compliance: ComplianceClient;
|
|
16
|
+
identity: IdentityClient;
|
|
17
|
+
orgs: OrgsClient;
|
|
18
|
+
}>;
|
|
19
|
+
connect(alias: string): Promise<{
|
|
11
20
|
accounts: AccountsClient;
|
|
12
21
|
compliance: ComplianceClient;
|
|
13
22
|
identity: IdentityClient;
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function setConfig(next:
|
|
3
|
-
export declare function getConfig():
|
|
1
|
+
import type { BloqueSDKConfig, HttpClient } from '@bloque/sdk-core';
|
|
2
|
+
export declare function setConfig(next: BloqueSDKConfig): void;
|
|
3
|
+
export declare function getConfig(): BloqueSDKConfig;
|
|
4
4
|
export declare function setHttpClient(client: HttpClient): void;
|
|
5
5
|
export declare function getHttpClient(): HttpClient;
|
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
|
|
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__,{SDK:()=>SDK});const sdk_accounts_namespaceObject=require("@bloque/sdk-accounts"),sdk_compliance_namespaceObject=require("@bloque/sdk-compliance"),sdk_core_namespaceObject=require("@bloque/sdk-core"),sdk_identity_namespaceObject=require("@bloque/sdk-identity"),sdk_orgs_namespaceObject=require("@bloque/sdk-orgs");class SDK{httpClient;identity;constructor(e){this.httpClient=new sdk_core_namespaceObject.HttpClient(e),this.identity=new sdk_identity_namespaceObject.IdentityClient(this.httpClient)}buildClients(){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)}}getApiKey(){let{auth:e}=this.httpClient;return"apiKey"===e.type?e.apiKey:""}buildUrn(e){let t=this.httpClient.origin;if(!t)throw Error("Origin is required to build a urn");return`did:bloque:${t}:${e}`}async register(e,t){t.extraContext||(t.extraContext={});let i=this.buildUrn(e),r=this.httpClient.origin,_=await this.identity.origins.register(i,r,{assertionResult:{alias:i,challengeType:"API_KEY",value:{apiKey:this.getApiKey(),alias:i}},...t});return this.httpClient.setAccessToken(_.accessToken),this.httpClient.setUrn(i),this.buildClients()}async connect(e){let t=this.buildUrn(e),i=this.httpClient.origin,r=await this.httpClient.request({path:`/api/origins/${i}/connect`,method:"POST",body:{assertion_result:{challengeType:"API_KEY",value:{api_key:this.getApiKey(),alias:t}},extra_context:{}}});return this.httpClient.setAccessToken(r.result.access_token),this.httpClient.setUrn(t),this.buildClients()}}for(var __rspack_i in exports.SDK=__webpack_exports__.SDK,__webpack_exports__)-1===["SDK"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { BloqueSDKConfig } from '@bloque/sdk-core';
|
|
2
2
|
export { SDK } from './bloque';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AccountsClient as t}from"@bloque/sdk-accounts";import{ComplianceClient as e}from"@bloque/sdk-compliance";import{HttpClient as i}from"@bloque/sdk-core";import{IdentityClient as
|
|
1
|
+
import{AccountsClient as t}from"@bloque/sdk-accounts";import{ComplianceClient as e}from"@bloque/sdk-compliance";import{HttpClient as i}from"@bloque/sdk-core";import{IdentityClient as n}from"@bloque/sdk-identity";import{OrgsClient as s}from"@bloque/sdk-orgs";class r{httpClient;identity;constructor(t){this.httpClient=new i(t),this.identity=new n(this.httpClient)}buildClients(){return{accounts:new t(this.httpClient),compliance:new e(this.httpClient),identity:this.identity,orgs:new s(this.httpClient)}}getApiKey(){let{auth:t}=this.httpClient;return"apiKey"===t.type?t.apiKey:""}buildUrn(t){let e=this.httpClient.origin;if(!e)throw Error("Origin is required to build a urn");return`did:bloque:${e}:${t}`}async register(t,e){e.extraContext||(e.extraContext={});let i=this.buildUrn(t),n=this.httpClient.origin,s=await this.identity.origins.register(i,n,{assertionResult:{alias:i,challengeType:"API_KEY",value:{apiKey:this.getApiKey(),alias:i}},...e});return this.httpClient.setAccessToken(s.accessToken),this.httpClient.setUrn(i),this.buildClients()}async connect(t){let e=this.buildUrn(t),i=this.httpClient.origin,n=await this.httpClient.request({path:`/api/origins/${i}/connect`,method:"POST",body:{assertion_result:{challengeType:"API_KEY",value:{api_key:this.getApiKey(),alias:e}},extra_context:{}}});return this.httpClient.setAccessToken(n.result.access_token),this.httpClient.setUrn(e),this.buildClients()}}export{r as SDK};
|
package/dist/init.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
export declare function init(config:
|
|
1
|
+
import { type BloqueSDKConfig } from '@bloque/sdk-core';
|
|
2
|
+
export declare function init(config: BloqueSDKConfig): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloque/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "Official Bloque SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"node": ">=22"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@bloque/sdk-accounts": "0.0.
|
|
67
|
-
"@bloque/sdk-compliance": "0.0.
|
|
68
|
-
"@bloque/sdk-core": "0.0.
|
|
69
|
-
"@bloque/sdk-identity": "0.0.
|
|
70
|
-
"@bloque/sdk-orgs": "0.0.
|
|
66
|
+
"@bloque/sdk-accounts": "0.0.24",
|
|
67
|
+
"@bloque/sdk-compliance": "0.0.24",
|
|
68
|
+
"@bloque/sdk-core": "0.0.24",
|
|
69
|
+
"@bloque/sdk-identity": "0.0.24",
|
|
70
|
+
"@bloque/sdk-orgs": "0.0.24"
|
|
71
71
|
}
|
|
72
72
|
}
|