@roomi-fields/grillhouse 0.28.3 → 0.30.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 (238) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +739 -0
  3. package/bin/grillhouse.mjs +128 -26
  4. package/cadre/templates/projet/.github/workflows/ci.yml +2 -13
  5. package/cadre/templates/projet/CLAUDE.md +5 -1
  6. package/cadre/templates/projet/README.md +11 -11
  7. package/cadre/templates/projet/_gitignore +2 -5
  8. package/cadre/templates/projet/docs/agents/issue-tracker.md +1 -1
  9. package/cadre/templates/projet/package.json +2 -2
  10. package/charte.md +37 -4
  11. package/dist/temporal/acte.d.ts +24 -0
  12. package/dist/temporal/acte.js +139 -0
  13. package/dist/temporal/acte.js.map +1 -0
  14. package/dist/temporal/attributs.d.ts +6 -0
  15. package/dist/temporal/attributs.js +15 -0
  16. package/dist/temporal/attributs.js.map +1 -0
  17. package/dist/temporal/circuit/activites.d.ts +13 -0
  18. package/dist/temporal/circuit/activites.js +33 -0
  19. package/dist/temporal/circuit/activites.js.map +1 -0
  20. package/dist/temporal/circuit/client.d.ts +72 -0
  21. package/dist/temporal/circuit/client.js +247 -0
  22. package/dist/temporal/circuit/client.js.map +1 -0
  23. package/dist/temporal/circuit/commande.d.ts +2 -0
  24. package/dist/temporal/circuit/commande.js +238 -0
  25. package/dist/temporal/circuit/commande.js.map +1 -0
  26. package/dist/temporal/circuit/contrat.d.ts +305 -0
  27. package/dist/temporal/circuit/contrat.js +24 -0
  28. package/dist/temporal/circuit/contrat.js.map +1 -0
  29. package/dist/temporal/circuit/deroule.d.ts +3 -0
  30. package/dist/temporal/circuit/deroule.js +540 -0
  31. package/dist/temporal/circuit/deroule.js.map +1 -0
  32. package/dist/temporal/client.d.ts +47 -0
  33. package/dist/temporal/client.js +69 -0
  34. package/dist/temporal/client.js.map +1 -0
  35. package/dist/temporal/commande.d.ts +2 -0
  36. package/dist/temporal/commande.js +95 -0
  37. package/dist/temporal/commande.js.map +1 -0
  38. package/dist/temporal/deroules.d.ts +5 -0
  39. package/dist/temporal/deroules.js +10 -0
  40. package/dist/temporal/deroules.js.map +1 -0
  41. package/dist/temporal/etat.d.ts +33 -0
  42. package/dist/temporal/etat.js +59 -0
  43. package/dist/temporal/etat.js.map +1 -0
  44. package/dist/temporal/file/activites.d.ts +10 -0
  45. package/dist/temporal/file/activites.js +25 -0
  46. package/dist/temporal/file/activites.js.map +1 -0
  47. package/dist/temporal/file/client.d.ts +4 -0
  48. package/dist/temporal/file/client.js +6 -0
  49. package/dist/temporal/file/client.js.map +1 -0
  50. package/dist/temporal/file/contrat.d.ts +158 -0
  51. package/dist/temporal/file/contrat.js +14 -0
  52. package/dist/temporal/file/contrat.js.map +1 -0
  53. package/dist/temporal/file/deroule.d.ts +15 -0
  54. package/dist/temporal/file/deroule.js +235 -0
  55. package/dist/temporal/file/deroule.js.map +1 -0
  56. package/dist/temporal/installation.d.ts +124 -0
  57. package/dist/temporal/installation.js +408 -0
  58. package/dist/temporal/installation.js.map +1 -0
  59. package/dist/temporal/places/activites.d.ts +8 -0
  60. package/dist/temporal/places/activites.js +13 -0
  61. package/dist/temporal/places/activites.js.map +1 -0
  62. package/dist/temporal/places/client.d.ts +28 -0
  63. package/dist/temporal/places/client.js +64 -0
  64. package/dist/temporal/places/client.js.map +1 -0
  65. package/dist/temporal/places/contrat.d.ts +106 -0
  66. package/dist/temporal/places/contrat.js +21 -0
  67. package/dist/temporal/places/contrat.js.map +1 -0
  68. package/dist/temporal/places/deroule.d.ts +3 -0
  69. package/dist/temporal/places/deroule.js +198 -0
  70. package/dist/temporal/places/deroule.js.map +1 -0
  71. package/dist/temporal/sonde/activites.d.ts +6 -0
  72. package/dist/temporal/sonde/activites.js +52 -0
  73. package/dist/temporal/sonde/activites.js.map +1 -0
  74. package/dist/temporal/sonde/contrat.d.ts +35 -0
  75. package/dist/temporal/sonde/contrat.js +10 -0
  76. package/dist/temporal/sonde/contrat.js.map +1 -0
  77. package/dist/temporal/sonde/deroule.d.ts +3 -0
  78. package/dist/temporal/sonde/deroule.js +39 -0
  79. package/dist/temporal/sonde/deroule.js.map +1 -0
  80. package/dist/temporal/tickets/activites.d.ts +7 -0
  81. package/dist/temporal/tickets/activites.js +81 -0
  82. package/dist/temporal/tickets/activites.js.map +1 -0
  83. package/dist/temporal/tickets/client.d.ts +10 -0
  84. package/dist/temporal/tickets/client.js +31 -0
  85. package/dist/temporal/tickets/client.js.map +1 -0
  86. package/dist/temporal/tickets/contrat.d.ts +56 -0
  87. package/dist/temporal/tickets/contrat.js +13 -0
  88. package/dist/temporal/tickets/contrat.js.map +1 -0
  89. package/dist/temporal/tickets/deroule.d.ts +3 -0
  90. package/dist/temporal/tickets/deroule.js +94 -0
  91. package/dist/temporal/tickets/deroule.js.map +1 -0
  92. package/dist/temporal/travailleur.d.ts +2 -0
  93. package/dist/temporal/travailleur.js +69 -0
  94. package/dist/temporal/travailleur.js.map +1 -0
  95. package/docs/ARCHITECTURE.md +813 -53
  96. package/docs/CADRE.md +17 -0
  97. package/docs/INTERFACE.md +161 -30
  98. package/hooks/crochet.mjs +19 -2
  99. package/hooks/hooks.json +11 -0
  100. package/package.json +16 -4
  101. package/scripts/activites.mjs +2182 -0
  102. package/scripts/aiguillage.d.mts +37 -0
  103. package/scripts/aiguillage.mjs +328 -0
  104. package/scripts/avancement.mjs +159 -64
  105. package/scripts/bilan.mjs +37 -19
  106. package/scripts/cadre.mjs +11 -2
  107. package/scripts/circuit.mjs +888 -3654
  108. package/scripts/circuits-cles.d.mts +4 -0
  109. package/scripts/circuits-cles.mjs +21 -0
  110. package/scripts/circuits-du-serveur.mjs +105 -0
  111. package/scripts/codes-de-sortie.mjs +9 -0
  112. package/scripts/commandes-composees.mjs +45 -41
  113. package/scripts/commandes-du-path.d.mts +7 -0
  114. package/scripts/commandes-du-path.mjs +25 -0
  115. package/scripts/composition-des-langages.mjs +30 -11
  116. package/scripts/conformite.mjs +19 -10
  117. package/scripts/copies-finies.mjs +188 -42
  118. package/scripts/depart-du-ticket.d.mts +53 -0
  119. package/scripts/depart-du-ticket.mjs +124 -0
  120. package/scripts/dependances-internes.mjs +115 -0
  121. package/scripts/dernier-vert.mjs +7 -15
  122. package/scripts/donnees-cles.mjs +228 -0
  123. package/scripts/droits.mjs +11 -1
  124. package/scripts/effets.mjs +352 -0
  125. package/scripts/enveloppe/enveloppe.mjs +119 -8
  126. package/scripts/enveloppe/lancer.sh +27 -32
  127. package/scripts/enveloppe/paquets-du-plan.mjs +2 -2
  128. package/scripts/enveloppe/travail-de-la-copie.mjs +99 -12
  129. package/scripts/etapes.mjs +6 -3
  130. package/scripts/faits-du-circuit.mjs +493 -0
  131. package/scripts/file-des-tickets.d.mts +21 -0
  132. package/scripts/file-des-tickets.mjs +58 -0
  133. package/scripts/flux-des-paquets.mjs +187 -0
  134. package/scripts/fusion-du-changelog.mjs +0 -1
  135. package/scripts/gardes-du-cadre.mjs +12 -2
  136. package/scripts/grillhouse-maj.mjs +16 -7
  137. package/scripts/integration/file.mjs +477 -422
  138. package/scripts/integration/integrer.mjs +20 -22
  139. package/scripts/integration/rejeu.mjs +19 -4
  140. package/scripts/jointure.d.ts +168 -28
  141. package/scripts/langages/cargo/commandes.mjs +426 -119
  142. package/scripts/langages/cargo/composants.mjs +187 -3
  143. package/scripts/langages/cargo/exemples.mjs +75 -17
  144. package/scripts/langages/cargo/index.mjs +32 -13
  145. package/scripts/langages/cargo/migrations/0.28.4-tailles-des-tests.mjs +35 -0
  146. package/scripts/langages/cargo/sccache.mjs +62 -16
  147. package/scripts/langages/cargo/squelette.mjs +72 -3
  148. package/scripts/langages/cargo/tailles-des-tests.mjs +195 -0
  149. package/scripts/langages/cargo/tests-de-head.mjs +159 -0
  150. package/scripts/langages/python/commandes.mjs +232 -79
  151. package/scripts/langages/python/composants.mjs +65 -3
  152. package/scripts/langages/python/exemples.mjs +21 -12
  153. package/scripts/langages/python/index.mjs +25 -5
  154. package/scripts/langages/python/lot.mjs +1 -36
  155. package/scripts/langages/python/squelette.mjs +119 -17
  156. package/scripts/langages/typescript/construire.mjs +6 -163
  157. package/scripts/langages/typescript/exemples.mjs +19 -11
  158. package/scripts/langages/typescript/frontieres.mjs +1 -1
  159. package/scripts/langages/typescript/index.mjs +48 -63
  160. package/scripts/langages/typescript/interfaces-contre-code.mjs +4 -4
  161. package/scripts/langages/typescript/migrations/0.30.0-prefixe-des-tickets.mjs +63 -0
  162. package/scripts/langages/typescript/migrations/0.30.0-tailles-des-outils-lourds.mjs +31 -0
  163. package/scripts/langages/typescript/migrations/0.30.0-titres-nommant-un-ticket.mjs +40 -0
  164. package/scripts/langages/typescript/mise-a-jour.mjs +1 -2
  165. package/scripts/langages/typescript/regle-des-tests.mjs +13 -0
  166. package/scripts/langages/typescript/squelette.mjs +18 -2
  167. package/scripts/langages/typescript/tailles-des-tests.mjs +40 -9
  168. package/scripts/langages/typescript/tests-de-nuit.mjs +44 -21
  169. package/scripts/langages/typescript/tests.mjs +17 -8
  170. package/scripts/langages/typescript/titres-de-tests.mjs +297 -0
  171. package/scripts/langages/typescript/turbo-des-paquets.mjs +183 -38
  172. package/scripts/langages/typescript/verdict.mjs +1 -1
  173. package/scripts/langages/typescript/verifier.mjs +110 -296
  174. package/scripts/langages/typescript/vitest-config/base.mjs +30 -10
  175. package/scripts/langages/typescript/vitest-config/bornes.mjs +13 -0
  176. package/scripts/langages/typescript/vitest-config/cibles.mjs +123 -62
  177. package/scripts/langages/typescript/vitest-config/delais.mjs +54 -0
  178. package/scripts/langages/typescript/vitest-config/delais.setup.mjs +11 -0
  179. package/scripts/langages/typescript/vitest-config/duree.classement.mjs +100 -0
  180. package/scripts/langages/typescript/vitest-config/duree.reporter.mjs +56 -64
  181. package/scripts/langages/typescript/vitest-config/machine.setup.mjs +7 -2
  182. package/scripts/langages/typescript/vitest-config/mesure.mjs +3 -2
  183. package/scripts/langages/typescript/vitest.nuit.config.mjs +22 -13
  184. package/scripts/lecture-unique.mjs +51 -0
  185. package/scripts/mesure/pression.mjs +11 -9
  186. package/scripts/mesure-de-la-machine.d.mts +21 -0
  187. package/scripts/mesure-de-la-machine.mjs +76 -0
  188. package/scripts/migrations/0.23.2-copies-du-cadre.mjs +8 -2
  189. package/scripts/migrations/0.30.0-ci-appelle-la-verification.mjs +120 -0
  190. package/scripts/migrations/0.31.0-paquets-dans-le-graphe.mjs +81 -0
  191. package/scripts/migrations.mjs +5 -0
  192. package/scripts/nuit.sh +29 -15
  193. package/scripts/outil.mjs +72 -0
  194. package/scripts/outils-cles.d.mts +24 -0
  195. package/scripts/outils-cles.mjs +0 -1
  196. package/scripts/paquet-npm.mjs +147 -0
  197. package/scripts/paquet.mjs +112 -14
  198. package/scripts/paquets.mjs +34 -6
  199. package/scripts/passe-de-la-machine.mjs +66 -0
  200. package/scripts/places-de-la-machine.mjs +360 -0
  201. package/scripts/places-du-serveur.mjs +170 -0
  202. package/scripts/prefixe-des-tickets.mjs +68 -0
  203. package/scripts/preparation.mjs +10 -3
  204. package/scripts/registre.mjs +3 -2
  205. package/scripts/regles-des-places.d.mts +36 -0
  206. package/scripts/regles-des-places.mjs +70 -0
  207. package/scripts/reponses-du-circuit.d.mts +6 -0
  208. package/scripts/reponses-du-circuit.mjs +28 -0
  209. package/scripts/resultats.mjs +29 -14
  210. package/scripts/retirer-les-copies-finies.mjs +25 -0
  211. package/scripts/sans-reponse.d.mts +4 -0
  212. package/scripts/sans-reponse.mjs +13 -0
  213. package/scripts/seances.mjs +918 -0
  214. package/scripts/services-du-noyau.mjs +28 -11
  215. package/scripts/session-start.sh +10 -1
  216. package/scripts/sortie.mjs +23 -4
  217. package/scripts/sources.mjs +3 -3
  218. package/scripts/sous-commandes.mjs +39 -9
  219. package/scripts/style-a-l-ecriture.mjs +229 -0
  220. package/scripts/superviseur.mjs +382 -16
  221. package/scripts/tableau.mjs +329 -130
  222. package/scripts/taches-du-graphe.mjs +328 -0
  223. package/scripts/ticket-du-circuit.mjs +206 -0
  224. package/scripts/transitions.d.mts +148 -0
  225. package/scripts/transitions.mjs +901 -0
  226. package/scripts/verrou-de-fichier.mjs +2 -2
  227. package/scripts/verrou-de-machine.mjs +322 -62
  228. package/skills/developpeur/SKILL.md +11 -3
  229. package/skills/explorateur/SKILL.md +2 -1
  230. package/skills/pitmaster/SKILL.md +62 -28
  231. package/skills/pitmaster/references/consigne-agent.md +5 -1
  232. package/skills/release/SKILL.md +3 -3
  233. package/skills/relecteur/SKILL.md +22 -8
  234. package/skills/testwriter/SKILL.md +47 -39
  235. package/scripts/demon.mjs +0 -138
  236. package/scripts/integration/file-attente.mjs +0 -61
  237. package/scripts/langages/cargo/touches.mjs +0 -93
  238. package/scripts/langages/typescript/script-des-tests.mjs +0 -6
@@ -0,0 +1,106 @@
1
+ /** The workflow's type. */
2
+ export declare const PLACES = "placesDeLaMachine";
3
+ /** The id of the one workflow of the machine. */
4
+ export declare const ID_DES_PLACES = "grillhouse-places-de-la-machine";
5
+ /** The update that asks for a place: it records the request and returns at once. */
6
+ export declare const PRENDRE = "prendre";
7
+ /** The update that draws the next rank of arrival of the machine, which a circuit keeps. */
8
+ export declare const TIRER_UN_RANG = "tirerUnRang";
9
+ /** The signal that gives a place back, or withdraws a request that waits. */
10
+ export declare const RENDRE = "rendre";
11
+ /** The signal that names the process that holds a place or a request. */
12
+ export declare const RATTACHER = "rattacher";
13
+ /** The query of the places, which the board reads. */
14
+ export declare const LES_PLACES = "lesPlaces";
15
+ /** The query of one request: given, waiting, or unknown (withdrawn, or its process gone). */
16
+ export declare const LA_DEMANDE = "laDemande";
17
+ /** A place taken. */
18
+ interface Prise {
19
+ id: string;
20
+ pid: number;
21
+ /** The start of the process (`departDe`), null when unknown. */
22
+ depart: string | null;
23
+ ticket: string | null;
24
+ rang: number;
25
+ /** The time it was taken, in ms. */
26
+ depuis: number;
27
+ }
28
+ /** A taking that waits, and why. */
29
+ interface Attente {
30
+ id: string;
31
+ pid: number;
32
+ depart: string | null;
33
+ ticket: string | null;
34
+ rang: number;
35
+ raison: string;
36
+ depuis: number;
37
+ }
38
+ /** The state of the places, which the workflow carries across a Continue-As-New. */
39
+ export interface EtatDesPlaces {
40
+ /** The last rank of arrival drawn. */
41
+ rang: number;
42
+ /** The time of the last start, in ms. */
43
+ dernier: number;
44
+ prises: Prise[];
45
+ attentes: Attente[];
46
+ }
47
+ /** What the machine gives at a moment (scripts/regles-des-places.mjs). */
48
+ export interface Mesure {
49
+ coeurs: number;
50
+ charge: number;
51
+ memoireLibre: number;
52
+ }
53
+ /** What the workflow receives. */
54
+ export interface EntreeDesPlaces {
55
+ /** The ceiling of the places (GRILLHOUSE_PLACES of the machine, 3 by default). */
56
+ plafond: number;
57
+ /** The gap between two starts, in ms (GRILLHOUSE_ESPACEMENT_MS). */
58
+ espacementMs: number;
59
+ /** How often a wait and the places taken are judged again, in ms. */
60
+ veilleMs: number;
61
+ /** The length of history past which the workflow continues as new; 2000 by default. */
62
+ limiteDHistoire?: number;
63
+ /** A machine of trial: the measure it always gives, in place of the activity's. */
64
+ mesureFixe?: Mesure;
65
+ /** The state a Continue-As-New carries. */
66
+ etat?: EtatDesPlaces;
67
+ }
68
+ /** A request: its id, the process that holds the place, its ticket, the rank of its circuit. */
69
+ export interface DemandeDePlace {
70
+ /** The id the caller draws; a request sent again under it is the same request. */
71
+ id: string;
72
+ pid: number;
73
+ depart: string | null;
74
+ ticket?: string | null;
75
+ /** The rank of arrival of the circuit; drawn by the workflow, past every rank given, when absent. */
76
+ rang?: number;
77
+ }
78
+ /** The place given. */
79
+ export interface PlaceDonnee {
80
+ id: string;
81
+ rang: number;
82
+ }
83
+ /** What the board reads: the ceiling, the places taken, the waits in their order of arrival. */
84
+ export interface VueDesPlaces {
85
+ plafond: number;
86
+ prises: Prise[];
87
+ attentes: Attente[];
88
+ }
89
+ /** Where a request stands. */
90
+ export type EtatDeLaDemande = {
91
+ etat: 'donnee';
92
+ rang: number;
93
+ } | {
94
+ etat: 'attend';
95
+ rang: number;
96
+ raison: string;
97
+ } | {
98
+ etat: 'inconnue';
99
+ };
100
+ /** The process that now holds the place or the request <id>. */
101
+ export interface Rattachement {
102
+ id: string;
103
+ pid: number;
104
+ depart: string | null;
105
+ }
106
+ export {};
@@ -0,0 +1,21 @@
1
+ // The contract of the workflow of the machine, which holds its places (grillhouse-4nr.7,
2
+ // decision D2): its type, its update, its signals and its queries by their names, its id, its state
3
+ // and what its callers send and receive. The workflow, its activities and their clients share it
4
+ // without importing each other.
5
+ /** The workflow's type. */
6
+ export const PLACES = 'placesDeLaMachine';
7
+ /** The id of the one workflow of the machine. */
8
+ export const ID_DES_PLACES = 'grillhouse-places-de-la-machine';
9
+ /** The update that asks for a place: it records the request and returns at once. */
10
+ export const PRENDRE = 'prendre';
11
+ /** The update that draws the next rank of arrival of the machine, which a circuit keeps. */
12
+ export const TIRER_UN_RANG = 'tirerUnRang';
13
+ /** The signal that gives a place back, or withdraws a request that waits. */
14
+ export const RENDRE = 'rendre';
15
+ /** The signal that names the process that holds a place or a request. */
16
+ export const RATTACHER = 'rattacher';
17
+ /** The query of the places, which the board reads. */
18
+ export const LES_PLACES = 'lesPlaces';
19
+ /** The query of one request: given, waiting, or unknown (withdrawn, or its process gone). */
20
+ export const LA_DEMANDE = 'laDemande';
21
+ //# sourceMappingURL=contrat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrat.js","sourceRoot":"","sources":["../../../src/temporal/places/contrat.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,oGAAoG;AACpG,iGAAiG;AACjG,gCAAgC;AAEhC,2BAA2B;AAC3B,MAAM,CAAC,MAAM,MAAM,GAAG,mBAAmB,CAAC;AAC1C,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,iCAAiC,CAAC;AAC/D,oFAAoF;AACpF,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AACjC,4FAA4F;AAC5F,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC;AAC3C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;AAC/B,yEAAyE;AACzE,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,sDAAsD;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AACtC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type EntreeDesPlaces } from './contrat.js';
2
+ /** The places of the machine, until the next Continue-As-New. */
3
+ export declare function placesDeLaMachine(entree: EntreeDesPlaces): Promise<void>;
@@ -0,0 +1,198 @@
1
+ // The workflow of the machine, which holds its places (grillhouse-4nr.7, decision D2), as the job
2
+ // server of GNU make shares its slots between every make of a build, and as the semaphore of
3
+ // Temporal's samples (samples-typescript « mutex ») grants its leases: one workflow for the machine
4
+ // (ID_DES_PLACES), the one state of the places, which every pass and session of the machine reads
5
+ // (scripts/places-de-la-machine.mjs). A circuit draws its rank of arrival at its launch by the
6
+ // update TIRER_UN_RANG; a session asks for a place by the update PRENDRE, which records its request and returns at once;
7
+ // the main loop grants the places, and the session learns its grant by the query LA_DEMANDE, so no
8
+ // handler stays open while a request waits, and a request lives in the state a Continue-As-New
9
+ // carries. The signal RENDRE gives a place back or withdraws a request, RATTACHER names the process
10
+ // that holds a place; the query LES_PLACES gives the board the places and the requests that wait.
11
+ // A grant passes by the rule of the places (`refusDeLaPlace` of
12
+ // scripts/regles-des-places.mjs): a free place under the ceiling, the turn of its rank of arrival
13
+ // between projects, the admission at the load and the memory (measured by an activity, once per
14
+ // judgement and only when the place and the turn pass), the spacing of the starts. The requests
15
+ // are judged again at each change and every `veilleMs`; a place or a request whose process is gone
16
+ // (one activity for all of them) is removed for good then. Past its length of history
17
+ // (`continueAsNewSuggested`, or `limiteDHistoire`), the workflow continues as new with its state.
18
+ // Deterministic: it imports the workflow API, the contract and the pure rule.
19
+ import { allHandlersFinished, condition, continueAsNew, defineQuery, defineSignal, defineUpdate, proxyActivities, setHandler, workflowInfo, } from '@temporalio/workflow';
20
+ import { refusDeLaPlace } from '../../../scripts/regles-des-places.mjs';
21
+ import { LA_DEMANDE, LES_PLACES, PRENDRE, RATTACHER, RENDRE, TIRER_UN_RANG, } from './contrat.js';
22
+ const { mesurerLaMachine, processusVivants } = proxyActivities({
23
+ startToCloseTimeout: '30 seconds',
24
+ retry: { initialInterval: '1 second', maximumAttempts: 5 },
25
+ });
26
+ const prendre = defineUpdate(PRENDRE);
27
+ const tirerUnRang = defineUpdate(TIRER_UN_RANG);
28
+ const rendre = defineSignal(RENDRE);
29
+ const rattacher = defineSignal(RATTACHER);
30
+ const lesPlaces = defineQuery(LES_PLACES);
31
+ const laDemande = defineQuery(LA_DEMANDE);
32
+ // The measure the rule asks for, which the workflow reads by its activity.
33
+ class BesoinDeLaMesure extends Error {
34
+ }
35
+ const LIMITE_D_HISTOIRE = 2000;
36
+ /** The places of the machine, until the next Continue-As-New. */
37
+ export async function placesDeLaMachine(entree) {
38
+ const etat = entree.etat ?? { rang: 0, dernier: 0, prises: [], attentes: [] };
39
+ // Each change of the places, which wakes the main loop.
40
+ let version = 0;
41
+ const changer = () => {
42
+ version += 1;
43
+ };
44
+ // Removes the places and the requests whose process is gone, by one activity for all of them. A
45
+ // place or a request attached to another process while the lives are read (`rattacher`, handled
46
+ // during the await) is judged on that process at the next reading, not on the one read.
47
+ const purger = async () => {
48
+ const tous = [...etat.prises, ...etat.attentes].map(x => ({
49
+ id: x.id,
50
+ pid: x.pid,
51
+ depart: x.depart,
52
+ }));
53
+ if (!tous.length) {
54
+ return;
55
+ }
56
+ const vivants = await processusVivants(tous.map(x => ({ pid: x.pid, depart: x.depart })));
57
+ const actuel = new Map([...etat.prises, ...etat.attentes].map(x => [x.id, x]));
58
+ const morts = new Set(tous
59
+ .filter((x, i) => {
60
+ const a = actuel.get(x.id);
61
+ return vivants[i] === false && a?.pid === x.pid && a.depart === x.depart;
62
+ })
63
+ .map(x => x.id));
64
+ if (!morts.size) {
65
+ return;
66
+ }
67
+ etat.prises = etat.prises.filter(p => !morts.has(p.id));
68
+ etat.attentes = etat.attentes.filter(a => !morts.has(a.id));
69
+ changer();
70
+ };
71
+ // Grants the requests in their order of arrival, each by the rule; the machine measured at most
72
+ // once, when a request passes the place and the turn. A request withdrawn while the measure is
73
+ // read (the signal RENDRE, handled during its await) is judged no more.
74
+ const juger = async () => {
75
+ let mesure = entree.mesureFixe ?? null;
76
+ const encore = (id) => etat.attentes.some(x => x.id === id);
77
+ for (const a of [...etat.attentes].sort((x, y) => x.rang - y.rang)) {
78
+ if (!encore(a.id)) {
79
+ continue;
80
+ }
81
+ const regle = (m) => refusDeLaPlace(etat, {
82
+ id: a.id,
83
+ rang: a.rang,
84
+ plafond: entree.plafond,
85
+ espacementMs: entree.espacementMs,
86
+ maintenant: Date.now(),
87
+ mesurer: m,
88
+ });
89
+ let raison;
90
+ try {
91
+ raison = regle(() => {
92
+ if (mesure) {
93
+ return mesure;
94
+ }
95
+ throw new BesoinDeLaMesure();
96
+ });
97
+ }
98
+ catch (e) {
99
+ if (!(e instanceof BesoinDeLaMesure)) {
100
+ throw e;
101
+ }
102
+ mesure = await mesurerLaMachine();
103
+ if (!encore(a.id)) {
104
+ continue;
105
+ }
106
+ const m = mesure;
107
+ raison = regle(() => m);
108
+ }
109
+ if (raison === null) {
110
+ etat.attentes = etat.attentes.filter(x => x.id !== a.id);
111
+ etat.prises.push({
112
+ id: a.id,
113
+ pid: a.pid,
114
+ depart: a.depart,
115
+ ticket: a.ticket,
116
+ rang: a.rang,
117
+ depuis: Date.now(),
118
+ });
119
+ etat.dernier = Date.now();
120
+ changer();
121
+ }
122
+ else if (a.raison !== raison) {
123
+ a.raison = raison;
124
+ }
125
+ }
126
+ };
127
+ setHandler(prendre, demande => {
128
+ const connue = etat.prises.find(p => p.id === demande.id) ?? etat.attentes.find(a => a.id === demande.id);
129
+ if (connue) {
130
+ return { id: connue.id, rang: connue.rang };
131
+ }
132
+ const rang = demande.rang ?? etat.rang + 1;
133
+ etat.rang = Math.max(etat.rang, rang);
134
+ etat.attentes.push({
135
+ id: demande.id,
136
+ pid: demande.pid,
137
+ depart: demande.depart,
138
+ ticket: demande.ticket ?? null,
139
+ rang,
140
+ raison: 'pas encore jugée',
141
+ depuis: Date.now(),
142
+ });
143
+ changer();
144
+ return { id: demande.id, rang };
145
+ });
146
+ setHandler(tirerUnRang, () => {
147
+ etat.rang += 1;
148
+ return etat.rang;
149
+ });
150
+ setHandler(rendre, id => {
151
+ const n = etat.prises.length + etat.attentes.length;
152
+ etat.prises = etat.prises.filter(p => p.id !== id);
153
+ etat.attentes = etat.attentes.filter(a => a.id !== id);
154
+ if (etat.prises.length + etat.attentes.length !== n) {
155
+ changer();
156
+ }
157
+ });
158
+ setHandler(rattacher, ({ id, pid, depart }) => {
159
+ const p = etat.prises.find(x => x.id === id) ?? etat.attentes.find(x => x.id === id);
160
+ if (p) {
161
+ p.pid = pid;
162
+ p.depart = depart;
163
+ changer();
164
+ }
165
+ });
166
+ setHandler(lesPlaces, () => ({
167
+ plafond: entree.plafond,
168
+ prises: etat.prises,
169
+ attentes: [...etat.attentes].sort((a, b) => a.rang - b.rang),
170
+ }));
171
+ setHandler(laDemande, id => {
172
+ const p = etat.prises.find(x => x.id === id);
173
+ if (p) {
174
+ return { etat: 'donnee', rang: p.rang };
175
+ }
176
+ const a = etat.attentes.find(x => x.id === id);
177
+ return a ? { etat: 'attend', rang: a.rang, raison: a.raison } : { etat: 'inconnue' };
178
+ });
179
+ const limite = entree.limiteDHistoire ?? LIMITE_D_HISTOIRE;
180
+ const aContinuer = () => workflowInfo().continueAsNewSuggested || workflowInfo().historyLength >= limite;
181
+ // The version the last judgement started from: a change during it (a request, a place given
182
+ // back, its own grants) wakes the next one at once.
183
+ let jugee = -1;
184
+ for (;;) {
185
+ await condition(() => version !== jugee || aContinuer(), entree.veilleMs);
186
+ jugee = version;
187
+ if (etat.prises.length || etat.attentes.length) {
188
+ await purger();
189
+ await juger();
190
+ }
191
+ if (aContinuer()) {
192
+ // Every handler returns at once: none holds the run open.
193
+ await condition(allHandlersFinished);
194
+ await continueAsNew({ ...entree, etat });
195
+ }
196
+ }
197
+ }
198
+ //# sourceMappingURL=deroule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deroule.js","sourceRoot":"","sources":["../../../src/temporal/places/deroule.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,6FAA6F;AAC7F,oGAAoG;AACpG,kGAAkG;AAClG,+FAA+F;AAC/F,yHAAyH;AACzH,mGAAmG;AACnG,+FAA+F;AAC/F,oGAAoG;AACpG,kGAAkG;AAClG,gEAAgE;AAChE,kGAAkG;AAClG,gGAAgG;AAChG,gGAAgG;AAChG,mGAAmG;AACnG,sFAAsF;AACtF,kGAAkG;AAClG,8EAA8E;AAC9E,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE,OAAO,EACL,UAAU,EACV,UAAU,EACV,OAAO,EACP,SAAS,EACT,MAAM,EACN,aAAa,GASd,MAAM,cAAc,CAAC;AAEtB,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,eAAe,CAAmB;IAC/E,mBAAmB,EAAE,YAAY;IACjC,KAAK,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,EAAE;CAC3D,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,YAAY,CAAgC,OAAO,CAAC,CAAC;AACrE,MAAM,WAAW,GAAG,YAAY,CAAa,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,GAAG,YAAY,CAAW,MAAM,CAAC,CAAC;AAC9C,MAAM,SAAS,GAAG,YAAY,CAAiB,SAAS,CAAC,CAAC;AAC1D,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,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACvF,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,IAAI,iBAAiB,CAAC;IAC3D,MAAM,UAAU,GAAG,GAAG,EAAE,CACtB,YAAY,EAAE,CAAC,sBAAsB,IAAI,YAAY,EAAE,CAAC,aAAa,IAAI,MAAM,CAAC;IAClF,4FAA4F;IAC5F,oDAAoD;IACpD,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IACf,SAAS,CAAC;QACR,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,OAAO,KAAK,KAAK,IAAI,UAAU,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1E,KAAK,GAAG,OAAO,CAAC;QAChB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC/C,MAAM,MAAM,EAAE,CAAC;YACf,MAAM,KAAK,EAAE,CAAC;QAChB,CAAC;QACD,IAAI,UAAU,EAAE,EAAE,CAAC;YACjB,0DAA0D;YAC1D,MAAM,SAAS,CAAC,mBAAmB,CAAC,CAAC;YACrC,MAAM,aAAa,CAA2B,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ResultatDeLActivite } from './contrat.js';
2
+ /** Runs the sonde's process for <etapes> steps, <pauseMs> ms apart, from its last sign of life. */
3
+ export declare function lancerLaSonde({ etapes, pauseMs, }: {
4
+ etapes: number;
5
+ pauseMs: number;
6
+ }): Promise<ResultatDeLActivite>;
@@ -0,0 +1,52 @@
1
+ // The sonde's activity: it starts a process that does its steps one by one and says each on its
2
+ // standard output, and sends a sign of life to the server at each step (`heartbeat`, the steps
3
+ // done). When its worker dies, the server gives the activity again once its sign of life is late,
4
+ // and the new attempt starts its process from the last sign of life the server kept
5
+ // (`heartbeatDetails`). A cancellation (the worker stopping) ends the process.
6
+ import { spawn } from 'node:child_process';
7
+ import { createInterface } from 'node:readline';
8
+ import { Context } from '@temporalio/activity';
9
+ // The process: from the step argv[1] to argv[2], one step every argv[3] ms, each said `fait <n>`;
10
+ // its reader gone (its worker killed), it ends at its next step.
11
+ const PROCESSUS = `
12
+ process.stdout.on('error', () => process.exit(1));
13
+ const [depuis, etapes, pause] = process.argv.slice(1).map(Number);
14
+ let i = depuis;
15
+ const pas = () => {
16
+ if (i >= etapes) return;
17
+ i += 1;
18
+ process.stdout.write('fait ' + i + '\\n');
19
+ setTimeout(pas, pause);
20
+ };
21
+ setTimeout(pas, pause);
22
+ `;
23
+ /** Runs the sonde's process for <etapes> steps, <pauseMs> ms apart, from its last sign of life. */
24
+ export async function lancerLaSonde({ etapes, pauseMs, }) {
25
+ const ctx = Context.current();
26
+ const depuis = ctx.info.heartbeatDetails?.fait ?? 0;
27
+ const enfant = spawn(process.execPath, ['-e', PROCESSUS, String(depuis), String(etapes), String(pauseMs)], { stdio: ['ignore', 'pipe', 'inherit'] });
28
+ const arreter = () => enfant.kill('SIGTERM');
29
+ ctx.cancellationSignal.addEventListener('abort', arreter);
30
+ let fait = depuis;
31
+ ctx.heartbeat({ fait });
32
+ createInterface({ input: enfant.stdout }).on('line', l => {
33
+ const m = /^fait (\d+)$/.exec(l);
34
+ if (m) {
35
+ fait = Number(m[1]);
36
+ ctx.heartbeat({ fait });
37
+ }
38
+ });
39
+ const code = await new Promise((ok, ko) => {
40
+ enfant.once('error', ko);
41
+ enfant.once('close', ok);
42
+ });
43
+ ctx.cancellationSignal.removeEventListener('abort', arreter);
44
+ if (ctx.cancellationSignal.aborted) {
45
+ throw ctx.cancellationSignal.reason;
46
+ }
47
+ if (code !== 0) {
48
+ throw new Error(`le processus de la sonde sort en ${code}`);
49
+ }
50
+ return { fait, depuis, tentative: ctx.info.attempt, pid: enfant.pid ?? 0 };
51
+ }
52
+ //# sourceMappingURL=activites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activites.js","sourceRoot":"","sources":["../../../src/temporal/sonde/activites.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,+FAA+F;AAC/F,kGAAkG;AAClG,oFAAoF;AACpF,+EAA+E;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,kGAAkG;AAClG,iEAAiE;AACjE,MAAM,SAAS,GAAG;;;;;;;;;;;CAWjB,CAAC;AAEF,mGAAmG;AACnG,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAClC,MAAM,EACN,OAAO,GAIR;IACC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAI,GAAG,CAAC,IAAI,CAAC,gBAA2C,EAAE,IAAI,IAAI,CAAC,CAAC;IAChF,MAAM,MAAM,GAAG,KAAK,CAClB,OAAO,CAAC,QAAQ,EAChB,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,EAClE,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CACzC,CAAC;IACF,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7C,GAAG,CAAC,kBAAkB,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 +1,35 @@
1
+ /** The workflow's type. */
2
+ export declare const SONDE = "sonde";
3
+ /** The signal that ends the wait of the workflow. */
4
+ export declare const FINIR = "finir";
5
+ /** What the workflow receives. */
6
+ export interface EntreeDeLaSonde {
7
+ /** The ticket the workflow carries, its search attribute GrillhouseTicket. */
8
+ ticket: string;
9
+ /** The steps the activity's process does. */
10
+ etapes: number;
11
+ /** The pause of the process between two steps, in milliseconds. */
12
+ pauseMs: number;
13
+ /** Whether the workflow waits for the signal FINIR once its activity is done. */
14
+ attendreLeSignal: boolean;
15
+ }
16
+ /** The sign of life of the activity: the steps its process has done. */
17
+ export interface SigneDeVie {
18
+ fait: number;
19
+ }
20
+ /** What the activity gives back. */
21
+ export interface ResultatDeLActivite {
22
+ /** The steps done, all of them. */
23
+ fait: number;
24
+ /** The step the attempt started from: its last sign of life, 0 for a first attempt. */
25
+ depuis: number;
26
+ /** The attempt, from 1. */
27
+ tentative: number;
28
+ /** The process the attempt started. */
29
+ pid: number;
30
+ }
31
+ /** What the workflow gives back. */
32
+ export interface ResultatDeLaSonde {
33
+ ticket: string;
34
+ activite: ResultatDeLActivite;
35
+ }
@@ -0,0 +1,10 @@
1
+ // The contract of the sonde, which the workflow, its activity and their clients share without
2
+ // importing each other: the workflow's type and its signal by their names, what it receives, what
3
+ // it and its activity give back, and the sign of life the activity sends. The sonde proves the
4
+ // service: a workflow whose activity starts a process and sends its signs of life, which waits for
5
+ // a signal when asked, and upserts its step at each move.
6
+ /** The workflow's type. */
7
+ export const SONDE = 'sonde';
8
+ /** The signal that ends the wait of the workflow. */
9
+ export const FINIR = 'finir';
10
+ //# sourceMappingURL=contrat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrat.js","sourceRoot":"","sources":["../../../src/temporal/sonde/contrat.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,kGAAkG;AAClG,+FAA+F;AAC/F,mGAAmG;AACnG,0DAA0D;AAE1D,2BAA2B;AAC3B,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;AAE7B,qDAAqD;AACrD,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type EntreeDeLaSonde, type ResultatDeLaSonde } from './contrat.js';
2
+ /** The sonde: its activity, then the wait for FINIR when asked. */
3
+ export declare function sonde(entree: EntreeDeLaSonde): Promise<ResultatDeLaSonde>;
@@ -0,0 +1,39 @@
1
+ // The sonde's workflow, which the worker bundles (Worker.create, workflowsPath): it upserts its
2
+ // ticket and its step as search attributes, runs its activity (a process with its signs of life,
3
+ // started again from its last sign of life when its worker dies), waits for the signal FINIR when
4
+ // asked, and gives back what its activity did. Deterministic: it imports nothing but the workflow
5
+ // API, the search attributes and the contract.
6
+ import { condition, defineSignal, proxyActivities, setHandler, upsertSearchAttributes, workflowInfo, } from '@temporalio/workflow';
7
+ import { ATTRIBUT_ETAPE, ATTRIBUT_TICKET } from '../attributs.js';
8
+ import { FINIR } from './contrat.js';
9
+ // The activity: its sign of life awaited every 3 s, an attempt given again after 1 s.
10
+ const { lancerLaSonde } = proxyActivities({
11
+ startToCloseTimeout: '10 minutes',
12
+ heartbeatTimeout: '3 seconds',
13
+ retry: { initialInterval: '1 second', maximumAttempts: 5 },
14
+ });
15
+ const finir = defineSignal(FINIR);
16
+ // Upserts the step <etape>, and the ticket <ticket> when the workflow does not carry it yet.
17
+ function etape(etape, ticket) {
18
+ const attributs = [{ key: ATTRIBUT_ETAPE, value: etape }];
19
+ if (workflowInfo().typedSearchAttributes.get(ATTRIBUT_TICKET) !== ticket) {
20
+ attributs.push({ key: ATTRIBUT_TICKET, value: ticket });
21
+ }
22
+ upsertSearchAttributes(attributs);
23
+ }
24
+ /** The sonde: its activity, then the wait for FINIR when asked. */
25
+ export async function sonde(entree) {
26
+ let fini = false;
27
+ setHandler(finir, () => {
28
+ fini = true;
29
+ });
30
+ etape('activite', entree.ticket);
31
+ const activite = await lancerLaSonde({ etapes: entree.etapes, pauseMs: entree.pauseMs });
32
+ if (entree.attendreLeSignal) {
33
+ etape('attente', entree.ticket);
34
+ await condition(() => fini);
35
+ }
36
+ etape('fini', entree.ticket);
37
+ return { ticket: entree.ticket, activite };
38
+ }
39
+ //# sourceMappingURL=deroule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deroule.js","sourceRoot":"","sources":["../../../src/temporal/sonde/deroule.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,iGAAiG;AACjG,kGAAkG;AAClG,kGAAkG;AAClG,+CAA+C;AAC/C,OAAO,EACL,SAAS,EACT,YAAY,EACZ,eAAe,EACf,UAAU,EACV,sBAAsB,EACtB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,KAAK,EAAgD,MAAM,cAAc,CAAC;AAEnF,sFAAsF;AACtF,MAAM,EAAE,aAAa,EAAE,GAAG,eAAe,CAAmB;IAC1D,mBAAmB,EAAE,YAAY;IACjC,gBAAgB,EAAE,WAAW;IAC7B,KAAK,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC,EAAE;CAC3D,CAAC,CAAC;AAEH,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;AAElC,6FAA6F;AAC7F,SAAS,KAAK,CAAC,KAAa,EAAE,MAAc;IAC1C,MAAM,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1D,IAAI,YAAY,EAAE,CAAC,qBAAqB,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,MAAM,EAAE,CAAC;QACzE,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,sBAAsB,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC;AAED,mEAAmE;AACnE,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAuB;IACjD,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE;QACrB,IAAI,GAAG,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACzF,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC5B,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAChC,MAAM,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ActivitesDesTickets } from './contrat.js';
2
+ type Entree<K extends keyof ActivitesDesTickets> = Parameters<ActivitesDesTickets[K]>[0];
3
+ type Sortie<K extends keyof ActivitesDesTickets> = Awaited<ReturnType<ActivitesDesTickets[K]>>;
4
+ export declare function ticketsAPartir(e: Entree<'ticketsAPartir'>): Promise<Sortie<'ticketsAPartir'>>;
5
+ export declare function circuitsVivants(e: Entree<'circuitsVivants'>): Promise<string[]>;
6
+ export declare function circuitsNonIntegres(e: Entree<'circuitsNonIntegres'>): Promise<string[]>;
7
+ export {};
@@ -0,0 +1,81 @@
1
+ // The activities of the queue of the tickets of a project (./deroule.ts): the tickets that start,
2
+ // read from Beads in the main tree of the repository with the setting of its package.json, the
3
+ // circuits of the project alive and those not integrated, read from the server. A package.json that does not parse, or a Beads that fails, is a fault named, never a key
4
+ // absent nor an empty list.
5
+ import { readFileSync } from 'node:fs';
6
+ import path from 'node:path';
7
+ import { reglageDesCircuits } from '../../../scripts/circuits-cles.mjs';
8
+ import { lireLesTickets, ticketsAPartir as aPartir } from '../../../scripts/file-des-tickets.mjs';
9
+ import { ouvrirLeClient } from '../client.js';
10
+ import { lireLesCircuits } from '../circuit/client.js';
11
+ import { idDuCircuit } from '../circuit/contrat.js';
12
+ // The package.json of the project at <racine>: absent, null; one that does not parse throws.
13
+ function lePaquet(racine) {
14
+ let texte;
15
+ try {
16
+ texte = readFileSync(path.join(racine, 'package.json'), 'utf8');
17
+ }
18
+ catch {
19
+ return null;
20
+ }
21
+ try {
22
+ return JSON.parse(texte);
23
+ }
24
+ catch (e) {
25
+ throw new Error(`package.json ne se lit pas : ${e.message}`);
26
+ }
27
+ }
28
+ export function ticketsAPartir(e) {
29
+ const faute = (message) => Promise.resolve({ partir: [], max: null, faute: message });
30
+ let paquet;
31
+ try {
32
+ paquet = lePaquet(e.racine);
33
+ }
34
+ catch (x) {
35
+ return faute(x.message);
36
+ }
37
+ const reglage = reglageDesCircuits(paquet);
38
+ if (reglage.faute) {
39
+ return faute(reglage.faute);
40
+ }
41
+ let tickets;
42
+ try {
43
+ tickets = lireLesTickets(e.racine);
44
+ }
45
+ catch (x) {
46
+ return faute(x.message);
47
+ }
48
+ return Promise.resolve({
49
+ partir: aPartir(tickets, { enCours: new Set(e.enCours) }).map(t => t.id),
50
+ max: reglage.max,
51
+ faute: null,
52
+ });
53
+ }
54
+ export async function circuitsVivants(e) {
55
+ const prefixe = idDuCircuit(e.racine, '');
56
+ const c = ouvrirLeClient();
57
+ try {
58
+ const vivants = [];
59
+ for await (const w of c.client.workflow.list({
60
+ query: `WorkflowType = 'circuitDuTicket' AND ExecutionStatus = 'Running'`,
61
+ })) {
62
+ if (w.workflowId.startsWith(prefixe)) {
63
+ vivants.push(w.workflowId.slice(prefixe.length));
64
+ }
65
+ }
66
+ return vivants.sort();
67
+ }
68
+ finally {
69
+ await c.fermer();
70
+ }
71
+ }
72
+ export async function circuitsNonIntegres(e) {
73
+ const c = ouvrirLeClient();
74
+ try {
75
+ return (await lireLesCircuits(c.client, e.racine)).map(x => x.ticket).sort();
76
+ }
77
+ finally {
78
+ await c.fermer();
79
+ }
80
+ }
81
+ //# sourceMappingURL=activites.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activites.js","sourceRoot":"","sources":["../../../src/temporal/tickets/activites.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,+FAA+F;AAC/F,yKAAyK;AACzK,4BAA4B;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,cAAc,IAAI,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMpD,6FAA6F;AAC7F,SAAS,QAAQ,CAAC,MAAc;IAC9B,IAAI,KAAa,CAAC;IAClB,IAAI,CAAC;QACH,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,gCAAiC,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,CA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IAC3B,IAAI,CAAC;QACH,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3C,KAAK,EAAE,kEAAkE;SAC1E,CAAC,EAAE,CAAC;YACH,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,CAAgC;IACxE,MAAM,CAAC,GAAG,cAAc,EAAE,CAAC;IAC3B,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,eAAe,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/E,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Client } from '@temporalio/client';
2
+ import { type EntreeDesTickets, type VueDesTickets } from './contrat.js';
3
+ /**
4
+ * Starts the queue of the tickets of <entree> on the task queue <file>, or leaves the one that
5
+ * runs; with <seance> (the supervisor's session that puts a ticket in it, or null), signals it to
6
+ * the queue, started if need be, which gives it to each circuit it starts then.
7
+ */
8
+ export declare function demarrerLesTickets(client: Client, entree: EntreeDesTickets, file: string, seance?: string | null): Promise<string>;
9
+ /** The queue of the tickets of the project at <racine>: its circuits alive, its fault. */
10
+ export declare function lireLaFileDesTickets(client: Client, racine: string): Promise<VueDesTickets>;