@tinycloud/operations 0.7.4-beta.2 → 0.7.4-beta.3

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/dist/index.js CHANGED
@@ -6246,6 +6246,15 @@ function nodeFailure(action) {
6246
6246
  function sqlServiceFailure(error, action) {
6247
6247
  const auth = authorizationFailure(error, action);
6248
6248
  if (auth !== void 0) return auth;
6249
+ if (isRecord2(error) && error.code === "SQL_REQUEST_TOO_LARGE") {
6250
+ return {
6251
+ status: "error",
6252
+ error: operationError(
6253
+ "INPUT_INVALID",
6254
+ SQL_REQUEST_TOO_LARGE_MESSAGE
6255
+ )
6256
+ };
6257
+ }
6249
6258
  if (isRecord2(error) && error.code === "SQL_RESPONSE_TOO_LARGE") {
6250
6259
  return {
6251
6260
  status: "error",
@@ -6258,6 +6267,9 @@ function sqlServiceFailure(error, action) {
6258
6267
  return nodeFailure(action);
6259
6268
  }
6260
6269
  function sqlMutationFailure(error) {
6270
+ if (isRecord2(error) && error.code === "SQL_REQUEST_TOO_LARGE") {
6271
+ return { status: "error", error: operationError("INPUT_INVALID", SQL_REQUEST_TOO_LARGE_MESSAGE) };
6272
+ }
6261
6273
  const storageFull = storageFullOperationError(error);
6262
6274
  if (storageFull) return { status: "error", error: storageFull };
6263
6275
  return {
@@ -6287,7 +6299,7 @@ function isByte(value) {
6287
6299
  function isRecord2(value) {
6288
6300
  return typeof value === "object" && value !== null && !Array.isArray(value);
6289
6301
  }
6290
- var DEFAULT_MAX_ROWS, MAX_MAX_ROWS, DEFAULT_MAX_BYTES, MAX_MAX_BYTES, SCHEMA_MAX_ROWS, SCHEMA_MAX_BYTES, MAX_PARAMETERS, MAX_SQL_LENGTH, SQL_WRITE_AUTHORITY_NOTICE, SCHEMA_QUERY, sqlParser, SpaceSchema, DatabaseSchema, SafeNumberSchema, Base64Schema, SqlInputValueSchema, SqlParamsSchema, RequiredSqlParamsSchema, SqlOutputValueSchema, SqlTargetInputSchema, SqlQueryInputSchema, SqlExecuteInputSchema, SqlLimitsOutputSchema, SqlSchemaInspectOutputSchema, SqlQueryOutputSchema, SqlExecuteOutputSchema, AUTHENTICATED_POSTURES, SQL_EXPOSURE, SQL_SCHEMA_SENSITIVITY, SQL_QUERY_SENSITIVITY, SQL_EXECUTE_SENSITIVITY, sqlOperationDefinitions;
6302
+ var DEFAULT_MAX_ROWS, MAX_MAX_ROWS, DEFAULT_MAX_BYTES, MAX_MAX_BYTES, SCHEMA_MAX_ROWS, SCHEMA_MAX_BYTES, MAX_PARAMETERS, MAX_SQL_LENGTH, SQL_WRITE_AUTHORITY_NOTICE, SQL_REQUEST_TOO_LARGE_MESSAGE, SCHEMA_QUERY, sqlParser, SpaceSchema, DatabaseSchema, SafeNumberSchema, Base64Schema, SqlInputValueSchema, SqlParamsSchema, RequiredSqlParamsSchema, SqlOutputValueSchema, SqlTargetInputSchema, SqlQueryInputSchema, SqlExecuteInputSchema, SqlLimitsOutputSchema, SqlSchemaInspectOutputSchema, SqlQueryOutputSchema, SqlExecuteOutputSchema, AUTHENTICATED_POSTURES, SQL_EXPOSURE, SQL_SCHEMA_SENSITIVITY, SQL_QUERY_SENSITIVITY, SQL_EXECUTE_SENSITIVITY, sqlOperationDefinitions;
6291
6303
  var init_sql = __esm({
6292
6304
  "src/operations/sql.ts"() {
6293
6305
  "use strict";
@@ -6303,6 +6315,7 @@ var init_sql = __esm({
6303
6315
  MAX_PARAMETERS = 100;
6304
6316
  MAX_SQL_LENGTH = 64 * 1024;
6305
6317
  SQL_WRITE_AUTHORITY_NOTICE = "Approving tinycloud.sql/write grants full read/write/schema mutation authority over this exact database; the MCP tool itself accepts only one parameterized INSERT, UPDATE, or DELETE.";
6318
+ SQL_REQUEST_TOO_LARGE_MESSAGE = "SQL request too large.";
6306
6319
  SCHEMA_QUERY = `SELECT type, name, tbl_name, sql
6307
6320
  FROM sqlite_schema
6308
6321
  WHERE type IN ('table', 'view', 'index', 'trigger')
@@ -6736,6 +6749,7 @@ function missingSchema(error) {
6736
6749
  function copyFailure(error) {
6737
6750
  if (isObject(error) && isObject(error.meta) && error.meta.status === 409) return new OperationInvocationError(operationError("NODE_ERROR", "The fast, searchable copy is unavailable and needs the node team. Answer from the records; do not retry or ask for another approval.", { retryable: false, details: { reason: "copy_unavailable" } }));
6738
6751
  if (isObject(error) && error.code === "SQL_RESPONSE_TOO_LARGE") return new OperationInvocationError(operationError("SQL_RESULT_LIMIT_EXCEEDED", "Narrow the fast-copy query to return fewer records or fields."));
6752
+ if (isObject(error) && error.code === "SQL_REQUEST_TOO_LARGE") return new OperationInvocationError(operationError("INPUT_INVALID", "Fast-copy request too large."));
6739
6753
  return new OperationInvocationError(appsFailure(error));
6740
6754
  }
6741
6755
  async function execute(db, sql, params = []) {