@supersoniks/concorde 4.9.9 → 4.9.92

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 (48) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +241 -241
  3. package/concorde-core.es.js +2931 -2851
  4. package/dist/concorde-core.bundle.js +241 -241
  5. package/dist/concorde-core.es.js +2931 -2851
  6. package/dist/js/core/decorators/api.js +146 -43
  7. package/dist/js/core/decorators/api.js.map +1 -1
  8. package/dist/js/decorators.js +4 -0
  9. package/dist/js/decorators.js.map +1 -1
  10. package/dist/types/core/decorators/api.d.ts +87 -60
  11. package/dist/types/core/decorators/api.d.ts.map +1 -1
  12. package/dist/types/decorators.d.ts +3 -1
  13. package/dist/types/decorators.d.ts.map +1 -1
  14. package/docs/assets/index-D2Q3JyQ6.css +1 -0
  15. package/docs/assets/{index-hElUgV9_.js → index-DURr6O71.js} +651 -736
  16. package/docs/crawl/docs/_decorators/get.html +89 -81
  17. package/docs/crawl/docs/_decorators/patch.html +43 -23
  18. package/docs/crawl/docs/_decorators/post.html +101 -72
  19. package/docs/crawl/docs/_decorators/put.html +44 -21
  20. package/docs/crawl/docs/_getting-started/ai-agents.html +45 -6
  21. package/docs/crawl/hubs/decorators.html +145 -70
  22. package/docs/crawl/hubs/remote-data.html +145 -70
  23. package/docs/index.html +2 -2
  24. package/docs/llms-full.txt +276 -147
  25. package/docs/llms.txt +4 -4
  26. package/docs/src/core/components/functional/queue/queue.md +0 -0
  27. package/docs/src/core/components/ui/button/button.md +0 -0
  28. package/docs/src/docs/_decorators/get.md +88 -80
  29. package/docs/src/docs/_decorators/patch.md +41 -25
  30. package/docs/src/docs/_decorators/post.md +104 -62
  31. package/docs/src/docs/_decorators/put.md +42 -24
  32. package/docs/src/docs/_getting-started/ai-agents.md +24 -4
  33. package/docs/src/docs/search/docs-search.json +182 -112
  34. package/docs/src/tsconfig.json +270 -267
  35. package/package.json +1 -1
  36. package/src/core/decorators/api.post.spec.ts +79 -1
  37. package/src/core/decorators/api.spec.ts +141 -1
  38. package/src/core/decorators/api.ts +330 -180
  39. package/src/decorators.ts +7 -0
  40. package/src/docs/_decorators/get.md +88 -80
  41. package/src/docs/_decorators/patch.md +41 -25
  42. package/src/docs/_decorators/post.md +104 -62
  43. package/src/docs/_decorators/put.md +42 -24
  44. package/src/docs/components/docs-demo-sources.ts +9 -14
  45. package/src/docs/example/decorators-demo-geo.ts +0 -21
  46. package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +42 -133
  47. package/src/docs/search/docs-search.json +128 -133
  48. package/docs/assets/index-Bnp7gVaA.css +0 -1
@@ -222,7 +222,7 @@ export const DOCS_DEMO_SOURCE_REGISTRY: Record<string, DocsSource[]> = {
222
222
  "demo-publish": [
223
223
  {
224
224
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
225
- line: 29,
225
+ line: 32,
226
226
  label: "demo-publish",
227
227
  },
228
228
  { path: "src/docs/example/decorators-demo-init.ts", label: "demo data" },
@@ -230,7 +230,7 @@ export const DOCS_DEMO_SOURCE_REGISTRY: Record<string, DocsSource[]> = {
230
230
  "demo-subscribe-dynamic": [
231
231
  {
232
232
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
233
- line: 313,
233
+ line: 269,
234
234
  label: "demo-subscribe-dynamic",
235
235
  },
236
236
  { path: "src/docs/example/decorators-demo-init.ts", label: "demo data" },
@@ -238,7 +238,7 @@ export const DOCS_DEMO_SOURCE_REGISTRY: Record<string, DocsSource[]> = {
238
238
  "demo-sub-template": [
239
239
  {
240
240
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
241
- line: 282,
241
+ line: 238,
242
242
  label: "demo-sub-template",
243
243
  },
244
244
  { path: "src/docs/example/decorators-demo-init.ts", label: "demo data" },
@@ -246,7 +246,7 @@ export const DOCS_DEMO_SOURCE_REGISTRY: Record<string, DocsSource[]> = {
246
246
  "demo-api-get": [
247
247
  {
248
248
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
249
- line: 83,
249
+ line: 86,
250
250
  label: "demo-api-get",
251
251
  },
252
252
  { path: "src/docs/example/decorators-demo-geo.ts", label: "geo API" },
@@ -255,20 +255,15 @@ export const DOCS_DEMO_SOURCE_REGISTRY: Record<string, DocsSource[]> = {
255
255
  "demo-api-get-configuration-key": [
256
256
  {
257
257
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
258
- line: 147,
258
+ line: 127,
259
259
  label: "demo-api-get-configuration-key",
260
260
  },
261
- {
262
- path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
263
- line: 239,
264
- label: "demo-api-get-refresh-remote",
265
- },
266
- { path: "src/docs/example/decorators-demo-geo.ts", label: "geo API + triggerKey" },
261
+ { path: "src/docs/example/decorators-demo-geo.ts", label: "geo API" },
267
262
  ],
268
263
  "demo-api-get-publish-subscribe": [
269
264
  {
270
265
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
271
- line: 227,
266
+ line: 178,
272
267
  label: "demo-api-get-publish-subscribe",
273
268
  },
274
269
  { path: "src/docs/example/decorators-demo-geo.ts", label: "geo API" },
@@ -300,7 +295,7 @@ export const DOCS_DEMO_SOURCE_REGISTRY: Record<string, DocsSource[]> = {
300
295
  "demo-handle": [
301
296
  {
302
297
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
303
- line: 360,
298
+ line: 316,
304
299
  label: "demo-handle",
305
300
  },
306
301
  { path: "src/docs/example/decorators-demo-init.ts", label: "demo data" },
@@ -308,7 +303,7 @@ export const DOCS_DEMO_SOURCE_REGISTRY: Record<string, DocsSource[]> = {
308
303
  "demo-handle-dynamic": [
309
304
  {
310
305
  path: "src/docs/example/decorators-demo-subscribe-publish-get-demos.ts",
311
- line: 396,
306
+ line: 351,
312
307
  label: "demo-handle-dynamic",
313
308
  },
314
309
  { path: "src/docs/example/decorators-demo-init.ts", label: "demo data" },
@@ -26,22 +26,6 @@ export const geoCommunesApiGetEndpoint = new Endpoint<GeoCommuneRow[]>(
26
26
  "communes?limit=5&fields=nom,code",
27
27
  );
28
28
 
29
- export const docsDemoDynApiConfKeyTemplate =
30
- new DataProviderKey<APIConfiguration>("docsDemoDynApiConf${configSlot}");
31
-
32
- export const docsDemoDynApiConfAKey = new DataProviderKey<APIConfiguration>(
33
- "docsDemoDynApiConfA",
34
- );
35
- export const docsDemoDynApiConfBKey = new DataProviderKey<APIConfiguration>(
36
- "docsDemoDynApiConfB",
37
- );
38
-
39
- set(docsDemoDynApiConfAKey, geoApiDemoConfiguration);
40
- set(docsDemoDynApiConfBKey, {
41
- ...geoApiDemoConfiguration,
42
- serviceURL: DOCS_MOCK_GEO_SERVICE,
43
- });
44
-
45
29
  export const geoCommunesApiGetEndpointDynamic = new Endpoint<GeoCommuneRow[]>(
46
30
  "communes?limit=${communeLimit}&fields=nom,code",
47
31
  );
@@ -49,8 +33,3 @@ export const geoCommunesApiGetEndpointDynamic = new Endpoint<GeoCommuneRow[]>(
49
33
  export const geoCommunesApiGetPublishKey = new DataProviderKey<
50
34
  ApiResult<GeoCommuneRow[]>
51
35
  >(geoCommunesApiGetEndpoint.path);
52
-
53
- /** Signal de refetch manuel pour les démos `@get` (voir `triggerKey`). */
54
- export const docsDemoGeoCommunesRefreshKey = new DataProviderKey<void>(
55
- "docsDemoGeoCommunesRefresh",
56
- );
@@ -5,7 +5,6 @@ import type { ApiResult } from "@supersoniks/concorde/core/utils/api";
5
5
  import { DataProviderKey } from "@supersoniks/concorde/core/utils/dataProviderKey";
6
6
  import { sub } from "@supersoniks/concorde/directives";
7
7
  import {
8
- dp,
9
8
  get as storeGet,
10
9
  set,
11
10
  } from "@supersoniks/concorde/core/utils/PublisherProxy";
@@ -13,30 +12,23 @@ import { publishDemoKey } from "./docs-provider-keys";
13
12
  import { tailwind } from "../tailwind";
14
13
  import "./decorators-demo-init";
15
14
  import {
16
- docsDemoDynApiConfKeyTemplate,
17
15
  docsDemoGeoApiConfigurationKey,
18
- docsDemoGeoCommunesRefreshKey,
19
16
  geoCommunesApiGetEndpoint,
20
17
  geoCommunesApiGetEndpointDynamic,
21
18
  geoCommunesApiGetPublishKey,
22
19
  type GeoCommuneRow,
23
20
  } from "./decorators-demo-geo";
24
21
 
25
- function formatFetchedAt(response: Response | null | undefined): string {
26
- const raw = response?.headers.get("X-Fetched-At");
27
- if (!raw) return "—";
28
- try {
29
- return new Date(raw).toLocaleTimeString();
30
- } catch {
31
- return raw;
32
- }
33
- }
34
-
35
22
  type PublishDemoData = {
36
23
  email: string;
37
24
  message: string;
38
25
  };
39
26
 
27
+ const geoCommunesGet = get(
28
+ geoCommunesApiGetEndpoint,
29
+ docsDemoGeoApiConfigurationKey,
30
+ );
31
+
40
32
  @customElement("demo-publish")
41
33
  export class DemoPublish extends LitElement {
42
34
  static styles = [tailwind];
@@ -95,50 +87,35 @@ export class DemoPublish extends LitElement {
95
87
  export class DemoApiGet extends LitElement {
96
88
  static styles = [tailwind];
97
89
 
98
- @get(geoCommunesApiGetEndpoint, docsDemoGeoApiConfigurationKey, {
99
- triggerKey: docsDemoGeoCommunesRefreshKey,
100
- })
90
+ @geoCommunesGet
101
91
  @state()
102
92
  geoApiPayload?: ApiResult<GeoCommuneRow[]>;
103
93
 
104
- private refresh() {
105
- dp(docsDemoGeoCommunesRefreshKey).invalidate();
94
+ private async refresh() {
95
+ await geoCommunesGet.refetch(this);
106
96
  }
107
97
 
108
98
  render() {
109
99
  const rows = this.geoApiPayload?.result;
110
- const status = this.geoApiPayload?.response?.status;
111
- const fetchedAt = formatFetchedAt(this.geoApiPayload?.response ?? null);
112
100
  return html`
113
- <div class="space-y-2">
101
+ <div class="space-y-3">
102
+ <div class="flex flex-wrap items-center gap-3">
103
+ <span class="text-sm font-medium">🗺️ GET simple</span>
104
+ <sonic-button size="sm" @click=${this.refresh}>Rafraîchir</sonic-button>
105
+ </div>
114
106
  <p class="text-sm text-neutral-600 dark:text-neutral-400">
115
- <code>@get</code> — même service que
116
- <code>sonic-queue</code> (<code>/docs-mock-api/geo/</code>).
117
- Propriété typée <code>ApiResult&lt;T&gt;</code>.
118
- Refetch via <code>triggerKey</code> (<code
119
- >docsDemoGeoCommunesRefresh</code
120
- >).
107
+ Une liste de communes chargée avec <code>@get</code>.
121
108
  </p>
122
- <sonic-button size="sm" @click=${this.refresh}>Rafraîchir</sonic-button>
123
- ${status != null
124
- ? html`<p class="text-xs text-neutral-500">
125
- HTTP ${status} · fetch ${fetchedAt}
126
- </p>`
127
- : ""}
128
- ${this.geoApiPayload === null
129
- ? html`<p class="text-neutral-500">Chargement…</p>`
109
+ ${this.geoApiPayload == null
110
+ ? html`<p class="text-sm text-neutral-500">Chargement…</p>`
130
111
  : !rows || rows.length === 0
131
- ? html`<p class="text-neutral-500">Aucune commune</p>`
112
+ ? html`<p class="text-sm text-neutral-500">Aucune commune</p>`
132
113
  : html`
133
- <ul class="list-disc pl-5 space-y-1">
114
+ <ul class="grid gap-1 sm:grid-cols-2">
134
115
  ${rows.map(
135
- (c) =>
136
- html`<li>
137
- <span class="font-medium">${c.nom}</span>
138
- <span class="text-neutral-500 text-sm">
139
- — ${c.code}</span
140
- >
141
- </li>`,
116
+ (c) => html`<li class="text-sm">
117
+ ${c.nom} <span class="text-neutral-500">(${c.code})</span>
118
+ </li>`,
142
119
  )}
143
120
  </ul>
144
121
  `}
@@ -151,116 +128,48 @@ export class DemoApiGet extends LitElement {
151
128
  export class DemoApiGetConfigurationKey extends LitElement {
152
129
  static styles = [tailwind];
153
130
 
154
- @property({ type: String })
155
- configSlot: "A" | "B" = "A";
156
-
157
131
  @property({ type: Number })
158
- communeLimit = 5;
132
+ communeLimit = 3;
159
133
 
160
- @get(geoCommunesApiGetEndpointDynamic, docsDemoDynApiConfKeyTemplate, {
161
- triggerKey: docsDemoGeoCommunesRefreshKey,
162
- })
134
+ @get(geoCommunesApiGetEndpointDynamic, docsDemoGeoApiConfigurationKey)
163
135
  @state()
164
136
  geoApiPayloadDyn?: ApiResult<GeoCommuneRow[]>;
165
137
 
166
138
  render() {
167
139
  const rows = this.geoApiPayloadDyn?.result;
168
- const status = this.geoApiPayloadDyn?.response?.status;
169
- const fetchedAt = formatFetchedAt(this.geoApiPayloadDyn?.response ?? null);
170
140
  return html`
171
141
  <div class="space-y-3">
172
142
  <p class="text-sm text-neutral-600 dark:text-neutral-400">
173
- Config dynamique (<code>docsDemoDynApiConf\${configSlot}</code>) +
174
- path d’endpoint avec <code>communeLimit</code>. Le refetch manuel
175
- passe par <code>triggerKey</code> — voir le bouton « ailleurs »
176
- ci-dessous dans la doc.
143
+ <code>@get</code> avec un endpoint et une configuration dynamiques.
177
144
  </p>
178
- <div class="flex flex-wrap gap-2 items-center">
179
- <span class="text-xs text-neutral-500">Limite API :</span>
145
+ <div class="flex flex-wrap items-center gap-2">
146
+ <span class="text-sm">Nombre de communes :</span>
180
147
  ${[3, 5, 10].map(
181
- (n) => html`
148
+ (limit) => html`
182
149
  <sonic-button
183
150
  size="sm"
184
- type=${this.communeLimit === n ? "primary" : "neutral"}
151
+ type=${this.communeLimit === limit ? "primary" : "neutral"}
185
152
  @click=${() => {
186
- this.communeLimit = n;
153
+ this.communeLimit = limit;
187
154
  }}
188
- >${n}</sonic-button
189
155
  >
156
+ ${limit}
157
+ </sonic-button>
190
158
  `,
191
159
  )}
192
160
  </div>
193
- <div class="flex flex-wrap gap-2 items-center">
194
- <span class="text-xs text-neutral-500">Publisher config :</span>
195
- <sonic-button
196
- size="sm"
197
- type=${this.configSlot === "A" ? "primary" : "neutral"}
198
- @click=${() => {
199
- this.configSlot = "A";
200
- }}
201
- >docsDemoDynApiConfA</sonic-button
202
- >
203
- <sonic-button
204
- size="sm"
205
- type=${this.configSlot === "B" ? "primary" : "neutral"}
206
- @click=${() => {
207
- this.configSlot = "B";
208
- }}
209
- >docsDemoDynApiConfB</sonic-button
210
- >
211
- </div>
212
- ${status != null
213
- ? html`<p class="text-xs text-neutral-500">
214
- HTTP ${status} · fetch ${fetchedAt} · limit=${this.communeLimit} ·
215
- conf=docsDemoDynApiConf${this.configSlot}
216
- </p>`
217
- : ""}
218
- ${this.geoApiPayloadDyn === null
219
- ? html`<p class="text-neutral-500">Chargement…</p>`
220
- : !rows || rows.length === 0
221
- ? html`<p class="text-neutral-500">Aucune commune</p>`
222
- : html`
223
- <ul class="list-disc pl-5 space-y-1">
224
- ${rows.map(
225
- (c) =>
226
- html`<li>
227
- <span class="font-medium">${c.nom}</span>
228
- <span class="text-neutral-500 text-sm">
229
- — ${c.code}</span
230
- >
231
- </li>`,
232
- )}
233
- </ul>
234
- `}
235
- </div>
236
- `;
237
- }
238
- }
239
-
240
- /** Déclenche le refetch d’un `@get` distant via `triggerKey` (sans toucher la config). */
241
- @customElement("demo-api-get-refresh-remote")
242
- export class DemoApiGetRefreshRemote extends LitElement {
243
- static styles = [tailwind];
244
-
245
- private refreshFromElsewhere() {
246
- dp(docsDemoGeoCommunesRefreshKey).invalidate();
247
- }
248
-
249
- render() {
250
- return html`
251
- <div
252
- class="rounded border border-dashed border-neutral-300 dark:border-neutral-600 p-3 space-y-2"
253
- >
254
- <p class="text-sm text-neutral-600 dark:text-neutral-400">
255
- Composant séparé — même publisher
256
- <code>docsDemoGeoCommunesRefresh</code> :
161
+ <p class="font-mono text-xs text-neutral-500">
162
+ communes?limit=${this.communeLimit}
257
163
  </p>
258
- <pre
259
- class="text-xs bg-neutral-100 dark:bg-neutral-800 p-2 rounded overflow-x-auto"
260
- ><code>dp(docsDemoGeoCommunesRefreshKey).invalidate();</code></pre>
261
- <sonic-button size="sm" variant="secondary" @click=${this.refreshFromElsewhere}>
262
- Rafraîchir le GET (depuis ailleurs)
263
- </sonic-button>
164
+ ${this.geoApiPayloadDyn == null
165
+ ? html`<p class="text-sm text-neutral-500">Chargement…</p>`
166
+ : html`
167
+ <ul class="grid gap-1 sm:grid-cols-2">
168
+ ${(rows ?? []).map(
169
+ (c) => html`<li class="text-sm">${c.nom}</li>`,
170
+ )}
171
+ </ul>
172
+ `}
264
173
  </div>
265
174
  `;
266
175
  }