@customyai/cli 0.10.1 → 0.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @customyai/cli
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `customy apps sync` admite `CUSTOMY_ADMIN_SECRET` (cabecera `x-admin-secret`), el 401 dice qué credencial espera Access, `SyncResult` devuelve `publishableKey` y la CLI imprime `CUSTOMY_PUBLISHABLE_KEY` y `CUSTOMY_ENVIRONMENT_ID`.
8
+
3
9
  ## 0.10.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -7,16 +7,18 @@ También opera Customy WhatsApp (`customy whatsapp …`) y los catálogos de tra
7
7
  ```bash
8
8
  npm install --save-dev @customyai/cli
9
9
 
10
- npx customy apps validate # --file customy.app.json
11
- npx customy apps codegen --out src/customy.generated.ts
12
- CUSTOMY_ACCESS_URL=https://access-api.customy.ai CUSTOMY_ACCESS_TOKEN=… \
13
- npx customy apps sync --workspace-env <envId> # --reason "…"
10
+ # Fuera del monorepo el paquete se invoca por su nombre completo: `npx customy` NO es este paquete.
11
+ npx @customyai/cli apps validate # --file customy.app.json
12
+ npx @customyai/cli apps codegen --out src/customy.generated.ts
13
+ CUSTOMY_ACCESS_URL=https://access-api.customy.ai CUSTOMY_ADMIN_SECRET=… \
14
+ npx @customyai/cli apps sync --workspace-env <envId> # --reason "…"
15
+ # o, con el token de un administrador del Workspace: CUSTOMY_ACCESS_TOKEN=… (Bearer)
14
16
  ```
15
17
 
16
18
  - **validate**: sale 1 y enseña cada problema con su ruta (`plans.0.capabilities.missing: CAPABILITY_UNDECLARED`) e imprime cuántos eventos, capabilities, permisos y roles declara.
17
19
  - **permisos y roles** (opcionales): `permissions: [{ key, description }]` y `roles: [{ key, name, description?, permissions }]`. Las claves van en el espacio de nombres de la app (`<clave>.…`, en minúsculas y sin comodines), todo permiso de un rol debe estar declarado en `permissions[]` y hay topes (128 permisos, 32 roles, 128 permisos por rol). Para que la app asigne esos roles a sus miembros, pide los scopes `app-roles:read` / `app-roles:write` en el producto `customy-access`. Los errores salen como `permissions.0.key: PERMISSION_NAMESPACE_VIOLATION`, `roles.0.permissions.1: PERMISSION_UNDECLARED`.
18
20
  - **codegen**: escribe los tipos de la app — `CustomyEventName`, `CustomyEventProperties` (de los JSON Schema de sus eventos), `CustomyCapability`, `CustomyPlan`, `CustomyMeter`, `CustomyPermission` y `CustomyRole` (de `permissions[]` y `roles[]`), `CUSTOMY_ROLE_PERMISSIONS` (lo que da cada rol), `CustomyAppTypes` (todos juntos) y los propósitos por evento — para `createCustomy<CustomyAppTypes>()` y `createAccess<CustomyCapability, CustomyRole, CustomyPermission>()` de `@customyai/sdk` (con ellos `permissions.effective`, `appRoles.assignments.assign` y `me()` salen tipados y un nombre de rol mal escrito no compila), `createData<CustomyEventProperties>()` y `createBilling<CustomyMeter>()`.
19
- - **sync**: idempotente. Instala la app en el Workspace si no existe y publica una versión nueva del manifiesto sobre la revisión actual; Access lo lleva a cada producto y la CLI enseña cómo quedó cada uno (sale 1 si alguno falló; repetir `sync` lo repara). Si el manifiesto declara permisos o roles, enseña también cuántos quedaron reconciliados (y los huérfanos). Lee `CUSTOMY_ACCESS_URL` y `CUSTOMY_ACCESS_TOKEN` (el de un administrador del Workspace) del entorno, nunca de la línea de comandos, y nunca crea credenciales.
21
+ - **sync**: idempotente. Instala la app en el Workspace si no existe y publica una versión nueva del manifiesto sobre la revisión actual; Access lo lleva a cada producto y la CLI enseña cómo quedó cada uno (sale 1 si alguno falló; repetir `sync` lo repara). Si el manifiesto declara permisos o roles, enseña también cuántos quedaron reconciliados (y los huérfanos). Lee `CUSTOMY_ACCESS_URL` y una credencial del entorno, nunca de la línea de comandos: `CUSTOMY_ADMIN_SECRET` (cabecera `x-admin-secret`, la que acepta Access de producción; manda si están las dos) o `CUSTOMY_ACCESS_TOKEN` (`Authorization: Bearer` de un administrador del Workspace). Con `ADMIN_SECRET_MODE=require-actor` Access exige además quién y por qué: la CLI manda `x-reason` (el `--reason`, de 8+ caracteres) y `x-actor` si defines `CUSTOMY_ADMIN_ACTOR`. Un 401 dice qué credencial mandó la CLI y cuál espera Access. Al terminar imprime `CUSTOMY_PUBLISHABLE_KEY=pk_…` (no es secreta) y `CUSTOMY_ENVIRONMENT_ID=env_…` para pegarlos en el `.env` de la app; `syncApp` los devuelve como `publishableKey` y `environmentId`. Nunca crea credenciales. Desde un checkout del monorepo hace falta compilar antes (`pnpm --filter @customyai/cli... build`); `npm pack` se niega si falta `dist/bin.mjs`.
20
22
 
21
23
  ## Provisioning de usuarios de PRUEBA
22
24
 
package/dist/bin.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var chunk6X3AX6PB_cjs = require('./chunk-6X3AX6PB.cjs');
4
+ var chunkVKMVRAMV_cjs = require('./chunk-VKMVRAMV.cjs');
5
5
  require('./chunk-2A6WFLXS.cjs');
6
6
  var promises = require('readline/promises');
7
7
 
@@ -15,7 +15,7 @@ async function prompt(question) {
15
15
  }
16
16
  var interrupt = new AbortController();
17
17
  process.once("SIGINT", () => interrupt.abort());
18
- chunk6X3AX6PB_cjs.runCli(process.argv.slice(2), {
18
+ chunkVKMVRAMV_cjs.runCli(process.argv.slice(2), {
19
19
  signal: interrupt.signal,
20
20
  cwd: process.cwd(),
21
21
  env: process.env,
package/dist/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-57NNDUEX.mjs';
2
+ import { runCli } from './chunk-VA4VPLZ4.mjs';
3
3
  import './chunk-QKIF4C5R.mjs';
4
4
  import { createInterface } from 'readline/promises';
5
5
 
@@ -153,6 +153,8 @@ var CONNECTABLE_PRODUCT_MANIFESTS = [
153
153
  product("customy-data", [{ kind: "external_source", keys: ["analytics-source"], operations: { allowed: ["submit"], mode: "exact" } }]),
154
154
  // Experiments: las apps conectadas lo referencian para evaluar flags con su clave publicable; sin enlaces propios todavía (F5).
155
155
  product("customy-experiments"),
156
+ // Paywalls: las apps conectadas lo consumen por `decide` con su clave publicable; sin enlaces propios todavía (F2 trae el SDK).
157
+ product("customy-paywalls"),
156
158
  product("customy-analytics"),
157
159
  product("customy-campaigns", [{ kind: "external_communication", keys: ["weekly-brief"], operations: { allowed: ["read"], mode: "exact" } }]),
158
160
  product("customy-engagement", [{ kind: "external_communication", keys: ["notification-delivery", "operator-approval"], operations: { allowed: ["deliver_notification", "request_operator_approval"], mode: "subset" } }]),
@@ -364,33 +366,43 @@ function validateManifest(input) {
364
366
  return problems.length ? { ok: false, problems } : { ok: true, manifest: AppManifestSchema.parse(input) };
365
367
  }
366
368
  var SyncError = class extends Error {
367
- constructor(code, status2) {
368
- super(`${code} (${status2})`);
369
+ constructor(code, status2, hint) {
370
+ super(`${code} (${status2})${hint ? ` \u2014 ${hint}` : ""}`);
369
371
  this.code = code;
370
372
  this.status = status2;
373
+ this.hint = hint;
371
374
  }
372
375
  code;
373
376
  status;
377
+ hint;
374
378
  };
379
+ function rejectedCredentialHint(sent) {
380
+ return sent === "bearer" ? "Access rechaz\xF3 el Bearer (CUSTOMY_ACCESS_TOKEN). Access de producci\xF3n espera el secreto de administrador en la cabecera x-admin-secret: define CUSTOMY_ADMIN_SECRET" : "Access rechaz\xF3 x-admin-secret (CUSTOMY_ADMIN_SECRET). Comprueba el secreto de ese entorno o usa un token de administrador del Workspace en CUSTOMY_ACCESS_TOKEN (Bearer)";
381
+ }
375
382
  async function syncApp(options) {
376
383
  const base = options.accessUrl.replace(/\/$/, "");
377
384
  if (!/^https:\/\//.test(base) && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(base)) throw new SyncError("ACCESS_URL_INSECURE", 0);
385
+ const sent = options.adminSecret ? "x-admin-secret" : "bearer";
386
+ if (!options.adminSecret && !options.token) throw new SyncError("ACCESS_CREDENTIAL_MISSING", 0, "define CUSTOMY_ADMIN_SECRET (x-admin-secret) o CUSTOMY_ACCESS_TOKEN (Bearer)");
387
+ const credential = options.adminSecret ? { "x-admin-secret": options.adminSecret, "x-reason": options.reason.slice(0, 256), ...options.actor ? { "x-actor": options.actor } : {} } : { authorization: `Bearer ${options.token}` };
378
388
  const call = async (method, path6, body) => {
379
389
  const response = await (options.fetch ?? fetch)(`${base}${path6}`, {
380
390
  method,
381
- headers: { authorization: `Bearer ${options.token}`, "content-type": "application/json", "idempotency-key": crypto.randomUUID() },
391
+ headers: { ...credential, "content-type": "application/json", "idempotency-key": crypto.randomUUID() },
382
392
  body: JSON.stringify(body)
383
393
  });
384
394
  const json = await response.json().catch(() => ({}));
385
- if (!response.ok) throw new SyncError(String(json.code ?? json.error ?? "ACCESS_REQUEST_FAILED"), response.status);
395
+ if (!response.ok) throw new SyncError(String(json.code ?? json.error ?? "ACCESS_REQUEST_FAILED"), response.status, response.status === 401 ? rejectedCredentialHint(sent) : void 0);
386
396
  return json;
387
397
  };
388
398
  const env = encodeURIComponent(options.workspaceEnvironmentId);
389
399
  const installed = await call("POST", `/api/admin/env/${env}/connected-applications/install`, { manifest: options.manifest, reason: options.reason });
390
400
  const connection = installed.connection;
401
+ const key2 = installed.publishableKey ?? connection.publishableKey;
402
+ const publishableKey = typeof key2 === "string" && key2 ? key2 : null;
391
403
  const reconciliation = (value) => value && typeof value === "object" ? value : {};
392
404
  if (!installed.replayed) {
393
- return { action: "installed", applicationId: connection.applicationId, environmentId: connection.environmentId, revision: connection.revision, reconciliation: reconciliation(installed.reconciliation) };
405
+ return { action: "installed", applicationId: connection.applicationId, environmentId: connection.environmentId, revision: connection.revision, publishableKey, reconciliation: reconciliation(installed.reconciliation) };
394
406
  }
395
407
  const updated = await call("PUT", `/api/admin/env/${encodeURIComponent(connection.environmentId)}/connected-application/manifest`, {
396
408
  expectedRevision: connection.revision,
@@ -398,7 +410,7 @@ async function syncApp(options) {
398
410
  reason: options.reason
399
411
  });
400
412
  const revision = Number(updated.revision ?? connection.revision);
401
- return { action: updated.unchanged ? "unchanged" : "updated", applicationId: connection.applicationId, environmentId: connection.environmentId, revision, reconciliation: reconciliation(updated.reconciliation) };
413
+ return { action: updated.unchanged ? "unchanged" : "updated", applicationId: connection.applicationId, environmentId: connection.environmentId, revision, publishableKey, reconciliation: reconciliation(updated.reconciliation) };
402
414
  }
403
415
  var EXIT = { ok: 0, failure: 1, unsupported: 2, auth: 3, confirmation: 4 };
404
416
  var PROVISIONING_GROUPS = ["users", "audit", "policy", "whoami", "login"];
@@ -3211,8 +3223,9 @@ async function runCli(argv, io) {
3211
3223
  const workspaceEnvironmentId = option(args, "workspace-env");
3212
3224
  const accessUrl = io.env.CUSTOMY_ACCESS_URL;
3213
3225
  const token = io.env.CUSTOMY_ACCESS_TOKEN;
3214
- if (!workspaceEnvironmentId || !accessUrl || !token) {
3215
- io.err("sync necesita --workspace-env y las variables CUSTOMY_ACCESS_URL y CUSTOMY_ACCESS_TOKEN");
3226
+ const adminSecret = io.env.CUSTOMY_ADMIN_SECRET;
3227
+ if (!workspaceEnvironmentId || !accessUrl || !token && !adminSecret) {
3228
+ io.err("sync necesita --workspace-env, CUSTOMY_ACCESS_URL y una credencial: CUSTOMY_ADMIN_SECRET (x-admin-secret, producci\xF3n) o CUSTOMY_ACCESS_TOKEN (Bearer)");
3216
3229
  return 2;
3217
3230
  }
3218
3231
  try {
@@ -3220,12 +3233,19 @@ async function runCli(argv, io) {
3220
3233
  manifest,
3221
3234
  accessUrl,
3222
3235
  token,
3236
+ adminSecret,
3237
+ actor: io.env.CUSTOMY_ADMIN_ACTOR,
3223
3238
  workspaceEnvironmentId,
3224
3239
  reason: option(args, "reason") ?? `customy apps sync ${manifest.key}`,
3225
3240
  fetch: io.fetch
3226
3241
  });
3227
3242
  const verb = { installed: "instalada", updated: "actualizada", unchanged: "sin cambios" }[result.action];
3228
3243
  io.out(`\u2713 ${manifest.key} ${verb}: aplicaci\xF3n ${result.applicationId}, entorno ${result.environmentId}, revisi\xF3n ${result.revision} (${authorizationSummary(manifest)})`);
3244
+ if (result.publishableKey) {
3245
+ io.out("Para el .env de la app (la clave p\xFAblica no es secreta):");
3246
+ io.out(`CUSTOMY_PUBLISHABLE_KEY=${result.publishableKey}`);
3247
+ }
3248
+ io.out(`CUSTOMY_ENVIRONMENT_ID=${result.environmentId}`);
3229
3249
  let failed = false;
3230
3250
  for (const [product2, outcome] of Object.entries(result.reconciliation)) {
3231
3251
  if (outcome.status === "failed") {
@@ -159,6 +159,8 @@ var CONNECTABLE_PRODUCT_MANIFESTS = [
159
159
  product("customy-data", [{ kind: "external_source", keys: ["analytics-source"], operations: { allowed: ["submit"], mode: "exact" } }]),
160
160
  // Experiments: las apps conectadas lo referencian para evaluar flags con su clave publicable; sin enlaces propios todavía (F5).
161
161
  product("customy-experiments"),
162
+ // Paywalls: las apps conectadas lo consumen por `decide` con su clave publicable; sin enlaces propios todavía (F2 trae el SDK).
163
+ product("customy-paywalls"),
162
164
  product("customy-analytics"),
163
165
  product("customy-campaigns", [{ kind: "external_communication", keys: ["weekly-brief"], operations: { allowed: ["read"], mode: "exact" } }]),
164
166
  product("customy-engagement", [{ kind: "external_communication", keys: ["notification-delivery", "operator-approval"], operations: { allowed: ["deliver_notification", "request_operator_approval"], mode: "subset" } }]),
@@ -370,33 +372,43 @@ function validateManifest(input) {
370
372
  return problems.length ? { ok: false, problems } : { ok: true, manifest: AppManifestSchema.parse(input) };
371
373
  }
372
374
  var SyncError = class extends Error {
373
- constructor(code, status2) {
374
- super(`${code} (${status2})`);
375
+ constructor(code, status2, hint) {
376
+ super(`${code} (${status2})${hint ? ` \u2014 ${hint}` : ""}`);
375
377
  this.code = code;
376
378
  this.status = status2;
379
+ this.hint = hint;
377
380
  }
378
381
  code;
379
382
  status;
383
+ hint;
380
384
  };
385
+ function rejectedCredentialHint(sent) {
386
+ return sent === "bearer" ? "Access rechaz\xF3 el Bearer (CUSTOMY_ACCESS_TOKEN). Access de producci\xF3n espera el secreto de administrador en la cabecera x-admin-secret: define CUSTOMY_ADMIN_SECRET" : "Access rechaz\xF3 x-admin-secret (CUSTOMY_ADMIN_SECRET). Comprueba el secreto de ese entorno o usa un token de administrador del Workspace en CUSTOMY_ACCESS_TOKEN (Bearer)";
387
+ }
381
388
  async function syncApp(options) {
382
389
  const base = options.accessUrl.replace(/\/$/, "");
383
390
  if (!/^https:\/\//.test(base) && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/.test(base)) throw new SyncError("ACCESS_URL_INSECURE", 0);
391
+ const sent = options.adminSecret ? "x-admin-secret" : "bearer";
392
+ if (!options.adminSecret && !options.token) throw new SyncError("ACCESS_CREDENTIAL_MISSING", 0, "define CUSTOMY_ADMIN_SECRET (x-admin-secret) o CUSTOMY_ACCESS_TOKEN (Bearer)");
393
+ const credential = options.adminSecret ? { "x-admin-secret": options.adminSecret, "x-reason": options.reason.slice(0, 256), ...options.actor ? { "x-actor": options.actor } : {} } : { authorization: `Bearer ${options.token}` };
384
394
  const call = async (method, path6, body) => {
385
395
  const response = await (options.fetch ?? fetch)(`${base}${path6}`, {
386
396
  method,
387
- headers: { authorization: `Bearer ${options.token}`, "content-type": "application/json", "idempotency-key": crypto.randomUUID() },
397
+ headers: { ...credential, "content-type": "application/json", "idempotency-key": crypto.randomUUID() },
388
398
  body: JSON.stringify(body)
389
399
  });
390
400
  const json = await response.json().catch(() => ({}));
391
- if (!response.ok) throw new SyncError(String(json.code ?? json.error ?? "ACCESS_REQUEST_FAILED"), response.status);
401
+ if (!response.ok) throw new SyncError(String(json.code ?? json.error ?? "ACCESS_REQUEST_FAILED"), response.status, response.status === 401 ? rejectedCredentialHint(sent) : void 0);
392
402
  return json;
393
403
  };
394
404
  const env = encodeURIComponent(options.workspaceEnvironmentId);
395
405
  const installed = await call("POST", `/api/admin/env/${env}/connected-applications/install`, { manifest: options.manifest, reason: options.reason });
396
406
  const connection = installed.connection;
407
+ const key2 = installed.publishableKey ?? connection.publishableKey;
408
+ const publishableKey = typeof key2 === "string" && key2 ? key2 : null;
397
409
  const reconciliation = (value) => value && typeof value === "object" ? value : {};
398
410
  if (!installed.replayed) {
399
- return { action: "installed", applicationId: connection.applicationId, environmentId: connection.environmentId, revision: connection.revision, reconciliation: reconciliation(installed.reconciliation) };
411
+ return { action: "installed", applicationId: connection.applicationId, environmentId: connection.environmentId, revision: connection.revision, publishableKey, reconciliation: reconciliation(installed.reconciliation) };
400
412
  }
401
413
  const updated = await call("PUT", `/api/admin/env/${encodeURIComponent(connection.environmentId)}/connected-application/manifest`, {
402
414
  expectedRevision: connection.revision,
@@ -404,7 +416,7 @@ async function syncApp(options) {
404
416
  reason: options.reason
405
417
  });
406
418
  const revision = Number(updated.revision ?? connection.revision);
407
- return { action: updated.unchanged ? "unchanged" : "updated", applicationId: connection.applicationId, environmentId: connection.environmentId, revision, reconciliation: reconciliation(updated.reconciliation) };
419
+ return { action: updated.unchanged ? "unchanged" : "updated", applicationId: connection.applicationId, environmentId: connection.environmentId, revision, publishableKey, reconciliation: reconciliation(updated.reconciliation) };
408
420
  }
409
421
  var EXIT = { ok: 0, failure: 1, unsupported: 2, auth: 3, confirmation: 4 };
410
422
  var PROVISIONING_GROUPS = ["users", "audit", "policy", "whoami", "login"];
@@ -3217,8 +3229,9 @@ async function runCli(argv, io) {
3217
3229
  const workspaceEnvironmentId = option(args, "workspace-env");
3218
3230
  const accessUrl = io.env.CUSTOMY_ACCESS_URL;
3219
3231
  const token = io.env.CUSTOMY_ACCESS_TOKEN;
3220
- if (!workspaceEnvironmentId || !accessUrl || !token) {
3221
- io.err("sync necesita --workspace-env y las variables CUSTOMY_ACCESS_URL y CUSTOMY_ACCESS_TOKEN");
3232
+ const adminSecret = io.env.CUSTOMY_ADMIN_SECRET;
3233
+ if (!workspaceEnvironmentId || !accessUrl || !token && !adminSecret) {
3234
+ io.err("sync necesita --workspace-env, CUSTOMY_ACCESS_URL y una credencial: CUSTOMY_ADMIN_SECRET (x-admin-secret, producci\xF3n) o CUSTOMY_ACCESS_TOKEN (Bearer)");
3222
3235
  return 2;
3223
3236
  }
3224
3237
  try {
@@ -3226,12 +3239,19 @@ async function runCli(argv, io) {
3226
3239
  manifest,
3227
3240
  accessUrl,
3228
3241
  token,
3242
+ adminSecret,
3243
+ actor: io.env.CUSTOMY_ADMIN_ACTOR,
3229
3244
  workspaceEnvironmentId,
3230
3245
  reason: option(args, "reason") ?? `customy apps sync ${manifest.key}`,
3231
3246
  fetch: io.fetch
3232
3247
  });
3233
3248
  const verb = { installed: "instalada", updated: "actualizada", unchanged: "sin cambios" }[result.action];
3234
3249
  io.out(`\u2713 ${manifest.key} ${verb}: aplicaci\xF3n ${result.applicationId}, entorno ${result.environmentId}, revisi\xF3n ${result.revision} (${authorizationSummary(manifest)})`);
3250
+ if (result.publishableKey) {
3251
+ io.out("Para el .env de la app (la clave p\xFAblica no es secreta):");
3252
+ io.out(`CUSTOMY_PUBLISHABLE_KEY=${result.publishableKey}`);
3253
+ }
3254
+ io.out(`CUSTOMY_ENVIRONMENT_ID=${result.environmentId}`);
3235
3255
  let failed = false;
3236
3256
  for (const [product2, outcome] of Object.entries(result.reconciliation)) {
3237
3257
  if (outcome.status === "failed") {
package/dist/index.cjs CHANGED
@@ -1,67 +1,67 @@
1
1
  'use strict';
2
2
 
3
- var chunk6X3AX6PB_cjs = require('./chunk-6X3AX6PB.cjs');
3
+ var chunkVKMVRAMV_cjs = require('./chunk-VKMVRAMV.cjs');
4
4
  require('./chunk-2A6WFLXS.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "EXPERIENCE_EXIT_CODES", {
9
9
  enumerable: true,
10
- get: function () { return chunk6X3AX6PB_cjs.EXPERIENCE_EXIT; }
10
+ get: function () { return chunkVKMVRAMV_cjs.EXPERIENCE_EXIT; }
11
11
  });
12
12
  Object.defineProperty(exports, "EXPERIMENTS_EXIT_CODES", {
13
13
  enumerable: true,
14
- get: function () { return chunk6X3AX6PB_cjs.EXPERIMENTS_EXIT; }
14
+ get: function () { return chunkVKMVRAMV_cjs.EXPERIMENTS_EXIT; }
15
15
  });
16
16
  Object.defineProperty(exports, "PROVISIONING_EXIT_CODES", {
17
17
  enumerable: true,
18
- get: function () { return chunk6X3AX6PB_cjs.EXIT; }
18
+ get: function () { return chunkVKMVRAMV_cjs.EXIT; }
19
19
  });
20
20
  Object.defineProperty(exports, "SyncError", {
21
21
  enumerable: true,
22
- get: function () { return chunk6X3AX6PB_cjs.SyncError; }
22
+ get: function () { return chunkVKMVRAMV_cjs.SyncError; }
23
23
  });
24
24
  Object.defineProperty(exports, "WHATSAPP_EXIT_CODES", {
25
25
  enumerable: true,
26
- get: function () { return chunk6X3AX6PB_cjs.WHATSAPP_EXIT; }
26
+ get: function () { return chunkVKMVRAMV_cjs.WHATSAPP_EXIT; }
27
27
  });
28
28
  Object.defineProperty(exports, "generateAppTypes", {
29
29
  enumerable: true,
30
- get: function () { return chunk6X3AX6PB_cjs.generateAppTypes; }
30
+ get: function () { return chunkVKMVRAMV_cjs.generateAppTypes; }
31
31
  });
32
32
  Object.defineProperty(exports, "runCli", {
33
33
  enumerable: true,
34
- get: function () { return chunk6X3AX6PB_cjs.runCli; }
34
+ get: function () { return chunkVKMVRAMV_cjs.runCli; }
35
35
  });
36
36
  Object.defineProperty(exports, "runExperienceCli", {
37
37
  enumerable: true,
38
- get: function () { return chunk6X3AX6PB_cjs.runExperienceCli; }
38
+ get: function () { return chunkVKMVRAMV_cjs.runExperienceCli; }
39
39
  });
40
40
  Object.defineProperty(exports, "runExperimentsCli", {
41
41
  enumerable: true,
42
- get: function () { return chunk6X3AX6PB_cjs.runExperimentsCli; }
42
+ get: function () { return chunkVKMVRAMV_cjs.runExperimentsCli; }
43
43
  });
44
44
  Object.defineProperty(exports, "runProvisioningCli", {
45
45
  enumerable: true,
46
- get: function () { return chunk6X3AX6PB_cjs.runProvisioningCli; }
46
+ get: function () { return chunkVKMVRAMV_cjs.runProvisioningCli; }
47
47
  });
48
48
  Object.defineProperty(exports, "runWhatsAppCli", {
49
49
  enumerable: true,
50
- get: function () { return chunk6X3AX6PB_cjs.runWhatsAppCli; }
50
+ get: function () { return chunkVKMVRAMV_cjs.runWhatsAppCli; }
51
51
  });
52
52
  Object.defineProperty(exports, "schemaToType", {
53
53
  enumerable: true,
54
- get: function () { return chunk6X3AX6PB_cjs.schemaToType; }
54
+ get: function () { return chunkVKMVRAMV_cjs.schemaToType; }
55
55
  });
56
56
  Object.defineProperty(exports, "serializeCatalog", {
57
57
  enumerable: true,
58
- get: function () { return chunk6X3AX6PB_cjs.serializeCatalog; }
58
+ get: function () { return chunkVKMVRAMV_cjs.serializeCatalog; }
59
59
  });
60
60
  Object.defineProperty(exports, "syncApp", {
61
61
  enumerable: true,
62
- get: function () { return chunk6X3AX6PB_cjs.syncApp; }
62
+ get: function () { return chunkVKMVRAMV_cjs.syncApp; }
63
63
  });
64
64
  Object.defineProperty(exports, "validateManifest", {
65
65
  enumerable: true,
66
- get: function () { return chunk6X3AX6PB_cjs.validateManifest; }
66
+ get: function () { return chunkVKMVRAMV_cjs.validateManifest; }
67
67
  });
package/dist/index.d.cts CHANGED
@@ -303,7 +303,12 @@ declare function validateManifest(input: unknown): {
303
303
  type SyncOptions = {
304
304
  manifest: AppManifest;
305
305
  accessUrl: string;
306
- token: string;
306
+ /** Token de administrador del Workspace: viaja como `Authorization: Bearer`. */
307
+ token?: string;
308
+ /** Secreto de administrador de Access: viaja como `x-admin-secret` (lo que acepta Access de producción). Manda sobre `token`. */
309
+ adminSecret?: string;
310
+ /** Quién opera (`x-actor`); Access con `ADMIN_SECRET_MODE=require-actor` lo exige junto a `x-reason` (8+ caracteres). */
311
+ actor?: string;
307
312
  workspaceEnvironmentId: string;
308
313
  reason: string;
309
314
  fetch?: typeof fetch;
@@ -328,13 +333,16 @@ type SyncResult = {
328
333
  applicationId: string;
329
334
  environmentId: string;
330
335
  revision: number;
336
+ /** Clave pública (`pk_…`) del entorno de la app; no es secreta. Va al `.env` de la app. `null` si Access no la devuelve. */
337
+ publishableKey: string | null;
331
338
  /** Cómo quedó cada producto; vacío si Access no lo informa. */
332
339
  reconciliation: Record<string, ProductReconciliation>;
333
340
  };
334
341
  declare class SyncError extends Error {
335
342
  readonly code: string;
336
343
  readonly status: number;
337
- constructor(code: string, status: number);
344
+ readonly hint?: string | undefined;
345
+ constructor(code: string, status: number, hint?: string | undefined);
338
346
  }
339
347
  declare function syncApp(options: SyncOptions): Promise<SyncResult>;
340
348
 
package/dist/index.d.ts CHANGED
@@ -303,7 +303,12 @@ declare function validateManifest(input: unknown): {
303
303
  type SyncOptions = {
304
304
  manifest: AppManifest;
305
305
  accessUrl: string;
306
- token: string;
306
+ /** Token de administrador del Workspace: viaja como `Authorization: Bearer`. */
307
+ token?: string;
308
+ /** Secreto de administrador de Access: viaja como `x-admin-secret` (lo que acepta Access de producción). Manda sobre `token`. */
309
+ adminSecret?: string;
310
+ /** Quién opera (`x-actor`); Access con `ADMIN_SECRET_MODE=require-actor` lo exige junto a `x-reason` (8+ caracteres). */
311
+ actor?: string;
307
312
  workspaceEnvironmentId: string;
308
313
  reason: string;
309
314
  fetch?: typeof fetch;
@@ -328,13 +333,16 @@ type SyncResult = {
328
333
  applicationId: string;
329
334
  environmentId: string;
330
335
  revision: number;
336
+ /** Clave pública (`pk_…`) del entorno de la app; no es secreta. Va al `.env` de la app. `null` si Access no la devuelve. */
337
+ publishableKey: string | null;
331
338
  /** Cómo quedó cada producto; vacío si Access no lo informa. */
332
339
  reconciliation: Record<string, ProductReconciliation>;
333
340
  };
334
341
  declare class SyncError extends Error {
335
342
  readonly code: string;
336
343
  readonly status: number;
337
- constructor(code: string, status: number);
344
+ readonly hint?: string | undefined;
345
+ constructor(code: string, status: number, hint?: string | undefined);
338
346
  }
339
347
  declare function syncApp(options: SyncOptions): Promise<SyncResult>;
340
348
 
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export { EXPERIENCE_EXIT as EXPERIENCE_EXIT_CODES, EXPERIMENTS_EXIT as EXPERIMENTS_EXIT_CODES, EXIT as PROVISIONING_EXIT_CODES, SyncError, WHATSAPP_EXIT as WHATSAPP_EXIT_CODES, generateAppTypes, runCli, runExperienceCli, runExperimentsCli, runProvisioningCli, runWhatsAppCli, schemaToType, serializeCatalog, syncApp, validateManifest } from './chunk-57NNDUEX.mjs';
1
+ export { EXPERIENCE_EXIT as EXPERIENCE_EXIT_CODES, EXPERIMENTS_EXIT as EXPERIMENTS_EXIT_CODES, EXIT as PROVISIONING_EXIT_CODES, SyncError, WHATSAPP_EXIT as WHATSAPP_EXIT_CODES, generateAppTypes, runCli, runExperienceCli, runExperimentsCli, runProvisioningCli, runWhatsAppCli, schemaToType, serializeCatalog, syncApp, validateManifest } from './chunk-VA4VPLZ4.mjs';
2
2
  import './chunk-QKIF4C5R.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customyai/cli",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Customy CLI: validate, type and sync customy.app.json (customy apps ...), provision TEST users (customy users | audit | policy | whoami), operate Customy WhatsApp (customy whatsapp numbers | send | messages | templates | findings | webhooks | broadcasts | flows) and manage Customy Experience translation catalogs and releases (customy experience pull | push | export | import | status | signing | ...). Also usable as a library.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Customy <hello@customy.ai>",