@bentley/context-registry-client
Advanced tools
Comparing version 3.0.0-dev.70 to 3.0.0-dev.71
@@ -1,2 +0,3 @@ | ||
import { AuthorizedClientRequestContext, RequestOptions } from "@bentley/itwin-client"; | ||
import { AccessToken } from "@bentley/bentleyjs-core"; | ||
import { RequestOptions } from "@bentley/itwin-client"; | ||
import { ITwin, ITwinAccess, ITwinQueryArg } from "./ITwinAccessProps"; | ||
@@ -14,3 +15,3 @@ import { WsgClient } from "./wsg/WsgClient"; | ||
*/ | ||
getAll(requestContext: AuthorizedClientRequestContext, arg?: ITwinQueryArg): Promise<ITwin[]>; | ||
getAll(accessToken: AccessToken, arg?: ITwinQueryArg): Promise<ITwin[]>; | ||
/** Gets all iTwins (projects or assets) using the given query options | ||
@@ -17,0 +18,0 @@ * @param requestContext The client request context |
@@ -147,3 +147,3 @@ "use strict"; | ||
*/ | ||
async getAll(requestContext, arg) { | ||
async getAll(accessToken, arg) { | ||
var _a, _b; | ||
@@ -160,3 +160,3 @@ const queryOptions = { | ||
} | ||
return this.getByQuery(requestContext, queryOptions); | ||
return this.getByQuery(accessToken, queryOptions); | ||
} | ||
@@ -168,3 +168,3 @@ /** Gets all iTwins (projects or assets) using the given query options | ||
*/ | ||
async getByQuery(requestContext, queryOptions) { | ||
async getByQuery(accessToken, queryOptions) { | ||
var _a; | ||
@@ -176,4 +176,4 @@ // Spread operator possible since there are no nested properties | ||
innerQuery.$skip = undefined; | ||
const projectITwins = await this.getInstances(requestContext, Project, "/Repositories/BentleyCONNECT--Main/ConnectedContext/project/", innerQuery); | ||
const assetITwins = await this.getInstances(requestContext, Asset, "/Repositories/BentleyCONNECT--Main/ConnectedContext/asset/", innerQuery); | ||
const projectITwins = await this.getInstances(accessToken, Project, "/Repositories/BentleyCONNECT--Main/ConnectedContext/project/", innerQuery); | ||
const assetITwins = await this.getInstances(accessToken, Asset, "/Repositories/BentleyCONNECT--Main/ConnectedContext/asset/", innerQuery); | ||
// Default range is whole list | ||
@@ -180,0 +180,0 @@ const projectRange = { |
/** @packageDocumentation | ||
* @module ContextRegistry | ||
*/ | ||
import { AuthorizedClientRequestContext } from "@bentley/itwin-client"; | ||
import { AccessToken } from "@bentley/bentleyjs-core"; | ||
/** The iTwin context object, for generalized properties of Projects, Assets, custom contexts, etc. | ||
@@ -46,4 +46,4 @@ * @beta | ||
/** Get iTwins associated with the requester */ | ||
getAll: (requestContext: AuthorizedClientRequestContext, arg?: ITwinQueryArg) => Promise<ITwin[]>; | ||
getAll(accessToken: AccessToken, arg?: ITwinQueryArg): Promise<ITwin[]>; | ||
} | ||
//# sourceMappingURL=ITwinAccessProps.d.ts.map |
@@ -1,3 +0,3 @@ | ||
import { GetMetaDataFunction, HttpStatus } from "@bentley/bentleyjs-core"; | ||
import { AuthorizedClientRequestContext, Client, DefaultRequestOptionsProvider, RequestOptions, RequestQueryOptions, RequestTimeoutOptions, ResponseError } from "@bentley/itwin-client"; | ||
import { AccessToken, GetMetaDataFunction, HttpStatus } from "@bentley/bentleyjs-core"; | ||
import { Client, DefaultRequestOptionsProvider, RequestOptions, RequestQueryOptions, RequestTimeoutOptions, ResponseError } from "@bentley/itwin-client"; | ||
import { ChunkedQueryContext } from "./ChunkedQueryContext"; | ||
@@ -125,3 +125,3 @@ import { WsgInstance } from "./ECJsonTypeMap"; | ||
/** used by clients to delete strongly typed instances through the standard WSG REST API */ | ||
protected deleteInstance<T extends WsgInstance>(requestContext: AuthorizedClientRequestContext, relativeUrlPath: string, instance?: T, requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise<void>; | ||
protected deleteInstance<T extends WsgInstance>(accessToken: AccessToken, relativeUrlPath: string, instance?: T, requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise<void>; | ||
/** | ||
@@ -137,3 +137,3 @@ * Used by clients to post strongly typed instances through standard WSG REST API | ||
*/ | ||
protected postInstance<T extends WsgInstance>(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, instance: T, requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise<T>; | ||
protected postInstance<T extends WsgInstance>(accessToken: AccessToken, typedConstructor: new () => T, relativeUrlPath: string, instance: T, requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise<T>; | ||
/** Used by clients to post multiple strongly typed instances through standard WSG REST API | ||
@@ -148,3 +148,3 @@ * @param requestContext Client request context | ||
*/ | ||
protected postInstances<T extends WsgInstance>(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, instances: T[], requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
protected postInstances<T extends WsgInstance>(accessToken: AccessToken, typedConstructor: new () => T, relativeUrlPath: string, instances: T[], requestOptions?: WsgRequestOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
/** | ||
@@ -159,3 +159,3 @@ * Used by clients to get strongly typed instances from standard WSG REST queries that return EC JSON instances. | ||
*/ | ||
protected getInstances<T extends WsgInstance>(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, queryOptions?: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
protected getInstances<T extends WsgInstance>(accessToken: AccessToken, typedConstructor: new () => T, relativeUrlPath: string, queryOptions?: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
/** | ||
@@ -171,3 +171,3 @@ * Used by clients to get a chunk of strongly typed instances from standard WSG REST queries that return EC JSON instances. | ||
*/ | ||
protected getInstancesChunk<T extends WsgInstance>(requestContext: AuthorizedClientRequestContext, url: string, chunkedQueryContext: ChunkedQueryContext | undefined, typedConstructor: new () => T, queryOptions?: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
protected getInstancesChunk<T extends WsgInstance>(accessToken: AccessToken, url: string, chunkedQueryContext: ChunkedQueryContext | undefined, typedConstructor: new () => T, queryOptions?: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
private getQueryRequestBody; | ||
@@ -181,3 +181,3 @@ /** Used by clients to get strongly typed instances from standard WSG REST queries that return EC JSON instances. | ||
*/ | ||
protected postQuery<T extends WsgInstance>(requestContext: AuthorizedClientRequestContext, typedConstructor: new () => T, relativeUrlPath: string, queryOptions: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
protected postQuery<T extends WsgInstance>(accessToken: AccessToken, typedConstructor: new () => T, relativeUrlPath: string, queryOptions: RequestQueryOptions, httpRequestOptions?: HttpRequestOptions): Promise<T[]>; | ||
/** Configures request options based on user defined values in HttpRequestOptions */ | ||
@@ -184,0 +184,0 @@ protected applyUserConfiguredHttpRequestOptions(requestOptions: RequestOptions, userDefinedRequestOptions?: HttpRequestOptions): void; |
@@ -254,3 +254,3 @@ "use strict"; | ||
/** used by clients to delete strongly typed instances through the standard WSG REST API */ | ||
async deleteInstance(requestContext, relativeUrlPath, instance, requestOptions, httpRequestOptions) { | ||
async deleteInstance(accessToken, relativeUrlPath, instance, requestOptions, httpRequestOptions) { | ||
const url = await this.getUrl() + relativeUrlPath; | ||
@@ -260,3 +260,3 @@ const untypedInstance = instance ? ECJsonTypeMap_1.ECJsonTypeMap.toJson("wsg", instance) : undefined; | ||
method: "DELETE", | ||
headers: { authorization: requestContext.accessToken.toTokenString() }, | ||
headers: { authorization: accessToken }, | ||
body: { | ||
@@ -271,3 +271,3 @@ instance: untypedInstance, | ||
await this.setupOptionDefaults(options); | ||
await (0, itwin_client_1.request)(requestContext, url, options); | ||
await (0, itwin_client_1.request)(url, options); | ||
} | ||
@@ -284,3 +284,3 @@ /** | ||
*/ | ||
async postInstance(requestContext, typedConstructor, relativeUrlPath, instance, requestOptions, httpRequestOptions) { | ||
async postInstance(accessToken, typedConstructor, relativeUrlPath, instance, requestOptions, httpRequestOptions) { | ||
const url = await this.getUrl() + relativeUrlPath; | ||
@@ -291,3 +291,3 @@ bentleyjs_core_1.Logger.logInfo(loggerCategory, "Sending POST request", () => ({ url })); | ||
method: "POST", | ||
headers: { authorization: requestContext.accessToken.toTokenString() }, | ||
headers: { authorization: accessToken }, | ||
body: { | ||
@@ -302,3 +302,3 @@ instance: untypedInstance, | ||
await this.setupOptionDefaults(options); | ||
const res = await (0, itwin_client_1.request)(requestContext, url, options); | ||
const res = await (0, itwin_client_1.request)(url, options); | ||
if (!res.body || !res.body.changedInstance || !res.body.changedInstance.instanceAfterChange) { | ||
@@ -325,3 +325,3 @@ throw new Error(`POST to URL ${url} executed successfully, but did not return the expected result.`); | ||
*/ | ||
async postInstances(requestContext, typedConstructor, relativeUrlPath, instances, requestOptions, httpRequestOptions) { | ||
async postInstances(accessToken, typedConstructor, relativeUrlPath, instances, requestOptions, httpRequestOptions) { | ||
const url = await this.getUrl() + relativeUrlPath; | ||
@@ -332,3 +332,3 @@ bentleyjs_core_1.Logger.logInfo(loggerCategory, "Sending POST request", () => ({ url })); | ||
method: "POST", | ||
headers: { authorization: requestContext.accessToken.toTokenString() }, | ||
headers: { authorization: accessToken }, | ||
body: { | ||
@@ -343,3 +343,3 @@ instances: untypedInstances, | ||
await this.setupOptionDefaults(options); | ||
const res = await (0, itwin_client_1.request)(requestContext, url, options); | ||
const res = await (0, itwin_client_1.request)(url, options); | ||
if (!res.body || !res.body.changedInstances) { | ||
@@ -373,3 +373,3 @@ throw new Error(`POST to URL ${url} executed successfully, but did not return the expected result.`); | ||
*/ | ||
async getInstances(requestContext, typedConstructor, relativeUrlPath, queryOptions, httpRequestOptions) { | ||
async getInstances(accessToken, typedConstructor, relativeUrlPath, queryOptions, httpRequestOptions) { | ||
const url = await this.getUrl() + relativeUrlPath; | ||
@@ -380,3 +380,3 @@ bentleyjs_core_1.Logger.logInfo(loggerCategory, "Sending GET request", () => ({ url })); | ||
do { | ||
const chunk = await this.getInstancesChunk(requestContext, url, chunkedQueryContext, typedConstructor, queryOptions, httpRequestOptions); | ||
const chunk = await this.getInstancesChunk(accessToken, url, chunkedQueryContext, typedConstructor, queryOptions, httpRequestOptions); | ||
typedInstances.push(...chunk); | ||
@@ -397,3 +397,3 @@ } while (chunkedQueryContext && !chunkedQueryContext.isQueryFinished); | ||
*/ | ||
async getInstancesChunk(requestContext, url, chunkedQueryContext, typedConstructor, queryOptions, httpRequestOptions) { | ||
async getInstancesChunk(accessToken, url, chunkedQueryContext, typedConstructor, queryOptions, httpRequestOptions) { | ||
const resultInstances = new Array(); | ||
@@ -408,3 +408,3 @@ if (chunkedQueryContext) | ||
options.headers = { | ||
authorization: requestContext.accessToken.toTokenString(), | ||
authorization: accessToken, | ||
}; | ||
@@ -415,3 +415,3 @@ this.applyUserConfiguredHttpRequestOptions(options, httpRequestOptions); | ||
await this.setupOptionDefaults(options); | ||
const res = await (0, itwin_client_1.request)(requestContext, url, options); | ||
const res = await (0, itwin_client_1.request)(url, options); | ||
if (!res.body || !res.body.hasOwnProperty("instances")) { | ||
@@ -462,3 +462,3 @@ throw new Error(`Query to URL ${url} executed successfully, but did NOT return any instances.`); | ||
*/ | ||
async postQuery(requestContext, typedConstructor, relativeUrlPath, queryOptions, httpRequestOptions) { | ||
async postQuery(accessToken, typedConstructor, relativeUrlPath, queryOptions, httpRequestOptions) { | ||
const url = `${await this.getUrl()}${relativeUrlPath}$query`; | ||
@@ -468,3 +468,3 @@ bentleyjs_core_1.Logger.logInfo(loggerCategory, "Sending POST request", () => ({ url })); | ||
method: "POST", | ||
headers: { authorization: requestContext.accessToken.toTokenString() }, | ||
headers: { authorization: accessToken }, | ||
body: this.getQueryRequestBody(queryOptions), | ||
@@ -474,3 +474,3 @@ }; | ||
await this.setupOptionDefaults(options); | ||
const res = await (0, itwin_client_1.request)(requestContext, url, options); | ||
const res = await (0, itwin_client_1.request)(url, options); | ||
if (!res.body || !res.body.hasOwnProperty("instances")) { | ||
@@ -477,0 +477,0 @@ throw new Error(`Query to URL ${url} executed successfully, but did NOT return any instances.`); |
{ | ||
"name": "@bentley/context-registry-client", | ||
"version": "3.0.0-dev.70", | ||
"version": "3.0.0-dev.71", | ||
"description": "iModel.js Context Registry Client", | ||
@@ -28,12 +28,12 @@ "main": "lib/context-registry-client.js", | ||
"peerDependencies": { | ||
"@bentley/bentleyjs-core": "^3.0.0-dev.70", | ||
"@bentley/itwin-client": "^3.0.0-dev.70" | ||
"@bentley/bentleyjs-core": "^3.0.0-dev.71", | ||
"@bentley/itwin-client": "^3.0.0-dev.71" | ||
}, | ||
"devDependencies": { | ||
"@bentley/bentleyjs-core": "3.0.0-dev.70", | ||
"@bentley/build-tools": "3.0.0-dev.70", | ||
"@bentley/certa": "3.0.0-dev.70", | ||
"@bentley/eslint-plugin": "3.0.0-dev.70", | ||
"@bentley/itwin-client": "3.0.0-dev.70", | ||
"@bentley/oidc-signin-tool": "3.0.0-dev.70", | ||
"@bentley/bentleyjs-core": "3.0.0-dev.71", | ||
"@bentley/build-tools": "3.0.0-dev.71", | ||
"@bentley/certa": "3.0.0-dev.71", | ||
"@bentley/eslint-plugin": "3.0.0-dev.71", | ||
"@bentley/itwin-client": "3.0.0-dev.71", | ||
"@bentley/oidc-signin-tool": "3.0.0-dev.71", | ||
"@types/chai": "^4.1.4", | ||
@@ -40,0 +40,0 @@ "@types/deep-assign": "^0.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
223969