@volter/supercode-teams 0.2.109 → 0.2.111
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/connector/index.mjs +1 -1
- package/package.json +1 -1
- package/worker/index.mjs +3 -1
package/connector/index.mjs
CHANGED
|
@@ -141,7 +141,7 @@ export class TeamsConnector {
|
|
|
141
141
|
// large first sync slows down instead of failing its pass and restarting the connector.
|
|
142
142
|
if(response.status!==429||attempt>=5)break;// The server names the wait in error.details (wire.mjs validationFailure); a Retry-After header is the fallback.
|
|
143
143
|
const limited=await response.json().catch(()=>null),named=limited?.error?.details?.retry_after_seconds??limited?.error?.retry_after_seconds??response.headers?.get?.('retry-after'),asked=named==null||named===''?NaN:Number(named),seconds=Number.isFinite(asked)?Math.min(60,Math.max(0,asked)):1;
|
|
144
|
-
await new Promise((resolve,reject)=>{const stop=()=>{clearTimeout(timer);reject(this.abort.signal.reason);},timer=setTimeout(()=>{this.abort.signal.removeEventListener('abort',stop);resolve();},seconds*1000);this.abort.signal.addEventListener('abort',stop,{once:true});});}if(response.type==='opaqueredirect'||response.status>=300&&response.status<400)throw Object.assign(new Error('cross-origin redirects are refused'),{code:'invalid_request',status:400});const value=await response.json();if(!response.ok)throw Object.assign(new Error(value.error?.message??`HTTP ${response.status}`),value.error,{status:response.status});return value.data;}
|
|
144
|
+
await new Promise((resolve,reject)=>{const stop=()=>{clearTimeout(timer);reject(this.abort.signal.reason);},timer=setTimeout(()=>{this.abort.signal.removeEventListener('abort',stop);resolve();},seconds*1000);this.abort.signal.addEventListener('abort',stop,{once:true});});}if(response.type==='opaqueredirect'||response.status>=300&&response.status<400)throw Object.assign(new Error('cross-origin redirects are refused'),{code:'invalid_request',status:400});const value=await response.json().catch(()=>{throw Object.assign(new Error(`Teams ${method} ${path} returned HTTP ${response.status} (${response.headers.get('content-type') ?? 'unknown content type'}), expected JSON`),{code:'invalid_response',status:response.status});});if(!response.ok)throw Object.assign(new Error(value.error?.message??`HTTP ${response.status}`),value.error,{status:response.status});return value.data;}
|
|
145
145
|
async configuration(){const value=await this.request('GET',`/machines/${this.machineId}/configuration`);this.configurationValue=value;this.pruneStamps(value);return value;}
|
|
146
146
|
// A capture stamp belongs to one rule; once that rule is no longer active its stamps are dropped.
|
|
147
147
|
pruneStamps(configuration){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.111",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
|
|
6
6
|
"license": "MIT",
|
package/worker/index.mjs
CHANGED
|
@@ -90,6 +90,8 @@ export class TeamsServer extends DurableObject {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
this.handler = createHttpHandler(this.api);
|
|
93
|
+
// Retention must also run after a restart: a full object may have failed to re-arm its alarm.
|
|
94
|
+
if (this.api.serverId) await maintain(this.api).catch(error => console.error(`maintain startup: ${error.message}`));
|
|
93
95
|
if (!(await ctx.storage.getAlarm())) await ctx.storage.setAlarm(Date.now() + MAINTAIN_MS);
|
|
94
96
|
});
|
|
95
97
|
}
|
|
@@ -118,7 +120,7 @@ export class TeamsServer extends DurableObject {
|
|
|
118
120
|
|
|
119
121
|
async alarm() {
|
|
120
122
|
await this.ready;
|
|
121
|
-
const done = this.api.serverId ? await maintain(this.api).catch(()
|
|
123
|
+
const done = this.api.serverId ? await maintain(this.api).catch(error => { console.error(`maintain failed: ${error.message}`); return null; }) : null;
|
|
122
124
|
// The database's size on every full pass, where `wrangler tail` reads it.
|
|
123
125
|
if (!done?.backlog) {
|
|
124
126
|
// What grows: free pages (space deletes left for reuse), and each busy table's newest rowid (its insert rate).
|