@supersoniks/concorde 4.9.7 → 4.9.91

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 (72) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +265 -265
  3. package/concorde-core.es.js +4600 -4385
  4. package/dist/concorde-core.bundle.js +265 -265
  5. package/dist/concorde-core.es.js +4600 -4385
  6. package/dist/js/core/components/functional/queue/queue.js +25 -153
  7. package/dist/js/core/components/functional/queue/queue.js.map +1 -1
  8. package/dist/js/core/components/ui/_css/scroll.js +2 -0
  9. package/dist/js/core/components/ui/_css/scroll.js.map +1 -1
  10. package/dist/js/core/decorators/api.js +92 -2
  11. package/dist/js/core/decorators/api.js.map +1 -1
  12. package/dist/js/core/utils/SafariScrollGuard.js +384 -0
  13. package/dist/js/core/utils/SafariScrollGuard.js.map +1 -0
  14. package/dist/js/decorators.js +4 -0
  15. package/dist/js/decorators.js.map +1 -1
  16. package/dist/js/utils.js +3 -0
  17. package/dist/js/utils.js.map +1 -1
  18. package/dist/types/core/components/functional/queue/queue.d.ts +8 -24
  19. package/dist/types/core/components/functional/queue/queue.d.ts.map +1 -1
  20. package/dist/types/core/components/ui/_css/scroll.d.ts.map +1 -1
  21. package/dist/types/core/decorators/api.d.ts +82 -60
  22. package/dist/types/core/decorators/api.d.ts.map +1 -1
  23. package/dist/types/core/utils/SafariScrollGuard.d.ts +36 -0
  24. package/dist/types/core/utils/SafariScrollGuard.d.ts.map +1 -0
  25. package/dist/types/decorators.d.ts +3 -1
  26. package/dist/types/decorators.d.ts.map +1 -1
  27. package/dist/types/utils.d.ts +1 -0
  28. package/dist/types/utils.d.ts.map +1 -1
  29. package/docs/assets/index-BL6WVF7g.css +1 -0
  30. package/docs/assets/{index-hElUgV9_.js → index-DVn8AeyA.js} +572 -555
  31. package/docs/crawl/docs/_decorators/get.html +64 -81
  32. package/docs/crawl/docs/_decorators/patch.html +35 -23
  33. package/docs/crawl/docs/_decorators/post.html +72 -72
  34. package/docs/crawl/docs/_decorators/put.html +36 -21
  35. package/docs/crawl/docs/_getting-started/ai-agents.html +45 -6
  36. package/docs/crawl/hubs/decorators.html +141 -69
  37. package/docs/crawl/hubs/remote-data.html +141 -69
  38. package/docs/index.html +2 -2
  39. package/docs/llms-full.txt +203 -149
  40. package/docs/llms.txt +4 -4
  41. package/docs/src/core/components/functional/queue/queue.md +0 -0
  42. package/docs/src/core/components/ui/button/button.md +0 -0
  43. package/docs/src/docs/_decorators/get.md +55 -81
  44. package/docs/src/docs/_decorators/patch.md +36 -25
  45. package/docs/src/docs/_decorators/post.md +71 -62
  46. package/docs/src/docs/_decorators/put.md +37 -24
  47. package/docs/src/docs/_getting-started/ai-agents.md +24 -4
  48. package/docs/src/docs/search/docs-search.json +151 -1
  49. package/docs/src/tsconfig.json +3 -0
  50. package/package.json +6 -2
  51. package/src/core/components/functional/queue/queue.ts +33 -164
  52. package/src/core/components/ui/_css/scroll.ts +3 -0
  53. package/src/core/decorators/api.post.spec.ts +79 -1
  54. package/src/core/decorators/api.spec.ts +100 -1
  55. package/src/core/decorators/api.ts +252 -138
  56. package/src/core/utils/SafariScrollGuard.ts +429 -0
  57. package/src/decorators.ts +7 -0
  58. package/src/docs/_decorators/get.md +81 -80
  59. package/src/docs/_decorators/patch.md +36 -25
  60. package/src/docs/_decorators/post.md +99 -62
  61. package/src/docs/_decorators/put.md +37 -24
  62. package/src/docs/components/docs-demo-sources.ts +1 -6
  63. package/src/docs/example/decorators-demo-geo.ts +0 -21
  64. package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +41 -132
  65. package/src/docs/search/docs-search.json +156 -241
  66. package/src/docs/tailwind/css/tailwind.css +0 -0
  67. package/src/tsconfig.json +3 -0
  68. package/src/tsconfig.tsbuildinfo +1 -1
  69. package/src/utils.ts +13 -0
  70. package/vite.config.mts +4 -0
  71. package/vitest.setup.ts +22 -0
  72. package/docs/assets/index-Bnp7gVaA.css +0 -1
@@ -6,7 +6,7 @@ import API, {
6
6
  type ApiResult,
7
7
  } from "@supersoniks/concorde/core/utils/api";
8
8
  import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
9
- import { get } from "./api";
9
+ import { get, refetch } from "./api";
10
10
 
11
11
  const staticConfig: APIConfiguration = {
12
12
  serviceURL: "https://api.example.test",
@@ -190,6 +190,105 @@ describe("get", () => {
190
190
  expect(el.payload?.result).toEqual({ id: "loaded" });
191
191
  });
192
192
 
193
+ it("expose un refetch local avant et après le premier payload", async () => {
194
+ const pubId = "getSpecLocalRefetch";
195
+ PublisherManager.get(pubId).set(staticConfig);
196
+ const confKey = new DataProviderKey<APIConfiguration>(pubId);
197
+ const itemEp = new Endpoint<{ id: string }>("items/local");
198
+ const localGet = get(itemEp, confKey);
199
+ const tag = "test-api-get-local-refetch";
200
+
201
+ class C extends HTMLElement {
202
+ @localGet
203
+ payload: ApiResult<{ id: string }> | null = null;
204
+ }
205
+ if (!customElements.get(tag)) {
206
+ customElements.define(tag, C);
207
+ }
208
+
209
+ const el = document.createElement(tag) as InstanceType<typeof C>;
210
+ document.body.appendChild(el);
211
+
212
+ localGet.refetch(el);
213
+ await flushGetFrames();
214
+ expect(API.prototype.getDetailed).toHaveBeenCalledTimes(1);
215
+
216
+ vi.mocked(API.prototype.getDetailed).mockClear();
217
+ el.payload = mockPayload({ id: "manual" });
218
+ localGet.refetch(el);
219
+ await flushGetFrames();
220
+
221
+ expect(API.prototype.getDetailed).toHaveBeenCalledTimes(1);
222
+ expect(el.payload?.result).toEqual({ id: "loaded" });
223
+ });
224
+
225
+ it("ne refait plus de GET avec un handle local après déconnexion", async () => {
226
+ const pubId = "getSpecLocalRefetchDisconnect";
227
+ PublisherManager.get(pubId).set(staticConfig);
228
+ const confKey = new DataProviderKey<APIConfiguration>(pubId);
229
+ const localGet = get(
230
+ new Endpoint<{ id: string }>("items/local-disconnect"),
231
+ confKey,
232
+ );
233
+ const tag = "test-api-get-local-refetch-disconnect";
234
+
235
+ class C extends HTMLElement {
236
+ @localGet
237
+ payload: ApiResult<{ id: string }> | null = null;
238
+ }
239
+ if (!customElements.get(tag)) {
240
+ customElements.define(tag, C);
241
+ }
242
+
243
+ const el = document.createElement(tag) as InstanceType<typeof C>;
244
+ document.body.appendChild(el);
245
+ await flushGetFrames();
246
+ vi.mocked(API.prototype.getDetailed).mockClear();
247
+
248
+ el.remove();
249
+ localGet.refetch(el);
250
+ await flushGetFrames();
251
+
252
+ expect(API.prototype.getDetailed).not.toHaveBeenCalled();
253
+ });
254
+
255
+ it("peut décorer une méthode et refetcher après sa résolution", async () => {
256
+ const pubId = "getSpecMethodRefetch";
257
+ PublisherManager.get(pubId).set(staticConfig);
258
+ const confKey = new DataProviderKey<APIConfiguration>(pubId);
259
+ const rowEp = new Endpoint<{ id: string }, { rowId: string }>(
260
+ "rows/${rowId}",
261
+ );
262
+ const localGet = get(rowEp, confKey);
263
+ const tag = "test-api-get-method-refetch";
264
+
265
+ class C extends HTMLElement {
266
+ rowId = "42";
267
+
268
+ @localGet
269
+ payload: ApiResult<{ id: string }> | null = null;
270
+
271
+ @refetch(localGet)
272
+ async reload() {
273
+ await Promise.resolve();
274
+ this.rowId = "84";
275
+ }
276
+ }
277
+ if (!customElements.get(tag)) {
278
+ customElements.define(tag, C);
279
+ }
280
+
281
+ const el = document.createElement(tag) as InstanceType<typeof C>;
282
+ document.body.appendChild(el);
283
+ await flushGetFrames();
284
+ vi.mocked(API.prototype.getDetailed).mockClear();
285
+
286
+ await el.reload();
287
+ await flushGetFrames();
288
+
289
+ expect(API.prototype.getDetailed).toHaveBeenCalledWith("rows/84");
290
+ });
291
+
193
292
  it("refetch automatique avec refetchEveryMs", async () => {
194
293
  vi.useFakeTimers();
195
294
  const itemEp = new Endpoint<{ id: string }>("items/1");