@mestra-dev/contract 0.0.38 → 0.0.40

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 (2) hide show
  1. package/dist/index.d.ts +126 -4
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -98,7 +98,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
98
98
  },
99
99
  {
100
100
  readonly name: "Files";
101
- readonly description: "S3 file upload (presigned POST to a temporary `.tmp` key), confirm (magic-byte validation then promote to final key), optional nested folder destination under `{workspace}/folders/{path}/`, profile and workspace picture upload/confirm/delete, comment attachment upload/confirm, list task comment files with download URLs, folder create/delete (nested paths), list (includes pin metadata; excludes `.tmp` objects), pin/unpin, download by relative path, move, and file delete. General uploads accept JPEG/PNG/WebP/PDF; profile/workspace pictures accept JPEG/PNG only (0.5 MB). Workspace file routes require active collaborator status and crm::files access; comment attachments require crm::tasks write/read.";
101
+ readonly description: "S3 file upload (presigned POST to a temporary `.tmp` key), confirm (magic-byte validation then promote to final key), optional nested folder destination under `{workspace}/folders/{path}/`, profile and workspace picture upload/confirm/delete, comment attachment upload/confirm, list task comment files with download URLs, folder create/delete (nested paths), list (includes pin metadata; excludes `.tmp` objects), storage usage, pin/unpin, download by relative path, move, and file delete. General uploads accept JPEG/PNG/WebP/PDF; profile/workspace pictures accept JPEG/PNG only (0.5 MB). Workspace file routes require active collaborator status and crm::files access; comment attachments require crm::tasks write/read.";
102
102
  },
103
103
  {
104
104
  readonly name: "Chat";
@@ -2012,6 +2012,43 @@ declare const routes: import("hono/hono-base").HonoBase<{
2012
2012
  };
2013
2013
  };
2014
2014
  };
2015
+ readonly StorageUsageSuccess: {
2016
+ readonly type: "object";
2017
+ readonly required: readonly [
2018
+ "success",
2019
+ "usedBytes",
2020
+ "filesBytes",
2021
+ "commentsBytes",
2022
+ "limitBytes"
2023
+ ];
2024
+ readonly properties: {
2025
+ readonly success: {
2026
+ readonly type: "boolean";
2027
+ readonly const: true;
2028
+ };
2029
+ readonly usedBytes: {
2030
+ readonly type: "integer";
2031
+ readonly description: "Total finalized storage in bytes (`filesBytes` + `commentsBytes`). Excludes `.tmp` objects.";
2032
+ readonly example: 348320;
2033
+ };
2034
+ readonly filesBytes: {
2035
+ readonly type: "integer";
2036
+ readonly description: "Finalized workspace file storage under `{workspace}/` (root files and folders). Excludes `.tmp`.";
2037
+ readonly example: 248320;
2038
+ };
2039
+ readonly commentsBytes: {
2040
+ readonly type: "integer";
2041
+ readonly description: "Finalized comment attachment storage under `{workspace}_comments/`. Excludes `.tmp`.";
2042
+ readonly example: 100000;
2043
+ };
2044
+ readonly limitBytes: {
2045
+ readonly type: "integer";
2046
+ readonly nullable: true;
2047
+ readonly description: "Plan storage limit in bytes for this workspace, or null when no subscription/limit is configured. Applies to the combined total.";
2048
+ readonly example: 1073741824;
2049
+ };
2050
+ };
2051
+ };
2015
2052
  readonly DownloadFileSuccess: {
2016
2053
  readonly type: "object";
2017
2054
  readonly required: readonly [
@@ -6202,7 +6239,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
6202
6239
  "Workspace"
6203
6240
  ];
6204
6241
  readonly summary: "Delete a workspace";
6205
- readonly description: "Deletes a workspace and cascades removal of related data (policies, assignees, chat tenants, collaborators, comments, task tags, tasks, customers, services, billings, tags, templates). Only the owner can delete a workspace. Requires write access to crm::general resource.";
6242
+ readonly description: "Deletes a workspace and cascades removal of related data (policies, assignees, chat tenants, collaborators, comments, task tags, tasks, customers, services, billings, subscription invoices, tags, templates). Only the owner can delete a workspace. Requires write access to crm::general. Also allowed when the workspace was never paid, still has its first unpaid initial invoice, and YooKassa checkout has not been started; frozen, past-due, or open-checkout workspaces cannot be deleted.";
6206
6243
  readonly security: readonly [
6207
6244
  never
6208
6245
  ];
@@ -6263,7 +6300,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
6263
6300
  };
6264
6301
  };
6265
6302
  readonly 403: {
6266
- readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access, or user lacks write access to crm::general resource.";
6303
+ readonly description: "Forbidden - Token issuer is not 'access', user lacks workspace access or crm::general write, or the workspace is frozen/past-due/has an open YooKassa checkout (delete is only exempt for an unpaid initial invoice with no checkout).";
6267
6304
  readonly content: {
6268
6305
  readonly "application/json": {
6269
6306
  readonly schema: {
@@ -11083,6 +11120,72 @@ declare const routes: import("hono/hono-base").HonoBase<{
11083
11120
  };
11084
11121
  };
11085
11122
  };
11123
+ readonly "/files/usage/{workspace}": {
11124
+ readonly get: {
11125
+ readonly tags: readonly [
11126
+ "Files"
11127
+ ];
11128
+ readonly summary: "Get workspace storage usage";
11129
+ readonly description: "Returns finalized storage usage broken down by workspace files (`filesBytes`) and comment attachments (`commentsBytes`), plus the combined total and plan limit. Temporary `.tmp` objects are excluded. Requires workspace access and read access to crm::files.";
11130
+ readonly security: readonly [
11131
+ never
11132
+ ];
11133
+ readonly parameters: readonly [
11134
+ {
11135
+ readonly name: "workspace";
11136
+ readonly in: "path";
11137
+ readonly required: true;
11138
+ readonly schema: {
11139
+ readonly type: "string";
11140
+ readonly format: "uuid";
11141
+ };
11142
+ readonly description: "Workspace identifier.";
11143
+ }
11144
+ ];
11145
+ readonly responses: {
11146
+ readonly 200: {
11147
+ readonly description: "Storage usage returned.";
11148
+ readonly content: {
11149
+ readonly "application/json": {
11150
+ readonly schema: {
11151
+ readonly $ref: "#/components/schemas/StorageUsageSuccess";
11152
+ };
11153
+ };
11154
+ };
11155
+ };
11156
+ readonly 401: {
11157
+ readonly description: "Unauthorized - Missing or invalid access token.";
11158
+ readonly content: {
11159
+ readonly "application/json": {
11160
+ readonly schema: {
11161
+ readonly $ref: "#/components/schemas/ErrorResponse";
11162
+ };
11163
+ };
11164
+ };
11165
+ };
11166
+ readonly 403: {
11167
+ readonly description: "Forbidden - Token issuer is not 'access' or user lacks workspace access.";
11168
+ readonly content: {
11169
+ readonly "application/json": {
11170
+ readonly schema: {
11171
+ readonly $ref: "#/components/schemas/ErrorResponse";
11172
+ };
11173
+ };
11174
+ };
11175
+ };
11176
+ readonly 404: {
11177
+ readonly description: "Workspace not found.";
11178
+ readonly content: {
11179
+ readonly "application/json": {
11180
+ readonly schema: {
11181
+ readonly $ref: "#/components/schemas/ErrorResponse";
11182
+ };
11183
+ };
11184
+ };
11185
+ };
11186
+ };
11187
+ };
11188
+ };
11086
11189
  readonly "/files/download/{workspace}": {
11087
11190
  readonly get: {
11088
11191
  readonly tags: readonly [
@@ -13367,7 +13470,7 @@ declare const routes: import("hono/hono-base").HonoBase<{
13367
13470
  error: string;
13368
13471
  };
13369
13472
  outputFormat: "json";
13370
- status: 400;
13473
+ status: 400 | 403 | 404;
13371
13474
  } | {
13372
13475
  input: {};
13373
13476
  output: {
@@ -18120,6 +18223,25 @@ declare const routes: import("hono/hono-base").HonoBase<{
18120
18223
  status: 200;
18121
18224
  };
18122
18225
  };
18226
+ } & {
18227
+ "/usage/:workspace": {
18228
+ $get: {
18229
+ input: {
18230
+ param: {
18231
+ workspace: string;
18232
+ };
18233
+ };
18234
+ output: {
18235
+ success: true;
18236
+ usedBytes: number;
18237
+ filesBytes: number;
18238
+ commentsBytes: number;
18239
+ limitBytes: number | null;
18240
+ };
18241
+ outputFormat: "json";
18242
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18243
+ };
18244
+ };
18123
18245
  } & {
18124
18246
  "/download/:workspace": {
18125
18247
  $get: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mestra-dev/contract",
3
- "version": "0.0.38",
3
+ "version": "0.0.40",
4
4
  "description": "Types-only Hono AppType contract for the Mestra auth API",
5
5
  "type": "module",
6
6
  "sideEffects": false,