Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ozone-typescript-client

Package Overview
Dependencies
Maintainers
1
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ozone-typescript-client - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

21

dist/index.d.ts
import { fsm } from "typescript-state-machine";
import { httpclient } from "typescript-http-client";
import { Item, SearchRequest, Query } from 'ozone-type';
export declare namespace OzoneClient {

@@ -41,3 +42,22 @@ import State = fsm.State;

send(message: Message): void;
itemClient<T extends Item>(typeIdentifier: string): ItemClient<T>;
}
type UUID = string;
interface SearchResults<T extends Item> {
id?: number;
total?: number;
size?: number;
results?: T[];
}
interface ItemClient<T extends Item> {
save(item: Partial<T>): Promise<T>;
saveAll(items: Partial<T>[]): Promise<T[]>;
findOne(id: UUID): Promise<T | null>;
findAll(): Promise<T[]>;
findAllByIds(ids: UUID[]): Promise<T[]>;
search(searchRequest: SearchRequest): Promise<SearchResults<T>>;
count(query?: Query): Promise<number>;
deleteById(id: UUID, permanent?: boolean): Promise<UUID | null>;
deleteByIds(ids: UUID[], permanent?: boolean): Promise<UUID[]>;
}
interface OzoneClientInternals extends OzoneClient {

@@ -114,2 +134,3 @@ setState(newState: ClientState): void;

private setupFilters;
itemClient<T extends Item>(typeIdentifier: string): OzoneClient.ItemClient<T>;
}

@@ -116,0 +137,0 @@ abstract class OzoneCredentials {

@@ -630,2 +630,82 @@ var __extends = (this && this.__extends) || (function () {

};
OzoneClientImpl.prototype.itemClient = function (typeIdentifier) {
var client = this;
var baseURL = this._config.ozoneURL;
return new /** @class */ (function () {
function class_1() {
}
class_1.prototype.count = function (query) {
return __awaiter(this, void 0, void 0, function () {
var results;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.search({
query: query,
size: 0
})];
case 1:
results = _a.sent();
return [2 /*return*/, results.total || 0];
}
});
});
};
class_1.prototype.deleteById = function (id, permanent) {
var request = new Request(baseURL + "/rest/v3/items/" + typeIdentifier + "/" + id)
.setMethod("DELETE");
return client.call(request);
};
class_1.prototype.deleteByIds = function (ids, permanent) {
var request = new Request(baseURL + "/rest/v3/items/" + typeIdentifier + "/bulkDelete")
.setMethod("POST")
.setBody();
return client.call(request);
};
class_1.prototype.findAll = function () {
return __awaiter(this, void 0, void 0, function () {
var results;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.search({
size: 10000
})];
case 1:
results = _a.sent();
return [2 /*return*/, results.results || []];
}
});
});
};
class_1.prototype.findAllByIds = function (ids) {
var request = new Request(baseURL + "/rest/v3/items/" + typeIdentifier + "/bulkGet")
.setMethod("POST")
.setBody(ids);
return client.call(request);
};
class_1.prototype.findOne = function (id) {
var request = new Request(baseURL + "/rest/v3/items/" + typeIdentifier)
.setMethod("GET");
return client.call(request);
};
class_1.prototype.save = function (item) {
var request = new Request(baseURL + "/rest/v3/items/" + typeIdentifier)
.setMethod("POST")
.setBody(item);
return client.call(request);
};
class_1.prototype.saveAll = function (items) {
var request = new Request(baseURL + "/rest/v3/items/" + typeIdentifier + "/bulkSave")
.setMethod("POST")
.setBody(items);
return client.call(request);
};
class_1.prototype.search = function (searchRequest) {
var request = new Request(baseURL + "/rest/v3/items/" + typeIdentifier + "/search")
.setMethod("POST")
.setBody(searchRequest);
return client.call(request);
};
return class_1;
}());
};
__decorate([

@@ -632,0 +712,0 @@ AssumeStateIs(OzoneClient.states.WS_CONNECTED),

5

package.json
{
"name": "ozone-typescript-client",
"version": "0.9.1",
"version": "0.9.2",
"description": "",

@@ -25,3 +25,4 @@ "main": "dist/index.js",

"typescript-state-machine": "^0.9.0",
"typescript-http-client": "^0.9.0"
"typescript-http-client": "^0.9.0",
"ozone-type": "^4.0.1"
},

@@ -28,0 +29,0 @@ "devDependencies": {

.idea/workspace.xml

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc