boondmanager-mcp-server 2.12.2 → 2.14.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.
Files changed (40) hide show
  1. package/README.md +2 -1
  2. package/dist/constants.d.ts +1 -0
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +8 -0
  5. package/dist/constants.js.map +1 -1
  6. package/dist/instructions.d.ts +1 -1
  7. package/dist/instructions.d.ts.map +1 -1
  8. package/dist/instructions.js +1 -0
  9. package/dist/instructions.js.map +1 -1
  10. package/dist/prompts/index.d.ts.map +1 -1
  11. package/dist/prompts/index.js +61 -0
  12. package/dist/prompts/index.js.map +1 -1
  13. package/dist/resources/index.d.ts +8 -2
  14. package/dist/resources/index.d.ts.map +1 -1
  15. package/dist/resources/index.js +84 -3
  16. package/dist/resources/index.js.map +1 -1
  17. package/dist/resources/templates.d.ts +109 -0
  18. package/dist/resources/templates.d.ts.map +1 -0
  19. package/dist/resources/templates.js +171 -0
  20. package/dist/resources/templates.js.map +1 -0
  21. package/dist/schemas/index.d.ts +85 -14
  22. package/dist/schemas/index.d.ts.map +1 -1
  23. package/dist/schemas/index.js +128 -14
  24. package/dist/schemas/index.js.map +1 -1
  25. package/dist/server.d.ts.map +1 -1
  26. package/dist/server.js +3 -1
  27. package/dist/server.js.map +1 -1
  28. package/dist/services/boond-client.d.ts +14 -1
  29. package/dist/services/boond-client.d.ts.map +1 -1
  30. package/dist/services/boond-client.js +21 -1
  31. package/dist/services/boond-client.js.map +1 -1
  32. package/dist/tools/crud-factory.d.ts +5 -1
  33. package/dist/tools/crud-factory.d.ts.map +1 -1
  34. package/dist/tools/crud-factory.js +4 -3
  35. package/dist/tools/crud-factory.js.map +1 -1
  36. package/dist/tools/expenses.d.ts.map +1 -1
  37. package/dist/tools/expenses.js +152 -6
  38. package/dist/tools/expenses.js.map +1 -1
  39. package/manifest.json +2 -2
  40. package/package.json +2 -2
@@ -0,0 +1,171 @@
1
+ import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
2
+ import { MAX_RESOURCE_BYTES } from "../constants.js";
3
+ import { apiRequest, projectEntity } from "../services/boond-client.js";
4
+ import { progressReporterFrom } from "../services/progress.js";
5
+ import { EntityIdSchema } from "../schemas/index.js";
6
+ /** Tabs cheap enough to aggregate: an identity/detail pair, never a collection. */
7
+ const IDENTITY_TABS = ["information"];
8
+ const IDENTITY_AND_SKILLS_TABS = ["information", "technical-data"];
9
+ export const ENTITY_TEMPLATES = [
10
+ {
11
+ name: "entity/candidate",
12
+ uriTemplate: "boond://candidate/{id}",
13
+ domain: "candidates",
14
+ entityName: "candidat",
15
+ apiPath: "/candidates",
16
+ tabs: IDENTITY_AND_SKILLS_TABS,
17
+ title: "Fiche candidat",
18
+ description: "Fiche complète d'un candidat (identité, informations, compétences/technical-data) en une seule lecture. " +
19
+ "L'id est numérique. Les actions et positionnements restent des outils (`boond_candidates_actions`, `_positionings`).",
20
+ },
21
+ {
22
+ name: "entity/resource",
23
+ uriTemplate: "boond://resource/{id}",
24
+ domain: "resources",
25
+ entityName: "ressource",
26
+ apiPath: "/resources",
27
+ tabs: IDENTITY_AND_SKILLS_TABS,
28
+ title: "Fiche ressource (collaborateur)",
29
+ description: "Fiche complète d'une ressource/collaborateur (identité, informations, compétences) en une seule lecture. " +
30
+ "L'id est numérique. Temps, absences et positionnements restent des outils.",
31
+ },
32
+ {
33
+ name: "entity/contact",
34
+ uriTemplate: "boond://contact/{id}",
35
+ domain: "contacts",
36
+ entityName: "contact",
37
+ apiPath: "/contacts",
38
+ tabs: IDENTITY_TABS,
39
+ title: "Fiche contact",
40
+ description: "Fiche complète d'un contact client (identité, informations) en une seule lecture. L'id est numérique.",
41
+ },
42
+ {
43
+ name: "entity/company",
44
+ uriTemplate: "boond://company/{id}",
45
+ domain: "companies",
46
+ entityName: "société",
47
+ apiPath: "/companies",
48
+ tabs: IDENTITY_TABS,
49
+ title: "Fiche société",
50
+ description: "Fiche complète d'une société cliente (identité, informations) en une seule lecture. L'id est numérique.",
51
+ },
52
+ {
53
+ name: "entity/opportunity",
54
+ uriTemplate: "boond://opportunity/{id}",
55
+ domain: "opportunities",
56
+ entityName: "opportunité",
57
+ apiPath: "/opportunities",
58
+ tabs: IDENTITY_TABS,
59
+ title: "Fiche opportunité",
60
+ description: "Fiche complète d'une opportunité commerciale (identité, informations) en une seule lecture. L'id est numérique.",
61
+ },
62
+ {
63
+ name: "entity/project",
64
+ uriTemplate: "boond://project/{id}",
65
+ domain: "projects",
66
+ entityName: "projet",
67
+ apiPath: "/projects",
68
+ tabs: IDENTITY_TABS,
69
+ title: "Fiche projet",
70
+ description: "Fiche complète d'un projet/mission (identité, informations) en une seule lecture. L'id est numérique.",
71
+ },
72
+ ];
73
+ /** Exposed for tests and the catalogue generator; mirrors `REGISTERED_RESOURCES`. */
74
+ export const REGISTERED_RESOURCE_TEMPLATES = ENTITY_TEMPLATES.map((t) => ({
75
+ name: t.name,
76
+ uriTemplate: t.uriTemplate,
77
+ title: t.title,
78
+ domain: t.domain,
79
+ }));
80
+ /** Project a tab response: an object stays an object, a collection stays a list. */
81
+ function projectTab(response) {
82
+ if (Array.isArray(response.data))
83
+ return response.data.map(projectEntity);
84
+ return response.data ? projectEntity(response.data) : null;
85
+ }
86
+ function errorMessage(reason) {
87
+ return reason instanceof Error ? reason.message : String(reason);
88
+ }
89
+ /**
90
+ * Serialise, and if the body is over the ceiling drop sections until it fits.
91
+ *
92
+ * Order of sacrifice, least to most informative: declared tabs from the last
93
+ * to the first (so `information` outlives `technical-data`), then the base
94
+ * record's `relationships`, then its `attributes`. In practice only the first
95
+ * rung is ever reached; the others exist so the ceiling is a guarantee rather
96
+ * than an intention.
97
+ */
98
+ function serializeWithinBudget(aggregate, tabOrder) {
99
+ const dropped = [];
100
+ const reason = `Corps au-delà de MAX_RESOURCE_BYTES (${MAX_RESOURCE_BYTES} octets) : sections abandonnées pour garder un JSON valide.`;
101
+ const render = () => {
102
+ const body = { ...aggregate };
103
+ if (dropped.length > 0)
104
+ body._omitted = { sections: [...dropped], reason };
105
+ return JSON.stringify(body, null, 2);
106
+ };
107
+ const overBudget = (json) => Buffer.byteLength(json, "utf8") > MAX_RESOURCE_BYTES;
108
+ let json = render();
109
+ if (!overBudget(json))
110
+ return json;
111
+ for (const tab of [...tabOrder].reverse()) {
112
+ if (!(tab in aggregate.sections))
113
+ continue;
114
+ delete aggregate.sections[tab];
115
+ dropped.push(tab);
116
+ json = render();
117
+ if (!overBudget(json))
118
+ return json;
119
+ }
120
+ for (const field of ["relationships", "attributes"]) {
121
+ if (aggregate.entity[field] === undefined)
122
+ continue;
123
+ delete aggregate.entity[field];
124
+ dropped.push(`entity.${field}`);
125
+ json = render();
126
+ if (!overBudget(json))
127
+ return json;
128
+ }
129
+ return json;
130
+ }
131
+ export async function readEntityAggregate(template, rawId, uri, extra) {
132
+ // `Variables` is `string | string[]`: a repeated URI segment would arrive as
133
+ // an array, which `EntityIdSchema` rejects rather than silently join.
134
+ const parsed = EntityIdSchema.safeParse(rawId);
135
+ if (!parsed.success) {
136
+ throw new McpError(ErrorCode.InvalidParams, `Identifiant de ${template.entityName} invalide dans « ${uri} » : attendu un id numérique (ex. ${template.uriTemplate.replace("{id}", "1234")}).`);
137
+ }
138
+ const id = parsed.data;
139
+ const report = progressReporterFrom(extra);
140
+ const total = 1 + template.tabs.length;
141
+ let done = 0;
142
+ const step = (label) => {
143
+ done += 1;
144
+ report(done, total, `${template.entityName} ${id} : ${label} (${done}/${total})`);
145
+ };
146
+ const base = apiRequest(`${template.apiPath}/${id}`).finally(() => step("fiche"));
147
+ const tabs = template.tabs.map((tab) => apiRequest(`${template.apiPath}/${id}/${tab}`).finally(() => step(tab)));
148
+ // The base record is awaited through allSettled together with the tabs so a
149
+ // tab failure cannot leave an unhandled rejection behind, then rethrown: with
150
+ // no record there is nothing to aggregate.
151
+ const [baseResult, ...tabResults] = await Promise.allSettled([base, ...tabs]);
152
+ if (baseResult.status === "rejected")
153
+ throw baseResult.reason;
154
+ const entity = Array.isArray(baseResult.value.data) ? baseResult.value.data[0] : baseResult.value.data;
155
+ if (!entity) {
156
+ throw new McpError(ErrorCode.InvalidParams, `${template.entityName} ${id} introuvable.`);
157
+ }
158
+ const aggregate = { uri, entity: projectEntity(entity), sections: {} };
159
+ const errors = {};
160
+ template.tabs.forEach((tab, i) => {
161
+ const result = tabResults[i];
162
+ if (result.status === "fulfilled")
163
+ aggregate.sections[tab] = projectTab(result.value);
164
+ else
165
+ errors[tab] = errorMessage(result.reason);
166
+ });
167
+ if (Object.keys(errors).length > 0)
168
+ aggregate._errors = errors;
169
+ return serializeWithinBudget(aggregate, template.tabs);
170
+ }
171
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAmB,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAiErD,mFAAmF;AACnF,MAAM,aAAa,GAAG,CAAC,aAAa,CAAU,CAAC;AAC/C,MAAM,wBAAwB,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAU,CAAC;AAE5E,MAAM,CAAC,MAAM,gBAAgB,GAA8B;IACzD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,wBAAwB;QACrC,MAAM,EAAE,YAAY;QACpB,UAAU,EAAE,UAAU;QACtB,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,wBAAwB;QAC9B,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,0GAA0G;YAC1G,sHAAsH;KACzH;IACD;QACE,IA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,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC;IACvG,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,GAAG,QAAQ,CAAC,UAAU,IAAI,EAAE,eAAe,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,SAAS,GAAoB,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACxF,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW;YAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;YACjF,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;IAE/D,OAAO,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzD,CAAC"}
@@ -685,25 +685,92 @@ export declare const AbsenceSearchSchema: z.ZodObject<{
685
685
  pageSize: z.ZodDefault<z.ZodNumber>;
686
686
  fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
687
687
  }, z.core.$strict>;
688
+ export declare const ExpenseLineSchema: z.ZodObject<{
689
+ startDate: z.ZodString;
690
+ expenseTypeReference: z.ZodOptional<z.ZodNumber>;
691
+ amountIncludingTax: z.ZodOptional<z.ZodNumber>;
692
+ tax: z.ZodOptional<z.ZodNumber>;
693
+ isKilometricExpense: z.ZodDefault<z.ZodBoolean>;
694
+ numberOfKilometers: z.ZodOptional<z.ZodNumber>;
695
+ activityType: z.ZodDefault<z.ZodEnum<{
696
+ production: "production";
697
+ absence: "absence";
698
+ internal: "internal";
699
+ }>>;
700
+ projectId: z.ZodString;
701
+ deliveryId: z.ZodString;
702
+ batchId: z.ZodOptional<z.ZodString>;
703
+ reinvoiced: z.ZodDefault<z.ZodBoolean>;
704
+ currency: z.ZodDefault<z.ZodNumber>;
705
+ exchangeRate: z.ZodDefault<z.ZodNumber>;
706
+ title: z.ZodOptional<z.ZodString>;
707
+ file: z.ZodOptional<z.ZodString>;
708
+ }, z.core.$strict>;
688
709
  export declare const ExpenseCreateSchema: z.ZodObject<{
689
710
  resourceId: z.ZodString;
690
- projectId: z.ZodOptional<z.ZodString>;
691
- typeOf: z.ZodOptional<z.ZodString>;
692
- term: z.ZodOptional<z.ZodString>;
693
- expenseDate: z.ZodString;
694
- amount: z.ZodNumber;
695
- currency: z.ZodOptional<z.ZodString>;
696
- exchangeRateAgency: z.ZodOptional<z.ZodNumber>;
697
- state: z.ZodOptional<z.ZodNumber>;
698
- note: z.ZodOptional<z.ZodString>;
711
+ agencyId: z.ZodOptional<z.ZodString>;
712
+ term: z.ZodString;
713
+ exchangeRateAgency: z.ZodDefault<z.ZodNumber>;
714
+ currencyAgency: z.ZodOptional<z.ZodNumber>;
715
+ informationComments: z.ZodOptional<z.ZodString>;
716
+ advance: z.ZodOptional<z.ZodNumber>;
717
+ ratePerKilometerTypeReference: z.ZodOptional<z.ZodNumber>;
718
+ actualExpenses: z.ZodOptional<z.ZodArray<z.ZodObject<{
719
+ startDate: z.ZodString;
720
+ expenseTypeReference: z.ZodOptional<z.ZodNumber>;
721
+ amountIncludingTax: z.ZodOptional<z.ZodNumber>;
722
+ tax: z.ZodOptional<z.ZodNumber>;
723
+ isKilometricExpense: z.ZodDefault<z.ZodBoolean>;
724
+ numberOfKilometers: z.ZodOptional<z.ZodNumber>;
725
+ activityType: z.ZodDefault<z.ZodEnum<{
726
+ production: "production";
727
+ absence: "absence";
728
+ internal: "internal";
729
+ }>>;
730
+ projectId: z.ZodString;
731
+ deliveryId: z.ZodString;
732
+ batchId: z.ZodOptional<z.ZodString>;
733
+ reinvoiced: z.ZodDefault<z.ZodBoolean>;
734
+ currency: z.ZodDefault<z.ZodNumber>;
735
+ exchangeRate: z.ZodDefault<z.ZodNumber>;
736
+ title: z.ZodOptional<z.ZodString>;
737
+ file: z.ZodOptional<z.ZodString>;
738
+ }, z.core.$strict>>>;
699
739
  }, z.core.$strict>;
700
740
  export declare const ExpenseUpdateSchema: z.ZodObject<{
701
741
  id: z.ZodString;
702
- term: z.ZodOptional<z.ZodString>;
703
- amount: z.ZodOptional<z.ZodNumber>;
704
742
  exchangeRateAgency: z.ZodOptional<z.ZodNumber>;
705
- state: z.ZodOptional<z.ZodNumber>;
706
- note: z.ZodOptional<z.ZodString>;
743
+ currencyAgency: z.ZodOptional<z.ZodNumber>;
744
+ informationComments: z.ZodOptional<z.ZodString>;
745
+ advance: z.ZodOptional<z.ZodNumber>;
746
+ closed: z.ZodOptional<z.ZodBoolean>;
747
+ ratePerKilometerTypeReference: z.ZodOptional<z.ZodNumber>;
748
+ actualExpenses: z.ZodOptional<z.ZodArray<z.ZodObject<{
749
+ startDate: z.ZodString;
750
+ expenseTypeReference: z.ZodOptional<z.ZodNumber>;
751
+ amountIncludingTax: z.ZodOptional<z.ZodNumber>;
752
+ tax: z.ZodOptional<z.ZodNumber>;
753
+ isKilometricExpense: z.ZodDefault<z.ZodBoolean>;
754
+ numberOfKilometers: z.ZodOptional<z.ZodNumber>;
755
+ activityType: z.ZodDefault<z.ZodEnum<{
756
+ production: "production";
757
+ absence: "absence";
758
+ internal: "internal";
759
+ }>>;
760
+ projectId: z.ZodString;
761
+ deliveryId: z.ZodString;
762
+ batchId: z.ZodOptional<z.ZodString>;
763
+ reinvoiced: z.ZodDefault<z.ZodBoolean>;
764
+ currency: z.ZodDefault<z.ZodNumber>;
765
+ exchangeRate: z.ZodDefault<z.ZodNumber>;
766
+ title: z.ZodOptional<z.ZodString>;
767
+ file: z.ZodOptional<z.ZodString>;
768
+ }, z.core.$strict>>>;
769
+ }, z.core.$strict>;
770
+ export declare const ExpenseDefaultSchema: z.ZodObject<{
771
+ resourceId: z.ZodString;
772
+ term: z.ZodString;
773
+ agencyId: z.ZodOptional<z.ZodString>;
707
774
  }, z.core.$strict>;
708
775
  export declare const ExpenseSearchSchema: z.ZodObject<{
709
776
  keywords: z.ZodOptional<z.ZodString>;
@@ -1000,10 +1067,10 @@ export declare const DocumentCreateSchema: z.ZodObject<{
1000
1067
  parentType: z.ZodEnum<{
1001
1068
  delivery: "delivery";
1002
1069
  resource: "resource";
1070
+ project: "project";
1003
1071
  order: "order";
1004
1072
  company: "company";
1005
1073
  candidate: "candidate";
1006
- project: "project";
1007
1074
  positioning: "positioning";
1008
1075
  product: "product";
1009
1076
  invoice: "invoice";
@@ -1050,4 +1117,8 @@ export type ReportingProjectsInput = z.infer<typeof ReportingProjectsSchema>;
1050
1117
  export type ReportingResourcesInput = z.infer<typeof ReportingResourcesSchema>;
1051
1118
  export type ReportingSynthesisInput = z.infer<typeof ReportingSynthesisSchema>;
1052
1119
  export type ReportingProductionPlansInput = z.infer<typeof ReportingProductionPlansSchema>;
1120
+ export type ExpenseLineInput = z.infer<typeof ExpenseLineSchema>;
1121
+ export type ExpenseCreateInput = z.infer<typeof ExpenseCreateSchema>;
1122
+ export type ExpenseUpdateInput = z.infer<typeof ExpenseUpdateSchema>;
1123
+ export type ExpenseDefaultInput = z.infer<typeof ExpenseDefaultSchema>;
1053
1124
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.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,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1062,28 +1062,142 @@ export const AbsenceSearchSchema = z
1062
1062
  })
1063
1063
  .strict();
1064
1064
  // ---- Expense schemas (Notes de frais) ----
1065
+ /**
1066
+ * The write model for `/expenses-reports` was verified field by field against
1067
+ * the live API (the RAML documents `post: description: Create an expenses` and
1068
+ * nothing else, and `/application/dictionary` publishes the attribute list but
1069
+ * not the required set).
1070
+ *
1071
+ * The entity is a **monthly container per resource** (`term` + `resource`) whose
1072
+ * lines live in the `actualExpenses` array — there is no such thing as a
1073
+ * standalone expense line endpoint. Consequences that the previous schema got
1074
+ * wrong, each one a 422:
1075
+ *
1076
+ * - `amount` / `expenseDate` / `typeOf` / `currency` are **line** attributes,
1077
+ * not report attributes. A report-level payload carrying them created nothing.
1078
+ * - `exchangeRateAgency` is **required** on create (`1002` otherwise).
1079
+ * - `note` is spelled `informationComments`.
1080
+ * - `state` is accepted and then **ignored**, on POST *and* PUT: the state is
1081
+ * moved by the validation workflow, never by a write. Exposing it as an input
1082
+ * promised something the API does not do, so it is gone from both schemas.
1083
+ * - `data.type` is ignored by the API, so the historical `"expense"` type string
1084
+ * was never the bug.
1085
+ *
1086
+ * A line's required set is larger than it looks: besides `startDate`,
1087
+ * `activityType`, `project`, `delivery` and the amount, the API also demands
1088
+ * `batch`, `isKilometricExpense`, `reinvoiced`, `currency` and `exchangeRate` —
1089
+ * it reports them in waves, one 422 per group, so a caller discovering them by
1090
+ * trial and error needs five round-trips. They are therefore `.default()`ed here
1091
+ * on their overwhelmingly common values rather than left to the model.
1092
+ *
1093
+ * `batch` is the sharp edge: it must be **present** and its `id` must be
1094
+ * `null` when the line is not attached to a batch. `{ id: "0" }` and `{ id: 0 }`
1095
+ * are both rejected (`1002`), which is why `batchId` maps to `{ id: null }`
1096
+ * rather than being dropped like every other undefined value.
1097
+ *
1098
+ * HT/VAT: `amountIncludingTax` (TTC) and `tax` (a **rate** in %, not an amount)
1099
+ * are what persist. `amountExcludingTax` and `taxAmount` are accepted on write
1100
+ * and silently recomputed — they are not echoed back — so there is nothing to
1101
+ * add for them and nothing is lost by omitting them.
1102
+ */
1103
+ const EXPENSE_ACTIVITY_TYPES = ["production", "internal", "absence"];
1104
+ export const ExpenseLineSchema = z
1105
+ .object({
1106
+ startDate: z
1107
+ .string()
1108
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
1109
+ .describe("Date du frais (YYYY-MM-DD). Doit tomber dans le mois `term` de la note de frais."),
1110
+ expenseTypeReference: z
1111
+ .number()
1112
+ .int()
1113
+ .optional()
1114
+ .describe("Code du type de frais (`reference`), à lire via `boond_expenses_default` — " +
1115
+ "les types de frais sont définis par agence et ne figurent PAS dans `boond_application_dictionary`. " +
1116
+ "À omettre pour un frais kilométrique."),
1117
+ amountIncludingTax: z
1118
+ .number()
1119
+ .optional()
1120
+ .describe("Montant TTC. Ignoré pour un frais kilométrique (recalculé = km × barème)."),
1121
+ tax: z
1122
+ .number()
1123
+ .optional()
1124
+ .describe("Taux de TVA en % (ex: 20 pour 20 %) — un taux, pas un montant. Défaut API: 0."),
1125
+ isKilometricExpense: z
1126
+ .boolean()
1127
+ .default(false)
1128
+ .describe("`true` pour un frais kilométrique : renseigner `numberOfKilometers` et omettre `expenseTypeReference`."),
1129
+ numberOfKilometers: z.number().optional().describe("Nombre de kilomètres (frais kilométrique uniquement)."),
1130
+ activityType: z.enum(EXPENSE_ACTIVITY_TYPES).default("production").describe("Type d'activité rattachée au frais."),
1131
+ projectId: z
1132
+ .string()
1133
+ .min(1)
1134
+ .describe("ID du projet à imputer. Obligatoire — les couples (projet, prestation) autorisés sont donnés par `boond_expenses_default`."),
1135
+ deliveryId: z
1136
+ .string()
1137
+ .min(1)
1138
+ .describe("ID de la prestation (delivery) à imputer. Obligatoire — voir `boond_expenses_default`."),
1139
+ batchId: z.string().optional().describe("ID du lot. Absent = aucun lot."),
1140
+ reinvoiced: z.boolean().default(false).describe("Frais refacturable au client."),
1141
+ currency: z.number().int().default(0).describe("ID de devise (`setting.currency`, 0 = EUR)."),
1142
+ exchangeRate: z.number().default(1).describe("Taux de change vers la devise agence."),
1143
+ title: z.string().optional().describe("Description libre de la ligne (marchand, motif, invités...)."),
1144
+ file: z
1145
+ .string()
1146
+ .optional()
1147
+ .describe("ID du justificatif déjà téléversé, suffixé (ex: `52979_proof`). " +
1148
+ "Un fichier doit d'abord être créé via `boond_documents_create` (`parentType: 'expensesReport'`)."),
1149
+ })
1150
+ .strict();
1065
1151
  export const ExpenseCreateSchema = z
1066
1152
  .object({
1067
- resourceId: z.string().min(1).describe("ID de la ressource"),
1068
- projectId: z.string().optional().describe("ID du projet associé"),
1069
- typeOf: z.string().optional().describe("Type de frais (transport, repas, hébergement...)"),
1070
- term: z.string().optional().describe("Période de la note de frais (YYYY-MM)"),
1071
- expenseDate: z.string().min(1).describe("Date du frais (YYYY-MM-DD)"),
1072
- amount: z.number().describe("Montant du frais"),
1073
- currency: z.string().optional().describe("Devise (EUR, USD...)"),
1074
- exchangeRateAgency: z.number().optional().describe("Taux de change agence"),
1075
- state: z.number().int().optional().describe("État de la note de frais"),
1076
- note: z.string().optional().describe("Description / justification"),
1153
+ resourceId: z.string().min(1).describe("ID de la ressource (le collaborateur qui a engagé les frais)."),
1154
+ agencyId: z
1155
+ .string()
1156
+ .optional()
1157
+ .describe("ID de l'agence — voir `boond_expenses_default`. Déduit de la ressource si omis."),
1158
+ term: z
1159
+ .string()
1160
+ .regex(/^\d{4}-\d{2}$/)
1161
+ .describe("Mois de la note de frais (YYYY-MM). Une note de frais = un mois × une ressource."),
1162
+ exchangeRateAgency: z.number().default(1).describe("Taux de change agence. Obligatoire côté API."),
1163
+ currencyAgency: z.number().int().optional().describe("ID de devise de l'agence (`setting.currency`)."),
1164
+ informationComments: z.string().optional().describe("Commentaires de la note de frais."),
1165
+ advance: z.number().optional().describe("Avance à reprendre."),
1166
+ ratePerKilometerTypeReference: z
1167
+ .number()
1168
+ .int()
1169
+ .optional()
1170
+ .describe("Code du barème kilométrique (`reference`) — voir `boond_expenses_default`."),
1171
+ actualExpenses: z
1172
+ .array(ExpenseLineSchema)
1173
+ .optional()
1174
+ .describe("Lignes de frais réels. Omettre pour créer une note de frais vide."),
1077
1175
  })
1078
1176
  .strict();
1079
1177
  export const ExpenseUpdateSchema = z
1080
1178
  .object({
1081
1179
  id: z.string().min(1).describe("ID de la note de frais à modifier"),
1082
- term: z.string().optional().describe("Période de la note de frais (YYYY-MM)"),
1083
- amount: z.number().optional().describe("Montant"),
1084
1180
  exchangeRateAgency: z.number().optional().describe("Taux de change agence"),
1085
- state: z.number().int().optional().describe("État"),
1086
- note: z.string().optional().describe("Description"),
1181
+ currencyAgency: z.number().int().optional().describe("ID de devise de l'agence"),
1182
+ informationComments: z.string().optional().describe("Commentaires"),
1183
+ advance: z.number().optional().describe("Avance à reprendre"),
1184
+ closed: z.boolean().optional().describe("Clôturer la note de frais"),
1185
+ ratePerKilometerTypeReference: z.number().int().optional().describe("Code du barème kilométrique"),
1186
+ actualExpenses: z
1187
+ .array(ExpenseLineSchema)
1188
+ .optional()
1189
+ .describe("⚠️ REMPLACE l'intégralité des lignes existantes. Pour ajouter une ligne, relire la note via " +
1190
+ "`boond_expenses_get` et renvoyer l'ensemble des lignes. Omettre pour ne toucher qu'aux autres champs."),
1191
+ })
1192
+ .strict();
1193
+ export const ExpenseDefaultSchema = z
1194
+ .object({
1195
+ resourceId: z.string().min(1).describe("ID de la ressource"),
1196
+ term: z
1197
+ .string()
1198
+ .regex(/^\d{4}-\d{2}$/)
1199
+ .describe("Mois ciblé (YYYY-MM)"),
1200
+ agencyId: z.string().optional().describe("ID de l'agence (optionnel — déduit de la ressource)"),
1087
1201
  })
1088
1202
  .strict();
1089
1203
  export const ExpenseSearchSchema = z