@fluree/fluree-client
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,3 @@ import { IFlureeConfig } from '../interfaces/IFlureeConfig'; | ||
import { IFlureeTransaction } from '../interfaces/IFlureeTransaction'; | ||
import { ContextStatement } from '../types/ContextTypes'; | ||
import { HistoryQueryInstance } from './HistoryQueryInstance'; | ||
@@ -35,2 +36,6 @@ import { QueryInstance } from './QueryInstance'; | ||
getPublicKey(): string | undefined; | ||
getDid(): string | undefined; | ||
setContext(context: ContextStatement): FlureeClient; | ||
addToContext(context: ContextStatement): FlureeClient; | ||
getContext(): ContextStatement | undefined; | ||
} |
@@ -19,2 +19,3 @@ "use strict"; | ||
exports.FlureeClient = void 0; | ||
const contextHandler_1 = require("../utils/contextHandler"); | ||
const FlureeError_1 = require("./FlureeError"); | ||
@@ -49,2 +50,7 @@ const HistoryQueryInstance_1 = require("./HistoryQueryInstance"); | ||
const mergedConfig = Object.assign(Object.assign({}, this.config), config); | ||
if (config.defaultContext) { | ||
if (this.config.defaultContext) { | ||
mergedConfig.defaultContext = (0, contextHandler_1.mergeContexts)(this.config.defaultContext, config.defaultContext); | ||
} | ||
} | ||
this.config = mergedConfig; | ||
@@ -151,2 +157,22 @@ __classPrivateFieldGet(this, _FlureeClient_instances, "m", _FlureeClient_checkConfig).call(this); | ||
} | ||
getDid() { | ||
return this.config.did; | ||
} | ||
setContext(context) { | ||
this.configure({ defaultContext: context }); | ||
return this; | ||
} | ||
addToContext(context) { | ||
if (this.config.defaultContext) { | ||
const newContext = (0, contextHandler_1.mergeContexts)(this.config.defaultContext, context); | ||
this.configure({ defaultContext: newContext }); | ||
} | ||
else { | ||
this.configure({ defaultContext: context }); | ||
} | ||
return this; | ||
} | ||
getContext() { | ||
return this.config.defaultContext; | ||
} | ||
} | ||
@@ -153,0 +179,0 @@ exports.FlureeClient = FlureeClient; |
@@ -13,2 +13,3 @@ "use strict"; | ||
exports.QueryInstance = void 0; | ||
const contextHandler_1 = require("../utils/contextHandler"); | ||
const FlureeError_1 = require("./FlureeError"); | ||
@@ -21,2 +22,7 @@ const crypto_1 = require("@fluree/crypto"); | ||
this.config = config; | ||
if (this.config.defaultContext || this.query['@context']) { | ||
const defaultContext = this.config.defaultContext || {}; | ||
const queryContext = this.query['@context'] || {}; | ||
this.query['@context'] = (0, contextHandler_1.mergeContexts)(defaultContext, queryContext); | ||
} | ||
if (config.signMessages) { | ||
@@ -46,2 +52,3 @@ this.sign(); | ||
// } | ||
debugger; | ||
return response.json(); | ||
@@ -48,0 +55,0 @@ }) |
@@ -13,2 +13,3 @@ "use strict"; | ||
exports.TransactionInstance = void 0; | ||
const contextHandler_1 = require("../utils/contextHandler"); | ||
const FlureeError_1 = require("./FlureeError"); | ||
@@ -21,2 +22,7 @@ const crypto_1 = require("@fluree/crypto"); | ||
this.config = config; | ||
if (this.config.defaultContext || this.transaction['@context']) { | ||
const defaultContext = this.config.defaultContext || {}; | ||
const transactionContext = this.transaction['@context'] || {}; | ||
this.transaction['@context'] = (0, contextHandler_1.mergeContexts)(defaultContext, transactionContext); | ||
} | ||
if (config.signMessages) { | ||
@@ -46,2 +52,3 @@ this.sign(); | ||
// } | ||
debugger; | ||
return response.json(); | ||
@@ -48,0 +55,0 @@ }) |
@@ -0,1 +1,2 @@ | ||
import { ContextStatement } from '../types/ContextTypes'; | ||
export interface IFlureeConfig { | ||
@@ -11,2 +12,3 @@ ledger?: string; | ||
signMessages?: boolean; | ||
defaultContext?: ContextStatement; | ||
} |
type ContextString = string; | ||
type ContextValue = string | Record<string, string>; | ||
type ContextMap = { | ||
export type ContextValue = string | Record<string, string>; | ||
export type ContextMap = { | ||
[key: string]: ContextValue; | ||
@@ -5,0 +5,0 @@ }; |
type InsertObject = { | ||
[key: string]: string | InsertStatement; | ||
[key: string]: string | string[] | InsertStatement; | ||
}; | ||
@@ -4,0 +4,0 @@ type InsertArray = Array<InsertObject>; |
{ | ||
"name": "@fluree/fluree-client", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -40,3 +40,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@fluree/crypto": "./crypto", | ||
"@fluree/crypto": "^3.0.0-alpha1", | ||
"@types/uuid": "^9.0.8", | ||
@@ -43,0 +43,0 @@ "uuid": "^9.0.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
27437
34
682
0
+ Added@cljs-oss/module-deps@1.1.1(transitive)
+ Added@fluree/crypto@3.0.0(transitive)
+ Added@fluree/sjcl@1.0.8-3(transitive)
+ AddedJSONStream@1.3.5(transitive)
+ Addedacorn@5.7.4(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedbabel-code-frame@6.26.0(transitive)
+ Addedbabel-messages@6.23.0(transitive)
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedbabel-traverse@6.26.0(transitive)
+ Addedbabel-types@6.26.0(transitive)
+ Addedbabylon@6.18.0(transitive)
+ Addedbrowser-resolve@1.11.3(transitive)
+ Addedcached-path-relative@1.1.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedconcat-stream@1.5.2(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedduplexer2@0.1.4(transitive)
+ Addedenhanced-resolve@3.4.1(transitive)
+ Addederrno@0.1.8(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglobals@9.18.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjs-sha3@0.9.3(transitive)
+ Addedjs-tokens@3.0.2(transitive)
+ Addedjsonparse@1.3.1(transitive)
+ Addedkonan@1.1.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedmemory-fs@0.4.1(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedms@2.0.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedparents@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-platform@0.11.15(transitive)
+ Addedprocess-nextick-args@1.0.72.0.1(transitive)
+ Addedprr@1.0.1(transitive)
+ Addedreadable-stream@2.0.62.3.8(transitive)
+ Addedregenerator-runtime@0.11.1(transitive)
+ Addedresolve@1.1.71.22.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstream-combiner2@1.1.1(transitive)
+ Addedstring_decoder@0.10.311.1.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsubarg@1.0.0(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtapable@0.2.9(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedthrough2@2.0.5(transitive)
+ Addedto-fast-properties@1.0.3(transitive)
+ Addedtypedarray@0.0.7(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)
Updated@fluree/crypto@^3.0.0-alpha1