Comparing version 3.3.0 to 3.4.0
@@ -97,17 +97,17 @@ "use strict"; | ||
const searchUri = 'search'; | ||
function get(id) { | ||
function get(id, headers) { | ||
const uri = externalEntityUri(moduleName, id); | ||
return api.get(uri); | ||
return api.get(uri, undefined, headers); | ||
} | ||
function bulkCreate(data) { | ||
function bulkCreate(data, headers) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const response = yield api.post(bulkCreateUri, data); | ||
const response = yield api.post(bulkCreateUri, data, headers); | ||
return response ? response : []; | ||
}); | ||
} | ||
function create(data) { | ||
return api.post(createUri, data); | ||
function create(data, headers) { | ||
return api.post(createUri, data, headers); | ||
} | ||
function update(data) { | ||
return api.post(updateUri, data); | ||
function update(data, headers) { | ||
return api.post(updateUri, data, headers); | ||
} | ||
@@ -120,3 +120,3 @@ function search(filters, options) { | ||
} | ||
function addCustomAttribute(moduleId, attribute) { | ||
function addCustomAttribute(moduleId, attribute, headers) { | ||
const payload = { | ||
@@ -126,5 +126,5 @@ module: { module_name: moduleName, module_id: moduleId }, | ||
}; | ||
return api.post(addCustomAttributeUri, payload); | ||
return api.post(addCustomAttributeUri, payload, headers); | ||
} | ||
function removeCustomAttribute(moduleId, attributeId) { | ||
function removeCustomAttribute(moduleId, attributeId, headers) { | ||
const payload = { | ||
@@ -134,5 +134,5 @@ module: { module_name: moduleName, module_id: moduleId }, | ||
}; | ||
return api.post(removeCustomAttributeUri, payload); | ||
return api.post(removeCustomAttributeUri, payload, headers); | ||
} | ||
function updateCustomAttribute(moduleId, attribute) { | ||
function updateCustomAttribute(moduleId, attribute, headers) { | ||
const payload = { | ||
@@ -142,3 +142,3 @@ module: { module_name: moduleName, module_id: moduleId }, | ||
}; | ||
return api.post(updateCustomAttributeUri, payload); | ||
return api.post(updateCustomAttributeUri, payload, headers); | ||
} | ||
@@ -145,0 +145,0 @@ return Object.freeze({ |
@@ -23,9 +23,9 @@ import { Domain, DomainModule, ICustomAttribute, ICustomAttributeAddedDTO, ICustomAttributeRemovedDTO, ICustomAttributeUpdatedDTO, IEntity, IModuleLink, ISODATE, ModuleProperty, SearchFilter, UUID } from 'bf-types'; | ||
export interface ExternalModuleEntity<T extends IEntity = IEntity> { | ||
get(id: UUID): Promise<Nullable<T>>; | ||
create(data: InsertData<T>): Promise<Nullable<T>>; | ||
update(data: PartialExceptFor<T, 'id'>): Promise<Nullable<T>>; | ||
search(filters: SearchFilter[], options?: SearchOptions): Promise<T[]>; | ||
addCustomAttribute<A>(moduleId: UUID, attribute: Omit<ICustomAttribute<A>, 'id'>): Promise<Nullable<ICustomAttributeAddedDTO>>; | ||
removeCustomAttribute(moduleId: UUID, attributeId: UUID): Promise<Nullable<ICustomAttributeRemovedDTO>>; | ||
updateCustomAttribute<A>(moduleId: UUID, attribute: PartialExceptFor<ICustomAttribute<A>, 'id'>): Promise<Nullable<ICustomAttributeUpdatedDTO>>; | ||
get: <H extends HeadersType = HeadersType>(id: UUID, headers?: H) => Promise<Nullable<T>>; | ||
create: <H extends HeadersType = HeadersType>(data: InsertData<T>, headers?: H) => Promise<Nullable<T>>; | ||
update: <H extends HeadersType = HeadersType>(data: PartialExceptFor<T, 'id'>, headers?: H) => Promise<Nullable<T>>; | ||
search: <H extends HeadersType = HeadersType>(filters: SearchFilter[], options?: SearchOptions<H>) => Promise<T[]>; | ||
addCustomAttribute: <H extends HeadersType = HeadersType>(moduleId: UUID, attribute: Omit<ICustomAttribute, 'id'>, headers?: H) => Promise<Nullable<ICustomAttributeAddedDTO>>; | ||
removeCustomAttribute: <H extends HeadersType = HeadersType>(moduleId: UUID, attributeId: UUID, headers?: H) => Promise<Nullable<ICustomAttributeRemovedDTO>>; | ||
updateCustomAttribute: <H extends HeadersType = HeadersType>(moduleId: UUID, attribute: PartialExceptFor<ICustomAttribute, 'id'>, headers?: H) => Promise<Nullable<ICustomAttributeUpdatedDTO>>; | ||
} | ||
@@ -32,0 +32,0 @@ export interface ModuleInternal { |
{ | ||
"name": "bf-lib", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"private": false, | ||
@@ -83,3 +83,3 @@ "description": "the standard client library for block-5 software", | ||
"peerDependencies": { | ||
"bf-types": "^4.19.2" | ||
"bf-types": "^4.21.0" | ||
}, | ||
@@ -90,10 +90,10 @@ "devDependencies": { | ||
"@types/axios": "^0.14.0", | ||
"@types/jest": "^26.0.16", | ||
"@types/node": "^14.14.10", | ||
"@types/jest": "^26.0.18", | ||
"@types/node": "^14.14.11", | ||
"@types/socket.io-client": "^1.4.34", | ||
"@types/voca": "^1.4.0", | ||
"@typescript-eslint/eslint-plugin": "^4.9.0", | ||
"@typescript-eslint/eslint-plugin-tslint": "^4.9.0", | ||
"@typescript-eslint/parser": "^4.9.0", | ||
"bf-types": "^4.19.2", | ||
"@typescript-eslint/eslint-plugin": "^4.9.1", | ||
"@typescript-eslint/eslint-plugin-tslint": "^4.9.1", | ||
"@typescript-eslint/parser": "^4.9.1", | ||
"bf-types": "^4.21.0", | ||
"commitizen": "^4.2.2", | ||
@@ -100,0 +100,0 @@ "eslint": "^7.15.0", |
98528