@surnie/plugin-kit 0.2.3 → 0.2.5

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/cli.js +24 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1057,10 +1057,19 @@ type SurnieTranslate = (key: string, vars?: Record<string, string | number>) =>
1057
1057
  type SurnieViewer = { id: string; name: string };
1058
1058
 
1059
1059
  /** El tercer argumento de una funci\xF3n o una acci\xF3n: qui\xE9n la pide, su idioma y los textos del plugin. */
1060
- type SurniePanelContext = { user: SurnieViewer; locale: string; t: SurnieTranslate };
1060
+ /**
1061
+ * Qui\xE9n mira, en una funci\xF3n o una acci\xF3n del panel. \`permissions\`: los permisos de panel.permissions
1062
+ * que tiene (el admin, todos). Una funci\xF3n se puede pedir desde cualquier pantalla o widget que quien
1063
+ * mira abra: la que cambia algo comprueba aqu\xED el suyo.
1064
+ */
1065
+ type SurniePanelContext = { user: SurnieViewer; permissions: readonly string[]; locale: string; t: SurnieTranslate };
1061
1066
 
1062
- /** Lo que devuelve una acci\xF3n: un aviso (opcional) y si el panel vuelve a leer la p\xE1gina (s\xED, por defecto). */
1063
- type SurnieActionAnswer = void | null | { toast?: string; tone?: "success" | "danger"; refresh?: boolean };
1067
+ /**
1068
+ * Lo que devuelve una acci\xF3n: un aviso (opcional), si el panel vuelve a leer la p\xE1gina (s\xED, por
1069
+ * defecto) y, con \`navigate\`, ad\xF3nde lleva: una pantalla tuya (\`"screen:<id>?param=valor"\`) o el
1070
+ * contenido del panel (\`"content:<apiId>[/<id>]"\`).
1071
+ */
1072
+ type SurnieActionAnswer = void | null | { toast?: string; tone?: "success" | "danger"; refresh?: boolean; navigate?: string };
1064
1073
 
1065
1074
  `;
1066
1075
  function settingType(s2) {
@@ -1089,6 +1098,8 @@ type SurnieUiContext = {
1089
1098
  readonly params: Readonly<Record<string, string>>;
1090
1099
  readonly locale: string;
1091
1100
  readonly user: Readonly<SurnieViewer>;
1101
+ /** Los permisos de panel.permissions que tiene quien mira (para ense\xF1ar o no un bot\xF3n). */
1102
+ readonly permissions: readonly string[];
1092
1103
  readonly t: SurnieTranslate;
1093
1104
  /** Llama a functions.<nombre> del servidor del plugin, con los permisos de quien mira. */
1094
1105
  call<T = unknown>(name: string, input?: unknown): Promise<T>;
@@ -1154,6 +1165,16 @@ function pluginTypes(m) {
1154
1165
  * l\xEDmite de fallos por registro (10 en 15 minutos): limita t\xFA tambi\xE9n por IP en tu ruta de login.
1155
1166
  */
1156
1167
  verifyPassword(input: { collection: string; id: string; field: string; value: string; locale?: string }): Promise<boolean>;
1168
+ };
1169
+ /** Los ficheros de la biblioteca de medios que est\xE1n en tus registros. */
1170
+ media: {
1171
+ /**
1172
+ * El enlace de descarga de \`media\` (su id), que tiene que estar en \`field\` del registro \`id\` de
1173
+ * \`collection\` (un campo media, una galer\xEDa o dentro de un componente). De un medio privado, firmado
1174
+ * y con caducidad (\`expiresIn\` segundos: 3600 por defecto, como mucho un d\xEDa); de uno p\xFAblico, su
1175
+ * direcci\xF3n (\`expiresAt\` null).
1176
+ */
1177
+ signedUrl(input: { collection: string; id?: string; field: string; media: string; expiresIn?: number; locale?: string }): Promise<{ url: string; expiresAt: string | null }>;
1157
1178
  };`);
1158
1179
  }
1159
1180
  if (userFields.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surnie/plugin-kit",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Kit para escribir plugins de Surnie: manifiesto, compilación reproducible, firma e inspección.",
5
5
  "type": "module",
6
6
  "bin": {