@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
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>@put — Concorde</title>
|
|
7
|
-
<meta name="description" content="
|
|
8
|
-
<meta name="keywords" content="Concorde, supersoniks, docs/_decorators/put, put, @put, decorator,
|
|
7
|
+
<meta name="description" content="@put replaces a resource with the body from a publisher. It uses exactly the">
|
|
8
|
+
<meta name="keywords" content="Concorde, supersoniks, docs/_decorators/put, put, @put, decorator, Endpoint, DataProviderKey, ApiResult, send(component),
|
|
9
|
+
|
|
10
|
+
, when: "before", autoPostOnBodyMutation: false, autoPostOnBodyMutation, skipIfBodyMissing">
|
|
9
11
|
<meta name="concorde-doc-id" content="docs/_decorators/put">
|
|
10
12
|
<link rel="canonical" href="https://concorde.supersoniks.org/crawl/docs/_decorators/put.html">
|
|
11
13
|
</head>
|
|
@@ -15,32 +17,53 @@
|
|
|
15
17
|
</header>
|
|
16
18
|
<main>
|
|
17
19
|
<article>
|
|
18
|
-
<p class="doc-lead" id="doc-summary"><strong>Concorde decorator — @put</strong>.
|
|
20
|
+
<p class="doc-lead" id="doc-summary"><strong>Concorde decorator — @put</strong>. @put replaces a resource with the body from a publisher. It uses exactly the <span>Doc ID: <code>docs/_decorators/put</code>. Keywords: Concorde, supersoniks, docs/_decorators/put, put, @put, decorator, Endpoint, DataProviderKey, ApiResult, send(component),
|
|
21
|
+
|
|
22
|
+
, when: "before", autoPostOnBodyMutation: false, autoPostOnBodyMutation, skipIfBodyMissing. URL: <a href="https://concorde.supersoniks.org/crawl/docs/_decorators/put.html">https://concorde.supersoniks.org/crawl/docs/_decorators/put.html</a>.</span></p>
|
|
19
23
|
<h1 id="put">@put</h1>
|
|
20
|
-
<p
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<h2 id="
|
|
25
|
-
<
|
|
24
|
+
<p><code>@put</code> replaces a resource with the body from a publisher. It uses exactly the
|
|
25
|
+
same model as <a href="./post.html#post">@post</a>:
|
|
26
|
+
<code>Endpoint<T></code>, <code>DataProviderKey<B></code>, <code>ApiResult<T></code>, options, and the
|
|
27
|
+
<code>send(component)</code> handle.</p>
|
|
28
|
+
<h2 id="minimal-usage">Minimal usage</h2>
|
|
29
|
+
<pre><code class="language-typescript">const bodyKey = new DataProviderKey<UpdateUser>("users.form");
|
|
30
|
+
const updateUser = put(new Endpoint<User>("users/42"), bodyKey);
|
|
31
|
+
|
|
32
|
+
@updateUser
|
|
33
|
+
@state()
|
|
34
|
+
payload?: ApiResult<User>;
|
|
35
|
+
</code></pre>
|
|
36
|
+
<p>To run the operation again from the component:</p>
|
|
37
|
+
<pre><code class="language-typescript">async update() {
|
|
38
|
+
await updateUser.send(this);
|
|
39
|
+
}
|
|
40
|
+
</code></pre>
|
|
41
|
+
<p><code>send(component)</code> returns a Promise resolved after the PUT completes. See
|
|
42
|
+
<a href="./post.html#post">@post</a> for the method-decorator form and the
|
|
43
|
+
<code>when: "before"</code> option.</p>
|
|
44
|
+
<p>The PUT is also sent automatically when the body mutates, unless
|
|
45
|
+
<code>autoPostOnBodyMutation: false</code> is set. See
|
|
46
|
+
<a href="./post.html#post">@post</a> for the option details:</p>
|
|
47
|
+
<ul>
|
|
48
|
+
<li><code>autoPostOnBodyMutation</code></li>
|
|
49
|
+
<li><code>skipIfBodyMissing</code></li>
|
|
50
|
+
<li><code>refetchEveryMs</code></li>
|
|
51
|
+
<li><code>skipEmptyPlaceholder</code></li>
|
|
52
|
+
<li><code>triggerKey</code></li>
|
|
53
|
+
</ul>
|
|
54
|
+
<p>Pass explicit API configuration as the third argument:</p>
|
|
55
|
+
<pre><code class="language-typescript">@put(endpoint, bodyKey, apiConfigurationKey)
|
|
56
|
+
</code></pre>
|
|
26
57
|
<h2 id="import">Import</h2>
|
|
27
58
|
<pre><code class="language-typescript">import { put, type ApiResult } from "@supersoniks/concorde/decorators";
|
|
28
|
-
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
29
59
|
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
60
|
+
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
30
61
|
</code></pre>
|
|
31
|
-
<h2 id="example">Example</h2>
|
|
32
|
-
<pre><code class="language-typescript">const bodyKey = new DataProviderKey&lt;UpdatePayload&gt;("resourceBody");
|
|
33
|
-
|
|
34
|
-
@put(new Endpoint&lt;Resource, { resourceId: string }&gt;("resources/${resourceId}"), bodyKey)
|
|
35
|
-
@state()
|
|
36
|
-
payload?: ApiResult&lt;Resource&gt; | null;
|
|
37
|
-
</code></pre>
|
|
38
|
-
<p>Changing <code>resourceId</code> on the host re-runs the PUT when the path becomes ready — see <a href="../_misc/dynamic-path.html#dynamic-path">Dynamic path placeholders</a>.</p>
|
|
39
62
|
<h2 id="see-also">See also</h2>
|
|
40
63
|
<ul>
|
|
41
|
-
<li><a href="./post.html#post">@post</a> —
|
|
42
|
-
<li><a href="./patch.html#patch">@patch</a> — partial update
|
|
43
|
-
<li><a href="../_misc/
|
|
64
|
+
<li><a href="./post.html#post">@post</a> — options and triggers</li>
|
|
65
|
+
<li><a href="./patch.html#patch">@patch</a> — partial update</li>
|
|
66
|
+
<li><a href="../_misc/dynamic-path.html#dynamic-path">Dynamic path placeholders</a></li>
|
|
44
67
|
</ul>
|
|
45
68
|
|
|
46
69
|
</article>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>AI agents (skills & AGENTS.md) — Concorde</title>
|
|
7
7
|
<meta name="description" content="Concorde ships skills, rules, and a root AGENTS.md so Cursor, JetBrains AI Assistant, and other coding agents follow framework patterns (DataProvider, decorators, short imports, scope, theme, migratio">
|
|
8
8
|
<meta name="keywords" content="Concorde, supersoniks, docs/_getting-started/ai-agents, ai-agents, AI agents (skills & AGENTS.md), guide, AGENTS.md, yarn ai:sync, ai-init, yarn add @supersoniks/concorde, |
|
|
9
|
-
| Concorde repo (contributors) | , --
|
|
9
|
+
| Concorde repo (contributors) | , --skip-agents, --merge-agents, --force-agents">
|
|
10
10
|
<meta name="concorde-doc-id" content="docs/_getting-started/ai-agents">
|
|
11
11
|
<link rel="canonical" href="https://concorde.supersoniks.org/crawl/docs/_getting-started/ai-agents.html">
|
|
12
12
|
</head>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<main>
|
|
18
18
|
<article>
|
|
19
19
|
<p class="doc-lead" id="doc-summary"><strong>Concorde guide — AI agents (skills & AGENTS.md)</strong>. Concorde ships skills, rules, and a root AGENTS.md so Cursor, JetBrains AI Assistant, and other coding agents follow framework patterns (DataProvider, decorators, short imports, scope, theme, migratio <span>Doc ID: <code>docs/_getting-started/ai-agents</code>. Keywords: Concorde, supersoniks, docs/_getting-started/ai-agents, ai-agents, AI agents (skills & AGENTS.md), guide, AGENTS.md, yarn ai:sync, ai-init, yarn add @supersoniks/concorde, |
|
|
20
|
-
| Concorde repo (contributors) | , --
|
|
20
|
+
| Concorde repo (contributors) | , --skip-agents, --merge-agents, --force-agents. URL: <a href="https://concorde.supersoniks.org/crawl/docs/_getting-started/ai-agents.html">https://concorde.supersoniks.org/crawl/docs/_getting-started/ai-agents.html</a>.</span></p>
|
|
21
21
|
<h1 id="ai-agents-skills--agentsmd">AI agents (skills & AGENTS.md)</h1>
|
|
22
22
|
<p>Concorde ships <strong>skills</strong>, <strong>rules</strong>, and a root <strong><code>AGENTS.md</code></strong> so Cursor, JetBrains AI Assistant, and other coding agents follow framework patterns (DataProvider, decorators, short imports, scope, theme, migrations).</p>
|
|
23
23
|
<p>On a <a href="./concorde-outside.html#concorde-outside">starter</a> project, run <code>yarn ai:sync</code> after install. On a <a href="./concorde-manual-install.html#concorde-manual-install">manual / brownfield</a> project, install Concorde first, then use <code>ai-init</code> below.</p>
|
|
@@ -57,12 +57,20 @@ node node_modules/@supersoniks/concorde/scripts/ai-init.mjs
|
|
|
57
57
|
</tr>
|
|
58
58
|
</thead>
|
|
59
59
|
<tbody><tr>
|
|
60
|
+
<td><code>--skip-agents</code></td>
|
|
61
|
+
<td>Never write <code>AGENTS.md</code> (skills / rules only)</td>
|
|
62
|
+
</tr>
|
|
63
|
+
<tr>
|
|
60
64
|
<td><code>--merge-agents</code></td>
|
|
61
|
-
<td>
|
|
65
|
+
<td>Opt-in: keep the project preamble and append / refresh the Concorde block</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td><code>--force-agents</code></td>
|
|
69
|
+
<td>Opt-in: <strong>replace</strong> the whole <code>AGENTS.md</code> (destructive)</td>
|
|
62
70
|
</tr>
|
|
63
71
|
<tr>
|
|
64
72
|
<td><code>--overlay <dir></code></td>
|
|
65
|
-
<td>
|
|
73
|
+
<td>Extra rules/skills + optional <code>AGENTS.concorde.md</code> for project-only Concorde agent notes</td>
|
|
66
74
|
</tr>
|
|
67
75
|
<tr>
|
|
68
76
|
<td><code>--cursor-only</code></td>
|
|
@@ -73,6 +81,37 @@ node node_modules/@supersoniks/concorde/scripts/ai-init.mjs
|
|
|
73
81
|
<td>Install only <code>.aiassistant/rules/</code></td>
|
|
74
82
|
</tr>
|
|
75
83
|
</tbody></table>
|
|
84
|
+
<h2 id="agentsmd-policy-non-invasive"><code>AGENTS.md</code> policy (non-invasive)</h2>
|
|
85
|
+
<table>
|
|
86
|
+
<thead>
|
|
87
|
+
<tr>
|
|
88
|
+
<th>Situation</th>
|
|
89
|
+
<th>Default</th>
|
|
90
|
+
</tr>
|
|
91
|
+
</thead>
|
|
92
|
+
<tbody><tr>
|
|
93
|
+
<td>No <code>AGENTS.md</code></td>
|
|
94
|
+
<td>Create the Concorde guide</td>
|
|
95
|
+
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td>File with <code><!-- concorde-ai --></code></td>
|
|
98
|
+
<td>Refresh the managed zone only</td>
|
|
99
|
+
</tr>
|
|
100
|
+
<tr>
|
|
101
|
+
<td>File <strong>without</strong> marker (project notes)</td>
|
|
102
|
+
<td><strong>Left untouched</strong> — skills / rules are enough</td>
|
|
103
|
+
</tr>
|
|
104
|
+
<tr>
|
|
105
|
+
<td><code>--merge-agents</code> / <code>--force-agents</code> / <code>--skip-agents</code></td>
|
|
106
|
+
<td>See flags above</td>
|
|
107
|
+
</tr>
|
|
108
|
+
</tbody></table>
|
|
109
|
+
<pre><code class="language-text">[optional project preamble — short, project-only]
|
|
110
|
+
<!-- concorde-ai -->
|
|
111
|
+
<package ai/AGENTS.md>
|
|
112
|
+
[--- + overlay AGENTS.concorde.md]
|
|
113
|
+
</code></pre>
|
|
114
|
+
<p>Everything <strong>after</strong> <code><!-- concorde-ai --></code> is replaced on each <code>ai-init</code> run (idempotent). Do not paste a full copy of the Concorde guide above the marker — put project-specific notes in <code>AGENTS.concorde.md</code> (overlay). If the preamble duplicates package <code>AGENTS.md</code>, <code>ai-init</code> slims or drops it and prints a warning. Legacy filenames <code>AGENTS.overlay.md</code> / <code>AGENTS.starter.md</code> are still accepted with a deprecation warning.</p>
|
|
76
115
|
<h2 id="what-gets-installed">What gets installed</h2>
|
|
77
116
|
<table>
|
|
78
117
|
<thead>
|
|
@@ -83,7 +122,7 @@ node node_modules/@supersoniks/concorde/scripts/ai-init.mjs
|
|
|
83
122
|
</thead>
|
|
84
123
|
<tbody><tr>
|
|
85
124
|
<td><code>AGENTS.md</code></td>
|
|
86
|
-
<td>
|
|
125
|
+
<td>Created only if missing; existing project-owned files are left alone unless <code>--merge-agents</code> / <code>--force-agents</code></td>
|
|
87
126
|
</tr>
|
|
88
127
|
<tr>
|
|
89
128
|
<td><code>.cursor/skills/concorde/</code></td>
|
|
@@ -122,7 +161,7 @@ node node_modules/@supersoniks/concorde/scripts/ai-init.mjs
|
|
|
122
161
|
<ol>
|
|
123
162
|
<li><strong>Starter project:</strong> <a href="./concorde-outside.html#concorde-outside">Installation</a> — <code>yarn ai:sync</code> is wired in the kit.</li>
|
|
124
163
|
<li><strong>Existing / manual Vite project:</strong> <a href="./concorde-manual-install.html#concorde-manual-install">Manual installation</a>, then <strong><code>ai-init</code></strong> after <code>yarn add @supersoniks/concorde</code>.</li>
|
|
125
|
-
<li>Commit <code
|
|
164
|
+
<li>Commit <code>.cursor/</code> and <code>.aiassistant/</code> (and <code>AGENTS.md</code> only if you opted in / it was created) if your team shares agent settings.</li>
|
|
126
165
|
<li>Re-run the same command when you bump <code>@supersoniks/concorde</code> to refresh skills from <code>node_modules/@supersoniks/concorde/ai/</code>.</li>
|
|
127
166
|
<li>In Cursor, skills under <code>.cursor/skills/</code> are picked up automatically; mention a skill in chat for focused tasks (e.g. migration → <code>concorde-get-set-dp</code>).</li>
|
|
128
167
|
</ol>
|
|
@@ -149,31 +149,55 @@ export class DemoBind extends LitElement {
|
|
|
149
149
|
<section id="docs-_decorators-get" data-doc-id="docs/_decorators/get">
|
|
150
150
|
<h2><a href="../docs/_decorators/get.html">@get</a></h2>
|
|
151
151
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/get</code> · <a href="../docs/_decorators/get.html">full page</a></p>
|
|
152
|
-
<p
|
|
152
|
+
<p>@get loads data and stores the result in an optional ApiResult<T> property.</p>
|
|
153
153
|
<pre class="doc-excerpt">@get
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
@get loads data and stores the result in an optional ApiResult property.
|
|
156
|
+
The property is undefined until a result is available.
|
|
156
157
|
|
|
157
|
-
|
|
158
|
+
- payload.result: typed data;
|
|
159
|
+
- payload.response: the HTTP response;
|
|
160
|
+
- payload.request: the request that was sent.
|
|
158
161
|
|
|
159
|
-
|
|
162
|
+
Minimal usage
|
|
160
163
|
|
|
161
|
-
|
|
162
|
-
- Second argument: DataProviderKey — config is read from the publisher at the resolved path; internal mutations trigger another GET. See API configuration for mock demos.
|
|
164
|
+
const usersEndpoint = new Endpoint ("users");
|
|
163
165
|
|
|
164
|
-
|
|
166
|
+
@get(usersEndpoint)
|
|
167
|
+
@state()
|
|
168
|
+
payload?: ApiResult ;
|
|
169
|
+
|
|
170
|
+
The first argument is always an
|
|
171
|
+
Endpoint . API configuration is read
|
|
172
|
+
from the HTML scope (serviceURL, token, etc.), so the component is usually
|
|
173
|
+
placed below an element that provides this configuration.
|
|
174
|
+
|
|
175
|
+
Refetching a GET
|
|
176
|
+
|
|
177
|
+
From the component
|
|
178
|
+
|
|
179
|
+
Keep the decorator in a constant to access refetch(component). Refetch only
|
|
180
|
+
targets the instance passed as the argument, even before it has received a
|
|
181
|
+
result.
|
|
182
|
+
|
|
183
|
+
const usersGet = get(new Endpoint ("users"));
|
|
165
184
|
|
|
166
|
-
|
|
185
|
+
@usersGet
|
|
186
|
+
@state()
|
|
187
|
+
payload?: ApiResult ;
|
|
188
|
+
|
|
189
|
+
async refresh() {
|
|
190
|
+
const payload = await usersGet.refetch(this);
|
|
191
|
+
console.log(payload?.result);
|
|
192
|
+
}
|
|
167
193
|
|
|
168
|
-
|
|
194
|
+
refetch(component) returns a Promise | undefined> that resolves
|
|
195
|
+
after the GET has completed.
|
|
169
196
|
|
|
170
|
-
|
|
197
|
+
From a method decorator
|
|
171
198
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
| skipEmptyPlaceholder | Treat "" as not ready (see Dynamic path). |
|
|
175
|
-
| refetchEveryMs | Automatic polling interval (ms). 0 or omitted = no polling. |
|
|
176
|
-
| tri</pre>
|
|
199
|
+
The refetch can decorate a local method. The default is after; if the
|
|
200
|
+
method returns a Promise, the GET waits for its resol</pre>
|
|
177
201
|
</section>
|
|
178
202
|
<section id="docs-_decorators-handle" data-doc-id="docs/_decorators/handle">
|
|
179
203
|
<h2><a href="../docs/_decorators/handle.html">@handle</a></h2>
|
|
@@ -253,71 +277,105 @@ export class DemoOnAssign extends LitElement {
|
|
|
253
277
|
<section id="docs-_decorators-patch" data-doc-id="docs/_decorators/patch">
|
|
254
278
|
<h2><a href="../docs/_decorators/patch.html">@patch</a></h2>
|
|
255
279
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/patch</code> · <a href="../docs/_decorators/patch.html">full page</a></p>
|
|
256
|
-
<p
|
|
280
|
+
<p>@patch applies a partial update with the body from a publisher. It uses the</p>
|
|
257
281
|
<pre class="doc-excerpt">@patch
|
|
258
282
|
|
|
259
|
-
|
|
283
|
+
@patch applies a partial update with the body from a publisher. It uses the
|
|
284
|
+
same model as @post:
|
|
285
|
+
Endpoint , DataProviderKey , ApiResult , options, and the
|
|
286
|
+
send(component) handle.
|
|
260
287
|
|
|
261
|
-
|
|
288
|
+
Minimal usage
|
|
262
289
|
|
|
263
|
-
|
|
290
|
+
const bodyKey = new DataProviderKey >("users.patch");
|
|
291
|
+
const patchUser = patch(new Endpoint ("users/42"), bodyKey);
|
|
264
292
|
|
|
265
|
-
|
|
293
|
+
@patchUser
|
|
294
|
+
@state()
|
|
295
|
+
payload?: ApiResult ;
|
|
266
296
|
|
|
267
|
-
|
|
297
|
+
To run the operation again from the component:
|
|
268
298
|
|
|
269
|
-
|
|
299
|
+
async savePatch() {
|
|
300
|
+
await patchUser.send(this);
|
|
301
|
+
}
|
|
270
302
|
|
|
271
|
-
|
|
303
|
+
send(component) returns a Promise resolved after the PATCH completes. See
|
|
304
|
+
@post for the method-decorator form and the
|
|
305
|
+
when: "before" option.
|
|
272
306
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
307
|
+
The PATCH is also sent automatically when the body mutates, unless
|
|
308
|
+
autoPostOnBodyMutation: false is set. The available options are described in
|
|
309
|
+
@post:
|
|
276
310
|
|
|
277
|
-
|
|
311
|
+
- autoPostOnBodyMutation
|
|
312
|
+
- skipIfBodyMissing
|
|
313
|
+
- refetchEveryMs
|
|
314
|
+
- skipEmptyPlaceholder
|
|
315
|
+
- triggerKey
|
|
278
316
|
|
|
279
|
-
|
|
317
|
+
Pass explicit API configuration as the third argument:
|
|
280
318
|
|
|
281
|
-
@patch(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
319
|
+
@patch(endpoint, bodyKey, apiConfigurationKey)
|
|
320
|
+
|
|
321
|
+
Import
|
|
322
|
+
|
|
323
|
+
import { patch, type ApiResult } from "@supersoniks/concorde/decorators";
|
|
324
|
+
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
325
|
+
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
288
326
|
|
|
289
327
|
See also
|
|
290
328
|
|
|
291
|
-
- @post
|
|
292
|
-
- @put — full rep</pre>
|
|
329
|
+
- @post —</pre>
|
|
293
330
|
</section>
|
|
294
331
|
<section id="docs-_decorators-post" data-doc-id="docs/_decorators/post">
|
|
295
332
|
<h2><a href="../docs/_decorators/post.html">@post</a></h2>
|
|
296
333
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/post</code> · <a href="../docs/_decorators/post.html">full page</a></p>
|
|
297
|
-
<p
|
|
334
|
+
<p>@post sends the contents of a publisher and stores the response in an</p>
|
|
298
335
|
<pre class="doc-excerpt">@post
|
|
299
336
|
|
|
300
|
-
|
|
337
|
+
@post sends the contents of a publisher and stores the response in an
|
|
338
|
+
optional ApiResult property. The property is undefined until a result
|
|
339
|
+
is available.
|
|
340
|
+
|
|
341
|
+
Minimal usage
|
|
342
|
+
|
|
343
|
+
Pass an Endpoint and a DataProviderKey for the request body.
|
|
344
|
+
|
|
345
|
+
const userBodyKey = new DataProviderKey ("users.form");
|
|
346
|
+
const createUser = post(new Endpoint ("users"), userBodyKey);
|
|
347
|
+
|
|
348
|
+
@createUser
|
|
349
|
+
@state()
|
|
350
|
+
payload?: ApiResult ;
|
|
351
|
+
|
|
352
|
+
The current body is read from userBodyKey. By default, the POST is sent when
|
|
353
|
+
the component connects and after each body mutation. Mutations in the same
|
|
354
|
+
frame are coalesced into one request.
|
|
355
|
+
|
|
356
|
+
API configuration is read from the HTML scope, as with
|
|
357
|
+
@get.
|
|
301
358
|
|
|
302
|
-
|
|
359
|
+
Sending the POST again
|
|
303
360
|
|
|
304
|
-
|
|
361
|
+
From the component
|
|
305
362
|
|
|
306
|
-
|
|
363
|
+
Keep the decorator to access send(component). The body is read again when the
|
|
364
|
+
operation runs.
|
|
307
365
|
|
|
308
|
-
|
|
366
|
+
async saveAgain() {
|
|
367
|
+
const payload = await createUser.send(this);
|
|
368
|
+
console.log(payload?.result);
|
|
369
|
+
}
|
|
309
370
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
| skipIfBodyMissing | Skip when body publisher is null/undefined (default: true). |
|
|
314
|
-
| autoPostOnBodyMutation | Re-post when the body publisher mutates (default: true). false = manual via triggerKey.invalidate(). |
|
|
315
|
-
| skipEmptyPlaceholder | If true, a placeholder resolved to '' blocks the request (empty string only — not 0 or false). See Dynamic paths. |
|
|
316
|
-
| triggerKey | DataProviderKey — invalidate() re-runs the POST with the current body. |
|
|
371
|
+
send() returns a Promise | undefined> that resolves after the
|
|
372
|
+
operation completes. It is useful for “Save” or “Retry” buttons and can repeat
|
|
373
|
+
an operation with side effects.
|
|
317
374
|
|
|
318
|
-
|
|
375
|
+
From a method decorator
|
|
319
376
|
|
|
320
|
-
|
|
377
|
+
The send action can decorate a local method. It runs after the method by
|
|
378
|
+
default, waits for an eventu</pre>
|
|
321
379
|
</section>
|
|
322
380
|
<section id="docs-_decorators-publish" data-doc-id="docs/_decorators/publish">
|
|
323
381
|
<h2><a href="../docs/_decorators/publish.html">@publish</a></h2>
|
|
@@ -365,40 +423,57 @@ Dynamic paths use the same placeholder rules as @bind / @subscribe. Resolution a
|
|
|
365
423
|
<section id="docs-_decorators-put" data-doc-id="docs/_decorators/put">
|
|
366
424
|
<h2><a href="../docs/_decorators/put.html">@put</a></h2>
|
|
367
425
|
<p><strong>Doc ID:</strong> <code>docs/_decorators/put</code> · <a href="../docs/_decorators/put.html">full page</a></p>
|
|
368
|
-
<p
|
|
426
|
+
<p>@put replaces a resource with the body from a publisher. It uses exactly the</p>
|
|
369
427
|
<pre class="doc-excerpt">@put
|
|
370
428
|
|
|
371
|
-
|
|
429
|
+
@put replaces a resource with the body from a publisher. It uses exactly the
|
|
430
|
+
same model as @post:
|
|
431
|
+
Endpoint , DataProviderKey , ApiResult , options, and the
|
|
432
|
+
send(component) handle.
|
|
372
433
|
|
|
373
|
-
|
|
434
|
+
Minimal usage
|
|
374
435
|
|
|
375
|
-
|
|
436
|
+
const bodyKey = new DataProviderKey ("users.form");
|
|
437
|
+
const updateUser = put(new Endpoint ("users/42"), bodyKey);
|
|
376
438
|
|
|
377
|
-
|
|
439
|
+
@updateUser
|
|
440
|
+
@state()
|
|
441
|
+
payload?: ApiResult ;
|
|
378
442
|
|
|
379
|
-
|
|
443
|
+
To run the operation again from the component:
|
|
380
444
|
|
|
381
|
-
|
|
445
|
+
async update() {
|
|
446
|
+
await updateUser.send(this);
|
|
447
|
+
}
|
|
382
448
|
|
|
383
|
-
|
|
449
|
+
send(component) returns a Promise resolved after the PUT completes. See
|
|
450
|
+
@post for the method-decorator form and the
|
|
451
|
+
when: "before" option.
|
|
384
452
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
453
|
+
The PUT is also sent automatically when the body mutates, unless
|
|
454
|
+
autoPostOnBodyMutation: false is set. See
|
|
455
|
+
@post for the option details:
|
|
388
456
|
|
|
389
|
-
|
|
457
|
+
- autoPostOnBodyMutation
|
|
458
|
+
- skipIfBodyMissing
|
|
459
|
+
- refetchEveryMs
|
|
460
|
+
- skipEmptyPlaceholder
|
|
461
|
+
- triggerKey
|
|
390
462
|
|
|
391
|
-
|
|
463
|
+
Pass explicit API configuration as the third argument:
|
|
392
464
|
|
|
393
|
-
@put(
|
|
394
|
-
@state()
|
|
395
|
-
payload?: ApiResult&lt;Resource&gt; | null;
|
|
465
|
+
@put(endpoint, bodyKey, apiConfigurationKey)
|
|
396
466
|
|
|
397
|
-
|
|
467
|
+
Import
|
|
468
|
+
|
|
469
|
+
import { put, type ApiResult } from "@supersoniks/concorde/decorators";
|
|
470
|
+
import { DataProviderKey } from "@supersoniks/concorde/dataProviderKey";
|
|
471
|
+
import { Endpoint } from "@supersoniks/concorde/utils/endpoint";
|
|
398
472
|
|
|
399
473
|
See also
|
|
400
474
|
|
|
401
|
-
- @post
|
|
475
|
+
- @post — options and triggers
|
|
476
|
+
- @</pre>
|
|
402
477
|
</section>
|
|
403
478
|
<section id="docs-_decorators-subscribe" data-doc-id="docs/_decorators/subscribe">
|
|
404
479
|
<h2><a href="../docs/_decorators/subscribe.html">@subscribe</a></h2>
|