Skip to content

Commit 8dd12e9

Browse files
committed
chore: temp fix sync
1 parent 6f5f9cb commit 8dd12e9

File tree

12 files changed

+122
-70
lines changed

12 files changed

+122
-70
lines changed

infrastructure/evault-provisioner/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ app.post(
100100
const JWKS = jose.createLocalJWKSet(jwksResponse.data);
101101
const { payload } = await jose.jwtVerify(registryEntropy, JWKS);
102102

103-
const evaultId = await new W3IDBuilder().withGlobal(true).build();
104103
const userId = await new W3IDBuilder()
105104
.withNamespace(namespace)
106105
.withEntropy(payload.entropy as string)
@@ -121,7 +120,11 @@ app.post(
121120
"This verification ID has already been used",
122121
);
123122
}
124-
const uri = await provisionEVault(w3id, evaultId.id);
123+
const evaultId = await new W3IDBuilder().withGlobal(true).build();
124+
const uri = await provisionEVault(
125+
w3id,
126+
process.env.PUBLIC_REGISTRY_URL,
127+
);
125128
await axios.post(
126129
new URL(
127130
"/register",

infrastructure/evault-provisioner/src/templates/evault.nomad.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function generatePassword(length = 16): string {
3636
*
3737
* @throws {Error} If the service endpoint cannot be determined from the cluster.
3838
*/
39-
export async function provisionEVault(w3id: string, eVaultId: string) {
39+
export async function provisionEVault(w3id: string, registryUrl: string) {
4040
console.log("starting to provision");
4141
const idParts = w3id.split("@");
4242
w3id = idParts[idParts.length - 1];
@@ -107,6 +107,10 @@ export async function provisionEVault(w3id: string, eVaultId: string) {
107107
name: "dbms.connector.bolt.listen_address",
108108
value: "0.0.0.0:7687",
109109
},
110+
{
111+
name: "REGISTRY_URL",
112+
value: registryUrl,
113+
},
110114
],
111115
volumeMounts: [
112116
{ name: "neo4j-data", mountPath: "/data" },

infrastructure/web3-adapter/src/evault/evault.ts

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,23 @@ export class EVaultClient {
122122
}
123123

124124
async storeMetaEnvelope(envelope: MetaEnvelope): Promise<string> {
125-
const client = await this.ensureClient(envelope.w3id).catch(() => {
126-
return null;
127-
});
128-
if (!client) return v4();
129-
130-
const response = await client
131-
.request<StoreMetaEnvelopeResponse>(STORE_META_ENVELOPE, {
132-
input: {
133-
ontology: envelope.schemaId,
134-
payload: envelope.data,
135-
acl: ["*"],
136-
},
137-
})
138-
.catch(() => null);
139-
if (!response) return v4();
140-
return response.storeMetaEnvelope.metaEnvelope.id;
125+
// const client = await this.ensureClient(envelope.w3id).catch(() => {
126+
// return null;
127+
// });
128+
// if (!client) return v4();
129+
//
130+
// const response = await client
131+
// .request<StoreMetaEnvelopeResponse>(STORE_META_ENVELOPE, {
132+
// input: {
133+
// ontology: envelope.schemaId,
134+
// payload: envelope.data,
135+
// acl: ["*"],
136+
// },
137+
// })
138+
// .catch(() => null);
139+
// if (!response) return v4();
140+
// return response.storeMetaEnvelope.metaEnvelope.id;
141+
return v4();
141142
}
142143

143144
async storeReference(referenceId: string, w3id: string): Promise<void> {
@@ -178,28 +179,29 @@ export class EVaultClient {
178179
async updateMetaEnvelopeById(
179180
id: string,
180181
envelope: MetaEnvelope,
181-
): Promise<StoreMetaEnvelopeResponse["storeMetaEnvelope"]> {
182-
const client = await this.ensureClient(envelope.w3id).catch(() => null);
183-
if (!client) throw new Error();
184-
185-
try {
186-
const variables = {
187-
id,
188-
input: {
189-
ontology: envelope.schemaId,
190-
payload: envelope.data,
191-
acl: ["*"],
192-
},
193-
};
194-
195-
const response = await client.request<StoreMetaEnvelopeResponse>(
196-
UPDATE_META_ENVELOPE,
197-
variables,
198-
);
199-
return response.updateMetaEnvelopeById;
200-
} catch (error) {
201-
console.error("Error updating meta envelope:", error);
202-
throw error;
203-
}
182+
): Promise<void> {
183+
// const client = await this.ensureClient(envelope.w3id).catch(() => null);
184+
// if (!client) throw new Error();
185+
//
186+
// try {
187+
// const variables = {
188+
// id,
189+
// input: {
190+
// ontology: envelope.schemaId,
191+
// payload: envelope.data,
192+
// acl: ["*"],
193+
// },
194+
// };
195+
//
196+
// const response = await client.request<StoreMetaEnvelopeResponse>(
197+
// UPDATE_META_ENVELOPE,
198+
// variables,
199+
// );
200+
// return response.updateMetaEnvelopeById;
201+
// } catch (error) {
202+
// console.error("Error updating meta envelope:", error);
203+
// throw error;
204+
// }
205+
return;
204206
}
205207
}

infrastructure/web3-adapter/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class Web3Adapter {
4646
console.log("Added", this.lockedIds);
4747
setTimeout(() => {
4848
this.lockedIds = this.lockedIds.filter((f) => f !== id);
49-
}, 60_000);
49+
}, 10_000);
5050
}
5151

5252
async handleChange(props: {
@@ -60,6 +60,7 @@ export class Web3Adapter {
6060
localId: data.id as string,
6161
tableName,
6262
});
63+
console.log("localId", data.id, "globalId", existingGlobalId);
6364

6465
// If we already have a mapping, use that global ID
6566
if (existingGlobalId) {

infrastructure/web3-adapter/src/mapper/mapper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export async function fromGlobal({
5555
}: IMappingConversionOptions): Promise<Omit<IMapperResponse, "ownerEvault">> {
5656
const result: Record<string, unknown> = {};
5757

58+
console.log("data to change", data);
59+
5860
for (let [localKey, globalPathRaw] of Object.entries(
5961
mapping.localToUniversalMap,
6062
)) {
@@ -129,6 +131,8 @@ export async function fromGlobal({
129131
result[localKey] = value;
130132
}
131133

134+
console.log("data changed to global", result);
135+
132136
return {
133137
data: result,
134138
};
@@ -168,6 +172,8 @@ export async function toGlobal({
168172
}: IMappingConversionOptions): Promise<IMapperResponse> {
169173
const result: Record<string, unknown> = {};
170174

175+
console.log("data to change", data);
176+
171177
for (let [localKey, globalPathRaw] of Object.entries(
172178
mapping.localToUniversalMap,
173179
)) {
@@ -277,6 +283,8 @@ export async function toGlobal({
277283
}
278284
const ownerEvault = await extractOwnerEvault(data, mapping.ownerEnamePath);
279285

286+
console.log("changed data to local", result);
287+
280288
return {
281289
ownerEvault,
282290
data: result,

platforms/blabsy-w3ds-auth-api/src/controllers/WebhookController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export class WebhookController {
100100
});
101101

102102
if (localId) {
103+
console.log("");
103104
adapter.addToLockedIds(localId);
104105
await this.updateRecord(tableName, localId, local.data);
105106
} else {
@@ -148,8 +149,7 @@ export class WebhookController {
148149
const docRef = collection.doc(localId);
149150

150151
adapter.addToLockedIds(docRef.id);
151-
const mappedData = this.mapDataToFirebase(tableName, data);
152-
console.log(mappedData);
152+
const mappedData = await this.mapDataToFirebase(tableName, data);
153153
await docRef.update(mappedData);
154154
}
155155

platforms/blabsy-w3ds-auth-api/src/web3adapter/watchers/firestoreWatcher.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,14 @@ export class FirestoreWatcher {
154154

155155
const tableName = tableNameRaw.slice(0, tableNameRaw.length - 1);
156156

157-
const envelope = await this.adapter.handleChange({
158-
data: { ...data, id: doc.id },
159-
tableName,
160-
});
161-
157+
const envelope = await this.adapter
158+
.handleChange({
159+
data: { ...data, id: doc.id },
160+
tableName,
161+
})
162+
.catch(() => null);
163+
164+
console.log("sending envelope", envelope);
162165
if (envelope) {
163166
try {
164167
if (

platforms/pictique-api/src/web3adapter/watchers/subscriber.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
5656

5757
if (entity.author) {
5858
const author = await AppDataSource.getRepository(
59-
"User"
59+
"User",
6060
).findOne({ where: { id: entity.author.id } });
6161
enrichedEntity.author = author;
6262
}
@@ -78,13 +78,13 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
7878
entity = (await this.enrichEntity(
7979
entity,
8080
event.metadata.tableName,
81-
event.metadata.target
81+
event.metadata.target,
8282
)) as ObjectLiteral;
8383
}
8484
this.handleChange(
8585
// @ts-ignore
8686
entity ?? event.entityId,
87-
event.metadata.tableName
87+
event.metadata.tableName,
8888
);
8989
}
9090

@@ -104,13 +104,13 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
104104
entity = (await this.enrichEntity(
105105
entity,
106106
event.metadata.tableName,
107-
event.metadata.target
107+
event.metadata.target,
108108
)) as ObjectLiteral;
109109
}
110110
this.handleChange(
111111
// @ts-ignore
112112
entity ?? event.entityId,
113-
event.metadata.tableName
113+
event.metadata.tableName,
114114
);
115115
}
116116

@@ -130,13 +130,13 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
130130
entity = (await this.enrichEntity(
131131
entity,
132132
event.metadata.tableName,
133-
event.metadata.target
133+
event.metadata.target,
134134
)) as ObjectLiteral;
135135
}
136136
this.handleChange(
137137
// @ts-ignore
138138
entity ?? event.entityId,
139-
event.metadata.tableName
139+
event.metadata.tableName,
140140
);
141141
}
142142

@@ -169,20 +169,21 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
169169
} catch (error) {
170170
console.error(
171171
`Error processing change for ${tableName}:`,
172-
error
172+
error,
173173
);
174174
}
175175
}, 2_000);
176176
}
177177

178178
private async deliverWebhook(envelope: Record<string, unknown>) {
179+
console.log("sending envelope", envelope);
179180
axios
180181
.post(
181182
new URL(
182183
"/api/webhook",
183-
process.env.PUBLIC_BLABSY_BASE_URL
184+
process.env.PUBLIC_BLABSY_BASE_URL,
184185
).toString(),
185-
envelope
186+
envelope,
186187
)
187188
.catch((e) => console.error(e));
188189
}
@@ -192,7 +193,7 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
192193
*/
193194
private async handleJunctionTableChange(
194195
entity: any,
195-
junctionInfo: { entity: string; idField: string }
196+
junctionInfo: { entity: string; idField: string },
196197
): Promise<void> {
197198
try {
198199
const parentId = entity[junctionInfo.idField];
@@ -228,7 +229,7 @@ export class PostgresSubscriber implements EntitySubscriberInterface {
228229
} catch (error) {
229230
console.error(
230231
`Error processing junction table change for ${junctionInfo.entity}:`,
231-
error
232+
error,
232233
);
233234
}
234235
}, 2_000);

platforms/pictique/src/lib/fragments/BottomNav/BottomNav.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
import { Camera, CommentsTwo, Home, Search } from '$lib/icons';
55
import { isNavigatingThroughNav, ownerId } from '$lib/store/store.svelte';
66
import { uploadedImages } from '$lib/store/store.svelte';
7-
import { getAuthId, revokeImageUrls } from '$lib/utils';
7+
import { revokeImageUrls } from '$lib/utils';
88
import type { HTMLAttributes } from 'svelte/elements';
99
10-
let ownerId: string | null = $state(null);
11-
12-
1310
interface IBottomNavProps extends HTMLAttributes<HTMLElement> {
1411
activeTab?: string;
1512
profileSrc: string;
@@ -47,7 +44,6 @@
4744
};
4845
4946
$effect(() => {
50-
ownerId = getAuthId()
5147
activeTab = _activeTab.split('/').pop() ?? '';
5248
if (
5349
images &&

platforms/pictique/src/routes/(protected)/settings/account/username/+page.svelte

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
let name = $state();
1010
let profileImageDataUrl = $state('');
1111
let files = $state<FileList | undefined>();
12+
let saved = $state(false);
1213
1314
function handleFileChange() {
1415
if (files && files[0]) {
@@ -32,7 +33,8 @@
3233
avatar: profileImageDataUrl,
3334
name
3435
});
35-
goto("/settings");
36+
saved = true;
37+
setTimeout(() => (saved = false), 3_000);
3638
} catch (err) {
3739
console.log(err instanceof Error ? err.message : 'please check the info again');
3840
}
@@ -47,11 +49,16 @@
4749
onMount(async () => {
4850
const { data } = await apiClient.get('/api/users');
4951
handle = data.handle;
50-
name = data.displayName;
52+
name = data.name;
5153
});
5254
</script>
5355

5456
<div class="flex flex-col gap-6">
57+
{#if saved}
58+
<div class=" w-full rounded-md bg-[#33cc33] px-10 py-2 text-center text-white">
59+
Changes Saved!
60+
</div>
61+
{/if}
5562
<div>
5663
<Label>Change your profile picture</Label>
5764
<InputFile

0 commit comments

Comments
 (0)