@chrischall/mcp-utils 0.23.0 → 0.23.1
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/README.md +3 -1
- package/dist/response/media.d.ts.map +1 -1
- package/dist/response/media.js +23 -2
- package/dist/response/media.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,7 +145,9 @@ from one, and a value that silently aliases to another is a lie in the schema.
|
|
|
145
145
|
`stripMediaUrls(payload)` is the highest-value projection that needs no
|
|
146
146
|
knowledge of the API: it drops `avatar` / `picture` / `cover_photo` /
|
|
147
147
|
`thumbnail` keys — including the `…Link` / `…Uri` / `…Url` suffixed forms every
|
|
148
|
-
Google Workspace API uses (`thumbnailLink`, `iconUri`, `photoUrl`)
|
|
148
|
+
Google Workspace API uses (`thumbnailLink`, `iconUri`, `photoUrl`), and the
|
|
149
|
+
snake_case and kebab-case forms most other APIs use (`image_url`,
|
|
150
|
+
`primary_photo_url`, `avatar_image_url`) — and bare
|
|
149
151
|
image URLs. The suffix is load-bearing outside consumer-social APIs: without it
|
|
150
152
|
the rule matched none of Google's media fields, and `thumbnailLink` alone is 32%
|
|
151
153
|
of a `gog drive ls` listing. Its key rule stays anchored at the START, so a key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/response/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/response/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAiFH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,GAAE,iBAAsB,GAAG,CAAC,CAmB3E"}
|
package/dist/response/media.js
CHANGED
|
@@ -62,8 +62,29 @@
|
|
|
62
62
|
* node_modules. An earlier draft said 33 across the two and named `avatarUrls`
|
|
63
63
|
* as a third form; neither reproduced.)
|
|
64
64
|
*/
|
|
65
|
-
const MEDIA_NOUN = '(?:avatar|
|
|
66
|
-
|
|
65
|
+
const MEDIA_NOUN = '(?:avatar|picture|photo|thumbnail|thumb|image|icon|banner|profile_pic(?:ture)?|logo)';
|
|
66
|
+
/**
|
|
67
|
+
* A bounded set of qualifiers that may precede the noun in a snake_case or
|
|
68
|
+
* kebab-case key: `primary_photo_url`, `profile_image_url`, `hero-banner`.
|
|
69
|
+
*
|
|
70
|
+
* CLOSED on purpose, never `\w+`. That is the whole difference between this
|
|
71
|
+
* and the two clauses removed in #191 — a bare `\bavatar\b` and an
|
|
72
|
+
* `/avatars?/` path segment — which were open-ended, stripped genuine page
|
|
73
|
+
* URLs, and (measured) removed zero bytes. A media noun is also allowed here,
|
|
74
|
+
* for `avatar_image_url`.
|
|
75
|
+
*
|
|
76
|
+
* `cover` and `tall` live here rather than as `cover_photo` / `cover_image` /
|
|
77
|
+
* `tall_avatar` entries in MEDIA_NOUN. Those three were redundant once this
|
|
78
|
+
* list existed — `cover` + `photo` already composes — and keeping both spellings
|
|
79
|
+
* meant the snake_case form matched while the camelCase one silently did not.
|
|
80
|
+
*
|
|
81
|
+
* The separator is OPTIONAL for the same reason. With `[_-]` required,
|
|
82
|
+
* `cover_photo` was stripped and `coverPhoto` was kept: the same field, the
|
|
83
|
+
* same meaning, a different answer decided by an API's casing convention. That
|
|
84
|
+
* asymmetry is the exact shape of the bug #197 was about, one level up.
|
|
85
|
+
*/
|
|
86
|
+
const MEDIA_QUALIFIER = '(?:primary|secondary|main|default|cover|hero|profile|master|rendered|small|medium|large|full|original|tall)';
|
|
87
|
+
const MEDIA_KEY = new RegExp(`^(?:(?:${MEDIA_QUALIFIER}|${MEDIA_NOUN})[_-]?)?${MEDIA_NOUN}s?(?:[_-]?(?:link|uri|url|src)s?)?$`, 'i');
|
|
67
88
|
/**
|
|
68
89
|
* A URL that points at an image rather than at a page: a known image extension
|
|
69
90
|
* ending the PATH.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/response/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/response/media.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,GAAG,sFAAsF,CAAC;AAE1G;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,eAAe,GACnB,6GAA6G,CAAC;AAEhH,MAAM,SAAS,GAAG,IAAI,MAAM,CAC1B,UAAU,eAAe,IAAI,UAAU,WAAW,UAAU,qCAAqC,EACjG,GAAG,CACJ,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,SAAS,GAAG,qEAAqE,CAAC;AA0BxF;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAI,KAAQ,EAAE,OAA0B,EAAE;IACtE,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACpE,+DAA+D;IAC/D,EAAE;IACF,8EAA8E;IAC9E,+EAA+E;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AK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,6EAA6E;IAC7E,6EAA6E;IAC7E,sCAAsC;IACtC,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC7G,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;QACxE,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAChC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACb,SAAS;QACX,CAAC;QACD,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;YAAE,SAAS;QACzD,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,SAAS;QACzD,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrischall/mcp-utils",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"description": "Shared scaffolding for the chrischall MCP fleet — server bootstrap, tool-result formatting, helpful errors, hardened env/config, a bearer API-client kit, zod atoms, session registries, a fetchproxy transport adapter, auth resolver skeletons, an in-memory test harness, and opt-in HTML helpers. The generic MCP glue hoisted out of ~19 sibling servers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|