From bed090866022441cf556a58c16077c8c3be590d3 Mon Sep 17 00:00:00 2001 From: Siddharth9890 Date: Fri, 13 Sep 2024 13:12:13 +0530 Subject: [PATCH 1/2] tests: modifed unit test for data assets --- scripts/generate-types.ts | 46 ++++++++++- src/common/routes.ts | 22 ++++++ src/common/types.ts | 157 ++++++++++---------------------------- test/auth.test.ts | 21 ++--- test/data-asset.test.ts | 77 +++++++++++++++---- test/stubs/common.stub.ts | 12 ++- 6 files changed, 189 insertions(+), 146 deletions(-) create mode 100644 src/common/routes.ts diff --git a/scripts/generate-types.ts b/scripts/generate-types.ts index fa76eec..6b8628d 100644 --- a/scripts/generate-types.ts +++ b/scripts/generate-types.ts @@ -2,18 +2,61 @@ import fs from 'fs'; const getJSONSchema = async () => { try { - const data = await fetch('https://dev.api.gateway.tech/swagger/doc.json'); + const data = await fetch('https://dev.api.gateway.tech/docs/swagger.json'); const body = await data.json(); const types = generateTypes(body.definitions); + const routes = generateRouteConstants(body.paths); + fs.writeFileSync('./src/common/types.ts', types); + fs.writeFileSync('./src/common/routes.ts', routes); } catch (error) { console.log(error); } }; +type PathItem = Record; + +interface Operation { + summary: string; +} + +function generateRouteConstants(paths: Record): string { + const constants: string[] = ['export const routes = {']; + + for (const path in paths) { + const pathItem = paths[path]; + + for (const method in pathItem) { + const operation = pathItem[method]; + const constantName = generateRouteConstantName( + method, + path, + operation.summary, + ); + const parameterizedPath = path; + constants.push(` ${constantName}: "${parameterizedPath}",`); + } + } + + constants.push('};'); + return constants.join('\n'); +} + +function generateRouteConstantName( + method: string, + path: string, + summary: string, +): string { + let name = summary.trim(); + if (name === '') { + name = path; + } + return toPascalCase(name); +} + function toPascalCase(str: string): string { const cleanedStr = str.replace(/^model\./, ''); return cleanedStr @@ -108,7 +151,6 @@ export interface OpenAPIClient { `export type ${toPascalCase(typeName)} = ${processSchema(schema)};\n`, ); }); - return types.join('\n'); }; diff --git a/src/common/routes.ts b/src/common/routes.ts new file mode 100644 index 0000000..09b2117 --- /dev/null +++ b/src/common/routes.ts @@ -0,0 +1,22 @@ +export const routes = { + CreateAccount: '/accounts', + GetMyAccount: '/accounts/me', + AuthenticateAccount: '/auth', + GenerateSignMessage: '/auth/message', + RefreshToken: '/auth/refresh-token', + CreateANewDataAsset: '/data-assets', + GetMyDataAssets: '/data-assets/me', + GetDataAssetByID: '/data-assets/{id}', + UpdateDataAssetByID: '/data-assets/{id}', + DeleteDataAssetByID: '/data-assets/{id}', + UpdateACLItemsToDataAsset: '/data-assets/{id}/acl', + AssignACLItemsToDataAsset: '/data-assets/{id}/acl', + DeleteAssignedRoleByACL: '/data-assets/{id}/acl', + DownloadDataAssetByID: '/data-assets/{id}/download', + ShareDataAssetByID: '/data-assets/{id}/share', + GetDataModels: '/data-models', + CreateDataModel: '/data-models', + GetDataModelsByUser: '/data-models/me', + GetDataModelByID: '/data-models/{id}', + UpdateDataModel: '/data-models/{id}', +}; diff --git a/src/common/types.ts b/src/common/types.ts index 7843ebb..aa6ebd9 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -1,12 +1,14 @@ import { ClientMethod, Middleware } from 'openapi-fetch'; import type { MediaType } from 'openapi-typescript-helpers'; + export interface Config { token: string; url: string; logging?: boolean; } + // eslint-disable-next-line @typescript-eslint/ban-types export interface OpenAPIClient { GET: ClientMethod; @@ -21,127 +23,46 @@ export interface OpenAPIClient { eject(...middleware: Middleware[]): void; } + export enum DataAssetType { StructuredData = 'Structured Data', UnstructedData = 'Other', } -export type HelperLinks = { - first: string; - last: string; - next: string; - previous: string; -}; - -export type HelperMeta = { - current_page: number; - items_per_page: number; - total_items: number; - total_pages: number; -}; - -export type HelperPaginatedResponse = { - data: T; - links: HelperLinks; - meta: HelperMeta; -}; - -export type ACLRequest = { address: string; roles: AccessLevel[] }; - -export enum AccessLevel { - VIEW = 'view', - UPDATE = 'update', - DELETE = 'delete', - SHARE = 'share', -} +export type HelperLinks = { first: string; last: string; next: string; previous: string; }; + +export type HelperMeta = { current_page: number; items_per_page: number; total_items: number; total_pages: number; }; + +export type HelperPaginatedResponse = { data: T; links: HelperLinks; meta: HelperMeta; }; + +export type ACLRequest = { address: string; roles: AccessLevel[]; }; + +export enum AccessLevel {VIEW = 'view',UPDATE = 'update',DELETE = 'delete',SHARE = 'share'}; + +export type AccountCreateRequest = { message: string; signature: string; username: string; wallet_address: string; }; + +export type AuthRequest = { message: string; signature: string; wallet_address: string; }; + +export type CreateDataAssetRequest = { acl?: ACLRequest[]; claim?: { }; data_model_id?: number; expiration_date?: string; name: string; tags?: string[]; }; + +export type DataAssetIDRequestAndResponse = { id: number; }; + +export type DataModel = { created_at?: string; created_by?: string; deleted_at?: string; description?: string; id?: number; schema?: { }; tags?: string[]; title?: string; updated_at?: string; }; + +export type DataModelRequest = { description: string; schema: { }; tags?: string[]; title: string; }; + +export type MessageResponse = { message: string; }; + +export type MyAccountResponse = { created_at?: string; did?: string; profile_picture?: string; updated_at?: string; username?: string; wallet_address?: string; }; + +export type PublicACL = { address?: string; created_at?: string; data_asset_id?: number; roles?: string[]; solana_address?: string; updated_at?: string; }; + +export type PublicDataAsset = { acl?: PublicACL[]; created_at?: string; created_by: string; data_model_id?: number; expiration_date?: string; fid: string; id: number; name: string; size: number; tags: string[]; transaction_id: string; type: string; updated_at?: string; }; + +export type ShareDataAssetRequest = { addresses?: string[]; }; + +export type TokenResponse = { token: string; }; + +export type UpdateDataAssetRequest = { claim?: { }; expiration_date?: string; name?: string; }; -export type AccountCreateRequest = { - message: string; - signature: string; - username: string; - wallet_address: string; -}; - -export type AuthRequest = { - message: string; - signature: string; - wallet_address: string; -}; - -export type CreateDataAssetRequest = { - acl?: ACLRequest[]; - claim?: {}; - data_model_id?: number; - expiration_date?: string; - name: string; - tags?: string[]; -}; - -export type DataAssetIDRequestAndResponse = { id: number }; - -export type DataModel = { - created_at?: string; - created_by?: string; - deleted_at?: string; - description?: string; - id?: number; - schema?: {}; - tags?: string[]; - title?: string; - updated_at?: string; -}; - -export type DataModelRequest = { - description: string; - schema: {}; - tags?: string[]; - title: string; -}; - -export type MessageResponse = { message: string }; - -export type MyAccountResponse = { - created_at?: string; - did?: string; - profile_picture?: string; - updated_at?: string; - username?: string; - wallet_address?: string; -}; - -export type PublicACL = { - address?: string; - created_at?: string; - data_asset_id?: number; - roles?: string[]; - solana_address?: string; - updated_at?: string; -}; - -export type PublicDataAsset = { - acl?: PublicACL[]; - created_at?: string; - created_by: string; - data_model_id?: number; - expiration_date?: string; - fid: string; - id: number; - name: string; - size: number; - tags: string[]; - transaction_id: string; - type: string; - updated_at?: string; -}; - -export type ShareDataAssetRequest = { addresses?: string[] }; - -export type TokenResponse = { token: string }; - -export type UpdateDataAssetRequest = { - claim?: {}; - expiration_date?: string; - name?: string; -}; - -export type ResponsesMessageResponse = { message?: string }; +export type ResponsesMessageResponse = { message?: string; }; diff --git a/test/auth.test.ts b/test/auth.test.ts index d7f4b70..59d88d8 100644 --- a/test/auth.test.ts +++ b/test/auth.test.ts @@ -11,6 +11,7 @@ import { mockPost, successMessage, } from './stubs/common.stub'; +import { routes } from '../src/common/routes'; jest.mock('openapi-fetch'); let auth: Auth; @@ -30,7 +31,7 @@ describe('Auth Unit Test', () => { const message = await auth.generateSignMessage(); expect(message).toBeDefined(); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith(routes.GenerateSignMessage); }); it('should throw GTWError for generate sign message', async () => { @@ -38,7 +39,7 @@ describe('Auth Unit Test', () => { await expect(auth.generateSignMessage()).rejects.toThrow(GTWError); expect(mockGet).toHaveBeenCalledWith('/auth/message'); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith(routes.GenerateSignMessage); }); test('should generate refresh token', async () => { @@ -47,15 +48,14 @@ describe('Auth Unit Test', () => { const message = await auth.generateRefreshToken(); expect(message).toBeDefined(); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith(routes.RefreshToken); }); it('should throw GTWError for generate refresh token', async () => { mockGet.mockResolvedValue(errorMessage()); await expect(auth.generateRefreshToken()).rejects.toThrow(GTWError); - expect(mockGet).toHaveBeenCalledWith('/auth/refresh-token'); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith(routes.RefreshToken); }); test('should login using etherum wallet', async () => { @@ -64,7 +64,9 @@ describe('Auth Unit Test', () => { const message = await auth.login(authDetails()); expect(message).toBeDefined(); - expect(mockPost).toHaveBeenCalled(); + expect(mockPost).toHaveBeenCalledWith(routes.AuthenticateAccount, { + body: authDetails(), + }); }); test('should login using solana wallet', async () => { @@ -73,16 +75,17 @@ describe('Auth Unit Test', () => { const message = await auth.login(authSolanaDetails()); expect(message).toBeDefined(); - expect(mockPost).toHaveBeenCalled(); + expect(mockPost).toHaveBeenCalledWith(routes.AuthenticateAccount, { + body: authDetails(), + }); }); it('should throw GTWError for login', async () => { mockPost.mockResolvedValue(errorMessage()); await expect(auth.login(authDetails())).rejects.toThrow(GTWError); - expect(mockPost).toHaveBeenCalledWith('/auth', { + expect(mockPost).toHaveBeenCalledWith(routes.AuthenticateAccount, { body: authDetails(), }); - expect(mockPost).toHaveBeenCalled(); }); }); diff --git a/test/data-asset.test.ts b/test/data-asset.test.ts index 1a35adb..ec07a39 100644 --- a/test/data-asset.test.ts +++ b/test/data-asset.test.ts @@ -1,5 +1,6 @@ import createClient from 'openapi-fetch'; import { + bodyStub, errorMessage, ID, linksStub, @@ -9,6 +10,7 @@ import { mockGet, mockPost, mockPut, + paramsStub, successMessage, } from './stubs/common.stub'; import { DataAsset } from '../src/modules/data-asset/data-asset'; @@ -20,6 +22,7 @@ import { blobStub, dataAssetStub, } from './stubs/data-asset.stub'; +import { routes } from '../src/common/routes'; jest.mock('openapi-fetch'); @@ -43,7 +46,10 @@ describe('Data Assets Test', () => { const pdaId = await dataAsset.createClaimBasedDataAsset(); expect(pdaId).toBeDefined(); - expect(mockPost).toHaveBeenCalled(); + expect(mockPost).toHaveBeenCalledWith( + routes.CreateANewDataAsset, + bodyStub(), + ); }); it('should throw GTWError for create claim based data asset', async () => { @@ -52,7 +58,10 @@ describe('Data Assets Test', () => { await expect(dataAsset.createClaimBasedDataAsset()).rejects.toThrow( GTWError, ); - expect(mockPost).toHaveBeenCalled(); + expect(mockPost).toHaveBeenCalledWith( + routes.CreateANewDataAsset, + bodyStub(), + ); }); it('should get my data assets', async () => { @@ -66,7 +75,7 @@ describe('Data Assets Test', () => { expect(data).toBeDefined(); expect(data.data.length).toBeGreaterThan(0); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith(routes.GetMyDataAssets, paramsStub()); }); it('should throw GTWError for get my data assets', async () => { @@ -74,7 +83,7 @@ describe('Data Assets Test', () => { await expect(dataAsset.getMyDataAssets()).rejects.toThrow(GTWError); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith(routes.GetMyDataAssets, paramsStub()); }); it('should get data asset by id', async () => { @@ -87,7 +96,10 @@ describe('Data Assets Test', () => { const data = await dataAsset.getDataAssetById(ID); expect(data).toBeDefined(); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith( + routes.GetDataAssetByID, + paramsStub({ params: { path: { id: 1 } } }), + ); }); it('should throw GTWError for get data asset by id', async () => { @@ -95,7 +107,10 @@ describe('Data Assets Test', () => { await expect(dataAsset.getDataAssetById(ID)).rejects.toThrow(GTWError); - expect(mockGet).toHaveBeenCalled(); + expect(mockGet).toHaveBeenCalledWith( + routes.GetDataAssetByID, + paramsStub({ params: { path: { id: 1 } } }), + ); }); it('should update data asset', async () => { @@ -104,14 +119,20 @@ describe('Data Assets Test', () => { const updatedDataAsset = await dataAsset.updateDataAsset(ID); expect(updatedDataAsset).toBeDefined(); - expect(mockPut).toHaveBeenCalled(); + expect(mockPut).toHaveBeenCalledWith(routes.UpdateDataAssetByID, { + body: {}, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should throw GTWError for update data asset', async () => { mockPut.mockResolvedValue(errorMessage()); await expect(dataAsset.updateDataAsset(ID)).rejects.toThrow(GTWError); - expect(mockPut).toHaveBeenCalled(); + expect(mockPut).toHaveBeenCalledWith(routes.UpdateDataAssetByID, { + body: {}, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should delete data asset by id', async () => { @@ -120,14 +141,20 @@ describe('Data Assets Test', () => { const deleteDataAsset = await dataAsset.deleteDataAsset(ID); expect(deleteDataAsset).toBeDefined(); - expect(mockDelete).toHaveBeenCalled(); + expect(mockDelete).toHaveBeenCalledWith( + routes.DeleteDataAssetByID, + paramsStub({ params: { path: { id: 1 } } }), + ); }); it('should throw GTWError for delete data asset by id', async () => { mockDelete.mockResolvedValue(errorMessage()); await expect(dataAsset.deleteDataAsset(ID)).rejects.toThrow(GTWError); - expect(mockDelete).toHaveBeenCalled(); + expect(mockDelete).toHaveBeenCalledWith( + routes.DeleteDataAssetByID, + paramsStub({ params: { path: { id: 1 } } }), + ); }); it('should update acl', async () => { @@ -136,7 +163,10 @@ describe('Data Assets Test', () => { const aclList = await dataAsset.updateACL(ID, [aclListStub()]); expect(aclList).toBeDefined(); - expect(mockPut).toHaveBeenCalled(); + expect(mockPut).toHaveBeenCalledWith(routes.UpdateACLItemsToDataAsset, { + body: bodyStub({ body: [aclListStub()] }).body, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should throw GTWError for updating acl', async () => { @@ -145,7 +175,10 @@ describe('Data Assets Test', () => { await expect(dataAsset.updateACL(ID, [aclListStub()])).rejects.toThrow( GTWError, ); - expect(mockPut).toHaveBeenCalled(); + expect(mockPut).toHaveBeenCalledWith(routes.UpdateACLItemsToDataAsset, { + body: bodyStub({ body: [aclListStub()] }).body, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should override acl', async () => { @@ -154,7 +187,10 @@ describe('Data Assets Test', () => { const aclList = await dataAsset.overrideACL(ID, [aclListStub()]); expect(aclList).toBeDefined(); - expect(mockPost).toHaveBeenCalled(); + expect(mockPost).toHaveBeenCalledWith(routes.AssignACLItemsToDataAsset, { + body: bodyStub({ body: [aclListStub()] }).body, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should throw GTWError for override acl', async () => { @@ -163,7 +199,10 @@ describe('Data Assets Test', () => { await expect(dataAsset.overrideACL(ID, [aclListStub()])).rejects.toThrow( GTWError, ); - expect(mockPost).toHaveBeenCalled(); + expect(mockPost).toHaveBeenCalledWith(routes.AssignACLItemsToDataAsset, { + body: bodyStub({ body: [aclListStub()] }).body, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should delete acl', async () => { @@ -172,7 +211,10 @@ describe('Data Assets Test', () => { const message = await dataAsset.deleteACL(ID, [aclListStub()]); expect(message).toBeDefined(); - expect(mockDelete).toHaveBeenCalled(); + expect(mockDelete).toHaveBeenCalledWith(routes.DeleteAssignedRoleByACL, { + body: bodyStub({ body: [aclListStub()] }).body, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should throw GTWError for updating acl', async () => { @@ -181,7 +223,10 @@ describe('Data Assets Test', () => { await expect(dataAsset.deleteACL(ID, [aclListStub()])).rejects.toThrow( GTWError, ); - expect(mockDelete).toHaveBeenCalled(); + expect(mockDelete).toHaveBeenCalledWith(routes.DeleteAssignedRoleByACL, { + body: bodyStub({ body: [aclListStub()] }).body, + params: paramsStub({ params: { path: { id: 1 } } }).params, + }); }); it('should share data asset', async () => { diff --git a/test/stubs/common.stub.ts b/test/stubs/common.stub.ts index f48d1ac..48b8244 100644 --- a/test/stubs/common.stub.ts +++ b/test/stubs/common.stub.ts @@ -16,7 +16,7 @@ export const errorMessage = (overrideError?: any) => ({ ...overrideError, }); -export const ID = 8708467049103462; +export const ID = 1; export const authDetails = (overrideAuth?: any) => ({ message: 'test', @@ -34,6 +34,16 @@ export const authSolanaDetails = (overrideAuth?: any) => ({ ...overrideAuth, }); +export const paramsStub = (overrideParams?: any) => ({ + params: { query: { page: 1, page_size: 10 } }, + ...overrideParams, +}); + +export const bodyStub = (overrideBody?: any) => ({ + body: { data: '' }, + ...overrideBody, +}); + export const metaStub = (overrideMetaStub?: HelperMeta) => ({ current_page: 1, items_per_page: 10, From e2792b5f647516631e3ec7fa02f3e792cacf3991 Mon Sep 17 00:00:00 2001 From: Siddharth9890 Date: Fri, 13 Sep 2024 13:14:23 +0530 Subject: [PATCH 2/2] fix(types.ts): ran prettier --- src/common/types.ts | 157 +++++++++++++++++++++++++++++++++----------- 1 file changed, 118 insertions(+), 39 deletions(-) diff --git a/src/common/types.ts b/src/common/types.ts index aa6ebd9..7843ebb 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -1,14 +1,12 @@ import { ClientMethod, Middleware } from 'openapi-fetch'; import type { MediaType } from 'openapi-typescript-helpers'; - export interface Config { token: string; url: string; logging?: boolean; } - // eslint-disable-next-line @typescript-eslint/ban-types export interface OpenAPIClient { GET: ClientMethod; @@ -23,46 +21,127 @@ export interface OpenAPIClient { eject(...middleware: Middleware[]): void; } - export enum DataAssetType { StructuredData = 'Structured Data', UnstructedData = 'Other', } -export type HelperLinks = { first: string; last: string; next: string; previous: string; }; - -export type HelperMeta = { current_page: number; items_per_page: number; total_items: number; total_pages: number; }; - -export type HelperPaginatedResponse = { data: T; links: HelperLinks; meta: HelperMeta; }; - -export type ACLRequest = { address: string; roles: AccessLevel[]; }; - -export enum AccessLevel {VIEW = 'view',UPDATE = 'update',DELETE = 'delete',SHARE = 'share'}; - -export type AccountCreateRequest = { message: string; signature: string; username: string; wallet_address: string; }; - -export type AuthRequest = { message: string; signature: string; wallet_address: string; }; - -export type CreateDataAssetRequest = { acl?: ACLRequest[]; claim?: { }; data_model_id?: number; expiration_date?: string; name: string; tags?: string[]; }; - -export type DataAssetIDRequestAndResponse = { id: number; }; - -export type DataModel = { created_at?: string; created_by?: string; deleted_at?: string; description?: string; id?: number; schema?: { }; tags?: string[]; title?: string; updated_at?: string; }; - -export type DataModelRequest = { description: string; schema: { }; tags?: string[]; title: string; }; - -export type MessageResponse = { message: string; }; - -export type MyAccountResponse = { created_at?: string; did?: string; profile_picture?: string; updated_at?: string; username?: string; wallet_address?: string; }; - -export type PublicACL = { address?: string; created_at?: string; data_asset_id?: number; roles?: string[]; solana_address?: string; updated_at?: string; }; - -export type PublicDataAsset = { acl?: PublicACL[]; created_at?: string; created_by: string; data_model_id?: number; expiration_date?: string; fid: string; id: number; name: string; size: number; tags: string[]; transaction_id: string; type: string; updated_at?: string; }; - -export type ShareDataAssetRequest = { addresses?: string[]; }; - -export type TokenResponse = { token: string; }; - -export type UpdateDataAssetRequest = { claim?: { }; expiration_date?: string; name?: string; }; +export type HelperLinks = { + first: string; + last: string; + next: string; + previous: string; +}; + +export type HelperMeta = { + current_page: number; + items_per_page: number; + total_items: number; + total_pages: number; +}; + +export type HelperPaginatedResponse = { + data: T; + links: HelperLinks; + meta: HelperMeta; +}; + +export type ACLRequest = { address: string; roles: AccessLevel[] }; + +export enum AccessLevel { + VIEW = 'view', + UPDATE = 'update', + DELETE = 'delete', + SHARE = 'share', +} -export type ResponsesMessageResponse = { message?: string; }; +export type AccountCreateRequest = { + message: string; + signature: string; + username: string; + wallet_address: string; +}; + +export type AuthRequest = { + message: string; + signature: string; + wallet_address: string; +}; + +export type CreateDataAssetRequest = { + acl?: ACLRequest[]; + claim?: {}; + data_model_id?: number; + expiration_date?: string; + name: string; + tags?: string[]; +}; + +export type DataAssetIDRequestAndResponse = { id: number }; + +export type DataModel = { + created_at?: string; + created_by?: string; + deleted_at?: string; + description?: string; + id?: number; + schema?: {}; + tags?: string[]; + title?: string; + updated_at?: string; +}; + +export type DataModelRequest = { + description: string; + schema: {}; + tags?: string[]; + title: string; +}; + +export type MessageResponse = { message: string }; + +export type MyAccountResponse = { + created_at?: string; + did?: string; + profile_picture?: string; + updated_at?: string; + username?: string; + wallet_address?: string; +}; + +export type PublicACL = { + address?: string; + created_at?: string; + data_asset_id?: number; + roles?: string[]; + solana_address?: string; + updated_at?: string; +}; + +export type PublicDataAsset = { + acl?: PublicACL[]; + created_at?: string; + created_by: string; + data_model_id?: number; + expiration_date?: string; + fid: string; + id: number; + name: string; + size: number; + tags: string[]; + transaction_id: string; + type: string; + updated_at?: string; +}; + +export type ShareDataAssetRequest = { addresses?: string[] }; + +export type TokenResponse = { token: string }; + +export type UpdateDataAssetRequest = { + claim?: {}; + expiration_date?: string; + name?: string; +}; + +export type ResponsesMessageResponse = { message?: string };