@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
@@ -153,138 +153,213 @@ dp(c</pre>
153
153
  <section id="docs-_decorators-get" data-doc-id="docs/_decorators/get">
154
154
  <h2><a href="../docs/_decorators/get.html">@get</a></h2>
155
155
  <p><strong>Doc ID:</strong> <code>docs/_decorators/get</code> · <a href="../docs/_decorators/get.html">full page</a></p>
156
- <p>Loads data through API.getDetailed. The decorated property is ApiResult&lt;T&gt; | null: request, response (or null for dataProvider(...) resolution without HTTP), and typed result.</p>
156
+ <p>@get loads data and stores the result in an optional ApiResult&lt;T&gt; property.</p>
157
157
  <pre class="doc-excerpt">@get
158
158
 
159
- Loads data through API.getDetailed. The decorated property is ApiResult | null: request, response (or null for dataProvider(...) resolution without HTTP), and typed result.
159
+ @get loads data and stores the result in an optional ApiResult property.
160
+ The property is undefined until a result is available.
160
161
 
161
- Pass an Endpoint as the first argument. Import get and ApiResult from @supersoniks/concorde/decorators, and Endpoint from @supersoniks/concorde/utils/endpoint.
162
+ - payload.result: typed data;
163
+ - payload.response: the HTTP response;
164
+ - payload.request: the request that was sent.
162
165
 
163
- Configuration
166
+ Minimal usage
164
167
 
165
- - Default: HTML.getApiConfiguration(host) (ancestor serviceURL, etc.).
166
- - Second argument: DataProviderKey — config is read from the publisher at the resolved path; internal mutations trigger another GET. See API configuration for mock demos.
168
+ const usersEndpoint = new Endpoint (&quot;users&quot;);
167
169
 
168
- Dynamic path
170
+ @get(usersEndpoint)
171
+ @state()
172
+ payload?: ApiResult ;
173
+
174
+ The first argument is always an
175
+ Endpoint . API configuration is read
176
+ from the HTML scope (serviceURL, token, etc.), so the component is usually
177
+ placed below an element that provides this configuration.
178
+
179
+ Refetching a GET
180
+
181
+ From the component
182
+
183
+ Keep the decorator in a constant to access refetch(component). Refetch only
184
+ targets the instance passed as the argument, even before it has received a
185
+ result.
169
186
 
170
- ${prop} on the endpoint or config key is resolved on the host. While a placeholder is null or undefined, no GET runs. Optional skipEmptyPlaceholder: true also blocks &quot;&quot; (empty string only). Details: Dynamic path placeholders.
187
+ const usersGet = get(new Endpoint (&quot;users&quot;));
171
188
 
172
- Options (GetOptions)
189
+ @usersGet
190
+ @state()
191
+ payload?: ApiResult ;
192
+
193
+ async refresh() {
194
+ const payload = await usersGet.refetch(this);
195
+ console.log(payload?.result);
196
+ }
197
+
198
+ refetch(component) returns a Promise | undefined&gt; that resolves
199
+ after the GET has completed.
173
200
 
174
- Pass as the second argument (scoped config) or third (with a configuration key). Same shape as send decorators where applicable:
201
+ From a method decorator
175
202
 
176
- | Option | Description |
177
- |--------|-------------|
178
- | skipEmptyPlaceholder | Treat &quot;&quot; as not ready (see Dynamic path). |
179
- | refetchEveryMs | Automatic polling interval (ms). 0 or omitted = no polling. |
180
- | tri</pre>
203
+ The refetch can decorate a local method. The default is after; if the
204
+ method returns a Promise, the GET waits for its resol</pre>
181
205
  </section>
182
206
  <section id="docs-_decorators-patch" data-doc-id="docs/_decorators/patch">
183
207
  <h2><a href="../docs/_decorators/patch.html">@patch</a></h2>
184
208
  <p><strong>Doc ID:</strong> <code>docs/_decorators/patch</code> · <a href="../docs/_decorators/patch.html">full page</a></p>
185
- <p>Sends data through API.patchDetailed. Same model as @post: decorated property is ApiResult&lt;T&gt; | null (request, response, result).</p>
209
+ <p>@patch applies a partial update with the body from a publisher. It uses the</p>
186
210
  <pre class="doc-excerpt">@patch
187
211
 
188
- Sends data through API.patchDetailed. Same model as @post: decorated property is ApiResult | null (request, response, result).
212
+ @patch applies a partial update with the body from a publisher. It uses the
213
+ same model as @post:
214
+ Endpoint , DataProviderKey , ApiResult , options, and the
215
+ send(component) handle.
189
216
 
190
- Pass an Endpoint and a DataProviderKey for the request body. Import patch and ApiResult from @supersoniks/concorde/decorators.
217
+ Minimal usage
191
218
 
192
- Configuration
219
+ const bodyKey = new DataProviderKey &gt;(&quot;users.patch&quot;);
220
+ const patchUser = patch(new Endpoint (&quot;users/42&quot;), bodyKey);
193
221
 
194
- Same as @post / @get: scoped HTML.getApiConfiguration(host) or DataProviderKey as third argument.
222
+ @patchUser
223
+ @state()
224
+ payload?: ApiResult ;
195
225
 
196
- Options (PatchOptions)
226
+ To run the operation again from the component:
197
227
 
198
- Same shape as PostOptions on @post (ApiSendOptions): refetchEveryMs, skipIfBodyMissing, autoPostOnBodyMutation, triggerKey, skipEmptyPlaceholder. See Dynamic path placeholders for ${sessionId} and empty-string behaviour.
228
+ async savePatch() {
229
+ await patchUser.send(this);
230
+ }
199
231
 
200
- Import
232
+ send(component) returns a Promise resolved after the PATCH completes. See
233
+ @post for the method-decorator form and the
234
+ when: &quot;before&quot; option.
201
235
 
202
- import { patch, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
203
- import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
204
- import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
236
+ The PATCH is also sent automatically when the body mutates, unless
237
+ autoPostOnBodyMutation: false is set. The available options are described in
238
+ @post:
205
239
 
206
- Example
240
+ - autoPostOnBodyMutation
241
+ - skipIfBodyMissing
242
+ - refetchEveryMs
243
+ - skipEmptyPlaceholder
244
+ - triggerKey
207
245
 
208
- const patchBodyKey = new DataProviderKey&amp;lt;Partial&amp;lt;Resource&amp;gt;&amp;gt;(&quot;resourcePatch&quot;);
246
+ Pass explicit API configuration as the third argument:
209
247
 
210
- @patch(
211
- new Endpoint&amp;lt;Resource, { resourceId: string }&amp;gt;(&quot;resources/${resourceId}&quot;),
212
- patchBodyKey,
213
- { skipEmptyPlaceholder: true },
214
- )
215
- @state()
216
- payload?: ApiResult&amp;lt;Resource&amp;gt; | null;
248
+ @patch(endpoint, bodyKey, apiConfigurationKey)
249
+
250
+ Import
251
+
252
+ import { patch, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
253
+ import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
254
+ import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
217
255
 
218
256
  See also
219
257
 
220
- - @post — POST (live demos)
221
- - @put — full rep</pre>
258
+ - @post —</pre>
222
259
  </section>
223
260
  <section id="docs-_decorators-post" data-doc-id="docs/_decorators/post">
224
261
  <h2><a href="../docs/_decorators/post.html">@post</a></h2>
225
262
  <p><strong>Doc ID:</strong> <code>docs/_decorators/post</code> · <a href="../docs/_decorators/post.html">full page</a></p>
226
- <p>Sends data through API.postDetailed. The decorated property is ApiResult&lt;T&gt; | null: request, response, and typed result.</p>
263
+ <p>@post sends the contents of a publisher and stores the response in an</p>
227
264
  <pre class="doc-excerpt">@post
228
265
 
229
- Sends data through API.postDetailed. The decorated property is ApiResult | null: request, response, and typed result.
266
+ @post sends the contents of a publisher and stores the response in an
267
+ optional ApiResult property. The property is undefined until a result
268
+ is available.
269
+
270
+ Minimal usage
271
+
272
+ Pass an Endpoint and a DataProviderKey for the request body.
273
+
274
+ const userBodyKey = new DataProviderKey (&quot;users.form&quot;);
275
+ const createUser = post(new Endpoint (&quot;users&quot;), userBodyKey);
276
+
277
+ @createUser
278
+ @state()
279
+ payload?: ApiResult ;
280
+
281
+ The current body is read from userBodyKey. By default, the POST is sent when
282
+ the component connects and after each body mutation. Mutations in the same
283
+ frame are coalesced into one request.
284
+
285
+ API configuration is read from the HTML scope, as with
286
+ @get.
230
287
 
231
- Pass an Endpoint as the first argument and a DataProviderKey for the request body as the second. Import post and ApiResult from @supersoniks/concorde/decorators, and Endpoint from @supersoniks/concorde/utils/endpoint.
288
+ Sending the POST again
232
289
 
233
- Configuration
290
+ From the component
234
291
 
235
- Same as @get: scoped HTML.getApiConfiguration(host) by default, or DataProviderKey as third argument. See API configuration for mock demos.
292
+ Keep the decorator to access send(component). The body is read again when the
293
+ operation runs.
236
294
 
237
- Optional PostOptions (third or fourth argument)
295
+ async saveAgain() {
296
+ const payload = await createUser.send(this);
297
+ console.log(payload?.result);
298
+ }
238
299
 
239
- | Option | Description |
240
- |--------|-------------|
241
- | refetchEveryMs | Re-post on an interval (ms). |
242
- | skipIfBodyMissing | Skip when body publisher is null/undefined (default: true). |
243
- | autoPostOnBodyMutation | Re-post when the body publisher mutates (default: true). false = manual via triggerKey.invalidate(). |
244
- | skipEmptyPlaceholder | If true, a placeholder resolved to '' blocks the request (empty string only — not 0 or false). See Dynamic paths. |
245
- | triggerKey | DataProviderKey — invalidate() re-runs the POST with the current body. |
300
+ send() returns a Promise | undefined&gt; that resolves after the
301
+ operation completes. It is useful for “Save” or “Retry” buttons and can repeat
302
+ an operation with side effects.
246
303
 
247
- When the POST runs again
304
+ From a method decorator
248
305
 
249
- - Body publisher onInternalMutation when autoPostOnBodyMutation is true (defa</pre>
306
+ The send action can decorate a local method. It runs after the method by
307
+ default, waits for an eventu</pre>
250
308
  </section>
251
309
  <section id="docs-_decorators-put" data-doc-id="docs/_decorators/put">
252
310
  <h2><a href="../docs/_decorators/put.html">@put</a></h2>
253
311
  <p><strong>Doc ID:</strong> <code>docs/_decorators/put</code> · <a href="../docs/_decorators/put.html">full page</a></p>
254
- <p>Sends data through API.putDetailed. Same model as @post: decorated property is ApiResult&lt;T&gt; | null (request, response, result).</p>
312
+ <p>@put replaces a resource with the body from a publisher. It uses exactly the</p>
255
313
  <pre class="doc-excerpt">@put
256
314
 
257
- Sends data through API.putDetailed. Same model as @post: decorated property is ApiResult | null (request, response, result).
315
+ @put replaces a resource with the body from a publisher. It uses exactly the
316
+ same model as @post:
317
+ Endpoint , DataProviderKey , ApiResult , options, and the
318
+ send(component) handle.
258
319
 
259
- Pass an Endpoint and a DataProviderKey for the request body. Import put and ApiResult from @supersoniks/concorde/decorators.
320
+ Minimal usage
260
321
 
261
- Configuration
322
+ const bodyKey = new DataProviderKey (&quot;users.form&quot;);
323
+ const updateUser = put(new Endpoint (&quot;users/42&quot;), bodyKey);
262
324
 
263
- Same as @post / @get: scoped HTML.getApiConfiguration(host) or DataProviderKey as third argument.
325
+ @updateUser
326
+ @state()
327
+ payload?: ApiResult ;
264
328
 
265
- Options (PutOptions)
329
+ To run the operation again from the component:
266
330
 
267
- Same shape as PostOptions on @post (ApiSendOptions): refetchEveryMs, skipIfBodyMissing, autoPostOnBodyMutation, triggerKey, skipEmptyPlaceholder. See Dynamic path placeholders for ${sessionId} and empty-string behaviour.
331
+ async update() {
332
+ await updateUser.send(this);
333
+ }
268
334
 
269
- Import
335
+ send(component) returns a Promise resolved after the PUT completes. See
336
+ @post for the method-decorator form and the
337
+ when: &quot;before&quot; option.
270
338
 
271
- import { put, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
272
- import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
273
- import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
339
+ The PUT is also sent automatically when the body mutates, unless
340
+ autoPostOnBodyMutation: false is set. See
341
+ @post for the option details:
274
342
 
275
- Example
343
+ - autoPostOnBodyMutation
344
+ - skipIfBodyMissing
345
+ - refetchEveryMs
346
+ - skipEmptyPlaceholder
347
+ - triggerKey
276
348
 
277
- const bodyKey = new DataProviderKey&amp;lt;UpdatePayload&amp;gt;(&quot;resourceBody&quot;);
349
+ Pass explicit API configuration as the third argument:
278
350
 
279
- @put(new Endpoint&amp;lt;Resource, { resourceId: string }&amp;gt;(&quot;resources/${resourceId}&quot;), bodyKey)
280
- @state()
281
- payload?: ApiResult&amp;lt;Resource&amp;gt; | null;
351
+ @put(endpoint, bodyKey, apiConfigurationKey)
352
+
353
+ Import
282
354
 
283
- Changing resourceId on the host re-runs the PUT when the path becomes ready — see Dynamic path placeholders.
355
+ import { put, type ApiResult } from &quot;@supersoniks/concorde/decorators&quot;;
356
+ import { DataProviderKey } from &quot;@supersoniks/concorde/dataProviderKey&quot;;
357
+ import { Endpoint } from &quot;@supersoniks/concorde/utils/endpoint&quot;;
284
358
 
285
359
  See also
286
360
 
287
- - @post —</pre>
361
+ - @post — options and triggers
362
+ - @</pre>
288
363
  </section>
289
364
  <section id="docs-_misc-api-configuration" data-doc-id="docs/_misc/api-configuration">
290
365
  <h2><a href="../docs/_misc/api-configuration.html">API configuration</a></h2>
package/docs/index.html CHANGED
@@ -10,8 +10,8 @@
10
10
  <!-- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
11
11
  -->
12
12
  <script src="https://cdn.jsdelivr.net/npm/marked@13.0.3"></script>
13
- <script type="module" crossorigin src="./assets/index-hElUgV9_.js"></script>
14
- <link rel="stylesheet" crossorigin href="./assets/index-Bnp7gVaA.css">
13
+ <script type="module" crossorigin src="./assets/index-DURr6O71.js"></script>
14
+ <link rel="stylesheet" crossorigin href="./assets/index-D2Q3JyQ6.css">
15
15
  </head>
16
16
  <body class="px-6 lg:px-20">
17
17
  <sonic-theme