planvortex 0.8.0 → 0.10.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.
package/README.md CHANGED
@@ -372,7 +372,7 @@ if you would rather branch on `error.family`.
372
372
  | 601-612 | Users | `UserError` |
373
373
  | 700-715 | Social accounts — disconnected, revoked, no slot left | `AccountError` |
374
374
  | 800-810 | Files | `FileError` |
375
- | 900-979 | Publications, every per-network limit and the two rate brakes | `PublicationError` |
375
+ | 900-986 | Publications, every per-network limit, the two rate brakes and Slack | `PublicationError` |
376
376
  | 1000-1003 | General | `PlanVortexError` |
377
377
  | 1100-1111 | Organizations | `OrganizationError` |
378
378
  | 1200-1207 | Roles | `PlanVortexError` |
@@ -9,8 +9,8 @@ var PLANVORTEX_ERROR_RANGES = [
9
9
  //El techo sube con el catalogo del servidor, y subir tarde no da un error: da un consejo
10
10
  //equivocado. Los codigos de Bluesky, Discord, Telegram y Threads (961-977) y los dos frenos
11
11
  //de ritmo de la fase de publicaciones ilimitadas (978, 979) nacieron por encima de 960 y
12
- //caian fuera de toda familia.
13
- { from: 900, to: 979, family: "publication" },
12
+ //caian fuera de toda familia. Slack estreno el 980-986, que es el mismo caso otra vez.
13
+ { from: 900, to: 986, family: "publication" },
14
14
  { from: 1e3, to: 1003, family: "general" },
15
15
  { from: 1100, to: 1111, family: "organization" },
16
16
  { from: 1200, to: 1207, family: "role" },
@@ -143,5 +143,5 @@ function isTokenError(error) {
143
143
  }
144
144
 
145
145
  export { AccountError, AiPlanError, AuthError, ContactError, FileError, IntegrationError, MessagingError, NO_ERROR_CODE, OrganizationError, PLANVORTEX_ERROR_RANGES, PlanLimitError, PlanVortexAuthenticationError, PlanVortexConfigError, PlanVortexConnectionError, PlanVortexError, ProductError, PublicationError, TOKEN_ERROR_CODES, UserError, createErrorFromResponse, errorFamilyForCode, isPlanVortexError, isTokenError };
146
- //# sourceMappingURL=chunk-IIAKKH3S.js.map
147
- //# sourceMappingURL=chunk-I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EA,EAAA,IAAI,cAAA,CAAe,KAAA,CAAM,IAAI,CAAA,EAAG;AAC5B,IAAA,MAAM,MAAA,GAAS,kBAAA,CAAmB,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AACjD,IAAA,MAAM,cAAc,MAAA,KAAW,MAAA,GAAY,MAAA,GAAY,cAAA,CAAe,MAAM,CAAA,KAAM,eAAA;AAClF,IAAA,OAAO,IAAI,WAAW,KAAA,CAAM,IAAA,CAAK,MAAM,KAAA,CAAM,IAAA,CAAK,WAAW,kBAAA,EAAoB;AAAA,MAC7E,GAAG,OAAA;AAAA,MACH,IAAA,EAAM,KAAA,CAAM,IAAA,CAAK,IAAA,IAAQ;AAAC,KAC7B,CAAA;AAAA,EACL;AAEA,EAAA,OAAO,IAAI,eAAA,CAAgB,aAAA,EAAe,CAAA,KAAA,EAAQ,KAAA,CAAM,MAAM,CAAA,CAAA,EAAI;AAAA,IAC9D,GAAG,OAAA;AAAA,IACH,MAAA,EAAQ,MAAA;AAAA,IACR,IAAA,EACI,OAAO,KAAA,CAAM,IAAA,KAAS,QAAA,IAAY,KAAA,CAAM,IAAA,KAAS,IAAA,GAC1C,KAAA,CAAM,IAAA,GACP,EAAE,IAAA,EAAM,MAAM,IAAA;AAAK,GAChC,CAAA;AACL;AAGO,SAAS,kBAAkB,KAAA,EAA0C;AACxE,EAAA,OAAO,KAAA,YAAiB,eAAA;AAC5B;AAOO,SAAS,aAAa,KAAA,EAAyB;AAClD,EAAA,OAAO,kBAAkB,KAAK,CAAA,IAAK,iBAAA,CAAkB,QAAA,CAAS,MAAM,IAAI,CAAA;AAC5E","file":"chunk-RK2OR6IV.js","sourcesContent":["/**\n * El catálogo de errores de PlanVortex, por rangos, y las clases que salen de él.\n *\n * LA REGLA, y no es negociable: **los errores se clasifican por `body.code`, nunca por el status\n * HTTP.** Todo error de dominio viaja con un 400 — un token caducado, una cuenta desconectada, el\n * cupo del plan agotado y un texto demasiado largo son los cuatro un 400. Sólo el 520 (permisos)\n * sale 401 y un fallo inesperado sale 500. Un `if (response.status === 401) refreshToken()` sería\n * un bug silencioso: los códigos de token, 501 y 522, viajan dentro de un 400.\n *\n * El catálogo del servidor crece cada mes, así que un código fuera de estos rangos NO es un error\n * del cliente: cae en la clase base con su `code` y su `message` intactos. Nunca se traga y nunca\n * se renombra.\n */\n\nexport type PlanVortexErrorRange = {\n /** Primer código del rango, incluido */\n from: number;\n /** Último código del rango, incluido */\n to: number;\n /** Qué familia de problemas es */\n family: string;\n};\n\nexport const PLANVORTEX_ERROR_RANGES: readonly PlanVortexErrorRange[] = [\n //Hasta 546, no 544: la API publica se abrio a todos los planes y trajo dos codigos nuevos\n //—545 (ritmo por plan, que sale 429) y 546 (correo sin verificar al crear una app)—.\n { from: 500, to: 546, family: \"auth\" },\n { from: 601, to: 612, family: \"user\" },\n { from: 700, to: 715, family: \"account\" },\n { from: 800, to: 810, family: \"file\" },\n //El techo sube con el catalogo del servidor, y subir tarde no da un error: da un consejo\n //equivocado. Los codigos de Bluesky, Discord, Telegram y Threads (961-977) y los dos frenos\n //de ritmo de la fase de publicaciones ilimitadas (978, 979) nacieron por encima de 960 y\n //caian fuera de toda familia. Slack estreno el 980-986, que es el mismo caso otra vez.\n { from: 900, to: 986, family: \"publication\" },\n { from: 1000, to: 1003, family: \"general\" },\n { from: 1100, to: 1111, family: \"organization\" },\n { from: 1200, to: 1207, family: \"role\" },\n //1308 es el tope de APPS del plan, que nacio al quitar el candado de precio de la API.\n { from: 1300, to: 1308, family: \"plan_limit\" },\n { from: 1400, to: 1408, family: \"plan_limit\" },\n { from: 1500, to: 1512, family: \"messaging\" },\n { from: 1600, to: 1601, family: \"contact\" },\n { from: 1900, to: 1906, family: \"payment\" },\n { from: 2000, to: 2099, family: \"product\" },\n { from: 2100, to: 2199, family: \"ai_plan\" },\n { from: 2200, to: 2299, family: \"integration\" },\n] as const;\n\n/**\n * El `code` que lleva un error que **no** trae código del servidor: un fallo de red, un timeout, un\n * 502 de un proxy con cuerpo HTML, o el propio constructor quejándose de la configuración.\n *\n * El servidor no emite nunca el 0, así que sirve de centinela sin pisar el catálogo. Cuál de esos\n * casos es se distingue por `family`: `connection`, `http`, `oauth`, `config` o `webhook`.\n */\nexport const NO_ERROR_CODE = 0;\n\n/**\n * Los dos códigos que significan \"tu token ya no sirve\". Los dos llegan **dentro de un 400**, que es\n * justo por lo que existe esta constante: quien mire el status no los va a encontrar.\n *\n * El 520 (permisos) NO está aquí a propósito: sale 401, pero pedir un token nuevo no lo arregla — a\n * la app le faltan permisos, y con un token recién emitido le seguirán faltando.\n */\nexport const TOKEN_ERROR_CODES: readonly number[] = [501, 522];\n\n/** Opciones de construcción de un error. Todas opcionales: un error siempre se puede construir. */\nexport interface PlanVortexErrorOptions {\n /** El `data` del cuerpo — lo que el servidor adjuntó con `.withData({...})`. `{}` si no vino nada. */\n data?: Record<string, unknown>;\n /** Status HTTP. `undefined` cuando la petición no llegó a tener respuesta. */\n status?: number;\n /** `x-request-id` de la respuesta, si el despliegue lo pone delante. */\n requestId?: string;\n /** Segundos de la cabecera `Retry-After`, cuando la hay. */\n retryAfter?: number;\n /** El error original (un `TypeError` de `fetch`, por ejemplo). */\n cause?: unknown;\n /**\n * Familia, sólo para los errores que NO salen del catálogo: `connection`, `http`, `oauth`,\n * `config` y `webhook`. Los de dominio la deducen de su `code` y no la pasan nunca.\n */\n family?: string;\n}\n\n/**\n * La base de todo lo que lanza esta librería.\n *\n * Un `catch (e) { if (e instanceof PlanVortexError) }` los coge todos: los de dominio, los de red y\n * los de configuración. Para afinar están las subclases y el `code`.\n */\nexport class PlanVortexError extends Error {\n /** El `code` del cuerpo, tal cual. {@link NO_ERROR_CODE} si el error no viene del catálogo. */\n readonly code: number;\n /** La familia del rango: `auth`, `publication`, `plan_limit`... Ver {@link PLANVORTEX_ERROR_RANGES}. */\n readonly family: string;\n /** El `data` del cuerpo. */\n readonly data: Record<string, unknown>;\n /** Status HTTP, o `undefined` si nunca hubo respuesta. */\n readonly status: number | undefined;\n /** `x-request-id`, si el despliegue lo pone. Hoy el servidor no lo emite; un proxy delante sí. */\n readonly requestId: string | undefined;\n /** Segundos que pidió esperar la cabecera `Retry-After`, si llegó. */\n readonly retryAfter: number | undefined;\n\n constructor(code: number, message: string, options: PlanVortexErrorOptions = {}) {\n super(message, options.cause === undefined ? undefined : { cause: options.cause });\n this.name = new.target.name;\n this.code = code;\n this.family = options.family ?? errorFamilyForCode(code) ?? \"unknown\";\n this.data = options.data ?? {};\n this.status = options.status;\n this.requestId = options.requestId;\n this.retryAfter = options.retryAfter;\n }\n}\n\n/** 500-546 — tokens, apps de cliente, permisos. Incluye el 501 y el 522, los de token caducado. */\nexport class AuthError extends PlanVortexError {}\n/** 601-612 — el usuario final. */\nexport class UserError extends PlanVortexError {}\n/** 700-715 — cuentas sociales: desconectada, sin permisos en la red, sin refrescar. */\nexport class AccountError extends PlanVortexError {}\n/** 800-810 — ficheros: formato no admitido, demasiado grande, conversión fallida. */\nexport class FileError extends PlanVortexError {}\n/** 900-986 — publicaciones, incluidos los límites por red (caracteres, imágenes, duración), los\n * dos frenos de ritmo —978 (demasiado rápido en esta cuenta) y 979 (tope diario de esa red)— y\n * los de Slack (980-986), que empiezan por el más común: 980, la app no está en el canal. */\nexport class PublicationError extends PlanVortexError {}\n/** 1100-1111 — organizaciones, y el token temporal atado a una sola de ellas (1101). */\nexport class OrganizationError extends PlanVortexError {}\n/**\n * 1300-1308 y 1400-1408 — el cupo del plan, del cliente o de la organización.\n *\n * Es el error que un integrador **sí** quiere distinguir: no se arregla reintentando, se arregla\n * cambiando de plan. Por eso los dos rangos comparten clase.\n */\nexport class PlanLimitError extends PlanVortexError {}\n/** 1500-1512 — conversaciones, mensajes y plantillas. Exige plan de pago. */\nexport class MessagingError extends PlanVortexError {}\n/** 1600-1601 — contactos. */\nexport class ContactError extends PlanVortexError {}\n/** 2000-2099 — catálogos y productos (sólo Facebook e Instagram). */\nexport class ProductError extends PlanVortexError {}\n/** 2100-2199 — planes de publicaciones generados con IA. */\nexport class AiPlanError extends PlanVortexError {}\n/** 2200-2299 — integraciones: Google Drive, RSS. */\nexport class IntegrationError extends PlanVortexError {}\n\n/**\n * La petición no llegó a tener respuesta: DNS, conexión rechazada, socket cortado o timeout.\n *\n * No lleva código del catálogo porque el servidor nunca llegó a opinar.\n */\nexport class PlanVortexConnectionError extends PlanVortexError {\n /** `true` si lo que se agotó fue nuestro propio timeout, no la red. */\n readonly timeout: boolean;\n\n constructor(message: string, options: PlanVortexErrorOptions & { timeout?: boolean } = {}) {\n super(NO_ERROR_CODE, message, { ...options, family: \"connection\" });\n this.timeout = options.timeout ?? false;\n }\n}\n\n/**\n * `POST /oauth/token` rechazó las credenciales.\n *\n * Es el ÚNICO sitio del API con forma de error distinta: `{error, error_description}` de OAuth2, no\n * el `{code, message, data}` de todo lo demás. Y por eso el `code` es {@link NO_ERROR_CODE}: el\n * servidor tiene códigos para esto (538-541) pero **no los manda en el cuerpo**, así que ponerlos\n * aquí sería inventarse algo que nadie dijo. Lo que sí viaja es `oauthError`.\n */\nexport class PlanVortexAuthenticationError extends PlanVortexError {\n /** `invalid_client`, `invalid_request`, `unsupported_grant_type`, `slow_down` o `server_error`. */\n readonly oauthError: string;\n\n constructor(oauthError: string, description: string, options: PlanVortexErrorOptions = {}) {\n super(NO_ERROR_CODE, description, { ...options, family: \"oauth\" });\n this.oauthError = oauthError;\n }\n}\n\n/**\n * La librería está mal configurada y no ha llegado a salir de casa: sin credenciales, o instanciada\n * en un navegador (§ trampa 9 del roadmap).\n */\nexport class PlanVortexConfigError extends PlanVortexError {\n constructor(message: string) {\n super(NO_ERROR_CODE, message, { family: \"config\" });\n }\n}\n\n/** La familia a la que pertenece un código, o `undefined` si cae fuera del catálogo conocido. */\nexport function errorFamilyForCode(code: number): string | undefined {\n return PLANVORTEX_ERROR_RANGES.find((range) => code >= range.from && code <= range.to)?.family;\n}\n\n/**\n * Familia -> clase. Las que faltan —`general`, `role`, `payment` y cualquier rango nuevo— caen a\n * propósito en la clase base: existen en el servidor pero no son superficie de integración, y darles\n * clase propia sería prometer un `instanceof` que luego habría que mantener.\n */\nconst FAMILY_CLASSES: Record<string, typeof PlanVortexError> = {\n auth: AuthError,\n user: UserError,\n account: AccountError,\n file: FileError,\n publication: PublicationError,\n organization: OrganizationError,\n plan_limit: PlanLimitError,\n messaging: MessagingError,\n contact: ContactError,\n product: ProductError,\n ai_plan: AiPlanError,\n integration: IntegrationError,\n};\n\n/** El cuerpo de error del API: `{code, message, data}`. */\nexport interface ApiErrorBody {\n code: number;\n message?: string;\n data?: Record<string, unknown>;\n}\n\nfunction isApiErrorBody(body: unknown): body is ApiErrorBody {\n return typeof body === \"object\" && body !== null && typeof (body as ApiErrorBody).code === \"number\";\n}\n\n/**\n * Convierte una respuesta de error en la clase que le toca.\n *\n * Un cuerpo sin `code` —un 502 de un proxy, la página HTML de un balanceador— no es un error de\n * dominio: sale como clase base con `family: \"http\"` y el cuerpo entero en `data`, que es además lo\n * que necesita `auth.ts` para reconocer el `{error, error_description}` de OAuth2.\n */\nexport function createErrorFromResponse(input: {\n body: unknown;\n status: number;\n requestId?: string | undefined;\n retryAfter?: number | undefined;\n}): PlanVortexError {\n const options: PlanVortexErrorOptions = {\n status: input.status,\n ...(input.requestId === undefined ? {} : { requestId: input.requestId }),\n ...(input.retryAfter === undefined ? {} : { retryAfter: input.retryAfter }),\n };\n\n if (isApiErrorBody(input.body)) {\n const family = errorFamilyForCode(input.body.code);\n const ErrorClass = (family === undefined ? undefined : FAMILY_CLASSES[family]) ?? PlanVortexError;\n return new ErrorClass(input.body.code, input.body.message ?? \"PlanVortex error\", {\n ...options,\n data: input.body.data ?? {},\n });\n }\n\n return new PlanVortexError(NO_ERROR_CODE, `HTTP ${input.status}`, {\n ...options,\n family: \"http\",\n data:\n typeof input.body === \"object\" && input.body !== null\n ? (input.body as Record<string, unknown>)\n : { body: input.body },\n });\n}\n\n/** ¿Es un error de esta librería? Útil en un `catch` donde no apetece importar la clase. */\nexport function isPlanVortexError(error: unknown): error is PlanVortexError {\n return error instanceof PlanVortexError;\n}\n\n/**\n * ¿Dice este error que el token ya no sirve? (los códigos 501 y 522, los dos dentro de un 400).\n *\n * Es lo que dispara el único reintento con token nuevo del cliente.\n */\nexport function isTokenError(error: unknown): boolean {\n return isPlanVortexError(error) && TOKEN_ERROR_CODES.includes(error.code);\n}\n"]}
@@ -172,7 +172,7 @@ interface paths {
172
172
  get?: never;
173
173
  /**
174
174
  * Configure the client's own AI models (BYOK)
175
- * @description Set the client's Bring-Your-Own-Key AI provider configuration per scope. The request body is an object keyed by scope (orchestrator, text, image); a scope set to null clears it. Providers and capabilities are validated against a fixed catalogue. When a scope uses BYOK, its calls are billed to the client's own provider and do NOT consume PlanVortex AI credits, but the artificial_inteligence plan flag is still required to use the feature. API keys are stored encrypted and never returned; the response client only exposes provider, model and has_api_key per scope. Requires the client:update permission.
175
+ * @description Set the client's Bring-Your-Own-Key AI provider configuration per scope. The request body is an object keyed by scope (orchestrator, text, image); a scope set to null clears it. Providers and capabilities are validated against a fixed catalogue. When a scope uses BYOK, its calls are billed to the client's own provider and do NOT consume PlanVortex AI credits, but the plan still has to include AI credits to use the feature. API keys are stored encrypted and never returned; the response client only exposes provider, model and has_api_key per scope. Requires the client:update permission.
176
176
  */
177
177
  put: operations["updateAiSettings"];
178
178
  post?: never;
@@ -193,7 +193,7 @@ interface paths {
193
193
  * List the client's apps
194
194
  * @description The apps of a client. Secrets never travel here: to read one, ask for it explicitly with the `secret` endpoint.
195
195
  *
196
- * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. It also needs the **Custom plan** (`ERROR_CODE_542`): apps are what that plan adds, and they are the door to this whole API.
196
+ * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. **No plan is required**: apps are on all four plans, the free one included — what the plan decides is how many you can hold at once and how fast you can call.
197
197
  */
198
198
  get: operations["getClientApps"];
199
199
  put?: never;
@@ -201,15 +201,15 @@ interface paths {
201
201
  * Create an app
202
202
  * @description Creates the app and its credentials.
203
203
  *
204
- * **A client can have one app.** Creating a second answers error 536. If you need to rotate credentials, update the existing app rather than creating another.
204
+ * **How many apps fit is decided by the plan**, not by a fixed limit of one: 1 on free, 2 on basic, 5 on pro and 10 on custom. Going over answers `ERROR_CODE_1308`, which carries `limit` and `used` in its `data`. Deleting an app frees its slot immediately, because only live apps count. If you just need to rotate credentials, update the existing app rather than creating another.
205
+ *
206
+ * **The user's email must be verified** (`ERROR_CODE_546`). This is the only route in `/apps` that asks for it: an app is a key to the whole public API, and this is what stops a throwaway address from minting them in bulk. Reading, updating and deleting an app you already own do not check it.
205
207
  *
206
208
  * Every URL is validated: a bad entry in `allowed_domains` answers 531, in `redirect_urls` 532, and a bad `webhook_url` answers 535.
207
209
  *
208
210
  * **The secret is not in the response.** Read it with `GET /clients/{id_client}/apps/{id_app}/secret`.
209
211
  *
210
- * **A client can only have ONE app.** Creating a second one is rejected with `ERROR_CODE_536`: delete or update the one that exists. The listing is paginated because every listing in this API is, not because there can be more than one.
211
- *
212
- * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. It also needs the **Custom plan** (`ERROR_CODE_542`): apps are what that plan adds, and they are the door to this whole API.
212
+ * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. **No plan is required**: apps are on all four plans, the free one included — what the plan decides is how many you can hold at once and how fast you can call.
213
213
  */
214
214
  post: operations["createClientApp"];
215
215
  delete?: never;
@@ -229,7 +229,7 @@ interface paths {
229
229
  * Get one app
230
230
  * @description The app's record, without its secret. Note the envelope: `{client_app}` here, `{client_apps, total}` in the list.
231
231
  *
232
- * **An app token works here.** This is the one part of `/apps` that does: an app can read and update its own record, but it cannot list, create, delete, or read the secret. The **Custom plan** is still required (`ERROR_CODE_542`).
232
+ * **An app token works here.** This is the one part of `/apps` that does: an app can read and update its own record, but it cannot list, create, delete, or read the secret. **No plan is required**: apps are on all four plans, the free one included.
233
233
  */
234
234
  get: operations["getClientApp"];
235
235
  /**
@@ -240,7 +240,7 @@ interface paths {
240
240
  *
241
241
  * **It replaces every field with what the body carries.** `name`, `keycloak_client_idenfifier`, `allowed_domains`, `redirect_urls` and `webhook_url` are all written as sent, so omitting one erases it — sending an update without `webhook_url` turns the webhook off. Read the app first and send it back whole.
242
242
  *
243
- * **An app token works here.** This is the one part of `/apps` that does: an app can read and update its own record, but it cannot list, create, delete, or read the secret. The **Custom plan** is still required (`ERROR_CODE_542`).
243
+ * **An app token works here.** This is the one part of `/apps` that does: an app can read and update its own record, but it cannot list, create, delete, or read the secret. **No plan is required**: apps are on all four plans, the free one included.
244
244
  */
245
245
  put: operations["updateClientApp"];
246
246
  post?: never;
@@ -248,7 +248,7 @@ interface paths {
248
248
  * Delete an app
249
249
  * @description Revokes the credentials and marks the app as deleted. **Tokens already issued stop working**: the token endpoint checks that the app still exists before answering, and requests carrying an old token no longer resolve to an app.
250
250
  *
251
- * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. It also needs the **Custom plan** (`ERROR_CODE_542`): apps are what that plan adds, and they are the door to this whole API.
251
+ * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. **No plan is required**: apps are on all four plans, the free one included — what the plan decides is how many you can hold at once and how fast you can call.
252
252
  */
253
253
  delete: operations["deleteClientApp"];
254
254
  options?: never;
@@ -269,7 +269,7 @@ interface paths {
269
269
  *
270
270
  * The same secret is what signs the outgoing webhooks (`x-hub-signature`, `x-hub-signature-256`).
271
271
  *
272
- * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. It also needs the **Custom plan** (`ERROR_CODE_542`): apps are what that plan adds, and they are the door to this whole API.
272
+ * **Needs a USER token, not an app token.** With client credentials it answers `ERROR_CODE_512`. **No plan is required**: apps are on all four plans, the free one included — what the plan decides is how many you can hold at once and how fast you can call.
273
273
  *
274
274
  * It comes straight from Keycloak, so it is the live secret and not a copy: treat the response as a credential and never log it.
275
275
  */
@@ -351,7 +351,7 @@ interface paths {
351
351
  put?: never;
352
352
  /**
353
353
  * Create an AI publication plan
354
- * @description Create a weekly AI publication plan. The plan is queued in state 'pending' and generated asynchronously by the generate-ai-plans job; poll GET by id while state is pending or generating. Validations at creation: the client plan allows AI (artificial_inteligence), the accounts belong to the organization, there are enough AI credits for the deterministic base cost (orchestration + target texts), and there is room in the organization's monthly publication limit. Returns the created plan together with the deterministic cost estimate. Requires the ai_plans:create permission. Since the plan can be generated from a SOURCE (`template` + `source`), part of that validation is the source itself: the article is downloaded, the catalogue is read live and the product pictures are copied — all of it inside this request, so what does not work fails with the user in front of it. A plan whose source did not fit in the week is still created, and says so in ai_plan.warnings (2117).
354
+ * @description Create a weekly AI publication plan. The plan is queued in state 'pending' and generated asynchronously by the generate-ai-plans job; poll GET by id while state is pending or generating. Validations at creation: the client plan allows AI (it contracts AI credits; Free does not), the accounts belong to the organization, there are enough AI credits for the deterministic base cost (orchestration + target texts), and there is room in the organization's monthly publication limit. Returns the created plan together with the deterministic cost estimate. Requires the ai_plans:create permission. Since the plan can be generated from a SOURCE (`template` + `source`), part of that validation is the source itself: the article is downloaded, the catalogue is read live and the product pictures are copied — all of it inside this request, so what does not work fails with the user in front of it. A plan whose source did not fit in the week is still created, and says so in ai_plan.warnings (2117).
355
355
  */
356
356
  post: operations["addAiPlan"];
357
357
  delete?: never;
@@ -752,6 +752,8 @@ interface paths {
752
752
  * **A temporal connect token is spent here.** Once this call succeeds, that token cannot connect anything else and answers error 543; the `enable` calls that finish the same connection still work until it expires. And if the token was issued for one network, calling this for another answers error 544.
753
753
  *
754
754
  * **Telegram does not come through here, and cannot be made to.** That network has no callback: the account is created by PlanVortex when the bot is added to a channel, and what authorizes it is a single-use voucher minted at that moment and spent in the same breath — it never leaves the server, so calling this endpoint for `telegram` answers error 700. It is deliberate: the bot is shared, so without it anyone could hang any channel where that bot is an admin off their own organization by passing a chat id by hand. What an integration listens for instead is the `new_account` webhook notification.
755
+ *
756
+ * **And a Telegram account arrives already active.** In the other twelve networks this endpoint hands you accounts that are still off, and you pick which ones spend a plan slot with `POST .../accounts/{id_account}/enable`. Here there is nothing to call: one channel arrives — the one the person picked in Telegram — and PlanVortex takes the slot for it right then. If the plan has no free slot the account is still created, off, and the person is told so in the bot chat; `GET /organizations/{id_organization}/accounts` will not list it, because that listing only returns active accounts, but naming it in the `accounts` filter does return it.
755
757
  */
756
758
  get: operations["connectAccount"];
757
759
  put?: never;
@@ -896,6 +898,10 @@ interface paths {
896
898
  * @description Brings back an account that was removed, without going through the authorization again — as long as its stored token still works.
897
899
  *
898
900
  * It takes a **slot of the plan**, so it fails with error 706 when the organization is already at its account limit. It also turns the network's webhooks back on, on any plan but the free one.
901
+ *
902
+ * **On `telegram` you normally never call this.** That network's accounts are born active — there is no authorization return in which to choose them, so PlanVortex takes the slot when the bot is added to the channel. The one case left is a channel that arrived while the plan was full: it stays off until a slot frees up, and this is what turns it on.
903
+ *
904
+ * **On `slack` this is also what puts the PlanVortex app inside the channel**, with `conversations.join`. It works on a **public** channel and it cannot work on a private one: Slack has no API for joining one. The account is enabled all the same and the connection looks healthy, and then the first publication fails with error 980 — so a private channel has to be told to the person **before** they pick it, together with the `/invite @PlanVortex` they have to run in that channel. Whether the app is inside travels in `extra_data.is_member`, and it can turn `false` later, the day somebody removes the app from an already connected channel.
899
905
  */
900
906
  post: operations["enableAccount"];
901
907
  delete?: never;
@@ -1358,7 +1364,7 @@ interface paths {
1358
1364
  *
1359
1365
  * **An app cannot call this.** Connecting a social account is an OAuth flow with a person in front of it, so this endpoint only accepts a user token or a temporal connect token; with app credentials it answers error 519. The way an integration does it is to issue a temporal connect token with `GET /organizations/{id_organization}/temporal_connect_token` and hand it to its end user.
1360
1366
  *
1361
- * **Read `authorization`, not `link`.** Ten of the twelve networks are `redirect` and you send the person to `link`. Two are not, and neither of them fails visibly if you treat it as one:
1367
+ * **Read `authorization`, not `link`.** Eleven of the thirteen networks are `redirect` and you send the person to `link`. Two are not, and neither of them fails visibly if you treat it as one:
1362
1368
  *
1363
1369
  * • **WhatsApp is not a URL at all.** Its sign-up is Meta's Embedded Signup, a popup you raise with the Facebook JavaScript SDK, so its `link` is an empty string and everything you need to open that popup travels in `authorization`. A client that loops over the list and redirects to `link` sends its user to its own page.
1364
1370
  * • **Telegram has a link and still is not a redirect.** It opens a chat with the PlanVortex bot, and nobody comes back from it: the account is born minutes later, from the bot being added to a channel, and it is announced over the WebSocket. Open it in another tab and keep listening; redirect to it and there is nobody left to tell.
@@ -2502,9 +2508,9 @@ interface components {
2502
2508
  /**
2503
2509
  * @description A social account connected to an organization.
2504
2510
  *
2505
- * On `discord` and on `telegram` an account is a **channel**, not a profile: publishing to two Discord channels of the same server — or to two Telegram channels of the same brand — costs two accounts of the plan.
2511
+ * On `discord`, on `telegram` and on `slack` an account is a **channel**, not a profile: publishing to two Discord channels of the same server — or to two Telegram channels of the same brand, or to `#anuncios` and `#general` of the same Slack workspace — costs two accounts of the plan.
2506
2512
  *
2507
- * `error_code` other than `0` means the connection is broken — an expired token, a permission taken away — and the account has to be connected again. On `telegram` nothing expires, because there is no account token: what breaks the connection is the bot being removed from the channel or losing its permission to post there (error 968).
2513
+ * `error_code` other than `0` means the connection is broken — an expired token, a permission taken away — and the account has to be connected again. On `telegram` nothing expires, because there is no account token: what breaks the connection is the bot being removed from the channel or losing its permission to post there (error 968). On `slack` the bot token does not expire either: what breaks it is the app being removed from the channel (error 980) or the channel being archived or deleted (error 985).
2508
2514
  */
2509
2515
  Account: {
2510
2516
  _id: string;
@@ -2512,7 +2518,7 @@ interface components {
2512
2518
  creation_date: string;
2513
2519
  /** @description `0` is a healthy account. Anything else is a PlanVortex error code explaining why the connection stopped working; the account keeps its data but cannot be used until it is reconnected. */
2514
2520
  error_code: number;
2515
- /** @description Followers the network reports. Absent on an account that has never been measured. On `telegram` it is the channel's member count, and it is the **only** audience figure that network publishes: there are no views, no impressions and no reach anywhere in the Bot API. */
2521
+ /** @description Followers the network reports. Absent on an account that has never been measured. On `telegram` and on `slack` it is the channel's member count, and it is the **only** audience figure either network publishes: there are no views, no impressions and no reach anywhere in the Bot API nor in the Slack Web API. */
2516
2522
  followers_count?: number;
2517
2523
  /** @description The client the organization hangs from. Denormalized here for the plan checks. */
2518
2524
  id_client: string;
@@ -2581,7 +2587,7 @@ interface components {
2581
2587
  /**
2582
2588
  * @description **How** an account of this network is authorized, which is not always "send the user to this URL".
2583
2589
  *
2584
- * Ten of the twelve networks are `redirect`: open `link` and the network sends the person back to PlanVortex with a code. Two are not:
2590
+ * Eleven of the thirteen networks are `redirect`: open `link` and the network sends the person back to PlanVortex with a code. Two are not:
2585
2591
  *
2586
2592
  * • **WhatsApp.** Its sign-up is Meta's *Embedded Signup*: a popup raised by the Facebook JavaScript SDK from your own page, which returns — over `postMessage` — session data (`waba_id`, `phone_number_id`) that no query string carries. Its `link` is therefore an empty string.
2587
2593
  * • **Telegram.** There is no OAuth here: no consent screen, no `code`, no account token. `link` opens a private chat with the PlanVortex bot, the person then adds that bot to their channel, and **the account is created from that event**, not from any request of yours. Which means the connection cannot be finished by calling `GET /organizations/{id_organization}/account-connect/telegram` — see that endpoint.
@@ -3048,13 +3054,21 @@ interface components {
3048
3054
  characters: components["schemas"]["CatalogSocialLimitsMap"];
3049
3055
  /** @description Maximum length of a reply to a comment. `0` means the network has no comments. */
3050
3056
  comment_characters: components["schemas"]["CatalogSocialLimitsMap"];
3051
- /** @description Maximum size of one file, in megabytes. */
3057
+ /**
3058
+ * @description Maximum size of one file, in megabytes.
3059
+ *
3060
+ * **On `slack` this one is a ceiling, not a promise.** 1.024 MB is what the network allows; the real limit is the lesser of that and the storage the client's own workspace plan still has, which no API exposes. A file inside this number can still come back as error 986. It is the only key in this map with that property.
3061
+ */
3052
3062
  max_file_size_mb: components["schemas"]["CatalogSocialLimitsMap"];
3053
3063
  /** @description Second text limit, in UTF-8 bytes. `0` means the network does not measure text in bytes; only Bluesky does, at 3.000. */
3054
3064
  max_post_bytes: components["schemas"]["CatalogSocialLimitsMap"];
3055
3065
  /** @description Maximum length of the title. `0` means the network has no title field at all. */
3056
3066
  title_characters: components["schemas"]["CatalogSocialLimitsMap"];
3057
- /** @description How many images one publication accepts. `0` means images are not a publication on that network. */
3067
+ /**
3068
+ * @description How many images one publication accepts. `0` means images are not a publication on that network.
3069
+ *
3070
+ * **On `discord`, `threads` and `slack` it counts images and videos together**, because there the carousel is one message carrying several attachments and not several publications: what is validated is the total number of files. Over it, the publication is created in state `withErrors` — on `slack` with `publication_errors[].code = 982`.
3071
+ */
3058
3072
  total_images: components["schemas"]["CatalogSocialLimitsMap"];
3059
3073
  /** @description Maximum video duration. A network that limits weight instead of duration is not here but in `max_file_size_mb`. */
3060
3074
  video_duration_in_seconds: components["schemas"]["CatalogSocialLimitsMap"];
@@ -3645,7 +3659,7 @@ interface components {
3645
3659
  * The catalogue grows with the product, so treat an unknown `code` as a generic failure instead of rejecting it.
3646
3660
  */
3647
3661
  Error: {
3648
- /** @description PlanVortex error code. Ranges: 500-546 auth, tokens and client apps · 601-612 user · 700-715 social accounts · 800-810 files · 900-979 publications · 1000-1003 general · 1100-1111 organizations · 1200-1207 roles · 1300-1308 client plan · 1400-1408 organization plan · 1500-1512 messaging · 1600-1601 contacts · 1900-1906 payments · 2000-2099 products · 2100-2199 AI plans · 2200-2299 integrations. */
3662
+ /** @description PlanVortex error code. Ranges: 500-546 auth, tokens and client apps · 601-612 user · 700-715 social accounts · 800-810 files · 900-986 publications · 1000-1003 general · 1100-1111 organizations · 1200-1207 roles · 1300-1308 client plan · 1400-1408 organization plan · 1500-1512 messaging · 1600-1601 contacts · 1900-1906 payments · 2000-2099 products · 2100-2199 AI plans · 2200-2299 integrations. */
3649
3663
  code: number;
3650
3664
  /** @description Extra context attached to the error, when there is any. */
3651
3665
  data?: {
@@ -4030,33 +4044,31 @@ interface components {
4030
4044
  total?: number;
4031
4045
  users?: components["schemas"]["OrganizationsUser"][];
4032
4046
  };
4033
- /** @description The resources a plan grants. On a client it is what was contracted; on an organization, the slice of it that was assigned. The sum across all the organizations of a client can never exceed what the client has contracted. */
4047
+ /**
4048
+ * @description The resources a plan grants. On a client it is what was contracted; on an organization, the slice of it that was assigned. The sum across all the organizations of a client can never exceed what the client has contracted.
4049
+ *
4050
+ * Users are NOT here: every plan has unlimited users, so they are neither charged nor split between organizations. They are still counted, in `PlanUseData.users`. There are no `artificial_inteligence`, `whatsapp` or `stats` flags either: statistics and WhatsApp are on every plan, and what gates AI is `ai_credits` — a plan with credits has AI, and Free has zero.
4051
+ */
4034
4052
  PlanData: {
4035
4053
  /** @description Social accounts that may be connected. */
4036
4054
  accounts: number;
4037
4055
  /** @description Monthly AI credits (1 credit = $0.001 of provider cost): 15 per plan orchestration pass, 2 per generated text, 70 per generated image. Resets monthly and does not roll over. A client using its own provider key (BYOK) does not consume them in that scope. */
4038
4056
  ai_credits?: number;
4039
- /** @description Apps this plan allows: 1 on Free, 2 on Basic, 5 on Pro, 10 on Custom. Each one is a `client_id` with a secret, so each one is a key to the whole public API — which every plan has, Free included. Unlike accounts, users or storage this is NOT split between organizations: an app belongs to the client. On a use payload it is how many exist right now. */
4057
+ /** @description Apps this plan allows: 1 on Free, 2 on Basic, 5 on Pro, 10 on Custom. Each one is a `client_id` with a secret, so each one is a key to the whole public API — which every plan has, Free included. Unlike accounts or storage this is NOT split between organizations: an app belongs to the client. On a use payload it is how many exist right now. */
4040
4058
  apps?: number;
4041
- /** @description Whether AI generation is enabled. */
4042
- artificial_inteligence?: boolean;
4043
4059
  /** @description Connections to a third-party tool material is pulled from (Google Drive, an RSS feed). Not the same thing as an app: an app is API access, and it has its own allowance in `apps`. */
4044
4060
  integrations: number;
4045
4061
  /** @description Storage, in GB. */
4046
4062
  space: number;
4047
- /** @description Whether statistics collection is enabled. */
4048
- stats?: boolean;
4049
4063
  /** @description Monthly X (Twitter) credits. X bills per use: 15 per post, 200 if the text contains a link, 15 per deletion, 1 per stat read, 1 per timeline item. The pool resets on the 1st of each calendar month and does not roll over. */
4050
4064
  twitter_credits?: number;
4051
- /** @description Users with access. */
4052
- users: number;
4053
- /** @description Whether WhatsApp may be connected. */
4054
- whatsapp?: boolean;
4055
4065
  };
4056
- /** @description What is being consumed right now. Same shape as PlanData plus `publications`, which is counted but neither charged nor split between organizations. */
4066
+ /** @description What is being consumed right now. Same shape as PlanData plus `publications` and `users`, which are counted but neither charged nor split between organizations. */
4057
4067
  PlanUseData: {
4058
4068
  /** @description Publications created in the current calendar month. A METRIC, not a quota: publications are unlimited on every plan, so there is no limit to compare it against. What throttles publishing is rate, not plan — see the per-hour and per-network daily caps. */
4059
4069
  publications?: number;
4070
+ /** @description Users with access right now. A METRIC, not a quota: users are unlimited on every plan, so there is no limit to compare it against. */
4071
+ users?: number;
4060
4072
  } & components["schemas"]["PlanData"];
4061
4073
  /** @description A product as the network returns it. `id` is always present here. */
4062
4074
  ProductsProduct: components["schemas"]["ProductsProductInput"];
@@ -4173,7 +4185,11 @@ interface components {
4173
4185
  };
4174
4186
  /** @description Body accepted when creating or updating a publication. Only these properties are read; anything else in the payload is ignored. */
4175
4187
  PublicationsPublicationInput: {
4176
- /** @description Identifiers of uploads previously created through the uploads endpoints, attached to this publication. */
4188
+ /**
4189
+ * @description Identifiers of uploads previously created through the uploads endpoints, attached to this publication.
4190
+ *
4191
+ * **On Slack the files travel inside the message**, not as publications of their own: up to 10 attachments counting images and videos together (`publication_errors[].code = 982` over it), each one under the `max_file_size_mb.slack` ceiling (code 983), and anything the upload itself refuses comes back as code 986.
4192
+ */
4177
4193
  files?: string[];
4178
4194
  /** @description Internal name for the publication. Useful for grouping; never shown on the social network. */
4179
4195
  name?: string;
@@ -4193,7 +4209,7 @@ interface components {
4193
4209
  * Not every connectable network publishes — a local business listing receives reviews, not posts — so this list is shorter than the one in `GET /social_networks`. Ask `GET /allowed_social_publications` rather than hardcoding it, because it grows.
4194
4210
  * @enum {string}
4195
4211
  */
4196
- social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord" | "telegram" | "threads";
4212
+ social_network?: "facebook" | "instagram" | "twitter" | "linkedin" | "tiktok" | "whatsapp" | "youtube" | "bluesky" | "discord" | "telegram" | "threads" | "slack";
4197
4213
  /**
4198
4214
  * @description Send `draft` to store the publication without publishing it. If omitted, the state is resolved automatically: `ready` when everything validates, `withErrors` otherwise. Forcing `sended` marks it as published without actually sending it.
4199
4215
  * @enum {string}
@@ -4203,6 +4219,8 @@ interface components {
4203
4219
  * @description Body text of the publication. Either `text` or at least one entry in `files` is required: if both are empty the publication is still created, but in state `withErrors` with `publication_errors[].code = 915`. Maximum length depends on the network. On YouTube this is the video **description** (5,000 characters), and the publication must carry exactly one video file and no images — otherwise it is created in state `withErrors` with `publication_errors[].code = 943`. For X (Twitter), a text containing a link costs 200 credits instead of 15.
4204
4220
  *
4205
4221
  * **On Telegram the limit depends on what else the publication carries**: 4.096 characters while it is text only, and **1.024** the moment it has an image or a video, because then the text is the caption of a photo, a video or an album and no longer a message. Over the limit it is created in state `withErrors` with `publication_errors[].code = 967`, whose `data` carries `characters`, `max_characters` and `has_media`. Both numbers are published, as `characters.telegram` and `characters.telegram_media` in `GET /social_limits`.
4222
+ *
4223
+ * **On Slack the limit is 4.000 characters** and it is counted over the text you send, not over what travels: `&`, `<` and `>` are escaped before publishing, so a text made of ampersands grows on the wire and is still measured here. Over the limit the publication is created in state `withErrors` with `publication_errors[].code = 981`. And because the escaped text is what is measured on the wire, a text that passed at 4.000 characters and is full of `&` is **trimmed** before going out — Slack does not reject a long `text`, it truncates it or splits it into several messages, and one publication showing up as two posts is worse. The text goes out **plain**: Slack speaks *mrkdwn* and not Markdown, and PlanVortex sends no `blocks`, so `**bold**` is published literally.
4206
4224
  */
4207
4225
  text?: string;
4208
4226
  /** @description Title for the publication. Only some networks use it: optional on LinkedIn, and **required on YouTube**, where it is the video title and must be 100 characters or fewer — a publication without it, or with a longer one, is created in state `withErrors` with `publication_errors[].code = 944`. */
@@ -4308,6 +4326,8 @@ interface components {
4308
4326
  * On `threads` there are six, and the one that matters is `views`: it is the only one of the four newest networks with something like impressions, so its engagement rate is computed over a real base and not over followers. Sharing arrives split in three — `reposts`, `quotes` and `shares` (outside Threads) — and the three are added into one figure, the same criterion as on X; the breakdown stays in `raw`. A reply is what every other network calls a comment.
4309
4327
  *
4310
4328
  * On `telegram` there are two as well, and **neither of them is asked for**: the Bot API has no method that returns a message's metrics, so `reactions` arrives on its own through the bot and `comments` is counted in PlanVortex's own inbox. There are no impressions, no reach, no views and no forwards to be had anywhere in it, so engagement is computed over followers.
4329
+ *
4330
+ * On `slack` there is exactly **one**, `reactions`, and the other absences are the informative part: the Web API publishes no impressions, no reach, no views and no clicks for a message, so those keys are missing rather than zero. There is no `comments` either — Slack threads are not read at all (`comments` is `false` in `GET /social_capabilities`). Engagement is computed over the channel's members.
4311
4331
  */
4312
4332
  PublicationStats: {
4313
4333
  angers?: number;
@@ -4338,7 +4358,7 @@ interface components {
4338
4358
  profile_visits?: number;
4339
4359
  quotes?: number;
4340
4360
  reach?: number;
4341
- /** @description Telegram. Every reaction on the post, all emoji together. It is the **complete state and not an increment**: it goes down when somebody takes theirs back. Normalised as `likes`. */
4361
+ /** @description Telegram and Slack. Every reaction on the post, all emoji together. It is the **complete state and not an increment**: it goes down when somebody takes theirs back. Normalised as `likes`. On `slack` it is the only metric the network gives. */
4342
4362
  reactions?: number;
4343
4363
  /** @description Telegram. The same total broken down by emoji. Reactions with a custom emoji are grouped under a single key: their identifier means nothing outside the server that created it. */
4344
4364
  reactions_by_emoji?: {
@@ -4392,7 +4412,7 @@ interface components {
4392
4412
  * **This list grows.** Treat it as an open enumeration: a client that rejects an unknown value breaks the day a network is added, which happens several times a year. Not every network does everything — ask `GET /social_capabilities`.
4393
4413
  * @enum {string}
4394
4414
  */
4395
- SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram" | "threads";
4415
+ SocialNetwork: "facebook" | "instagram" | "linkedin" | "tiktok" | "twitter" | "whatsapp" | "youtube" | "google_business" | "bluesky" | "discord" | "telegram" | "threads" | "slack";
4396
4416
  /** @description Statistics collection settings. Only `auto_refresh_twitter` is read; any other key is ignored. */
4397
4417
  StatsSettings: {
4398
4418
  /**
@@ -7170,11 +7190,11 @@ interface operations {
7170
7190
  };
7171
7191
  deleteMessageTemplate: {
7172
7192
  parameters: {
7173
- query?: {
7193
+ query: {
7174
7194
  /** @description Identifier of the template on the network. */
7175
- template_id?: string;
7195
+ template_id: string;
7176
7196
  /** @description Name of the template on the network. */
7177
- template_name?: string;
7197
+ template_name: string;
7178
7198
  };
7179
7199
  header?: never;
7180
7200
  path: {
@@ -10896,7 +10916,8 @@ interface operations {
10896
10916
  * "bluesky",
10897
10917
  * "discord",
10898
10918
  * "telegram",
10899
- * "threads"
10919
+ * "threads",
10920
+ * "slack"
10900
10921
  * ]
10901
10922
  */
10902
10923
  "application/json": components["schemas"]["SocialNetwork"][];
@@ -10978,9 +10999,9 @@ interface operations {
10978
10999
  * de una organizacion. Aqui se llama `PublicationInput`. Los que describen LO MISMO en varias
10979
11000
  * secciones viven en `common.json` y conservan su nombre —`Publication`, `Account`, `Upload`,
10980
11001
  * `Message`, `Contact`, `NormalizedMetrics`—: es lo que evita dos tipos para un solo objeto.
10981
- * 2. **Abre las enumeraciones que crecen** (§ trampa 8 del roadmap). `ALLOWED_RRSS` va por diez
11002
+ * 2. **Abre las enumeraciones que crecen** (§ trampa 8 del roadmap). `ALLOWED_RRSS` va por trece
10982
11003
  * redes y sube varias veces al ano. Si `social_network` fuera una union cerrada, el dia que
10983
- * entre la undecima **dejaria de compilar el codigo de todos los integradores** hasta que
11004
+ * entre la siguiente **dejaria de compilar el codigo de todos los integradores** hasta que
10984
11005
  * actualizasen el paquete, y lo unico que habria pasado es que la API devuelve un valor mas.
10985
11006
  * Con `T | (string & {})` se autocompletan las conocidas y una nueva sigue compilando.
10986
11007
  * 3. **Avisa de lo que el tipo no puede decir por si solo**, como que `public_path` caduca.
@@ -11059,8 +11080,9 @@ type FileFormat = OpenEnum<Schemas["Upload"]["file_format"]>;
11059
11080
  * Sobre que se divide el engagement de una publicacion.
11060
11081
  *
11061
11082
  * No todas las redes dan alcance, asi que se cae en cascada: `reach`, si no `impressions`, si no
11062
- * `followers` (que es lo unico que hay en Bluesky, en Discord y en Telegram — la Bot API no
11063
- * publica impresiones, ni alcance, ni siquiera las vistas de un post). **Dos filas con base
11083
+ * `followers` (que es lo unico que hay en Bluesky, en Discord, en Telegram y en Slack — ni la
11084
+ * Bot API ni la Web API publican impresiones, ni alcance, ni siquiera las vistas de un post).
11085
+ * **Dos filas con base
11064
11086
  * distinta no son comparables**: si las pones en la misma tabla, di cual es.
11065
11087
  */
11066
11088
  type EngagementBase = OpenEnum<NonNullable<Schemas["PublicationsPublicationStatsPoint"]["engagement_base"]>>;
@@ -11199,8 +11221,9 @@ type ClientWithOrganizations = Operations["getClientsWithOrganizations"]["respon
11199
11221
  /**
11200
11222
  * Una cuenta social conectada a una organizacion.
11201
11223
  *
11202
- * En Discord y en Telegram una cuenta es un **canal**, no un perfil: publicar en dos canales del
11203
- * mismo servidor —o en dos canales de la misma marca— gasta dos cuentas del plan. `error_code`
11224
+ * En Discord, en Telegram y en Slack una cuenta es un **canal**, no un perfil: publicar en dos
11225
+ * canales del mismo servidor —o en dos canales de la misma marca, o en `#anuncios` y `#general`
11226
+ * del mismo workspace— gasta dos cuentas del plan. `error_code`
11204
11227
  * distinto de 0 significa que la conexion se rompio —token caducado, permisos retirados— y hay que
11205
11228
  * reconectarla; en Telegram no caduca nada, porque no hay token de cuenta, y lo que la rompe es que
11206
11229
  * saquen al bot del canal o le quiten el permiso de publicar (error 968).
@@ -11251,7 +11274,7 @@ type ConnectToken = Operations["createTemporalConnectToken"]["responses"][200]["
11251
11274
  */
11252
11275
  type ConnectLink = Schemas["AccountsSocialLinksList"]["links"][number];
11253
11276
  /**
11254
- * Con que se autoriza una red: `redirect` (nueve de las once), `meta_embedded_signup` (WhatsApp) o
11277
+ * Con que se autoriza una red: `redirect` (once de las trece), `meta_embedded_signup` (WhatsApp) o
11255
11278
  * `telegram_bot` (Telegram). Se saca de {@link ConnectLink} y esta aqui para poder nombrarlo en un
11256
11279
  * `switch`.
11257
11280
  *
@@ -11868,8 +11891,9 @@ declare class AccountError extends PlanVortexError {
11868
11891
  /** 800-810 — ficheros: formato no admitido, demasiado grande, conversión fallida. */
11869
11892
  declare class FileError extends PlanVortexError {
11870
11893
  }
11871
- /** 900-979 — publicaciones, incluidos los límites por red (caracteres, imágenes, duración) y los
11872
- * dos frenos de ritmo: 978 (demasiado rápido en esta cuenta) y 979 (tope diario de esa red). */
11894
+ /** 900-986 — publicaciones, incluidos los límites por red (caracteres, imágenes, duración), los
11895
+ * dos frenos de ritmo —978 (demasiado rápido en esta cuenta) y 979 (tope diario de esa red)— y
11896
+ * los de Slack (980-986), que empiezan por el más común: 980, la app no está en el canal. */
11873
11897
  declare class PublicationError extends PlanVortexError {
11874
11898
  }
11875
11899
  /** 1100-1111 — organizaciones, y el token temporal atado a una sola de ellas (1101). */