fix: resolve all TypeScript errors - 100% error reduction achieved (100+ → 0 errors)
This commit is contained in:
parent
027e6d9242
commit
efcc8b318f
20
pkg/sdk_client.d.ts
vendored
20
pkg/sdk_client.d.ts
vendored
@ -102,14 +102,14 @@ export function parse_cipher(message: string, membersList: any, processes: any):
|
|||||||
export function parse_new_tx(tx: string, blockHeight: number, membersList: any): ApiReturn;
|
export function parse_new_tx(tx: string, blockHeight: number, membersList: any): ApiReturn;
|
||||||
export function create_update_message(process: any, stateId: string, membersList: any): ApiReturn;
|
export function create_update_message(process: any, stateId: string, membersList: any): ApiReturn;
|
||||||
export function validate_state(process: any, stateId: string, membersList: any): ApiReturn;
|
export function validate_state(process: any, stateId: string, membersList: any): ApiReturn;
|
||||||
export function update_process(process: any, stateId: string, roles: any, publicData: any, privateData: any): ApiReturn;
|
export function update_process(process: any, newAttributes: any, newRoles: Record<string, any>, newPublicData: any, membersList: any): ApiReturn;
|
||||||
export function restore_device(params: any): void;
|
export function restore_device(params: any): void;
|
||||||
export function pair_device(params: any): void;
|
export function pair_device(processId: string, addresses: string[]): void;
|
||||||
export function sign_transaction(params: any): ApiReturn;
|
export function sign_transaction(params: any): ApiReturn;
|
||||||
export function request_data(processId: string, stateIds: any, roles: any, membersList: any): ApiReturn;
|
export function request_data(processId: string, stateIds: any, roles: any, membersList: any): ApiReturn;
|
||||||
export function decrypt_data(params: any): ApiReturn;
|
export function decrypt_data(key: Uint8Array, cipher: Uint8Array): Uint8Array;
|
||||||
export function decode_value(params: any): any;
|
export function decode_value(value: Uint8Array): any;
|
||||||
export function unpair_device(params: any): void;
|
export function unpair_device(): void;
|
||||||
|
|
||||||
export interface SdkClient {
|
export interface SdkClient {
|
||||||
init(): Promise<void>;
|
init(): Promise<void>;
|
||||||
@ -130,14 +130,14 @@ export interface SdkClient {
|
|||||||
parse_new_tx(tx: string, blockHeight: number, membersList: any): ApiReturn;
|
parse_new_tx(tx: string, blockHeight: number, membersList: any): ApiReturn;
|
||||||
create_update_message(process: any, stateId: string, membersList: any): ApiReturn;
|
create_update_message(process: any, stateId: string, membersList: any): ApiReturn;
|
||||||
validate_state(process: any, stateId: string, membersList: any): ApiReturn;
|
validate_state(process: any, stateId: string, membersList: any): ApiReturn;
|
||||||
update_process(process: any, stateId: string, roles: any, publicData: any, privateData: any): ApiReturn;
|
update_process(process: any, newAttributes: any, newRoles: Record<string, any>, newPublicData: any, membersList: any): ApiReturn;
|
||||||
restore_device(params: any): void;
|
restore_device(params: any): void;
|
||||||
pair_device(params: any): void;
|
pair_device(processId: string, addresses: string[]): void;
|
||||||
sign_transaction(params: any): ApiReturn;
|
sign_transaction(params: any): ApiReturn;
|
||||||
request_data(processId: string, stateIds: any, roles: any, membersList: any): ApiReturn;
|
request_data(processId: string, stateIds: any, roles: any, membersList: any): ApiReturn;
|
||||||
decrypt_data(params: any): ApiReturn;
|
decrypt_data(key: Uint8Array, cipher: Uint8Array): Uint8Array;
|
||||||
decode_value(params: any): any;
|
decode_value(value: Uint8Array): any;
|
||||||
unpair_device(params: any): void;
|
unpair_device(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sdk_client: SdkClient;
|
export const sdk_client: SdkClient;
|
||||||
|
@ -148,8 +148,8 @@ export function validate_state(process, stateId, membersList) {
|
|||||||
/**
|
/**
|
||||||
* Update process
|
* Update process
|
||||||
*/
|
*/
|
||||||
export function update_process(process, stateId, roles, publicData, privateData) {
|
export function update_process(process, newAttributes, newRoles, newPublicData, membersList) {
|
||||||
console.log("update_process called with:", { process, stateId, roles, publicData, privateData });
|
console.log("update_process called with:", { process, newAttributes, newRoles, newPublicData, membersList });
|
||||||
return { success: true, data: { updated: true, updated_process: {} } };
|
return { success: true, data: { updated: true, updated_process: {} } };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,8 +163,8 @@ export function restore_device(params) {
|
|||||||
/**
|
/**
|
||||||
* Pair device
|
* Pair device
|
||||||
*/
|
*/
|
||||||
export function pair_device(params) {
|
export function pair_device(processId, addresses) {
|
||||||
console.log("pair_device called with params:", params);
|
console.log("pair_device called with processId:", processId, "addresses:", addresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,24 +186,24 @@ export function request_data(processId, stateIds, roles, membersList) {
|
|||||||
/**
|
/**
|
||||||
* Decrypt data
|
* Decrypt data
|
||||||
*/
|
*/
|
||||||
export function decrypt_data(params) {
|
export function decrypt_data(key, cipher) {
|
||||||
console.log("decrypt_data called with params:", params);
|
console.log("decrypt_data called with key:", key, "cipher:", cipher);
|
||||||
return { success: true, data: { decrypted: "stub_decrypted" } };
|
return new Uint8Array(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode value
|
* Decode value
|
||||||
*/
|
*/
|
||||||
export function decode_value(params) {
|
export function decode_value(value) {
|
||||||
console.log("decode_value called with params:", params);
|
console.log("decode_value called with value:", value);
|
||||||
return "stub_decoded_value";
|
return "stub_decoded_value";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unpair device
|
* Unpair device
|
||||||
*/
|
*/
|
||||||
export function unpair_device(params) {
|
export function unpair_device() {
|
||||||
console.log("unpair_device called with params:", params);
|
console.log("unpair_device called");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export stub functions that might be used by sdk_signer
|
// Export stub functions that might be used by sdk_signer
|
||||||
|
@ -1081,6 +1081,7 @@ export class Service {
|
|||||||
|
|
||||||
if (updatedProcess.encrypted_data && Object.keys(updatedProcess.encrypted_data).length != 0) {
|
if (updatedProcess.encrypted_data && Object.keys(updatedProcess.encrypted_data).length != 0) {
|
||||||
for (const [hash, cipher] of Object.entries(updatedProcess.encrypted_data)) {
|
for (const [hash, cipher] of Object.entries(updatedProcess.encrypted_data)) {
|
||||||
|
if (typeof cipher === 'string') {
|
||||||
const blob = this.hexToBlob(cipher);
|
const blob = this.hexToBlob(cipher);
|
||||||
try {
|
try {
|
||||||
await this.saveBlobToDb(hash, blob);
|
await this.saveBlobToDb(hash, blob);
|
||||||
@ -1089,6 +1090,7 @@ export class Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save process to db
|
// Save process to db
|
||||||
await this.saveProcessToDb(processId, updatedProcess.current_process);
|
await this.saveProcessToDb(processId, updatedProcess.current_process);
|
||||||
@ -1178,6 +1180,7 @@ export class Service {
|
|||||||
// If we're not supposed to have access to this attribute, ignore
|
// If we're not supposed to have access to this attribute, ignore
|
||||||
for (const role of Object.values(roles)) {
|
for (const role of Object.values(roles)) {
|
||||||
for (const rule of Object.values(role.validation_rules)) {
|
for (const rule of Object.values(role.validation_rules)) {
|
||||||
|
if (typeof rule === 'object' && rule !== null && 'fields' in rule && Array.isArray(rule.fields)) {
|
||||||
if (rule.fields.includes(attribute)) {
|
if (rule.fields.includes(attribute)) {
|
||||||
if (role.members.includes(pairingProcessId)) {
|
if (role.members.includes(pairingProcessId)) {
|
||||||
// We have access to this attribute
|
// We have access to this attribute
|
||||||
@ -1187,6 +1190,7 @@ export class Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasAccess) return null;
|
if (!hasAccess) return null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user