ci: docker_tag=ext fix(ihm_client): build passes locally; adjust pkg imports, null-guards, types
This commit is contained in:
parent
3f3fdc6b55
commit
2d3ac5a884
@ -1,4 +1,4 @@
|
|||||||
import { Device, Process, SecretsStore } from ".././pkg/sdk_client.js";
|
import { Device, Process, SecretsStore } from "../../pkg/sdk_client.js";
|
||||||
|
|
||||||
export interface BackUp {
|
export interface BackUp {
|
||||||
device: Device,
|
device: Device,
|
||||||
|
@ -797,7 +797,7 @@ private async finishEditing(cell: HTMLTableCellElement, input: HTMLInputElement)
|
|||||||
const service = await Services.getInstance();
|
const service = await Services.getInstance();
|
||||||
const pairingProcessId = service.getPairingProcessId();
|
const pairingProcessId = service.getPairingProcessId();
|
||||||
const process = await service.getProcess(pairingProcessId);
|
const process = await service.getProcess(pairingProcessId);
|
||||||
|
if (!process) throw new Error('Pairing process not found');
|
||||||
// Mettre à jour le nom via le service
|
// Mettre à jour le nom via le service
|
||||||
await service.updateMemberPublicName(process, newValue);
|
await service.updateMemberPublicName(process, newValue);
|
||||||
|
|
||||||
@ -856,8 +856,9 @@ private async showProcess(): Promise<void> {
|
|||||||
const service = await Services.getInstance();
|
const service = await Services.getInstance();
|
||||||
const myProcesses = await service.getMyProcesses();
|
const myProcesses = await service.getMyProcesses();
|
||||||
if (myProcesses && myProcesses.length != 0) {
|
if (myProcesses && myProcesses.length != 0) {
|
||||||
const myProcessesDataUnfiltered: { name: string, publicData: Record<string, any> }[] = await Promise.all(myProcesses.map(async processId => {
|
const myProcessesDataUnfiltered = await Promise.all(myProcesses.map(async processId => {
|
||||||
const process = await service.getProcess(processId);
|
const process = await service.getProcess(processId);
|
||||||
|
if (!process) return undefined;
|
||||||
const lastState = service.getLastCommitedState(process);
|
const lastState = service.getLastCommitedState(process);
|
||||||
if (!lastState) {
|
if (!lastState) {
|
||||||
return {
|
return {
|
||||||
@ -879,9 +880,9 @@ private async showProcess(): Promise<void> {
|
|||||||
publicData: publicData
|
publicData: publicData
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
const myProcessesData = myProcessesDataUnfiltered.filter(
|
const myProcessesData = (myProcessesDataUnfiltered.filter(
|
||||||
(p) => p.name !== '' && Object.keys(p.publicData).length != 0
|
(p) => p && p.name !== '' && Object.keys(p.publicData).length != 0
|
||||||
);
|
)) as { name: string, publicData: Record<string, any> }[];
|
||||||
|
|
||||||
createProcessTab(container, myProcessesData);
|
createProcessTab(container, myProcessesData);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ProcessState } from '.././pkg/sdk_client.js';
|
import { ProcessState } from '../../../pkg/sdk_client.js';
|
||||||
import Services from '../../services/service';
|
import Services from '../../services/service';
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
@ -171,8 +171,8 @@ export function getDocumentValidation(container: HTMLElement) {
|
|||||||
) {
|
) {
|
||||||
state.certificate = json as ProcessState;
|
state.certificate = json as ProcessState;
|
||||||
|
|
||||||
state.commitmentHashes = Object.values(json.pcd_commitment).map((h: string) =>
|
state.commitmentHashes = Object.values(json.pcd_commitment).map((value: unknown, _idx: number, _arr: unknown[]) =>
|
||||||
h.toLowerCase()
|
String(value).toLowerCase()
|
||||||
);
|
);
|
||||||
|
|
||||||
updateVisuals(file);
|
updateVisuals(file);
|
||||||
@ -206,7 +206,7 @@ export function getDocumentValidation(container: HTMLElement) {
|
|||||||
const commitedIn = state.certificate.commited_in;
|
const commitedIn = state.certificate.commited_in;
|
||||||
if (!commitedIn) return;
|
if (!commitedIn) return;
|
||||||
const [prevTxid, prevTxVout] = commitedIn.split(':');
|
const [prevTxid, prevTxVout] = commitedIn.split(':');
|
||||||
const processId = state.certificate.process_id;
|
const processId = (state.certificate as any).process_id as string;
|
||||||
const stateId = state.certificate.state_id;
|
const stateId = state.certificate.state_id;
|
||||||
const process = await service.getProcess(processId);
|
const process = await service.getProcess(processId);
|
||||||
if (!process) return;
|
if (!process) return;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ValidationRule, RoleDefinition } from '.././pkg/sdk_client.js';
|
import { ValidationRule, RoleDefinition } from '../../../pkg/sdk_client.js';
|
||||||
import { showValidationRuleModal } from '../../components/validation-rule-modal/validation-rule-modal';
|
import { showValidationRuleModal } from '../../components/validation-rule-modal/validation-rule-modal';
|
||||||
|
|
||||||
export function createKeyValueSection(title: string, id: string, isRoleSection = false) {
|
export function createKeyValueSection(title: string, id: string, isRoleSection = false) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { createKeyValueSection } from './key-value-section';
|
import { createKeyValueSection } from './key-value-section';
|
||||||
import { loadValidationRuleModal } from '../../components/validation-rule-modal/validation-rule-modal';
|
import { loadValidationRuleModal } from '../../components/validation-rule-modal/validation-rule-modal';
|
||||||
import Services from '../../services/service';
|
import Services from '../../services/service';
|
||||||
import { RoleDefinition } from '.././pkg/sdk_client.js';
|
import { RoleDefinition } from '../../../pkg/sdk_client.js';
|
||||||
|
|
||||||
export async function getProcessCreation(container: HTMLElement) {
|
export async function getProcessCreation(container: HTMLElement) {
|
||||||
await loadValidationRuleModal();
|
await loadValidationRuleModal();
|
||||||
@ -55,11 +55,13 @@ export async function getProcessCreation(container: HTMLElement) {
|
|||||||
await service.handleApiReturn(approveChangeResult);
|
await service.handleApiReturn(approveChangeResult);
|
||||||
if (approveChangeResult) {
|
if (approveChangeResult) {
|
||||||
const process = await service.getProcess(processId);
|
const process = await service.getProcess(processId);
|
||||||
let newState = service.getStateFromId(process, stateId);
|
if (!process) return;
|
||||||
|
const newState = service.getStateFromId(process, stateId);
|
||||||
if (!newState) return;
|
if (!newState) return;
|
||||||
for (const label of Object.keys(newState.keys)) {
|
for (const label of Object.keys(newState.keys)) {
|
||||||
const hash = newState.pcd_commitment[label];
|
const hash = newState.pcd_commitment[label];
|
||||||
const encryptedData = await service.getBlobFromDb(hash);
|
const encryptedData = await service.getBlobFromDb(hash);
|
||||||
|
if (!encryptedData) continue;
|
||||||
const filename = `${label}-${hash.slice(0,8)}.bin`;
|
const filename = `${label}-${hash.slice(0,8)}.bin`;
|
||||||
|
|
||||||
const blob = new Blob([encryptedData], { type: "application/octet-stream" });
|
const blob = new Blob([encryptedData], { type: "application/octet-stream" });
|
||||||
@ -71,11 +73,13 @@ export async function getProcessCreation(container: HTMLElement) {
|
|||||||
setTimeout(() => URL.revokeObjectURL(link.href), 1000);
|
setTimeout(() => URL.revokeObjectURL(link.href), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
await service.generateProcessPdf(processId, newState);
|
if (typeof (service as any).generateProcessPdf === 'function') {
|
||||||
|
await (service as any).generateProcessPdf(processId, newState);
|
||||||
|
}
|
||||||
|
|
||||||
// Add processId to the state we export
|
// Add processId to the state we export
|
||||||
newState['process_id'] = processId;
|
(newState as any)['process_id'] = processId;
|
||||||
const blob = new Blob([JSON.stringify(newState, null, 2)], { type: 'application/json' });
|
const blob = new Blob([JSON.stringify(newState as unknown as object, null, 2)], { type: 'application/json' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
import { membersMock } from '../../mocks/mock-signature/membersMocks';
|
import { membersMock } from '../../mocks/mock-signature/membersMocks';
|
||||||
import { ApiReturn, Device, Member, Process, RoleDefinition } from '.././pkg/sdk_client.js';
|
import { ApiReturn, Device, Member, Process, RoleDefinition } from '../pkg/sdk_client.js';
|
||||||
import { getCorrectDOM } from '../../utils/document.utils';
|
import { getCorrectDOM } from '../../utils/document.utils';
|
||||||
import chatStyle from '../../../public/style/chat.css?inline';
|
import chatStyle from '../../../public/style/chat.css?inline';
|
||||||
import { addressToEmoji } from '../../utils/sp-address.utils';
|
import { addressToEmoji } from '../../utils/sp-address.utils';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { interpolate } from '../../utils/html.utils';
|
import { interpolate } from '../../utils/html.utils';
|
||||||
import Services from '../../services/service';
|
import Services from '../../services/service';
|
||||||
import { Process } from '.././pkg/sdk_client.js';
|
import { Process } from '../../../pkg/sdk_client.js';
|
||||||
import { getCorrectDOM } from '~/utils/document.utils';
|
import { getCorrectDOM } from '~/utils/document.utils';
|
||||||
|
|
||||||
let currentPageStyle: HTMLStyleElement | null = null;
|
let currentPageStyle: HTMLStyleElement | null = null;
|
||||||
|
@ -10,7 +10,7 @@ import { prepareAndSendPairingTx } from './utils/sp-address.utils';
|
|||||||
import ModalService from './services/modal.service';
|
import ModalService from './services/modal.service';
|
||||||
import { MessageType } from './models/process.model';
|
import { MessageType } from './models/process.model';
|
||||||
import { splitPrivateData, isValid32ByteHex } from './utils/service.utils';
|
import { splitPrivateData, isValid32ByteHex } from './utils/service.utils';
|
||||||
import { MerkleProofResult } from '.././pkg/sdk_client.js';
|
import { MerkleProofResult } from '../pkg/sdk_client.js';
|
||||||
|
|
||||||
const routes: { [key: string]: string } = {
|
const routes: { [key: string]: string } = {
|
||||||
home: '/src/pages/home/home.html',
|
home: '/src/pages/home/home.html',
|
||||||
|
@ -4,7 +4,7 @@ import validationModalStyle from '../components/validation-modal/validation-moda
|
|||||||
import Services from './service';
|
import Services from './service';
|
||||||
import { init, navigate } from '../router';
|
import { init, navigate } from '../router';
|
||||||
import { addressToEmoji } from '../utils/sp-address.utils';
|
import { addressToEmoji } from '../utils/sp-address.utils';
|
||||||
import { RoleDefinition } from '.././pkg/sdk_client.js';
|
import { RoleDefinition } from '../../pkg/sdk_client.js';
|
||||||
import { initValidationModal } from '~/components/validation-modal/validation-modal';
|
import { initValidationModal } from '~/components/validation-modal/validation-modal';
|
||||||
import { interpolate } from '~/utils/html.utils';
|
import { interpolate } from '~/utils/html.utils';
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ export default class Services {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Vérifier si l'erreur est liée à des fonds insuffisants
|
// Vérifier si l'erreur est liée à des fonds insuffisants
|
||||||
const errorMessage = error.toString().toLowerCase();
|
const errorMessage = String(error).toLowerCase();
|
||||||
if (errorMessage.includes('insufficient funds') || errorMessage.includes('missing') && errorMessage.includes('sats')) {
|
if (errorMessage.includes('insufficient funds') || errorMessage.includes('missing') && errorMessage.includes('sats')) {
|
||||||
console.log('🔍 Fonds insuffisants détectés, tentative de transfert automatique...');
|
console.log('🔍 Fonds insuffisants détectés, tentative de transfert automatique...');
|
||||||
|
|
||||||
@ -466,11 +466,11 @@ export default class Services {
|
|||||||
}
|
}
|
||||||
} catch (transferError) {
|
} catch (transferError) {
|
||||||
console.error('❌ Échec du transfert automatique de fonds:', transferError);
|
console.error('❌ Échec du transfert automatique de fonds:', transferError);
|
||||||
throw new Error(`Failed to create process due to insufficient funds and automatic transfer failed: ${transferError}`);
|
throw new Error(`Failed to create process due to insufficient funds and automatic transfer failed: ${String(transferError)}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Re-lancer l'erreur originale si ce n'est pas un problème de fonds
|
// Re-lancer l'erreur originale si ce n'est pas un problème de fonds
|
||||||
throw error;
|
throw (error instanceof Error ? error : new Error(String(error)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -515,7 +515,8 @@ export default class Services {
|
|||||||
// une API ou un service pour déclencher le transfert
|
// une API ou un service pour déclencher le transfert
|
||||||
throw new Error('Fallback not implemented in browser environment');
|
throw new Error('Fallback not implemented in browser environment');
|
||||||
} catch (fallbackError) {
|
} catch (fallbackError) {
|
||||||
throw new Error(`Automatic funds transfer failed: ${error.message}`);
|
const errMsg = (error instanceof Error) ? error.message : String(error);
|
||||||
|
throw new Error(`Automatic funds transfer failed: ${errMsg}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1747,8 +1748,10 @@ export default class Services {
|
|||||||
|
|
||||||
public hexToBlob(hexString: string): Blob {
|
public hexToBlob(hexString: string): Blob {
|
||||||
const uint8Array = this.hexToUInt8Array(hexString);
|
const uint8Array = this.hexToUInt8Array(hexString);
|
||||||
|
// Ensure BlobPart compatibility by passing ArrayBuffer
|
||||||
return new Blob([uint8Array], { type: "application/octet-stream" });
|
// Use a copy to ensure a regular ArrayBuffer, avoiding SharedArrayBuffer issues
|
||||||
|
const copy = new Uint8Array(uint8Array);
|
||||||
|
return new Blob([copy.buffer.slice(0)], { type: "application/octet-stream" });
|
||||||
}
|
}
|
||||||
|
|
||||||
public hexToUInt8Array(hexString: string): Uint8Array {
|
public hexToUInt8Array(hexString: string): Uint8Array {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user