@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.
- package/build-infos.json +1 -1
- package/concorde-core.bundle.js +241 -241
- package/concorde-core.es.js +2931 -2851
- package/dist/concorde-core.bundle.js +241 -241
- package/dist/concorde-core.es.js +2931 -2851
- package/dist/js/core/decorators/api.js +146 -43
- package/dist/js/core/decorators/api.js.map +1 -1
- package/dist/js/decorators.js +4 -0
- package/dist/js/decorators.js.map +1 -1
- package/dist/types/core/decorators/api.d.ts +87 -60
- package/dist/types/core/decorators/api.d.ts.map +1 -1
- package/dist/types/decorators.d.ts +3 -1
- package/dist/types/decorators.d.ts.map +1 -1
- package/docs/assets/index-D2Q3JyQ6.css +1 -0
- package/docs/assets/{index-hElUgV9_.js → index-DURr6O71.js} +651 -736
- package/docs/crawl/docs/_decorators/get.html +89 -81
- package/docs/crawl/docs/_decorators/patch.html +43 -23
- package/docs/crawl/docs/_decorators/post.html +101 -72
- package/docs/crawl/docs/_decorators/put.html +44 -21
- package/docs/crawl/docs/_getting-started/ai-agents.html +45 -6
- package/docs/crawl/hubs/decorators.html +145 -70
- package/docs/crawl/hubs/remote-data.html +145 -70
- package/docs/index.html +2 -2
- package/docs/llms-full.txt +276 -147
- package/docs/llms.txt +4 -4
- package/docs/src/core/components/functional/queue/queue.md +0 -0
- package/docs/src/core/components/ui/button/button.md +0 -0
- package/docs/src/docs/_decorators/get.md +88 -80
- package/docs/src/docs/_decorators/patch.md +41 -25
- package/docs/src/docs/_decorators/post.md +104 -62
- package/docs/src/docs/_decorators/put.md +42 -24
- package/docs/src/docs/_getting-started/ai-agents.md +24 -4
- package/docs/src/docs/search/docs-search.json +182 -112
- package/docs/src/tsconfig.json +270 -267
- package/package.json +1 -1
- package/src/core/decorators/api.post.spec.ts +79 -1
- package/src/core/decorators/api.spec.ts +141 -1
- package/src/core/decorators/api.ts +330 -180
- package/src/decorators.ts +7 -0
- package/src/docs/_decorators/get.md +88 -80
- package/src/docs/_decorators/patch.md +41 -25
- package/src/docs/_decorators/post.md +104 -62
- package/src/docs/_decorators/put.md +42 -24
- package/src/docs/components/docs-demo-sources.ts +9 -14
- package/src/docs/example/decorators-demo-geo.ts +0 -21
- package/src/docs/example/decorators-demo-subscribe-publish-get-demos.ts +42 -133
- package/src/docs/search/docs-search.json +128 -133
- 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
|
|
156
|
+
<p>@get loads data and stores the result in an optional ApiResult<T> property.</p>
|
|
157
157
|
<pre class="doc-excerpt">@get
|
|
158
158
|
|
|
159
|
-
|
|
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
|
-
|
|
162
|
+
- payload.result: typed data;
|
|
163
|
+
- payload.response: the HTTP response;
|
|
164
|
+
- payload.request: the request that was sent.
|
|
162
165
|
|
|
163
|
-
|
|
166
|
+
Minimal usage
|
|
164
167
|
|
|
165
|
-
|
|
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 ("users");
|
|
167
169
|
|
|
168
|
-
|
|
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
|
-
|
|
187
|
+
const usersGet = get(new Endpoint ("users"));
|
|
171
188
|
|
|
172
|
-
|
|
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> that resolves
|
|
199
|
+
after the GET has completed.
|
|
173
200
|
|
|
174
|
-
|
|
201
|
+
From a method decorator
|
|
175
202
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
| skipEmptyPlaceholder | Treat "" 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
|
|
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
|
-
|
|
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
|
-
|
|
217
|
+
Minimal usage
|
|
191
218
|
|
|
192
|
-
|
|
219
|
+
const bodyKey = new DataProviderKey >("users.patch");
|
|
220
|
+
const patchUser = patch(new Endpoint ("users/42"), bodyKey);
|
|
193
221
|
|
|
194
|
-
|
|
222
|
+
@patchUser
|
|
223
|
+
@state()
|
|
224
|
+
payload?: ApiResult ;
|
|
195
225
|
|
|
196
|
-
|
|
226
|
+
To run the operation again from the component:
|
|
197
227
|
|
|
198
|
-
|
|
228
|
+
async savePatch() {
|
|
229
|
+
await patchUser.send(this);
|
|
230
|
+
}
|
|
199
231
|
|
|
200
|
-
|
|
232
|
+
send(component) returns a Promise resolved after the PATCH completes. See
|
|
233
|
+
@post for the method-decorator form and the
|
|
234
|
+
when: "before" option.
|
|
201
235
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
240
|
+
- autoPostOnBodyMutation
|
|
241
|
+
- skipIfBodyMissing
|
|
242
|
+
- refetchEveryMs
|
|
243
|
+
- skipEmptyPlaceholder
|
|
244
|
+
- triggerKey
|
|
207
245
|
|
|
208
|
-
|
|
246
|
+
Pass explicit API configuration as the third argument:
|
|
209
247
|
|
|
210
|
-
@patch(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
248
|
+
@patch(endpoint, bodyKey, apiConfigurationKey)
|
|
249
|
+
|
|
250
|
+
Import
|
|
251
|
+
|
|
252
|
+
import { patch, type ApiResult } from "@supersoniks/concorde/decorators";
|
|
253
|
+
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
254
|
+
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
217
255
|
|
|
218
256
|
See also
|
|
219
257
|
|
|
220
|
-
- @post
|
|
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
|
|
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
|
-
|
|
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 ("users.form");
|
|
275
|
+
const createUser = post(new Endpoint ("users"), 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
|
-
|
|
288
|
+
Sending the POST again
|
|
232
289
|
|
|
233
|
-
|
|
290
|
+
From the component
|
|
234
291
|
|
|
235
|
-
|
|
292
|
+
Keep the decorator to access send(component). The body is read again when the
|
|
293
|
+
operation runs.
|
|
236
294
|
|
|
237
|
-
|
|
295
|
+
async saveAgain() {
|
|
296
|
+
const payload = await createUser.send(this);
|
|
297
|
+
console.log(payload?.result);
|
|
298
|
+
}
|
|
238
299
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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> 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
|
-
|
|
304
|
+
From a method decorator
|
|
248
305
|
|
|
249
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
320
|
+
Minimal usage
|
|
260
321
|
|
|
261
|
-
|
|
322
|
+
const bodyKey = new DataProviderKey ("users.form");
|
|
323
|
+
const updateUser = put(new Endpoint ("users/42"), bodyKey);
|
|
262
324
|
|
|
263
|
-
|
|
325
|
+
@updateUser
|
|
326
|
+
@state()
|
|
327
|
+
payload?: ApiResult ;
|
|
264
328
|
|
|
265
|
-
|
|
329
|
+
To run the operation again from the component:
|
|
266
330
|
|
|
267
|
-
|
|
331
|
+
async update() {
|
|
332
|
+
await updateUser.send(this);
|
|
333
|
+
}
|
|
268
334
|
|
|
269
|
-
|
|
335
|
+
send(component) returns a Promise resolved after the PUT completes. See
|
|
336
|
+
@post for the method-decorator form and the
|
|
337
|
+
when: "before" option.
|
|
270
338
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
-
|
|
343
|
+
- autoPostOnBodyMutation
|
|
344
|
+
- skipIfBodyMissing
|
|
345
|
+
- refetchEveryMs
|
|
346
|
+
- skipEmptyPlaceholder
|
|
347
|
+
- triggerKey
|
|
276
348
|
|
|
277
|
-
|
|
349
|
+
Pass explicit API configuration as the third argument:
|
|
278
350
|
|
|
279
|
-
@put(
|
|
280
|
-
|
|
281
|
-
|
|
351
|
+
@put(endpoint, bodyKey, apiConfigurationKey)
|
|
352
|
+
|
|
353
|
+
Import
|
|
282
354
|
|
|
283
|
-
|
|
355
|
+
import { put, type ApiResult } from "@supersoniks/concorde/decorators";
|
|
356
|
+
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
357
|
+
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
284
358
|
|
|
285
359
|
See also
|
|
286
360
|
|
|
287
|
-
- @post
|
|
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-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
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
|