@volter/world-core 2.0.2 → 2.0.4

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.
@@ -506,6 +506,10 @@
506
506
  {
507
507
  "host": "cdn.bsky.app",
508
508
  "pathPattern": "^/img/"
509
+ },
510
+ {
511
+ "host": "bsky.app",
512
+ "pathPattern": "^/profile/[^/]+/?$|^/profile/[^/]+/post/[A-Za-z0-9._:~-]{1,512}/?$"
509
513
  }
510
514
  ],
511
515
  "archetype": "crud",
@@ -4274,6 +4278,38 @@
4274
4278
  {
4275
4279
  "host": "api.twitter.com",
4276
4280
  "pathPattern": "^(?:/2/media/upload/?|/2/media/upload/initialize/?|/2/media/upload/[0-9]+/(?:append|finalize)/?|/2/tweets/?|/2/tweets/[^/]+/?|/2/tweets/search/recent/?|/2/users/(?!me/?$)[^/]+/?|/2/users/by/username/[^/]+/?|/2/users/[^/]+/mentions/?|/2/users/[^/]+/tweets/?|/2/users/[^/]+/timelines/reverse_chronological/?)$|^/_twin/(?!assets/consent\\.(?:js|css)$)"
4281
+ },
4282
+ {
4283
+ "host": "x.com",
4284
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4285
+ },
4286
+ {
4287
+ "host": "twitter.com",
4288
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4289
+ },
4290
+ {
4291
+ "host": "www.x.com",
4292
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4293
+ },
4294
+ {
4295
+ "host": "www.twitter.com",
4296
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4297
+ },
4298
+ {
4299
+ "host": "mobile.twitter.com",
4300
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4301
+ },
4302
+ {
4303
+ "host": "mobile.x.com",
4304
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4305
+ },
4306
+ {
4307
+ "host": "pbs.twimg.com",
4308
+ "pathPattern": "^/media/[0-9a-f]{64}\\.(?:jpg|png|gif|webp)$|^/ext_tw_video_thumb/[0-9]{1,19}/pu/img/[0-9a-f]{64}\\.svg$"
4309
+ },
4310
+ {
4311
+ "host": "video.twimg.com",
4312
+ "pathPattern": "^/ext_tw_video/[0-9]{1,19}/pu/vid/avc1/[0-9]+x[0-9]+/[0-9a-f]{64}\\.mp4$"
4277
4313
  }
4278
4314
  ],
4279
4315
  "archetype": "crud",
@@ -614,7 +614,10 @@ async function contextFor(m, call, scope) {
614
614
  // a handler reading the body itself sees the adopted id too (the boundary's one resolution, below)
615
615
  if (body && typeof body === 'object' && !Array.isArray(body))
616
616
  body = adoptedInCall(m.service, body, root);
617
- const params = await boundaryParams(m, call, root);
617
+ // every read of the body is of a copy, so the handler's own `call.request` and the core's answer (`core()`) each
618
+ // still find it unread, whichever of them reads it first
619
+ const pristine = call.request.clone();
620
+ const params = await boundaryParams(m, { ...call, request: call.request.clone() }, root);
618
621
  const paths = expandPaths(m, params);
619
622
  return {
620
623
  call,
@@ -677,7 +680,7 @@ async function contextFor(m, call, scope) {
677
680
  sse: (events) => sse(m, events, call.operation.id),
678
681
  expand: (resource, body) => (paths.length ? expand(m, resource, body, paths, root) : body),
679
682
  at: (when) => contextFor(m, { ...call, request: new Request(call.request.url) }, { ...scope, clock: () => when }),
680
- core: async () => { const out = await serveCore(m, call, { ...scope, clock: () => at }); return 'served' in out ? out.served : undefined; },
683
+ core: async () => { const out = await serveCore(m, { ...call, request: pristine.clone() }, { ...scope, clock: () => at }); return 'served' in out ? out.served : undefined; },
681
684
  own: (row) => ownFields(row),
682
685
  };
683
686
  }
@@ -77,13 +77,14 @@ const isGoogleOAuthTokenPath = (p) =>
77
77
  // operation must fail LOCALLY, not succeed remotely.
78
78
 
79
79
  /**
80
- * The www.googleapis.com paths it serves: the v1 (PEM) and v3 (JWK) cert endpoints, and the v3
81
- * userinfo alias. NOT `/oauth2/v2/*` — Google publishes no v2 certs endpoint at all, and the v2
82
- * userinfo alias returns a DIFFERENT field set the pack does not model
83
- * (`googleoauth.endpoints.userinfo_v2`, todo), so its handler refuses it.
80
+ * The www.googleapis.com paths it serves: the v1 (PEM) and v3 (JWK) cert endpoints, the v3
81
+ * userinfo alias, and the OAuth2 API v2's userinfo (`/oauth2/v2/userinfo` and its `/userinfo/v2/me`
82
+ * alias, a different field set: `googleoauth.endpoints.userinfo_v2`), which `@googleapis/oauth2`
83
+ * calls (Cal.com's Google Calendar callback). NOT `/oauth2/v2/certs`: Google publishes no v2 certs
84
+ * endpoint at all.
84
85
  */
85
86
  const isGoogleOAuthApisPath = (p) =>
86
- typeof p === 'string' && /^\/oauth2\/(v1\/certs|v3\/(certs|userinfo))\/?$/.test(p);
87
+ typeof p === 'string' && /^\/(oauth2\/(v1\/certs|v3\/(certs|userinfo)|v2\/userinfo)|userinfo\/v2\/me)\/?$/.test(p);
87
88
 
88
89
  // vendor → predicate(hostname, pathname?). A vendor is only active if its twin URL is set.
89
90
  // THE HAND TABLE'S ONLY RESIDENTS: keys served by KERNEL packages (browser-assets serves
@@ -506,6 +506,10 @@
506
506
  {
507
507
  "host": "cdn.bsky.app",
508
508
  "pathPattern": "^/img/"
509
+ },
510
+ {
511
+ "host": "bsky.app",
512
+ "pathPattern": "^/profile/[^/]+/?$|^/profile/[^/]+/post/[A-Za-z0-9._:~-]{1,512}/?$"
509
513
  }
510
514
  ],
511
515
  "archetype": "crud",
@@ -4274,6 +4278,38 @@
4274
4278
  {
4275
4279
  "host": "api.twitter.com",
4276
4280
  "pathPattern": "^(?:/2/media/upload/?|/2/media/upload/initialize/?|/2/media/upload/[0-9]+/(?:append|finalize)/?|/2/tweets/?|/2/tweets/[^/]+/?|/2/tweets/search/recent/?|/2/users/(?!me/?$)[^/]+/?|/2/users/by/username/[^/]+/?|/2/users/[^/]+/mentions/?|/2/users/[^/]+/tweets/?|/2/users/[^/]+/timelines/reverse_chronological/?)$|^/_twin/(?!assets/consent\\.(?:js|css)$)"
4281
+ },
4282
+ {
4283
+ "host": "x.com",
4284
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4285
+ },
4286
+ {
4287
+ "host": "twitter.com",
4288
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4289
+ },
4290
+ {
4291
+ "host": "www.x.com",
4292
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4293
+ },
4294
+ {
4295
+ "host": "www.twitter.com",
4296
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4297
+ },
4298
+ {
4299
+ "host": "mobile.twitter.com",
4300
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4301
+ },
4302
+ {
4303
+ "host": "mobile.x.com",
4304
+ "pathPattern": "^/(?!_twin/)[A-Za-z0-9_]{1,15}/status/[0-9]{1,19}/?$|^/(?!(?:i|en|home|explore|notifications|messages|settings|search|compose|login|logout|signup|tos|privacy|about|account|intent|share|hashtag|lists|bookmarks|jobs|download|grok|premium|communities|creators|twin|_twin)/?$)[A-Za-z0-9_]{1,15}/?$"
4305
+ },
4306
+ {
4307
+ "host": "pbs.twimg.com",
4308
+ "pathPattern": "^/media/[0-9a-f]{64}\\.(?:jpg|png|gif|webp)$|^/ext_tw_video_thumb/[0-9]{1,19}/pu/img/[0-9a-f]{64}\\.svg$"
4309
+ },
4310
+ {
4311
+ "host": "video.twimg.com",
4312
+ "pathPattern": "^/ext_tw_video/[0-9]{1,19}/pu/vid/avc1/[0-9]+x[0-9]+/[0-9a-f]{64}\\.mp4$"
4277
4313
  }
4278
4314
  ],
4279
4315
  "archetype": "crud",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/world-core",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "The kernel of Volter World: one log per twin, branches as pointers, checkpoints, the fold that keeps a twin current, the head that performs a write against the vendor, references, and the git plane. A twin package builds on it; the runtime serves it.",
5
5
  "keywords": [
6
6
  "twin",
@@ -851,7 +851,10 @@ async function contextFor(m: DerivedManifest, call: DerivedCall, scope: CoreScop
851
851
  try { body = text ? JSON.parse(text) : undefined; } catch { body = text; }
852
852
  // a handler reading the body itself sees the adopted id too (the boundary's one resolution, below)
853
853
  if (body && typeof body === 'object' && !Array.isArray(body)) body = adoptedInCall(m.service, body as Record<string, unknown>, root);
854
- const params = await boundaryParams(m, call, root);
854
+ // every read of the body is of a copy, so the handler's own `call.request` and the core's answer (`core()`) each
855
+ // still find it unread, whichever of them reads it first
856
+ const pristine = call.request.clone();
857
+ const params = await boundaryParams(m, { ...call, request: call.request.clone() }, root);
855
858
  const paths = expandPaths(m, params);
856
859
  return {
857
860
  call,
@@ -913,7 +916,7 @@ async function contextFor(m: DerivedManifest, call: DerivedCall, scope: CoreScop
913
916
  sse: (events) => sse(m, events, call.operation.id),
914
917
  expand: (resource, body) => (paths.length ? expand(m, resource, body, paths, root) : body),
915
918
  at: (when) => contextFor(m, { ...call, request: new Request(call.request.url) }, { ...scope, clock: () => when }),
916
- core: async () => { const out = await serveCore(m, call, { ...scope, clock: () => at }); return 'served' in out ? out.served : undefined; },
919
+ core: async () => { const out = await serveCore(m, { ...call, request: pristine.clone() }, { ...scope, clock: () => at }); return 'served' in out ? out.served : undefined; },
917
920
  own: (row) => ownFields(row as unknown as TwinResource),
918
921
  };
919
922
  }
package/vendor-hosts.cjs CHANGED
@@ -77,13 +77,14 @@ const isGoogleOAuthTokenPath = (p) =>
77
77
  // operation must fail LOCALLY, not succeed remotely.
78
78
 
79
79
  /**
80
- * The www.googleapis.com paths it serves: the v1 (PEM) and v3 (JWK) cert endpoints, and the v3
81
- * userinfo alias. NOT `/oauth2/v2/*` — Google publishes no v2 certs endpoint at all, and the v2
82
- * userinfo alias returns a DIFFERENT field set the pack does not model
83
- * (`googleoauth.endpoints.userinfo_v2`, todo), so its handler refuses it.
80
+ * The www.googleapis.com paths it serves: the v1 (PEM) and v3 (JWK) cert endpoints, the v3
81
+ * userinfo alias, and the OAuth2 API v2's userinfo (`/oauth2/v2/userinfo` and its `/userinfo/v2/me`
82
+ * alias, a different field set: `googleoauth.endpoints.userinfo_v2`), which `@googleapis/oauth2`
83
+ * calls (Cal.com's Google Calendar callback). NOT `/oauth2/v2/certs`: Google publishes no v2 certs
84
+ * endpoint at all.
84
85
  */
85
86
  const isGoogleOAuthApisPath = (p) =>
86
- typeof p === 'string' && /^\/oauth2\/(v1\/certs|v3\/(certs|userinfo))\/?$/.test(p);
87
+ typeof p === 'string' && /^\/(oauth2\/(v1\/certs|v3\/(certs|userinfo)|v2\/userinfo)|userinfo\/v2\/me)\/?$/.test(p);
87
88
 
88
89
  // vendor → predicate(hostname, pathname?). A vendor is only active if its twin URL is set.
89
90
  // THE HAND TABLE'S ONLY RESIDENTS: keys served by KERNEL packages (browser-assets serves