@stardust-collective/dag4-core
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -13,11 +13,4 @@ import { RestConfig } from './rest.config'; | ||
const client = this.config.protocolClient(); | ||
return client.invoke({ | ||
authToken: this.config.authToken(), | ||
url, | ||
body: data, | ||
method, | ||
queryParams, | ||
errorHook: this.config.errorHook(), | ||
...options | ||
}); | ||
return client.invoke(Object.assign({ authToken: this.config.authToken(), url, body: data, method, | ||
queryParams, errorHook: this.config.errorHook() }, options)); | ||
} | ||
@@ -24,0 +17,0 @@ configure() { |
@@ -0,1 +1,10 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
const defaultFetch = typeof window !== 'undefined' ? window.fetch.bind(window) : undefined; | ||
@@ -47,5 +56,5 @@ export class FetchRestService { | ||
this.httpClient(options.url, options) | ||
.then(async (res) => { | ||
.then((res) => __awaiter(this, void 0, void 0, function* () { | ||
if (res.status !== 200) { | ||
const text = await res.text(); | ||
const text = yield res.text(); | ||
// let error = new Error(text); | ||
@@ -58,3 +67,3 @@ // | ||
return res.text(); | ||
}) | ||
})) | ||
.then(body => { | ||
@@ -64,3 +73,3 @@ try { | ||
} | ||
catch { } | ||
catch (_a) { } | ||
if (options.transformResponse) { | ||
@@ -67,0 +76,0 @@ resolve(options.transformResponse(body)); |
@@ -0,1 +1,10 @@ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
export class ArrayUtils { | ||
@@ -62,19 +71,23 @@ constructor() { | ||
} | ||
async asyncCallEach(array, callback) { | ||
if (!array || array.length === 0) { | ||
return; | ||
} | ||
const promises = array.map(async (item, index) => callback(item, index)); | ||
return await Promise.all(promises); | ||
asyncCallEach(array, callback) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!array || array.length === 0) { | ||
return; | ||
} | ||
const promises = array.map((item, index) => __awaiter(this, void 0, void 0, function* () { return callback(item, index); })); | ||
return yield Promise.all(promises); | ||
}); | ||
} | ||
async syncCallEach(array, callback, options = { stopProcessing: false }) { | ||
if (!array || array.length === 0) { | ||
return; | ||
} | ||
for (let index = 0; index < array.length; index++) { | ||
await callback(array[index], index, options); | ||
if (options.stopProcessing) { | ||
break; | ||
syncCallEach(array, callback, options = { stopProcessing: false }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!array || array.length === 0) { | ||
return; | ||
} | ||
} | ||
for (let index = 0; index < array.length; index++) { | ||
yield callback(array[index], index, options); | ||
if (options.stopProcessing) { | ||
break; | ||
} | ||
} | ||
}); | ||
} | ||
@@ -81,0 +94,0 @@ promiseAny(iterable) { |
{ | ||
"name": "@stardust-collective/dag4-core", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Constellation HyperGraph JavaScript API", | ||
@@ -5,0 +5,0 @@ "author": "Frank Fox", |
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
77822
1503