@agimon-ai/po-native 0.0.1-alpha.65 → 0.0.1-alpha.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-native",
3
- "version": "0.0.1-alpha.65",
3
+ "version": "0.0.1-alpha.67",
4
4
  "description": "Po for iOS and Android",
5
5
  "homepage": "https://agimon.ai",
6
6
  "bugs": {
@@ -29,17 +29,17 @@
29
29
  "access": "public"
30
30
  },
31
31
  "dependencies": {
32
- "@agimon-ai/po-core": "0.0.0-alpha.185",
33
- "@agimon-ai/po-expo-signing": "0.0.1-alpha.65",
34
- "@agimon-ai/po-identity": "0.0.2-alpha.132",
35
- "@agimon-ai/po-native-components": "0.0.0-alpha.185",
36
- "@agimon-ai/po-native-dashboard": "0.0.0-alpha.57",
37
- "@agimon-ai/po-template-advanced": "0.0.0-alpha.185",
38
- "@agimon-ai/po-template-elegant": "0.0.0-alpha.185",
39
- "@agimon-ai/po-voice": "0.0.0-alpha.185",
40
- "@agimon-ai/po-web-components": "0.0.0-alpha.185",
41
- "@agimon-ai/po-web-dashboard": "0.0.0-alpha.185",
42
- "@agimon-ai/po-web-security": "0.0.0-alpha.185",
32
+ "@agimon-ai/po-core": "0.0.0-alpha.187",
33
+ "@agimon-ai/po-expo-signing": "0.0.1-alpha.67",
34
+ "@agimon-ai/po-identity": "0.0.2-alpha.134",
35
+ "@agimon-ai/po-native-components": "0.0.0-alpha.187",
36
+ "@agimon-ai/po-native-dashboard": "0.0.0-alpha.59",
37
+ "@agimon-ai/po-template-advanced": "0.0.0-alpha.187",
38
+ "@agimon-ai/po-template-elegant": "0.0.0-alpha.187",
39
+ "@agimon-ai/po-voice": "0.0.0-alpha.187",
40
+ "@agimon-ai/po-web-components": "0.0.0-alpha.187",
41
+ "@agimon-ai/po-web-dashboard": "0.0.0-alpha.187",
42
+ "@agimon-ai/po-web-security": "0.0.0-alpha.187",
43
43
  "@better-auth/expo": "1.7.12",
44
44
  "@config-plugins/react-native-webrtc": "15.0.2",
45
45
  "@earendil-works/chord": "1.5.2",
@@ -96,12 +96,16 @@ type Send = (request: SealedHttpRequest, signal?: AbortSignal) => Promise<Respon
96
96
 
97
97
  // Po Cloud hosts are reached with the person's sign-in, not a paired sealed channel.
98
98
  const cloudApis = new Map<string, Send>();
99
+ const providerNetworkCache = new Map<string, { hostId: string; networkId: string }>();
99
100
 
100
101
  /** Names how a signed-in Po Cloud host is called. Returns the undo. */
101
102
  export function bindCloudApi(hostId: string, send: Send): () => void {
102
103
  cloudApis.set(hostId, send);
103
104
  return () => {
104
- if (cloudApis.get(hostId) === send) cloudApis.delete(hostId);
105
+ if (cloudApis.get(hostId) === send) {
106
+ cloudApis.delete(hostId);
107
+ providerNetworkCache.delete(hostId);
108
+ }
105
109
  };
106
110
  }
107
111
 
@@ -164,8 +168,12 @@ export function transportForHost(hostId: string): ApiTransport {
164
168
  if (!signedIn) throw new Error('Sign in to this host’s account before reading shared calendar events.');
165
169
  const { auth, record } = signedIn;
166
170
  if (!record) throw new Error('Approve this phone before reading shared calendar events.');
167
- const metadata = await request('/api/compositions');
168
- const network = metadata.ok ? parseProviderNetwork(await metadata.json()) : undefined;
171
+ let network = providerNetworkCache.get(hostId);
172
+ if (!network) {
173
+ const metadata = await request('/api/compositions');
174
+ network = metadata.ok ? parseProviderNetwork(await metadata.json()) : undefined;
175
+ if (network) providerNetworkCache.set(hostId, network);
176
+ }
169
177
  if (!network) throw new Error('This host has no network identity.');
170
178
  const token = await identityToken(auth, record, network.networkId);
171
179
  if (typeof init?.body !== 'string') throw new Error('A calendar request needs a JSON body.');