@layervai/qurl-mcp 0.4.0 → 0.5.0

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.
Files changed (173) hide show
  1. package/README.md +742 -46
  2. package/assets/fonts/NotoSansSC-Regular.ttf +0 -0
  3. package/assets/fonts/OFL.txt +93 -0
  4. package/assets/fonts/README.md +18 -0
  5. package/dist/auth/request-context.d.ts +13 -0
  6. package/dist/auth/request-context.d.ts.map +1 -0
  7. package/dist/auth/request-context.js +21 -0
  8. package/dist/auth/request-context.js.map +1 -0
  9. package/dist/auth/static-bearer.d.ts +12 -0
  10. package/dist/auth/static-bearer.d.ts.map +1 -0
  11. package/dist/auth/static-bearer.js +47 -0
  12. package/dist/auth/static-bearer.js.map +1 -0
  13. package/dist/client.d.ts +112 -23
  14. package/dist/client.d.ts.map +1 -1
  15. package/dist/client.js +173 -78
  16. package/dist/client.js.map +1 -1
  17. package/dist/config.d.ts +98 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +543 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/credential-rate-limit-store.d.ts +38 -0
  22. package/dist/credential-rate-limit-store.d.ts.map +1 -0
  23. package/dist/credential-rate-limit-store.js +135 -0
  24. package/dist/credential-rate-limit-store.js.map +1 -0
  25. package/dist/email-addresses.d.ts +7 -0
  26. package/dist/email-addresses.d.ts.map +1 -0
  27. package/dist/email-addresses.js +36 -0
  28. package/dist/email-addresses.js.map +1 -0
  29. package/dist/email-types.d.ts +33 -0
  30. package/dist/email-types.d.ts.map +1 -0
  31. package/dist/email-types.js +28 -0
  32. package/dist/email-types.js.map +1 -0
  33. package/dist/emf-metrics.d.ts +25 -0
  34. package/dist/emf-metrics.d.ts.map +1 -0
  35. package/dist/emf-metrics.js +87 -0
  36. package/dist/emf-metrics.js.map +1 -0
  37. package/dist/http-config.d.ts +38 -0
  38. package/dist/http-config.d.ts.map +1 -0
  39. package/dist/http-config.js +243 -0
  40. package/dist/http-config.js.map +1 -0
  41. package/dist/http-routes.d.ts +5 -0
  42. package/dist/http-routes.d.ts.map +1 -0
  43. package/dist/http-routes.js +12 -0
  44. package/dist/http-routes.js.map +1 -0
  45. package/dist/http.d.ts +33 -0
  46. package/dist/http.d.ts.map +1 -0
  47. package/dist/http.js +1116 -0
  48. package/dist/http.js.map +1 -0
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.d.ts.map +1 -1
  51. package/dist/index.js +42 -25
  52. package/dist/index.js.map +1 -1
  53. package/dist/logging.d.ts +7 -0
  54. package/dist/logging.d.ts.map +1 -0
  55. package/dist/logging.js +110 -0
  56. package/dist/logging.js.map +1 -0
  57. package/dist/prompts/secure-a-service.d.ts +16 -4
  58. package/dist/prompts/secure-a-service.d.ts.map +1 -1
  59. package/dist/prompts/secure-a-service.js +7 -15
  60. package/dist/prompts/secure-a-service.js.map +1 -1
  61. package/dist/server.d.ts +18 -6
  62. package/dist/server.d.ts.map +1 -1
  63. package/dist/server.js +41 -8
  64. package/dist/server.js.map +1 -1
  65. package/dist/services/email.d.ts +17 -0
  66. package/dist/services/email.d.ts.map +1 -0
  67. package/dist/services/email.js +351 -0
  68. package/dist/services/email.js.map +1 -0
  69. package/dist/services/html.d.ts +5 -0
  70. package/dist/services/html.d.ts.map +1 -0
  71. package/dist/services/html.js +28 -0
  72. package/dist/services/html.js.map +1 -0
  73. package/dist/services/legal-pages.d.ts +12 -0
  74. package/dist/services/legal-pages.d.ts.map +1 -0
  75. package/dist/services/legal-pages.js +588 -0
  76. package/dist/services/legal-pages.js.map +1 -0
  77. package/dist/services/text-pdf.d.ts +16 -0
  78. package/dist/services/text-pdf.d.ts.map +1 -0
  79. package/dist/services/text-pdf.js +141 -0
  80. package/dist/services/text-pdf.js.map +1 -0
  81. package/dist/services/video-page.d.ts +4 -0
  82. package/dist/services/video-page.d.ts.map +1 -0
  83. package/dist/services/video-page.js +311 -0
  84. package/dist/services/video-page.js.map +1 -0
  85. package/dist/text.d.ts +4 -0
  86. package/dist/text.d.ts.map +1 -0
  87. package/dist/text.js +16 -0
  88. package/dist/text.js.map +1 -0
  89. package/dist/tools/_shared.d.ts +13 -3
  90. package/dist/tools/_shared.d.ts.map +1 -1
  91. package/dist/tools/_shared.js +31 -7
  92. package/dist/tools/_shared.js.map +1 -1
  93. package/dist/tools/batch-create.d.ts +36 -343
  94. package/dist/tools/batch-create.d.ts.map +1 -1
  95. package/dist/tools/batch-create.js +7 -4
  96. package/dist/tools/batch-create.js.map +1 -1
  97. package/dist/tools/create-qurl.d.ts +79 -237
  98. package/dist/tools/create-qurl.d.ts.map +1 -1
  99. package/dist/tools/create-qurl.js +77 -47
  100. package/dist/tools/create-qurl.js.map +1 -1
  101. package/dist/tools/delete-qurl.d.ts +5 -22
  102. package/dist/tools/delete-qurl.d.ts.map +1 -1
  103. package/dist/tools/delete-qurl.js +19 -13
  104. package/dist/tools/delete-qurl.js.map +1 -1
  105. package/dist/tools/email-delivery.d.ts +37 -0
  106. package/dist/tools/email-delivery.d.ts.map +1 -0
  107. package/dist/tools/email-delivery.js +115 -0
  108. package/dist/tools/email-delivery.js.map +1 -0
  109. package/dist/tools/extend-qurl.d.ts +36 -189
  110. package/dist/tools/extend-qurl.d.ts.map +1 -1
  111. package/dist/tools/extend-qurl.js +3 -3
  112. package/dist/tools/extend-qurl.js.map +1 -1
  113. package/dist/tools/get-qurl.d.ts +36 -185
  114. package/dist/tools/get-qurl.d.ts.map +1 -1
  115. package/dist/tools/get-qurl.js +8 -5
  116. package/dist/tools/get-qurl.js.map +1 -1
  117. package/dist/tools/list-qurl-sessions.d.ts +45 -0
  118. package/dist/tools/list-qurl-sessions.d.ts.map +1 -0
  119. package/dist/tools/list-qurl-sessions.js +33 -0
  120. package/dist/tools/list-qurl-sessions.js.map +1 -0
  121. package/dist/tools/list-qurls.d.ts +38 -319
  122. package/dist/tools/list-qurls.d.ts.map +1 -1
  123. package/dist/tools/list-qurls.js +45 -20
  124. package/dist/tools/list-qurls.js.map +1 -1
  125. package/dist/tools/mint-link.d.ts +72 -303
  126. package/dist/tools/mint-link.d.ts.map +1 -1
  127. package/dist/tools/mint-link.js +35 -21
  128. package/dist/tools/mint-link.js.map +1 -1
  129. package/dist/tools/output-schemas.d.ts +326 -1112
  130. package/dist/tools/output-schemas.d.ts.map +1 -1
  131. package/dist/tools/output-schemas.js +141 -40
  132. package/dist/tools/output-schemas.js.map +1 -1
  133. package/dist/tools/resolve-qurl.d.ts +6 -37
  134. package/dist/tools/resolve-qurl.d.ts.map +1 -1
  135. package/dist/tools/resolve-qurl.js +5 -5
  136. package/dist/tools/resolve-qurl.js.map +1 -1
  137. package/dist/tools/revoke-qurl-token.d.ts +41 -0
  138. package/dist/tools/revoke-qurl-token.d.ts.map +1 -0
  139. package/dist/tools/revoke-qurl-token.js +40 -0
  140. package/dist/tools/revoke-qurl-token.js.map +1 -0
  141. package/dist/tools/terminate-qurl-sessions.d.ts +41 -0
  142. package/dist/tools/terminate-qurl-sessions.d.ts.map +1 -0
  143. package/dist/tools/terminate-qurl-sessions.js +68 -0
  144. package/dist/tools/terminate-qurl-sessions.js.map +1 -0
  145. package/dist/tools/update-qurl-token.d.ts +142 -0
  146. package/dist/tools/update-qurl-token.d.ts.map +1 -0
  147. package/dist/tools/update-qurl-token.js +75 -0
  148. package/dist/tools/update-qurl-token.js.map +1 -0
  149. package/dist/tools/update-qurl.d.ts +43 -264
  150. package/dist/tools/update-qurl.d.ts.map +1 -1
  151. package/dist/tools/update-qurl.js +57 -8
  152. package/dist/tools/update-qurl.js.map +1 -1
  153. package/dist/tools/upload-file-data-qurl.d.ts +182 -0
  154. package/dist/tools/upload-file-data-qurl.d.ts.map +1 -0
  155. package/dist/tools/upload-file-data-qurl.js +200 -0
  156. package/dist/tools/upload-file-data-qurl.js.map +1 -0
  157. package/dist/tools/upload-file-qurl.d.ts +162 -0
  158. package/dist/tools/upload-file-qurl.d.ts.map +1 -0
  159. package/dist/tools/upload-file-qurl.js +167 -0
  160. package/dist/tools/upload-file-qurl.js.map +1 -0
  161. package/dist/tools/upload-file-shared.d.ts +36 -0
  162. package/dist/tools/upload-file-shared.d.ts.map +1 -0
  163. package/dist/tools/upload-file-shared.js +347 -0
  164. package/dist/tools/upload-file-shared.js.map +1 -0
  165. package/dist/tools/upload-mint-options.d.ts +22 -0
  166. package/dist/tools/upload-mint-options.d.ts.map +1 -0
  167. package/dist/tools/upload-mint-options.js +29 -0
  168. package/dist/tools/upload-mint-options.js.map +1 -0
  169. package/dist/tools/upload-text-qurl.d.ts +144 -0
  170. package/dist/tools/upload-text-qurl.d.ts.map +1 -0
  171. package/dist/tools/upload-text-qurl.js +102 -0
  172. package/dist/tools/upload-text-qurl.js.map +1 -0
  173. package/package.json +27 -8
package/dist/client.js CHANGED
@@ -1,6 +1,15 @@
1
1
  /**
2
2
  * qURL API client for the MCP server.
3
+ *
4
+ * The exported `QURLClient` is a thin adapter over the published
5
+ * `@layervai/qurl` SDK: the SDK owns all HTTP, retry, and error-parsing
6
+ * behavior, and this file translates between the SDK's surface and the local
7
+ * domain types/`IQURLClient` contract the tools, resources, and output schemas
8
+ * are written against (`{ data }` wrapping, the `qurls` field name, and the
9
+ * `QURLAPIError` error class).
3
10
  */
11
+ import { QURLClient as SDKQURLClient, QURLError } from "@layervai/qurl";
12
+ import { markRequestCredentialValidated } from "./auth/request-context.js";
4
13
  // --- Error class ---
5
14
  /**
6
15
  * Error thrown by `QURLClient` for any API or pre-flight failure.
@@ -16,28 +25,86 @@ export class QURLAPIError extends Error {
16
25
  type;
17
26
  instance;
18
27
  requestId;
19
- constructor(statusCode, code, message, type, instance, requestId) {
28
+ tombstone;
29
+ constructor(statusCode, code, message, type, instance, requestId, tombstone) {
20
30
  super(message);
21
31
  this.statusCode = statusCode;
22
32
  this.code = code;
23
33
  this.type = type;
24
34
  this.instance = instance;
25
35
  this.requestId = requestId;
36
+ this.tombstone = tombstone;
26
37
  this.name = "QURLAPIError";
27
38
  }
28
39
  }
29
40
  /**
30
41
  * Shared message for the missing-API-key condition. Emitted both at boot
31
- * (stderr warning in `index.ts`) and on every API call from `request()`.
42
+ * (stderr warning in `index.ts`) and on every API call (the lazy `sdk` getter
43
+ * throws it when no key is configured).
32
44
  * Keeping a single string means a user grepping logs/transcripts hits the
33
45
  * same phrase from both sites, and the CI introspection probe has a stable
34
46
  * substring to assert against.
35
47
  */
36
- export const MISSING_API_KEY_MESSAGE = "QURL_API_KEY is not set. Set it in the MCP server environment and restart to make API calls.";
48
+ export const MISSING_API_KEY_MESSAGE = "QURL_API_KEY is not set. Set it in the MCP server environment or runtime config and restart to make API calls.";
49
+ // --- SDK adapter helpers ---
50
+ /**
51
+ * Translate an error thrown by the SDK into the `QURLAPIError` the MCP tools
52
+ * branch on. Two consumers depend on the exact fields: `delete-qurl` checks
53
+ * `statusCode === 404`, and `withMissingApiKeyHandler` checks
54
+ * `code === "missing_api_key"`. A `QURLAPIError` we raised ourselves (the
55
+ * missing-key pre-flight) passes through untouched; anything that isn't a
56
+ * `QURLError` is returned as-is.
57
+ */
58
+ function translateError(err) {
59
+ if (err instanceof QURLAPIError)
60
+ return err;
61
+ if (err instanceof QURLError) {
62
+ return new QURLAPIError(err.status, err.code,
63
+ // `QURLError.detail` is non-optional and always populated (the SDK falls
64
+ // back to `title` when the API omits detail), so it carries the same
65
+ // human-readable text the old client's detail/title/message chain did.
66
+ err.detail, err.type, err.instance, err.requestId,
67
+ // 410 tombstone metadata: the SDK's QURLError does not currently surface
68
+ // it, so this is always undefined. Kept for forward-compat and because
69
+ // QURLAPIError carries the field; no MCP tool reads it today.
70
+ err.tombstone);
71
+ }
72
+ return err;
73
+ }
74
+ /**
75
+ * Map an SDK resource read (`QURL`/`Resource`) onto the MCP's `QURL` shape.
76
+ * The only structural difference is the field name for the nested tokens:
77
+ * the SDK exposes `access_tokens`, the MCP's output schemas validate `qurls`.
78
+ * When the SDK omits `access_tokens`, the key is dropped entirely rather than
79
+ * surfaced as `qurls: undefined`.
80
+ */
81
+ function mapResource(raw) {
82
+ const { access_tokens, ...rest } = raw;
83
+ // Drop the key for both `undefined` and a defensive `null`.
84
+ const mapped = access_tokens === undefined || access_tokens === null
85
+ ? rest
86
+ : { ...rest, qurls: access_tokens };
87
+ return mapped;
88
+ }
37
89
  // --- Client implementation ---
90
+ /**
91
+ * Adapter implementing {@link IQURLClient} over the `@layervai/qurl` SDK.
92
+ *
93
+ * The SDK owns HTTP, retries, and error parsing. This class only translates
94
+ * shapes (re-wraps the SDK's unwrapped returns into `{ data }`, renames
95
+ * `access_tokens` → `qurls`, reshapes list/batch/session envelopes) and maps
96
+ * the SDK's `QURLError` subclasses onto `QURLAPIError`.
97
+ */
38
98
  export class QURLClient {
39
99
  apiKey;
40
100
  baseURL;
101
+ /**
102
+ * Constructed lazily on first API call. The SDK constructor throws on an
103
+ * empty key, but `index.ts` deliberately boots the server keyless so MCP
104
+ * introspection (tools/list, resources/list, prompts/list) works without a
105
+ * configured key — the missing-key error must defer to the first real call.
106
+ */
107
+ _sdk;
41
108
  constructor(config) {
42
109
  // `?? ""` defends against JS callers that hand in `undefined` (the TS
43
110
  // type forbids it, but `JSON.parse`'d configs and other dynamic call
@@ -45,112 +112,140 @@ export class QURLClient {
45
112
  // stray `QURL_API_KEY=" "`) takes the typed `missing_api_key` path
46
113
  // instead of being sent over the wire as a server-side 401.
47
114
  this.apiKey = (config.apiKey ?? "").trim();
48
- this.baseURL = config.baseURL.replace(/\/$/, "");
115
+ // `?? ""` mirrors the apiKey guard above: a JS caller passing `undefined`
116
+ // for baseURL (the TS type forbids it; index.ts always supplies a default)
117
+ // gets the default-empty path rather than a raw TypeError from `.replace`.
118
+ this.baseURL = (config.baseURL ?? "").replace(/\/$/, "");
49
119
  }
50
120
  /**
51
- * Issue an HTTP request and parse the JSON response.
52
- *
53
- * `passthroughStatuses` lets a caller opt certain non-2xx codes out of the
54
- * default throw-on-error path and receive the parsed body instead. This is
55
- * used by `batchCreate`, where the API returns a structured BatchCreateResponse
56
- * on HTTP 400 (all items rejected) — throwing would drop the per-item errors.
121
+ * Lazily build the SDK client. Throws the typed `missing_api_key` error
122
+ * (status 0) when no key is configured, matching the pre-SDK behavior that
123
+ * `withMissingApiKeyHandler` and the CI introspection probe rely on. Note
124
+ * the SDK option is `baseUrl` (lowercase) vs. the MCP config's `baseURL`.
57
125
  */
58
- async request(method, path, body, passthroughStatuses = []) {
126
+ get sdk() {
59
127
  if (!this.apiKey) {
60
128
  throw new QURLAPIError(0, "missing_api_key", MISSING_API_KEY_MESSAGE);
61
129
  }
62
- const url = `${this.baseURL}${path}`;
63
- const headers = {
64
- Authorization: `Bearer ${this.apiKey}`,
65
- };
66
- if (body !== undefined) {
67
- headers["Content-Type"] = "application/json";
130
+ if (!this._sdk) {
131
+ this._sdk = new SDKQURLClient({ apiKey: this.apiKey, baseUrl: this.baseURL });
68
132
  }
69
- const response = await fetch(url, {
70
- method,
71
- headers,
72
- body: body !== undefined ? JSON.stringify(body) : undefined,
73
- });
74
- const text = await response.text();
75
- // Handle empty 2xx responses (e.g., 204 No Content from DELETE).
76
- // Only deleteQURL hits this path — T is void there, so undefined is correct.
77
- if (!text && response.ok) {
78
- return undefined;
79
- }
80
- const json = this.parseJSON(text, response.status);
81
- if (!response.ok && !passthroughStatuses.includes(response.status)) {
82
- // Trust boundary: we cast the parsed error body to the RFC 7807 shape
83
- // the API documents. The fallback chain below tolerates missing fields,
84
- // so a malformed error response still degrades to `HTTP ${status}`.
85
- const error = json.error;
86
- const meta = json.meta;
87
- throw new QURLAPIError(response.status, error?.code ?? "unknown", error?.detail ?? error?.title ?? error?.message ?? `HTTP ${response.status}`, error?.type, error?.instance, meta?.request_id);
88
- }
89
- return json;
133
+ return this._sdk;
90
134
  }
91
- parseJSON(text, status) {
135
+ /** Run an SDK call, translating its errors into `QURLAPIError`. */
136
+ async call(fn) {
92
137
  try {
93
- return JSON.parse(text);
138
+ const result = await fn(this.sdk);
139
+ // Only a successful API response conclusively validates the request
140
+ // credential. Any error status may have originated from an intermediary
141
+ // before the qURL API authenticated the bearer token. This trust boundary
142
+ // assumes the operator-configured HTTPS endpoint and its intermediaries
143
+ // neither synthesize nor cache authenticated success responses.
144
+ markRequestCredentialValidated();
145
+ return result;
94
146
  }
95
- catch {
96
- throw new QURLAPIError(status, "parse_error", `Failed to parse response: ${text.slice(0, 200)}`);
147
+ catch (err) {
148
+ throw translateError(err);
97
149
  }
98
150
  }
99
- qurlPath(id) {
100
- return `/v1/qurls/${encodeURIComponent(id)}`;
101
- }
151
+ // Casts at the SDK boundary are kept as tight as the compiler allows:
152
+ // inputs pass through unannotated where the MCP type is structurally
153
+ // assignable to the SDK type (a genuine drift then fails to compile), and
154
+ // outputs use a single `as` (not `as unknown as`) so a grossly incompatible
155
+ // SDK return is still rejected. `mapResource`'s `QURL`/`Resource` → MCP
156
+ // `QURL` conversion is the one place a double cast is genuinely required.
157
+ // The tools additionally validate every `structuredContent` against their
158
+ // zod `outputSchema`, so any residual response drift surfaces at runtime.
102
159
  async createQURL(input) {
103
- return this.request("POST", "/v1/qurls", input);
160
+ return this.call(async (sdk) => ({ data: (await sdk.create(input)) }));
104
161
  }
105
162
  async getQURL(id) {
106
- return this.request("GET", this.qurlPath(id));
163
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.get(id)) }));
107
164
  }
108
165
  async listQURLs(input) {
109
- const params = new URLSearchParams();
110
- if (input?.limit !== undefined)
111
- params.set("limit", String(input.limit));
112
- if (input?.cursor)
113
- params.set("cursor", input.cursor);
114
- if (input?.status)
115
- params.set("status", input.status);
116
- if (input?.created_after)
117
- params.set("created_after", input.created_after);
118
- if (input?.created_before)
119
- params.set("created_before", input.created_before);
120
- if (input?.expires_before)
121
- params.set("expires_before", input.expires_before);
122
- if (input?.expires_after)
123
- params.set("expires_after", input.expires_after);
124
- if (input?.sort)
125
- params.set("sort", input.sort);
126
- if (input?.q)
127
- params.set("q", input.q);
128
- const query = params.toString();
129
- return this.request("GET", `/v1/qurls${query ? `?${query}` : ""}`);
166
+ return this.call(async (sdk) => {
167
+ const out = await sdk.list(input);
168
+ // The SDK's list envelope is `{ qurls, next_cursor, has_more }` and does
169
+ // not surface `meta.page_size` / `meta.request_id` (both optional in the
170
+ // output schema), so they are intentionally absent here.
171
+ return {
172
+ data: out.qurls.map(mapResource),
173
+ meta: { next_cursor: out.next_cursor, has_more: out.has_more },
174
+ };
175
+ });
130
176
  }
131
177
  async deleteQURL(id) {
132
- await this.request("DELETE", this.qurlPath(id));
178
+ // Preserve the legacy endpoint while bypassing its SDK prefix guard for modern IDs.
179
+ await this.call((sdk) => (id.startsWith("r_") ? sdk.delete(id) : sdk.deleteResource(id)));
133
180
  }
134
181
  async updateQURL(id, input) {
135
- return this.request("PATCH", this.qurlPath(id), input);
182
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.update(id, input)) }));
183
+ }
184
+ async updateResource(id, input) {
185
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.updateResource(id, input)) }));
136
186
  }
137
187
  async extendQURL(id, input) {
138
- // ExtendQURLInput is a strict subset of UpdateQURLInput (just extend_by),
139
- // so we delegate to updateQURL rather than duplicating the PATCH call.
140
- return this.updateQURL(id, input);
188
+ return this.call(async (sdk) => ({ data: mapResource(await sdk.extend(id, input)) }));
141
189
  }
142
190
  async resolveQURL(input) {
143
- return this.request("POST", "/v1/resolve", input);
191
+ return this.call(async (sdk) => ({ data: (await sdk.resolve(input)) }));
144
192
  }
145
193
  async getQuota() {
146
- return this.request("GET", "/v1/quota");
194
+ return this.call(async (sdk) => ({ data: (await sdk.getQuota()) }));
147
195
  }
148
196
  async mintLink(id, input) {
149
- return this.request("POST", `${this.qurlPath(id)}/mint_link`, input);
197
+ return this.call(async (sdk) => ({ data: (await sdk.mintLink(id, input)) }));
150
198
  }
151
199
  async batchCreate(input) {
152
- // 400 carries per-item errors (see request() JSDoc).
153
- return this.request("POST", "/v1/qurls/batch", input, [400]);
200
+ return this.call(async (sdk) => {
201
+ // The SDK passes through HTTP 400 (all items failed) as a populated
202
+ // BatchCreateOutput rather than throwing, so the all-failed case still
203
+ // reaches here with `failed > 0` — matching the old passthrough behavior
204
+ // that batch-create.ts depends on. A populated response proves the API
205
+ // accepted the credential, so the shared call wrapper intentionally
206
+ // marks the request credential validated even for this HTTP 400 shape.
207
+ const out = await sdk.batchCreate(input);
208
+ return {
209
+ data: {
210
+ succeeded: out.succeeded,
211
+ failed: out.failed,
212
+ results: out.results,
213
+ },
214
+ meta: { request_id: out.request_id },
215
+ };
216
+ });
217
+ }
218
+ async revokeQurlToken(resourceId, qurlId) {
219
+ await this.call((sdk) => sdk.revokeResourceQurl(resourceId, qurlId));
220
+ }
221
+ async updateQurlToken(resourceId, qurlId, input) {
222
+ return this.call(async (sdk) => ({
223
+ // The SDK types this input as an extend_by-XOR-expires_at discriminated
224
+ // union; the MCP's UpdateQurlTokenInput allows both fields and enforces
225
+ // the XOR via a zod refinement in update-qurl-token.ts, so bridge here.
226
+ data: (await sdk.updateResourceQurl(resourceId, qurlId, input)),
227
+ }));
228
+ }
229
+ async listResourceSessions(resourceId) {
230
+ return this.call(async (sdk) => {
231
+ const out = await sdk.listResourceSessions(resourceId);
232
+ return {
233
+ data: out.sessions,
234
+ meta: { request_id: out.request_id },
235
+ };
236
+ });
237
+ }
238
+ async terminateResourceSession(resourceId, sessionId) {
239
+ await this.call((sdk) => sdk.terminateResourceSession(resourceId, sessionId));
240
+ }
241
+ async terminateAllResourceSessions(resourceId) {
242
+ return this.call(async (sdk) => {
243
+ const out = await sdk.terminateAllResourceSessions(resourceId);
244
+ return {
245
+ data: { terminated: out.terminated },
246
+ meta: { request_id: out.request_id },
247
+ };
248
+ });
154
249
  }
155
250
  }
156
251
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AA4OH,sBAAsB;AAEtB;;;;;;;GAOG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAE5B;IACA;IAEA;IACA;IACA;IANT,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AAC,UAAkB,EAAE,SAAiB;QAClE,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,wBAAwB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,UAAkB;QACnD,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC7B,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC;YAC/D,OAAO;gBACL,IAAI,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE;gBACpC,IAAI,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE;aACrC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,98 @@
1
+ export interface SmtpConfig {
2
+ host: string;
3
+ port: number;
4
+ secure: boolean;
5
+ username: string;
6
+ password: string;
7
+ fromEmail: string;
8
+ fromName?: string;
9
+ allowedRecipients?: string[];
10
+ allowedRecipientDomains?: string[];
11
+ maxRecipientsPerMessage: number;
12
+ maxRecipientsPerHour: number;
13
+ }
14
+ export interface RuntimeConfig {
15
+ maxUploadFileDataBytes: number;
16
+ defaultQurlApiUrl: string;
17
+ defaultQurlConnectorUrl?: string;
18
+ qurlApiKey?: string;
19
+ smtp?: SmtpConfig;
20
+ publicVideo?: PublicVideoConfig;
21
+ }
22
+ export interface PublicVideoConfig {
23
+ title: string;
24
+ pagePath: string;
25
+ filePath: string;
26
+ }
27
+ export interface SmtpConfigInspection {
28
+ enabled: boolean;
29
+ missingFields: string[];
30
+ securityWarnings: string[];
31
+ host?: string;
32
+ port?: number;
33
+ secure?: boolean;
34
+ username?: string;
35
+ fromEmail?: string;
36
+ fromName?: string;
37
+ }
38
+ export type UncheckedConfigFileShape = Partial<{
39
+ port: number;
40
+ host: string;
41
+ baseUrl: string;
42
+ allowedHosts: string[];
43
+ trustProxyHops: number;
44
+ maxSessions: number;
45
+ maxSessionsPerCredential: number;
46
+ maxUnvalidatedSessions: number;
47
+ sessionIdleTtlMs: number;
48
+ sessionAbsoluteTtlMs: number;
49
+ unvalidatedSessionTtlMs: number;
50
+ mcpRateLimitPerMinute: number;
51
+ stateless: boolean;
52
+ serveLayerVLegalPages: boolean;
53
+ maxConcurrentRequests: number;
54
+ credentialRateLimitStore: "memory" | "dynamodb";
55
+ rateLimitDynamoDbTable: string;
56
+ metricsNamespace: string;
57
+ metricsService: string;
58
+ metricsEnvironment: string;
59
+ publicFileRateLimitPerMinute: number;
60
+ maxUploadFileDataBytes: string | number;
61
+ defaultQurlApiUrl: string;
62
+ defaultQurlConnectorUrl: string;
63
+ smtp: Partial<SmtpConfig>;
64
+ publicVideo: Partial<PublicVideoConfig>;
65
+ }>;
66
+ export declare const DEFAULT_QURL_API_URL = "https://api.layerv.ai";
67
+ export declare const DEFAULT_PUBLIC_VIDEO_TITLE = "Video Showcase";
68
+ export declare const DEFAULT_PUBLIC_VIDEO_PAGE_PATH = "/media/video";
69
+ export declare const MAX_PUBLIC_VIDEO_TITLE_CHARACTERS = 200;
70
+ export declare const DEFAULT_MAX_UPLOAD_FILE_DATA_BYTES: number;
71
+ export declare const MAX_UPLOAD_FILE_DATA_BYTES: number;
72
+ export declare const MAX_CONFIG_ALLOWLIST_ENTRIES = 1000;
73
+ export declare function parseConfigFile(configPath: string): UncheckedConfigFileShape;
74
+ export declare function parseSizeBytes(value: unknown, fallback: number, fieldName: string): number;
75
+ export declare function getDefaultConfigPath(): string;
76
+ export declare function trimString(value: unknown): string | undefined;
77
+ export declare function isLoopbackHostname(hostname: string): boolean;
78
+ export declare function normalizeServiceBaseUrl(value: string, fieldName: string, requireHttps: boolean): string;
79
+ export declare function normalizePublicPath(value: string | undefined, fallback: string, fieldName?: string): string;
80
+ export declare function normalizeAbsoluteFilePath(value: unknown, fieldName: string): string | undefined;
81
+ export declare function normalizePublicVideoTitle(value: string | undefined): string;
82
+ export declare function normalizePublicVideoConfig(rawConfig: Partial<PublicVideoConfig> | undefined): PublicVideoConfig | undefined;
83
+ /**
84
+ * Load runtime configuration from file and environment variables.
85
+ * Results are cached per config path, environment fingerprint, and file
86
+ * metadata so edits are picked up without a process restart.
87
+ *
88
+ * @param configPath - Path to config file (defaults to getDefaultConfigPath())
89
+ * @returns Resolved runtime configuration
90
+ */
91
+ export declare function loadRuntimeConfig(configPath?: string): RuntimeConfig;
92
+ /**
93
+ * Clear the runtime config cache. Useful for tests or for forcing a reload
94
+ * after an operator deliberately preserves a file's metadata while editing.
95
+ */
96
+ export declare function clearRuntimeConfigCache(): void;
97
+ export declare function inspectSmtpConfig(configPath?: string): SmtpConfigInspection;
98
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;IACnC,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED,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