ponch-mcp-server 1.0.89 → 1.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9974,7 +9974,10 @@ function wrapWithContract(contract, helper, options = {}) {
|
|
|
9974
9974
|
state: "denied_role"
|
|
9975
9975
|
};
|
|
9976
9976
|
}
|
|
9977
|
-
const
|
|
9977
|
+
const cleanInput = input && typeof input === "object" && !Array.isArray(input) ? Object.fromEntries(
|
|
9978
|
+
Object.entries(input).filter(([, v]) => v !== null)
|
|
9979
|
+
) : input;
|
|
9980
|
+
const parseResult = contract.paramsSchema.safeParse(cleanInput);
|
|
9978
9981
|
if (!parseResult.success) {
|
|
9979
9982
|
const validationErrors = parseResult.error.issues.map((i) => {
|
|
9980
9983
|
const issue = i;
|
|
@@ -12965,7 +12968,7 @@ var contenidoRejecterContract = MartinContractSchema.parse(
|
|
|
12965
12968
|
rawContract13
|
|
12966
12969
|
);
|
|
12967
12970
|
async function photoBriefingWriter(input) {
|
|
12968
|
-
const { db, tenantId, brandId, semana, necesidades } = input;
|
|
12971
|
+
const { db, tenantId, brandId, semana, necesidades, actor } = input;
|
|
12969
12972
|
const docId = `${tenantId}_${brandId}_${semana}`;
|
|
12970
12973
|
const ref = db.collection("tenants").doc(tenantId).collection("marketing_fotobriefings").doc(docId);
|
|
12971
12974
|
const snap = await ref.get();
|
|
@@ -13005,9 +13008,23 @@ async function photoBriefingWriter(input) {
|
|
|
13005
13008
|
estado,
|
|
13006
13009
|
generadoEn: existing?.generadoEn ?? null
|
|
13007
13010
|
});
|
|
13011
|
+
const isCreate = !snap.exists;
|
|
13012
|
+
const actorFields = {
|
|
13013
|
+
actualizadoPorId: actor.uid,
|
|
13014
|
+
actualizadoPorNombre: actor.nombre,
|
|
13015
|
+
actualizadoPorClient: actor.clientType,
|
|
13016
|
+
actualizadoPorClientMetadata: actor.clientMetadata ?? null
|
|
13017
|
+
};
|
|
13018
|
+
if (isCreate) {
|
|
13019
|
+
actorFields.creadoPorId = actor.uid;
|
|
13020
|
+
actorFields.creadoPorNombre = actor.nombre;
|
|
13021
|
+
actorFields.creadoPorClient = actor.clientType;
|
|
13022
|
+
actorFields.creadoPorClientMetadata = actor.clientMetadata ?? null;
|
|
13023
|
+
}
|
|
13008
13024
|
await ref.set(
|
|
13009
13025
|
{
|
|
13010
13026
|
...doc,
|
|
13027
|
+
...actorFields,
|
|
13011
13028
|
generadoEn: existing?.generadoEn ?? import_firebase_admin10.firestore.FieldValue.serverTimestamp(),
|
|
13012
13029
|
fechaActualizacion: import_firebase_admin10.firestore.FieldValue.serverTimestamp()
|
|
13013
13030
|
},
|
|
@@ -13034,7 +13051,13 @@ var ParamsSchema14 = import_zod49.z.object({
|
|
|
13034
13051
|
tenantId: import_zod49.z.string().min(1).describe('Tenant identifier. Example: "your-tenant-id".'),
|
|
13035
13052
|
brandId: import_zod49.z.string().min(1).describe('Brand identifier within the tenant. Example: "your-brand-id".'),
|
|
13036
13053
|
semana: import_zod49.z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "semana debe ser ISO YYYY-MM-DD del lunes").describe('Week identifier (ISO date of Monday). Example: "2026-05-11".'),
|
|
13037
|
-
necesidades: import_zod49.z.array(NecesidadInputSchema).min(1).describe("Array of photo needs (at least 1). Each is merged by tema.")
|
|
13054
|
+
necesidades: import_zod49.z.array(NecesidadInputSchema).min(1).describe("Array of photo needs (at least 1). Each is merged by tema."),
|
|
13055
|
+
actor: import_zod49.z.object({
|
|
13056
|
+
uid: import_zod49.z.string().min(1).describe('User id creating/updating the briefing. Example: "your-user-uid".'),
|
|
13057
|
+
nombre: import_zod49.z.string().min(1).describe('Human-readable user name. Example: "Daniel Gonz\xE1lez".'),
|
|
13058
|
+
clientType: import_zod49.z.string().min(1).describe('Client surface origin. Example: one of "mcp_client" | "martin" | "web" | "admin".'),
|
|
13059
|
+
clientMetadata: import_zod49.z.record(import_zod49.z.string(), import_zod49.z.unknown()).nullable().optional().describe("Optional metadata about the client (session id, device, etc.).")
|
|
13060
|
+
}).describe("Actor (user) creating/updating the briefing \u2014 extracted by the server.tool from ctx.user (\xA79.2).")
|
|
13038
13061
|
});
|
|
13039
13062
|
var OutputSchema14 = import_zod49.z.object({
|
|
13040
13063
|
ok: import_zod49.z.literal(true),
|
|
@@ -17499,11 +17522,17 @@ IMPORTANT \u2014 'razon' field: the tenant sees this in the app. Write in friend
|
|
|
17499
17522
|
const tenantId = session.requireTenant();
|
|
17500
17523
|
const brandId = inputBrandId ?? session.requireBrand();
|
|
17501
17524
|
const ctx = await buildContext(session, brandId);
|
|
17525
|
+
const actor = {
|
|
17526
|
+
uid: ctx.user.uid,
|
|
17527
|
+
nombre: ctx.user.nombre ?? ctx.user.uid,
|
|
17528
|
+
clientType: ctx.user.clientType ?? "mcp_client",
|
|
17529
|
+
clientMetadata: ctx.user.clientMetadata ?? null
|
|
17530
|
+
};
|
|
17502
17531
|
const result = await dispatchWithContract({
|
|
17503
17532
|
contract: photoBriefingWriterContract,
|
|
17504
17533
|
helper: photoBriefingWriter,
|
|
17505
17534
|
callable: callPhotoBriefingWriter,
|
|
17506
|
-
input: { tenantId, brandId, semana, necesidades },
|
|
17535
|
+
input: { tenantId, brandId, semana, necesidades, actor },
|
|
17507
17536
|
ctx
|
|
17508
17537
|
});
|
|
17509
17538
|
let payload;
|