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 create_update_message(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 pair_device(params: any): void;
|
||||
export function pair_device(processId: string, addresses: string[]): void;
|
||||
export function sign_transaction(params: any): ApiReturn;
|
||||
export function request_data(processId: string, stateIds: any, roles: any, membersList: any): ApiReturn;
|
||||
export function decrypt_data(params: any): ApiReturn;
|
||||
export function decode_value(params: any): any;
|
||||
export function unpair_device(params: any): void;
|
||||
export function decrypt_data(key: Uint8Array, cipher: Uint8Array): Uint8Array;
|
||||
export function decode_value(value: Uint8Array): any;
|
||||
export function unpair_device(): void;
|
||||
|
||||
export interface SdkClient {
|
||||
init(): Promise<void>;
|
||||
@ -130,14 +130,14 @@ export interface SdkClient {
|
||||
parse_new_tx(tx: string, blockHeight: number, membersList: any): ApiReturn;
|
||||
create_update_message(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;
|
||||
pair_device(params: any): void;
|
||||
pair_device(processId: string, addresses: string[]): void;
|
||||
sign_transaction(params: any): ApiReturn;
|
||||
request_data(processId: string, stateIds: any, roles: any, membersList: any): ApiReturn;
|
||||
decrypt_data(params: any): ApiReturn;
|
||||
decode_value(params: any): any;
|
||||
unpair_device(params: any): void;
|
||||
decrypt_data(key: Uint8Array, cipher: Uint8Array): Uint8Array;
|
||||
decode_value(value: Uint8Array): any;
|
||||
unpair_device(): void;
|
||||
}
|
||||
|
||||
export const sdk_client: SdkClient;
|
||||
|
@ -148,8 +148,8 @@ export function validate_state(process, stateId, membersList) {
|
||||
/**
|
||||
* Update process
|
||||
*/
|
||||
export function update_process(process, stateId, roles, publicData, privateData) {
|
||||
console.log("update_process called with:", { process, stateId, roles, publicData, privateData });
|
||||
export function update_process(process, newAttributes, newRoles, newPublicData, membersList) {
|
||||
console.log("update_process called with:", { process, newAttributes, newRoles, newPublicData, membersList });
|
||||
return { success: true, data: { updated: true, updated_process: {} } };
|
||||
}
|
||||
|
||||
@ -163,8 +163,8 @@ export function restore_device(params) {
|
||||
/**
|
||||
* Pair device
|
||||
*/
|
||||
export function pair_device(params) {
|
||||
console.log("pair_device called with params:", params);
|
||||
export function pair_device(processId, addresses) {
|
||||
console.log("pair_device called with processId:", processId, "addresses:", addresses);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -186,24 +186,24 @@ export function request_data(processId, stateIds, roles, membersList) {
|
||||
/**
|
||||
* Decrypt data
|
||||
*/
|
||||
export function decrypt_data(params) {
|
||||
console.log("decrypt_data called with params:", params);
|
||||
return { success: true, data: { decrypted: "stub_decrypted" } };
|
||||
export function decrypt_data(key, cipher) {
|
||||
console.log("decrypt_data called with key:", key, "cipher:", cipher);
|
||||
return new Uint8Array(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode value
|
||||
*/
|
||||
export function decode_value(params) {
|
||||
console.log("decode_value called with params:", params);
|
||||
export function decode_value(value) {
|
||||
console.log("decode_value called with value:", value);
|
||||
return "stub_decoded_value";
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpair device
|
||||
*/
|
||||
export function unpair_device(params) {
|
||||
console.log("unpair_device called with params:", params);
|
||||
export function unpair_device() {
|
||||
console.log("unpair_device called");
|
||||
}
|
||||
|
||||
// Export stub functions that might be used by sdk_signer
|
||||
|
@ -1081,11 +1081,13 @@ export class Service {
|
||||
|
||||
if (updatedProcess.encrypted_data && Object.keys(updatedProcess.encrypted_data).length != 0) {
|
||||
for (const [hash, cipher] of Object.entries(updatedProcess.encrypted_data)) {
|
||||
const blob = this.hexToBlob(cipher);
|
||||
try {
|
||||
await this.saveBlobToDb(hash, blob);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
if (typeof cipher === 'string') {
|
||||
const blob = this.hexToBlob(cipher);
|
||||
try {
|
||||
await this.saveBlobToDb(hash, blob);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1178,11 +1180,13 @@ export class Service {
|
||||
// If we're not supposed to have access to this attribute, ignore
|
||||
for (const role of Object.values(roles)) {
|
||||
for (const rule of Object.values(role.validation_rules)) {
|
||||
if (rule.fields.includes(attribute)) {
|
||||
if (role.members.includes(pairingProcessId)) {
|
||||
// We have access to this attribute
|
||||
hasAccess = true;
|
||||
break;
|
||||
if (typeof rule === 'object' && rule !== null && 'fields' in rule && Array.isArray(rule.fields)) {
|
||||
if (rule.fields.includes(attribute)) {
|
||||
if (role.members.includes(pairingProcessId)) {
|
||||
// We have access to this attribute
|
||||
hasAccess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user