@fluree/fluree-client
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -19,7 +19,9 @@ import { IFlureeConfig } from '../interfaces/IFlureeConfig'; | ||
* @param config.defaultContext - The default context to use for queries/txns | ||
* @param config.isFlureeHosted - If true, the client will use the Fluree hosted service | ||
* @param config.apiKey - The API key to use for the Fluree hosted service | ||
* @example | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 58090, | ||
* ledger: 'fluree-client/client', | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -46,13 +48,13 @@ * | ||
* @param config.defaultContext - The default context to use for queries/txns | ||
* @param config.isFlureeHosted - If true, the client will use the Fluree hosted service | ||
* @param config.apiKey - The API key to use for the Fluree hosted service | ||
* @returns FlureeClient | ||
* @example | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client', | ||
* isFlureeHosted: true, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
* | ||
* const updatedClient = client.configure({ | ||
* privateKey: 'XXXXXXXX', | ||
* signMessages: true | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* }); | ||
@@ -70,5 +72,5 @@ */ | ||
* const connectedClient = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -100,5 +102,5 @@ */ | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -119,5 +121,5 @@ * | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -138,5 +140,5 @@ * | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -162,5 +164,5 @@ * | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -183,5 +185,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -204,5 +206,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -220,5 +222,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -236,5 +238,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -255,5 +257,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* defaultContext: { "schema": "http://schema.org/" } | ||
@@ -277,5 +279,5 @@ * }); | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* defaultContext: { "schema": "http://schema.org/" } | ||
@@ -297,5 +299,5 @@ * }); | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* defaultContext: { "schema": "http://schema.org/" } | ||
@@ -302,0 +304,0 @@ * }); |
@@ -35,7 +35,9 @@ "use strict"; | ||
* @param config.defaultContext - The default context to use for queries/txns | ||
* @param config.isFlureeHosted - If true, the client will use the Fluree hosted service | ||
* @param config.apiKey - The API key to use for the Fluree hosted service | ||
* @example | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 58090, | ||
* ledger: 'fluree-client/client', | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -68,13 +70,13 @@ * | ||
* @param config.defaultContext - The default context to use for queries/txns | ||
* @param config.isFlureeHosted - If true, the client will use the Fluree hosted service | ||
* @param config.apiKey - The API key to use for the Fluree hosted service | ||
* @returns FlureeClient | ||
* @example | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client', | ||
* isFlureeHosted: true, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
* | ||
* const updatedClient = client.configure({ | ||
* privateKey: 'XXXXXXXX', | ||
* signMessages: true | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* }); | ||
@@ -102,5 +104,5 @@ */ | ||
* const connectedClient = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -154,5 +156,5 @@ */ | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -181,5 +183,5 @@ * | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -208,5 +210,5 @@ * | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -240,5 +242,5 @@ * | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }).connect(); | ||
@@ -267,5 +269,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -294,5 +296,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -312,5 +314,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -330,5 +332,5 @@ * | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* }); | ||
@@ -343,2 +345,14 @@ * | ||
} | ||
// TODO: Implement this | ||
// async insertDid(did?: string): Promise<void> { | ||
// const didKey = did || this.config.did; | ||
// if (!didKey) { | ||
// throw new FlureeError( | ||
// 'did is required; try calling generateKeyPair() or passing a did string as a parameter' | ||
// ); | ||
// } | ||
// await this.transact({ | ||
// insert: { '@id': didKey }, | ||
// }).send(); | ||
// } | ||
/** | ||
@@ -352,5 +366,5 @@ * Sets the default context for the FlureeClient instance. This context will be used for all queries and transactions by default. | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* defaultContext: { "schema": "http://schema.org/" } | ||
@@ -377,5 +391,5 @@ * }); | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* defaultContext: { "schema": "http://schema.org/" } | ||
@@ -406,5 +420,5 @@ * }); | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* isFlureeHosted: true, | ||
* apiKey: process.env.FLUREE_API_KEY, | ||
* ledger: 'fluree-jld/387028092978173', | ||
* defaultContext: { "schema": "http://schema.org/" } | ||
@@ -423,7 +437,14 @@ * }); | ||
_FlureeClient_instances = new WeakSet(), _FlureeClient_checkConfig = function _FlureeClient_checkConfig(config, isConnecting = false) { | ||
const { host, ledger, signMessages, privateKey } = config; | ||
const { host, port, ledger, signMessages, privateKey, isFlureeHosted, apiKey, create, } = config; | ||
if (isConnecting) { | ||
if (!host) { | ||
throw new FlureeError_1.FlureeError('host is required on either FlureeClient or connect'); | ||
if (isFlureeHosted) { | ||
if (create) { | ||
throw new FlureeError_1.FlureeError('cannot create a ledger through the Fluree hosted service API'); | ||
} | ||
} | ||
else { | ||
if (!host) { | ||
throw new FlureeError_1.FlureeError('host is required on either FlureeClient or connect'); | ||
} | ||
} | ||
if (!ledger) { | ||
@@ -436,2 +457,13 @@ throw new FlureeError_1.FlureeError('ledger is required on either FlureeClient or connect'); | ||
} | ||
if (isFlureeHosted) { | ||
if (host) { | ||
throw new FlureeError_1.FlureeError('"host" should not be set when using the Fluree hosted service'); | ||
} | ||
if (port) { | ||
throw new FlureeError_1.FlureeError('"port" should not be set when using the Fluree hosted service'); | ||
} | ||
if (!apiKey && !privateKey) { | ||
console.warn('either an "apiKey" or a "privateKey" for signing messages is required when using the Fluree hosted service'); | ||
} | ||
} | ||
}, _FlureeClient_testLedgers = function _FlureeClient_testLedgers() { | ||
@@ -438,0 +470,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -13,2 +13,3 @@ "use strict"; | ||
exports.HistoryQueryInstance = void 0; | ||
const fetchOptions_1 = require("../utils/fetchOptions"); | ||
const FlureeError_1 = require("./FlureeError"); | ||
@@ -48,15 +49,5 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { host, port } = this.config; | ||
let url = `http://${host}`; | ||
if (port) { | ||
url += `:${port}`; | ||
} | ||
url += '/fluree/history'; | ||
return fetch(url, { | ||
method: 'POST', | ||
body: JSON.stringify(this.query), | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}) | ||
const [url, fetchOptions] = (0, fetchOptions_1.generateFetchParams)(this.config, 'history'); | ||
fetchOptions.body = JSON.stringify(this.query); | ||
return fetch(url, fetchOptions) | ||
.then((response) => { | ||
@@ -63,0 +54,0 @@ // if (response.status > 201) { |
@@ -14,2 +14,3 @@ "use strict"; | ||
const contextHandler_1 = require("../utils/contextHandler"); | ||
const fetchOptions_1 = require("../utils/fetchOptions"); | ||
const FlureeError_1 = require("./FlureeError"); | ||
@@ -56,15 +57,5 @@ const crypto_1 = require("@fluree/crypto"); | ||
const query = this.signedQuery || JSON.stringify(this.query); | ||
const { host, port } = this.config; | ||
let url = `http://${host}`; | ||
if (port) { | ||
url += `:${port}`; | ||
} | ||
url += '/fluree/query'; | ||
return fetch(url, { | ||
method: 'POST', | ||
body: query, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}) | ||
const [url, fetchOptions] = (0, fetchOptions_1.generateFetchParams)(this.config, 'query'); | ||
fetchOptions.body = query; | ||
return fetch(url, fetchOptions) | ||
.then((response) => { | ||
@@ -71,0 +62,0 @@ // if (response.status > 201) { |
@@ -14,2 +14,3 @@ "use strict"; | ||
const contextHandler_1 = require("../utils/contextHandler"); | ||
const fetchOptions_1 = require("../utils/fetchOptions"); | ||
const FlureeError_1 = require("./FlureeError"); | ||
@@ -56,15 +57,5 @@ const crypto_1 = require("@fluree/crypto"); | ||
const transaction = this.signedTransaction || JSON.stringify(this.transaction); | ||
const { host, port } = this.config; | ||
let url = `http://${host}`; | ||
if (port) { | ||
url += `:${port}`; | ||
} | ||
url += '/fluree/transact'; | ||
return fetch(url, { | ||
method: 'POST', | ||
body: transaction, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}) | ||
const [url, fetchOptions] = (0, fetchOptions_1.generateFetchParams)(this.config, 'transact'); | ||
fetchOptions.body = transaction; | ||
return fetch(url, fetchOptions) | ||
.then((response) => { | ||
@@ -71,0 +62,0 @@ // if (response.status > 201) { |
@@ -13,2 +13,4 @@ import { ContextStatement } from '../types/ContextTypes'; | ||
* @param defaultContext - The default context to use for queries | ||
* @param isFlureeHosted - If true, the client will use the Fluree hosted service | ||
* @param apiKey - The API key to use for the Fluree hosted service | ||
*/ | ||
@@ -25,2 +27,4 @@ export interface IFlureeConfig { | ||
defaultContext?: ContextStatement; | ||
isFlureeHosted?: boolean; | ||
apiKey?: string; | ||
} |
{ | ||
"name": "@fluree/fluree-client", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -16,3 +16,3 @@ "main": "dist/index.js", | ||
"build": "tsc", | ||
"test": "jest --detectOpenHandles --silent=false", | ||
"test": "jest --silent=false --forceExit", | ||
"lint": "eslint --ext .ts src", | ||
@@ -43,4 +43,5 @@ "coverage": "jest --coverage --silent=false", | ||
"@types/uuid": "^9.0.8", | ||
"dotenv": "^16.4.1", | ||
"uuid": "^9.0.1" | ||
} | ||
} |
201
README.md
@@ -19,5 +19,5 @@ # Fluree Client SDK for TypeScript/JavaScript | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 58090, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -38,3 +38,6 @@ | ||
{ | ||
isFlureeHosted, // [boolean] If true, the client will use the Fluree hosted service | ||
apiKey, // [string] The API key to use for the Fluree hosted service | ||
ledger, // [string] The ledger/db name on the Fluree instance | ||
// Do not set "host" and "port" if "isFlureeHosted" is true | ||
host, // [string] The host where your instance is running (e.g. localhost) | ||
@@ -71,5 +74,5 @@ port, // [number] The port where your instance is running (e.g. 58090) | ||
const client = new FlureeClient({ | ||
ledger: 'fluree-client/client', | ||
host: 'localhost', | ||
port: 58090, | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}); | ||
@@ -109,5 +112,5 @@ | ||
const connectedClient = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -140,5 +143,5 @@ ``` | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -153,20 +156,2 @@ | ||
<!-- /** | ||
* Creates a new TransactionInstance for transacting with the Fluree database. The TransactionInstance can be used & re-used to build, sign, and send transactions to the Fluree instance. | ||
* @param transaction {IFlureeTransaction} - The transaction to send to the Fluree instance | ||
* @returns TransactionInstance | ||
* @example | ||
* const client = await new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* }).connect(); | ||
* | ||
* const transaction = client.transact({ | ||
* insert: { "@id": "freddy", "name": "Freddy" } | ||
* }); | ||
* | ||
* const response = await transaction.send(); | ||
*/ --> | ||
#### `transact()` | ||
@@ -180,5 +165,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -201,5 +186,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -221,5 +206,5 @@ | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}); | ||
@@ -240,5 +225,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -262,5 +247,5 @@ | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}); | ||
@@ -279,5 +264,5 @@ | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}); | ||
@@ -296,5 +281,5 @@ | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}); | ||
@@ -315,9 +300,9 @@ | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client' | ||
defaultContext: { "schema": "http://schema.org/" } | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
defaultContext: { schema: 'http://schema.org/' }, | ||
}); | ||
client.setContext({ "ex": "http://example.org/" }); | ||
client.setContext({ ex: 'http://example.org/' }); | ||
@@ -335,9 +320,9 @@ // client.getContext() === { "ex": "http://example.org/" } | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client' | ||
defaultContext: { "schema": "http://schema.org/" } | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
defaultContext: { schema: 'http://schema.org/' }, | ||
}); | ||
client.addToContext({ "ex": "http://example.org/" }); | ||
client.addToContext({ ex: 'http://example.org/' }); | ||
@@ -350,18 +335,2 @@ // client.getContext() === { | ||
<!-- /** | ||
* Returns the default context for the FlureeClient instance (if one has been set) | ||
* @returns ContextStatement | undefined | ||
* @example | ||
* const client = new FlureeClient({ | ||
* host: 'localhost', | ||
* port: 8080, | ||
* ledger: 'fluree-client/client' | ||
* defaultContext: { "schema": "http://schema.org/" } | ||
* }); | ||
* | ||
* const context = client.getContext(); | ||
* | ||
* // context === { "schema": "http://schema.org/" } | ||
*/ --> | ||
#### `getContext()` | ||
@@ -373,5 +342,5 @@ | ||
const client = new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
defaultContext: { schema: 'http://schema.org/' }, | ||
@@ -391,5 +360,5 @@ }); | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -419,5 +388,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -438,5 +407,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -469,5 +438,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
defaultContext: { ex: 'http://example.org/' }, | ||
@@ -496,5 +465,5 @@ }).connect(); | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -522,5 +491,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -550,5 +519,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -569,5 +538,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -600,5 +569,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -625,5 +594,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -651,5 +620,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -671,5 +640,5 @@ | ||
const client = await new FlureeClient({ | ||
host: 'localhost', | ||
port: 8080, | ||
ledger: 'fluree-client/client', | ||
isFlureeHosted: true, | ||
apiKey: process.env.FLUREE_API_KEY, | ||
ledger: 'fluree-jld/387028092978173', | ||
}).connect(); | ||
@@ -676,0 +645,0 @@ |
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
76282
36
1590
4
624
+ Addeddotenv@^16.4.1
+ Addeddotenv@16.4.5(transitive)