Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into storage-classes
Browse files Browse the repository at this point in the history
  • Loading branch information
wkolod committed Aug 23, 2023
2 parents 1ea6b53 + 97050d4 commit 2dcf119
Show file tree
Hide file tree
Showing 19 changed files with 936 additions and 722 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@akord/akord-js",
"version": "4.16.1",
"version": "4.18.1",
"description": "A set of core js functions to interact with Akord",
"main": "lib/index.js",
"repository": "git@github.com:Akord-com/akord-js.git",
Expand Down
13 changes: 10 additions & 3 deletions src/__tests__/batch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe("Testing batch actions", () => {
let noteId: string;
let viewerId: string;
let contributorId: string;
let stackIds: string[];

beforeEach(async () => {
akord = await initInstance(email, password);
Expand All @@ -37,7 +38,7 @@ describe("Testing batch actions", () => {
it("should revoke all items in a batch", async () => {
await akord.batch.revoke([
{ id: folderId, type: "Folder" },
{ id: noteId, type: "Note" },
{ id: noteId, type: "Stack" },
])

const folder = await akord.folder.get(folderId);
Expand All @@ -50,7 +51,7 @@ describe("Testing batch actions", () => {
it("should restore all items in a batch", async () => {
await akord.batch.restore([
{ id: folderId, type: "Folder" },
{ id: noteId, type: "Note" },
{ id: noteId, type: "Stack" },
])

const folder = await akord.folder.get(folderId);
Expand All @@ -72,8 +73,10 @@ describe("Testing batch actions", () => {
items.push({ file, name });
}

const response = (await akord.batch.stackCreate(vaultId, items)).data;
const { data: response, errors } = await akord.batch.stackCreate(vaultId, items);

expect(errors.length).toEqual(0);
stackIds = response.map((item) => item.stackId);
for (let index in items) {
const stack = await akord.stack.get(response[index].stackId);
expect(stack.status).toEqual("ACTIVE");
Expand All @@ -82,6 +85,10 @@ describe("Testing batch actions", () => {
expect(stack.versions[0].name).toEqual(firstFileName);
}
});

it("should revoke the previously uploaded batch", async () => {
await akord.batch.revoke(stackIds.map(stackId => ({ id: stackId, type: "Stack" })));
});
});

describe("Batch membership actions", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/api/akord-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export default class AkordApi extends Api {
return resources;
};

public async postContractTransaction<T>(contractId: string, input: ContractInput, tags: Tags, metadata?: any): Promise<{ id: string, object: T }> {
public async postContractTransaction<T>(vaultId: string, input: ContractInput, tags: Tags, metadata?: any): Promise<{ id: string, object: T }> {
const { id, object } = await new ApiClient()
.env(this.config)
.vaultId(contractId)
.vaultId(vaultId)
.metadata(metadata)
.input(input)
.tags(tags)
Expand Down
2 changes: 1 addition & 1 deletion src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class Api {

constructor() { }

abstract postContractTransaction<T>(contractId: string, input: ContractInput, tags: Tags, metadata?: any): Promise<{ id: string, object: T }>
abstract postContractTransaction<T>(vaultId: string, input: ContractInput, tags: Tags, metadata?: any): Promise<{ id: string, object: T }>

abstract initContractId(tags: Tags, state?: any): Promise<string>

Expand Down
Loading

0 comments on commit 2dcf119

Please sign in to comment.