@mohsinonxrm/pptb-dataverse-request-studio 1.5.0 → 1.6.0-beta.1

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 (142) hide show
  1. package/CHANGELOG.md +245 -0
  2. package/README.md +28 -10
  3. package/dist/assets/ActionParamForm-DvTh6hUs.js +1 -0
  4. package/dist/assets/AllOrNothingOption-C7wGq_-r.js +1 -0
  5. package/dist/assets/AssociateMode-Dj-iEObO.js +1 -0
  6. package/dist/assets/BatchMode-Dsa1JVpd.js +10 -0
  7. package/dist/assets/BinaryColumnPickers-NAaoPcPt.js +1 -0
  8. package/dist/assets/BinaryPipelineCard-CSklRaME.js +1 -0
  9. package/dist/assets/BulkDeleteMode-Cqpb47QI.js +1 -0
  10. package/dist/assets/BulkWriteMode-CRkiw89Q.js +6 -0
  11. package/dist/assets/CodeView-C65Y5vXN.js +874 -0
  12. package/dist/assets/CreateMode-CwGffdDR.js +1 -0
  13. package/dist/assets/DeleteMode-CaWEZkJ1.js +1 -0
  14. package/dist/assets/DisassociateMode-Ddk9Jm3g.js +2 -0
  15. package/dist/assets/ExecuteActionMode-BbN_9350.js +1 -0
  16. package/dist/assets/ExecuteFunctionMode-G3PFBDpl.js +1 -0
  17. package/dist/assets/ExecuteWorkflowMode-D2MxIt5s.js +1 -0
  18. package/dist/assets/FieldSetEditor-Dg6WsDgG.js +3 -0
  19. package/dist/assets/ImportCurlDialog-BiURYtjH.js +7 -0
  20. package/dist/assets/ManageAttachmentMode-D14EZog8.js +1 -0
  21. package/dist/assets/ManageFileMode-DMLRV2xg.js +1 -0
  22. package/dist/assets/ManageImageMode-CoSAt9yh.js +1 -0
  23. package/dist/assets/MergeMode-PfbLAjOh.js +1 -0
  24. package/dist/assets/OptionGroup-DYAAm_pt.js +1 -0
  25. package/dist/assets/PredefinedQueryMode-CdT1I6jB.js +1 -0
  26. package/dist/assets/RetrieveNextLinkMode-BK9KD3q6.js +1 -0
  27. package/dist/assets/RetrieveSingleMode-_y2Z1G7C.js +1 -0
  28. package/dist/assets/UpdateMode-Dvd6cr4i.js +1 -0
  29. package/dist/assets/UpsertMode-BuyV7FEg.js +1 -0
  30. package/dist/assets/WriteResultCard-N_Ewu4dP.js +1 -0
  31. package/dist/assets/bypassAdvisories-BhBeq_oI.js +1 -0
  32. package/dist/assets/decodeForDisplay-D55DM53E.js +1 -0
  33. package/dist/assets/index-NW0Z4UWR.js +42 -0
  34. package/dist/assets/javascript-Dti3Ss-T.js +1 -0
  35. package/dist/assets/{jsonMode-DOHFeg2H.js → jsonMode-YuJX0ZcQ.js} +1 -1
  36. package/dist/assets/jsonWorkerInPage-CTjyykdK.js +33 -0
  37. package/dist/assets/{monacoSetup-CEhMjQNN.js → monacoSetup-Bxl8fgYX.js} +176 -176
  38. package/dist/assets/multipart-Bd_eOd8a.js +4 -0
  39. package/dist/assets/{python-DDgBOsRh.js → python-CZnGM3Qv.js} +1 -1
  40. package/dist/assets/writeResultName-Dw705_0B.js +1 -0
  41. package/dist/assets/writeState-DgYICTBE.js +1 -0
  42. package/dist/assets/{xml-BXhJpCm5.js → xml-gySD1GMR.js} +1 -1
  43. package/dist/icons/icon.svg +13 -13
  44. package/dist/index.html +7 -1
  45. package/index.html +6 -0
  46. package/package.json +1 -1
  47. package/dist/assets/AssociateMode-mu2ai0TV.js +0 -1
  48. package/dist/assets/AssociateTargetsEditor-BoH9Qxe8.js +0 -1
  49. package/dist/assets/BatchMode-BVAfFgPy.js +0 -11
  50. package/dist/assets/BinaryColumnPickers-DYpKoRIO.js +0 -1
  51. package/dist/assets/BulkDeleteMode-Df-XirlR.js +0 -1
  52. package/dist/assets/BulkWriteMode-UXREEvbe.js +0 -6
  53. package/dist/assets/DisassociateMode-CKBL5nUo.js +0 -2
  54. package/dist/assets/ExecuteWorkflowMode-4EWco-ze.js +0 -1
  55. package/dist/assets/ManageFileMode-BFNwxuEY.js +0 -1
  56. package/dist/assets/ManageImageMode-DX0AdPN1.js +0 -1
  57. package/dist/assets/MergeMode-BzyXLu1b.js +0 -1
  58. package/dist/assets/PredefinedQueryMode-BT-HdZHF.js +0 -1
  59. package/dist/assets/RetrieveNextLinkMode-QBuIwdgS.js +0 -1
  60. package/dist/assets/abap-CRCWOmpq.js +0 -1
  61. package/dist/assets/apex-DnsZk_dE.js +0 -1
  62. package/dist/assets/azcli-1IWB1ccx.js +0 -1
  63. package/dist/assets/bat-DPkNLes8.js +0 -1
  64. package/dist/assets/bicep-Corcdgou.js +0 -2
  65. package/dist/assets/cameligo-CGrWLZr3.js +0 -1
  66. package/dist/assets/clojure-D9WOWImG.js +0 -1
  67. package/dist/assets/coffee-B7EJu28W.js +0 -1
  68. package/dist/assets/cpp-SEyurbux.js +0 -1
  69. package/dist/assets/csp-C46ZqvIl.js +0 -1
  70. package/dist/assets/css-DQU6DXDx.js +0 -3
  71. package/dist/assets/css.worker-CwQehIRV.js +0 -93
  72. package/dist/assets/cssMode-DRNC4UuD.js +0 -4
  73. package/dist/assets/cypher-D84EuPTj.js +0 -1
  74. package/dist/assets/dart-D8lhlL1r.js +0 -1
  75. package/dist/assets/dockerfile-DLk6rpji.js +0 -1
  76. package/dist/assets/ecl-BO6FnfXk.js +0 -1
  77. package/dist/assets/elixir-BRjLKONM.js +0 -1
  78. package/dist/assets/flow9-Cac8vKd7.js +0 -1
  79. package/dist/assets/freemarker2-BITb8GyO.js +0 -3
  80. package/dist/assets/fsharp-fd1GTHhf.js +0 -1
  81. package/dist/assets/go-O9LJTZXk.js +0 -1
  82. package/dist/assets/graphql-LQdxqEYJ.js +0 -1
  83. package/dist/assets/handlebars-BbDVduNH.js +0 -1
  84. package/dist/assets/hcl-DxDQ3s82.js +0 -1
  85. package/dist/assets/html-Ru2Cy2VS.js +0 -1
  86. package/dist/assets/html.worker-4xVL0wjo.js +0 -470
  87. package/dist/assets/htmlMode-DeMh8vPt.js +0 -4
  88. package/dist/assets/index-XmEQbXiX.js +0 -703
  89. package/dist/assets/ini-BvajGCUy.js +0 -1
  90. package/dist/assets/java-SYsfObOQ.js +0 -1
  91. package/dist/assets/javascript-DLj2yjBO.js +0 -1
  92. package/dist/assets/julia-DQXNmw_w.js +0 -1
  93. package/dist/assets/kotlin-qQ0MG-9I.js +0 -1
  94. package/dist/assets/less-GGFNNJHn.js +0 -2
  95. package/dist/assets/lexon-Canl7DCW.js +0 -1
  96. package/dist/assets/liquid-udbJGOUP.js +0 -1
  97. package/dist/assets/lua-D28Ae8-K.js +0 -1
  98. package/dist/assets/m3-DPitgjJI.js +0 -1
  99. package/dist/assets/markdown-B811l8j2.js +0 -1
  100. package/dist/assets/mdx-B6ABiFDH.js +0 -1
  101. package/dist/assets/mips-CdjsipkG.js +0 -1
  102. package/dist/assets/msdax-CYqgjx_P.js +0 -1
  103. package/dist/assets/mysql-BHd6q0vd.js +0 -1
  104. package/dist/assets/objective-c-B1aVtJYH.js +0 -1
  105. package/dist/assets/pascal-BhNW15KB.js +0 -1
  106. package/dist/assets/pascaligo-5jv8CcQD.js +0 -1
  107. package/dist/assets/perl-DlYyT36c.js +0 -1
  108. package/dist/assets/pgsql-Dy0bjov7.js +0 -1
  109. package/dist/assets/php-120yhfDK.js +0 -1
  110. package/dist/assets/pla-CjnFlu4u.js +0 -1
  111. package/dist/assets/postiats-CQpG440k.js +0 -1
  112. package/dist/assets/powerquery-DdJtto1Z.js +0 -1
  113. package/dist/assets/protobuf-IBS6jZEB.js +0 -2
  114. package/dist/assets/pug-kFxLfcjb.js +0 -1
  115. package/dist/assets/qsharp-q7JyzKFN.js +0 -1
  116. package/dist/assets/r-BIFz-_sK.js +0 -1
  117. package/dist/assets/razor-DGf0KCTP.js +0 -1
  118. package/dist/assets/redis-CHOsPHWR.js +0 -1
  119. package/dist/assets/redshift-CBifECDb.js +0 -1
  120. package/dist/assets/restructuredtext-CghPJEOS.js +0 -1
  121. package/dist/assets/ruby-CYWGW-b1.js +0 -1
  122. package/dist/assets/rust-DMDD0SHb.js +0 -1
  123. package/dist/assets/sb-BYAiYHFx.js +0 -1
  124. package/dist/assets/scala-Bqvq8jcR.js +0 -1
  125. package/dist/assets/scheme-Dhb-2j9p.js +0 -1
  126. package/dist/assets/scss-CTwUZ5N7.js +0 -3
  127. package/dist/assets/solidity-CME5AdoB.js +0 -1
  128. package/dist/assets/sophia-RYC1BQQz.js +0 -1
  129. package/dist/assets/sparql-KEyrF7De.js +0 -1
  130. package/dist/assets/sql-BdTr02Mf.js +0 -1
  131. package/dist/assets/st-C7iG7M4S.js +0 -1
  132. package/dist/assets/swift-D7IUmUK8.js +0 -1
  133. package/dist/assets/systemverilog-DgMryOEJ.js +0 -1
  134. package/dist/assets/tcl-PloMZuKG.js +0 -1
  135. package/dist/assets/ts.worker-B8Ae6930.js +0 -51330
  136. package/dist/assets/tsMode-D4ZDTisA.js +0 -11
  137. package/dist/assets/twig-BfRIq3la.js +0 -1
  138. package/dist/assets/typescript-CJFgy1iR.js +0 -1
  139. package/dist/assets/typespec-CzxlYoT_.js +0 -1
  140. package/dist/assets/vb-BwAE3J76.js +0 -1
  141. package/dist/assets/wgsl-Dksx_ONF.js +0 -298
  142. package/dist/assets/yaml-B7iGwJkY.js +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,251 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.6.0-beta.1] - 2026-11-07
11
+
12
+ The first 1.6.0 beta. Recent runs survive a reload or restart ([#226]),
13
+ throttled requests are explained ([#269]), Retrieve Multiple can count only
14
+ ([#272]), the Code tab writes Python ([#270]) and a cURL command can be
15
+ imported ([#271]). The JSON body editor and hand-typed URLs get suggestions
16
+ from the table's metadata ([#268]), results suggest the next step ([#291]) and
17
+ every mode lists what blocks Execute ([#294]). The package is about half the
18
+ size and loads less at startup ([#236]).
19
+
20
+ Still a **prerelease** on the npm `beta` tag, with the gold Insider icon.
21
+ Power Platform ToolBox **1.2.7 or later** is recommended.
22
+
23
+ ### ✨ Added
24
+
25
+ - **The JSON body editor knows the table** ([#268]). In a field set's JSON view
26
+ (Create, Update, Upsert, Bulk Write rows and entity parameters):
27
+ - **Keys:** typing `"` lists the columns the form can set. Lookups are
28
+ listed as their `@odata.bind` keys, one per target for Customer and other
29
+ polymorphic lookups.
30
+ - **Values:**
31
+ - Choice, Status and State columns list their values with labels, for
32
+ example `Accounting · 1`; typing a number narrows the list. Multi-select
33
+ choices list theirs as strings.
34
+ - A lookup key inserts `"/<entityset>(<guid>)"`, with the GUID selected.
35
+ - **Hover:** a key shows its column's display name, type and whether it's
36
+ required.
37
+ - **Type check:** a value of the wrong JSON type is underlined, for example
38
+ text in a Currency column. The check follows the same rules as switching
39
+ back to the Form view, with one difference: a multi-select value given as
40
+ an array is underlined too, because a JSON body is sent as typed and
41
+ Dataverse wants `"1,2"`.
42
+
43
+ With *Advanced Find only* on, columns Advanced Find hides aren't listed, but
44
+ they still get hover text and type checks. Unknown keys and annotations
45
+ aren't underlined, because the pane already lists them. The table's option
46
+ values, lookup targets and date behaviour load when the JSON view opens, in
47
+ one request per column type.
48
+
49
+ - **Hand-typed URLs get suggestions** ([#268]). The Batch custom request URL and
50
+ Retrieve query options, the Paste OData URL dialog and Retrieve Next Link list
51
+ what fits where the caret is:
52
+ - **Path:** tables and unbound functions and actions, then a row's navigation
53
+ properties and bound operations, or a table's `$count`.
54
+ - **Query options:** option names, columns in `$select` and `$orderby`
55
+ (lookups as `_<column>_value`), `asc` / `desc`, navigation properties in
56
+ `$expand` and the options inside `$expand(…)`, for the nav's own table.
57
+ - **`$filter`:** columns, `nav/column` paths, `contains` / `startswith` /
58
+ `endswith`, then operators and `and` / `or`.
59
+
60
+ The list opens as you type, not when you paste a URL. ↑ / ↓ move through it,
61
+ Enter or Tab inserts, Esc closes it, and Ctrl+Space opens it again. *Advanced
62
+ Find only* narrows it like the pickers. Lambdas (`any` / `all`) aren't
63
+ suggested yet.
64
+
65
+ - **Results suggest the next step** ([#291]):
66
+ - **0 rows:** **Edit $filter** opens the $filter, **Run without $filter**
67
+ removes it from the builder and runs again (with **Restore $filter**
68
+ afterwards), and **Copy request URL**.
69
+ - **403:** the card names the missing privilege when Dataverse's message has
70
+ one, for example `prvReadAccount` (Read access on account).
71
+ - **401:** the card says to sign in to the connection again in ToolBox's
72
+ Connection Manager.
73
+ - **Unknown entity set** ("Resource not found for the segment …"): the card
74
+ suggests the closest table in your entity scope. In Retrieve NextLink,
75
+ **Use** fixes the URL.
76
+ - **Every error**, including failed writes: **Copy error report** copies the
77
+ method, URL, status, error code and message. It never includes request
78
+ headers, so no credentials or impersonation ids.
79
+ - **Every mode lists what blocks Execute in Advisories** ([#294]). Create,
80
+ Associate, Disassociate, Execute Action / Function / Workflow, Manage File /
81
+ Image / Attachment, Predefined Query, `$batch`, Bulk Write and Bulk Delete
82
+ used to explain a disabled Execute only in its tooltip. Now the blocker is
83
+ in the Advisories drawer, like the read modes, and **Open** goes to the
84
+ sidebar node that fixes it, for example the first unset required parameter
85
+ or the first Bulk Write row with a problem. What blocks Execute is
86
+ unchanged.
87
+ - **Open on any advisory shows the Builder and focuses the field** ([#294]),
88
+ from any tab, in every mode.
89
+ - **Recent runs survive a reload or restart** ([#226]). Each mode keeps its
90
+ runs against each environment: the last 200 runs, with the request, status,
91
+ row count, duration and time. Response bodies are never kept, and neither
92
+ are credential or impersonation headers.
93
+ - Under Recent runs, **Show all** (or **Search runs**) opens the mode's
94
+ history: search by URL, status or method, and click a run to restore it.
95
+ - Settings → **Request history** turns it off (which also clears it) or
96
+ clears it.
97
+ - **Throttling is explained** ([#269]). When Dataverse's service protection
98
+ limits refuse a request (429: `0x80072322` requests, `0x80072321` execution
99
+ time, `0x80072326` concurrent requests), the result names the limit and says
100
+ what to do. Read results offer **Try again**; a failed write says it didn't
101
+ run.
102
+ - **Retrieve all** pauses instead of failing. The rows so far are kept, and
103
+ **Continue** asks for the refused page again.
104
+ - Waiting the exact `Retry-After` time needs response headers, which
105
+ ToolBox doesn't pass through yet.
106
+ - **Count only in Retrieve Multiple** ([#272]). Under $count, **Count only**
107
+ shows just the number of rows matching your $filter, with **Copy count**.
108
+ It asks for one row with `$count=true` and reads `@odata.count`, because
109
+ Dataverse rejects $filter on `<set>/$count` and ToolBox can't read that
110
+ plain-text answer. Dataverse counts up to 5,000 rows (500 for elastic
111
+ tables); past that, the result says more rows match. Pasting a `/$count` URL
112
+ turns Count only on.
113
+ - **Python code** ([#270]). The Code tab has a **Python** format that sends
114
+ the request with `requests`: the URL, your headers, and the body as a
115
+ Python dict (or the file's bytes for an upload). Multi-request modes send
116
+ each request in order on one session. In `$batch` and ExecuteMultiple,
117
+ **Python (requests)** posts the multipart body. Put your token in
118
+ `ACCESS_TOKEN`.
119
+ - **Import a cURL command** ([#271]). More actions (**…**) → **Import cURL
120
+ command…** reads a pasted `curl` command, for example from your
121
+ browser's Copy as cURL (bash or cmd) or DRS's own cURL code, and opens it
122
+ in the mode that sends it, filled in but not run:
123
+ - GET a table → Retrieve Multiple (the query is checked like Paste OData
124
+ URL), GET a row → Retrieve Single.
125
+ - POST to a table → Create, PATCH → Update with `If-Match` or Upsert
126
+ without it, DELETE → Delete (a row or one column). The body opens in the
127
+ field set's JSON view; Prefer, `If-Match` and the bypass headers fill
128
+ their panes.
129
+ - POST to an action → Execute Action, Custom API or Custom Action, with
130
+ the body read into its parameters (row references and new rows
131
+ included). A parameter it can't read is refused, not sent as null.
132
+ - POST `$batch` → `$batch`, with change sets kept.
133
+ - `Authorization`, cookies and browser headers are left out, and the
134
+ dialog lists what was left out or changed. Functions, associations,
135
+ alternate keys and file uploads aren't imported yet.
136
+ - **All or nothing for Associate and Disassociate** ([#224]). With two or
137
+ more targets on a one-to-many or many-to-many relationship, turn on **All
138
+ or nothing** under the target records to send their requests as one
139
+ `$batch` change set. If any target fails, Dataverse rolls back the rest, so
140
+ nothing is linked or unlinked; the results list the failed target and mark
141
+ the others **Not applied**. A change set holds at most 1,000 requests. It's off by default: each target
142
+ is still sent on its own, and a failure leaves the targets before it
143
+ changed. The Code tab follows the choice: with it on, fetch, Python, C#,
144
+ PowerShell and cURL post one `$batch`, and `Xrm.WebApi.executeMultiple`
145
+ nests the requests in a change set. Needs Power Platform ToolBox 1.2.7 or
146
+ later; on an older ToolBox the option is unavailable and the requests go
147
+ one at a time.
148
+
149
+ ### 🐛 Fixed
150
+
151
+ - **Screen readers and speech input get the right names; status and URL
152
+ colours are readable** ([#387]):
153
+ - Each results row's checkbox is named after the record (or its row
154
+ number), like the header's **Select all rows**.
155
+ - Recent runs, and the rows in run history, are named by what they show
156
+ ("GET just now · 200 · 3 rows") and then their URL, so speech users can
157
+ say what they see. So are the buttons whose tooltip used to rename them
158
+ (**Saved**, **Refresh**, **Copy URL**, **Copy ID**, **Open**, **Copy**,
159
+ **Save** in the Code tab, **Paste** and **Clear** in Retrieve NextLink,
160
+ and a binary file's **Change**): the tooltip now describes the button.
161
+ In the $filter editor, **NOT** is named by its text and the query
162
+ function picker has a name.
163
+ - The status pill ("200 OK · 82 ms") is a Fluent filled badge, as the
164
+ design specifies, with a check on success, and its time is no longer
165
+ faded.
166
+ - The purple of the URL bar's `$select`, `$filter`, … names and the
167
+ $filter editor's function labels follows the theme as the design pairs
168
+ it: a shade deeper in light, the lighter "relate" purple in dark (it
169
+ stayed the light-theme purple before). The ƒ badge is dark violet in
170
+ dark.
171
+ - The selected **AND** / **OR** is a Fluent primary button: brand blue
172
+ with white text in Retrieve modes, the mode's colour elsewhere. In dark it
173
+ was white on a light tint.
174
+ - All of these meet 4.5:1 contrast in light and dark.
175
+ - **Execute Function no longer lists query functions** ([#384]). `Last7Days`,
176
+ `Contains`, `Between` and the other `$filter` query functions only work
177
+ inside a `$filter`, and the picker was meant to hide them. It missed them
178
+ because Dataverse declares them unbound.
179
+ - **JSON bodies are checked in the PPTB VS Code extension** ([#255]). The
180
+ extension serves DRS's files from another origin than the page, so
181
+ Monaco's workers couldn't start. The JSON editors then showed no error
182
+ squiggles and offered no formatting or folding, and threw an error on
183
+ every edit. Where a worker can't start, the same code now runs on the
184
+ page. That includes a worker that fails after it was created, for
185
+ example one a host's CSP forbids, or one whose file is gone after DRS
186
+ updated while open. ToolBox desktop still uses real workers.
187
+ - **Update and Upsert results show what came back** ([#224]). A 204 used
188
+ to show a made-up `{"@odata.context": "update"}` body in the JSON tab;
189
+ now it shows none. ToolBox's update passes no row back, even with
190
+ `Prefer: return=representation` (Upsert's default), so the result says so
191
+ and points to **Retrieve this record**.
192
+ - **Retrieve NextLink names the right table** ([#224]). The table came from
193
+ trimming the entity set's plural (`mailboxes` became `mailboxe`); now it's
194
+ looked up in the environment's entity list, and left blank when unknown.
195
+ - **Manage Image's preview has a sidebar entry** ([#224]). The pane with the
196
+ operation banner, the 144×144 preview tile and the pipeline had no sidebar
197
+ item: once you left it, only loading a request (or **Open** on _Image
198
+ operations run externally_) brought it back, so the picked record's
199
+ initials on the tile went unseen. A **Preview** section now heads the
200
+ sidebar, named after the picked record and badged with its initials, and
201
+ **Open** highlights it.
202
+
203
+ ### 🔄 Changed
204
+
205
+ - **A smaller, faster-loading package** ([#236]). The npm package is about
206
+ 1.8 MB (6.7 MB unpacked), down from 3.6 MB (14.5 MB), and DRS loads less
207
+ at startup:
208
+ - The editors load only the languages DRS shows (JSON, FetchXML and the
209
+ Code tab's formats) instead of all of Monaco's: its TypeScript, CSS and
210
+ HTML language services (~7.6 MB of workers) and ~80 language files are
211
+ gone.
212
+ - Every mode except Retrieve Multiple, the one DRS opens on, loads the
213
+ first time you pick it, as do the Code tab, the cURL import and the
214
+ write-result card. The startup bundle is ~1.7 MB, down from ~2 MB.
215
+ - The editors still highlight every Code tab format, and JSON is still
216
+ checked, formatted and folded. The JavaScript in the Code tab's Editor
217
+ playground loses what TypeScript's language service gave it: error
218
+ squiggles, completions, hover and formatting.
219
+ - CI fails the build if the package, or its startup bundle, grows past
220
+ its budget, or if an unused Monaco worker comes back.
221
+
222
+ ### 🔧 Internal
223
+
224
+ - Executor clean-ups ([#224]): one `API_VERSION` constant, matching the
225
+ `v9.2` ToolBox calls; unused exports and `void` import keepers removed;
226
+ the executor's module header describes what it does today. Manage
227
+ Image's preview tile takes its initials from the picked record instead of
228
+ a fixed `?`.
229
+ - `src/mock/` is renamed for what it holds ([#224]): the table registry and
230
+ CSDL action types are in `src/metadata/`, the environment in `src/env/`.
231
+ No behaviour change.
232
+ - One header composition ([#244]): Create, Update, Upsert, Delete, Merge
233
+ and Bulk Write, the collection exports and `$batch` all build the
234
+ precondition, duplicate-detection and bypass headers in
235
+ `engine/requestHeaders.ts`, so Execute, the Code tab and exports can't
236
+ drift apart. A test checks they match.
237
+ - One Recent-runs push ([#244]): every mode adds its run with `addRun`,
238
+ which stamps the id and time and keeps the list at `RECENT_SHOWN`.
239
+
240
+ [#224]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/224
241
+ [#244]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/244
242
+ [#236]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/236
243
+ [#255]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/255
244
+ [#268]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/268
245
+ [#291]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/291
246
+ [#294]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/294
247
+ [#226]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/226
248
+ [#269]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/269
249
+ [#272]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/272
250
+ [#270]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/270
251
+ [#271]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/271
252
+ [#384]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/384
253
+ [#387]: https://github.com/mohsinonxrm/pptb-mxrm-dataverse-request-studio/issues/387
254
+
10
255
  ## [1.5.0] - 2026-11-07
11
256
 
12
257
  Writes ask before they're sent, naming the environment, and Production gets a
package/README.md CHANGED
@@ -23,10 +23,11 @@ React 18, Fluent UI v9, TypeScript, and live Dataverse metadata integration.
23
23
 
24
24
  DRS ships with **23 request modes** in 7 groups. Every mode is
25
25
  metadata-driven and generates the correct OData / Web API shape. The
26
- single-request modes emit ready-to-copy code in ten formats: `fetch`, `Xrm.WebApi`,
27
- `Xrm.WebApi.executeMultiple`, `XMLHttpRequest`, Power Automate, C#, PowerShell,
28
- cURL, JSON, and an OpenAPI 3 document; the `$batch` and ExecuteMultiple
29
- modes have their own HTTP / fetch / C# / PPTB outputs.
26
+ single-request modes emit ready-to-copy code in eleven formats: `fetch`,
27
+ `Xrm.WebApi`, `Xrm.WebApi.executeMultiple`, `XMLHttpRequest`, Power Automate,
28
+ C#, Python (`requests`), PowerShell, cURL, JSON, and an OpenAPI 3 document.
29
+ `$batch` has its own HTTP / fetch / Python / PPTB outputs, and ExecuteMultiple
30
+ has C# / HTTP / Python / PPTB.
30
31
 
31
32
  ### 📖 Read group
32
33
 
@@ -161,6 +162,11 @@ modes have their own HTTP / fetch / C# / PPTB outputs.
161
162
  precondition, bypass or impersonation header are blocked with an
162
163
  explanation. `Authorization` / `Cookie` headers are never sent, saved or
163
164
  exported.
165
+ - **Import a cURL command** — More actions → **Import cURL command…** opens a
166
+ pasted `curl` command (a browser's Copy as cURL, or DRS's own cURL code) in
167
+ the mode that sends it: Retrieve Multiple / Single, Create, Update, Upsert,
168
+ Delete, Execute Action / Custom API / Custom Action, or `$batch`. It's
169
+ filled in, not run, and credentials and browser headers are left out.
164
170
  - **Antipattern advisories** — Surfaces real-time guidance per the
165
171
  [Microsoft query-antipatterns doc](https://learn.microsoft.com/en-us/power-apps/developer/data-platform/query-antipatterns):
166
172
  `FilteringOnCalculatedColumns`, `LargeAmountOfLogicalAttributes`, large-text
@@ -180,8 +186,11 @@ modes have their own HTTP / fetch / C# / PPTB outputs.
180
186
  dirty-state detection. Export / import as JSON, export as a Postman /
181
187
  Insomnia / Bruno collection, and copy or move requests from other
182
188
  connections. A library that can't be read is never overwritten.
183
- - **Recent runs** — click a run to restore it into its mode. Each mode keeps
184
- its unsaved request when you switch modes.
189
+ - **Recent runs** — click a run to restore it into its mode. Runs are kept
190
+ across restarts, per environment (the last 200, without response bodies or
191
+ credential / impersonation headers), and **Show all** searches them. Turn
192
+ the history off or clear it in Settings. Each mode keeps its unsaved request
193
+ when you switch modes.
185
194
  - **Results** — CSV export (formulas neutralised for spreadsheets), JSON
186
195
  export, Copy as TSV, and response-size hints.
187
196
  - **Accessibility** — labelled inputs, readable badges and live-region
@@ -423,7 +432,7 @@ src/
423
432
  executeBuilders.ts — action / function / workflow body builders
424
433
  binaryBuilders.ts — file / image / attachment pipelines
425
434
  codeGenerators.ts — fetch, Xrm.WebApi (+ executeMultiple), XHR,
426
- Power Automate, C#, PowerShell, cURL, JSON
435
+ Power Automate, C#, Python, PowerShell, cURL, JSON
427
436
  openApiGenerator.ts — OpenAPI 3 document for the current request
428
437
  collectionFormats.ts, savedToCollection.ts
429
438
  — Postman / Insomnia / Bruno collection export
@@ -443,6 +452,15 @@ src/
443
452
  cache.ts — per-org metadata caches (TTL + in-flight dedup)
444
453
  useLiveMetadata.ts, useColumnDetail.ts, useScopedEntities.ts, …
445
454
 
455
+ metadata/ — Dataverse metadata model
456
+ metadata.ts — table / column types + live table registry
457
+ (findTable, findTableBySet)
458
+ actionsCsdl.ts — CSDL action / function types
459
+
460
+ env/ — target environment
461
+ environment.ts — connected environment (getEnv, ENV) +
462
+ API_VERSION / API_BASE
463
+
446
464
  primitives/ — small reusable UI bits
447
465
  ClauseTreeItem.tsx, SectionHeader.tsx, ModeCard.tsx, RequestTypePicker.tsx
448
466
  StatusPill.tsx, MethodPill.tsx, AdvisoryDrawer.tsx, advisories.ts
@@ -534,9 +552,9 @@ Ideas under consideration include:
534
552
  - FetchXML and Dataverse Search API modes
535
553
  - A metadata browser mode
536
554
  - Comparing responses across runs or environments
537
- - Importing Postman / Insomnia collections and cURL commands
538
- - More code-generation targets (C# ServiceClient / IOrganizationService,
539
- Python, the PowerShell Dataverse module)
555
+ - Importing Postman / Insomnia collections
556
+ - More code-generation targets (C# ServiceClient / IOrganizationService, the
557
+ PowerShell Dataverse module)
540
558
 
541
559
  ---
542
560
 
@@ -0,0 +1 @@
1
+ import{bg as be,j as e,c0 as Se,t as n,B as x,C as f,bv as Ne,dP as Be,r as y,w as ze,z as _,ay as Z,aL as Fe,S as ke,dQ as Oe,M as A,m as W,o as De,dR as X,dS as Le,au as ee,bt as H,bd as I,ca as $e,a$ as ue,br as ve,bs as V,aK as te,cr as _e,dT as Ae,dU as We,dV as qe,dW as Ue,aq as Ge,av as P,an as Je,aB as pe,cq as me,R as ne,bS as He,s as Ve,be as we,dX as ye,dY as Ke,b$ as Ye,u as Qe,dZ as Te,d_ as Ze,d$ as Xe}from"./index-NW0Z4UWR.js";import{O as he}from"./OptionGroup-DYAAm_pt.js";import{M as et}from"./CodeView-C65Y5vXN.js";import{F as tt}from"./FieldSetEditor-Dg6WsDgG.js";const nt={WhoAmIResponse:[{name:"UserId",type:"Edm.Guid",notes:"GUID of the calling user."},{name:"BusinessUnitId",type:"Edm.Guid",notes:"User's business unit."},{name:"OrganizationId",type:"Edm.Guid",notes:"Current org (tenant)."}],RetrieveTotalRecordCountResponse:[{name:"EntityRecordCountCollection",type:"EntityRecordCountCollection",notes:"Count keyed by entity logical name."}],GetTimeZoneCodeByLocalizedNameResponse:[{name:"TimeZoneCode",type:"Edm.Int32",notes:"Resolved timezone code."}],AddToQueueResponse:[{name:"QueueItemId",type:"Edm.Guid",notes:"GUID of the new queueitem row."}],RetrieveUserPrivilegesResponse:[{name:"RolePrivileges",type:"Collection(RolePrivilege)",notes:"Privileges granted by the user's security roles."}],RetrievePrincipalAccessResponse:[{name:"AccessRights",type:"AccessRights (bitmask)",notes:"Effective access rights as a comma-separated string."}],ExportTranslationResponse:[{name:"ExportTranslationFile",type:"Edm.Binary",notes:"Base64-encoded translation .zip."}],sample_SendNotificationResponse:[{name:"NotificationId",type:"Edm.Guid",notes:"GUID of the notification row created."},{name:"DeliveredAt",type:"Edm.DateTimeOffset",notes:"Server time the notification was queued."}]};function Ce(t){const r=/^Collection\((.+)\)$/.exec(t.trim());return r?r[1].trim():null}function re(t,r){if(t==="collection"){const i=Ce(r);return i?re("complex",i):[]}if(t!=="complex"&&t!=="entity")return[];const l=new Map,s=new Set,a=i=>{const o=Be(i.includes(".")?i:`mscrm.${i}`);if(!(!o||s.has(o.name))){s.add(o.name),o.baseType&&a(o.baseType);for(const c of o.properties)l.set(c.name,{name:c.name,type:c.type})}};return a(r),[...l.values()]}function Ee(t){return t.kind==="entity"&&re("entity",t.typeName).length>0?"complex":t.kind}function jt({action:t,pillText:r}){const l=be(),s=t.returnType,a=nt[s.typeName]??re(s.kind,s.typeName),i=r??(t.source==="custom-api"?"from Custom API def":"from $metadata"),o=s.kind==="collection"?Ce(s.typeName):null,c=e.jsxs("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:0,fontSize:11},children:[e.jsx("thead",{children:e.jsxs(G,{header:!0,children:[e.jsx(L,{children:"Name"}),e.jsx(L,{children:"Type"}),e.jsx(L,{children:"Notes"})]})}),e.jsx("tbody",{children:a.map(u=>e.jsxs(G,{children:[e.jsx($,{mono:!0,children:u.name}),e.jsx($,{children:u.type}),e.jsx($,{children:u.notes??""})]},u.name))})]});return e.jsxs("div",{className:Ne(l.inlineCard),style:{padding:12,maxWidth:980},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[e.jsx(Se,{style:{width:16,height:16,color:n.colorBrandForeground1}}),e.jsx("strong",{style:{fontSize:12},children:"Response properties"}),e.jsx(x,{appearance:"ghost",children:i}),e.jsx(x,{appearance:"tint",color:"brand",style:{marginLeft:4},children:Ee(s)}),e.jsx("span",{style:{flexGrow:1}}),e.jsx(f,{style:{color:n.colorNeutralForeground3,fontFamily:n.fontFamilyMonospace,fontSize:10},children:s.typeName})]}),s.kind==="void"?e.jsxs(f,{style:{color:n.colorNeutralForeground3,fontStyle:"italic",display:"block",padding:"6px 4px"},children:["No response body — Dataverse returns ",e.jsx("code",{children:"204 No Content"}),"."]}):s.kind==="primitive"?e.jsxs("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:0,fontSize:11},children:[e.jsx("thead",{children:e.jsxs(G,{header:!0,children:[e.jsx(L,{children:"Name"}),e.jsx(L,{children:"Type"}),e.jsx(L,{children:"Notes"})]})}),e.jsx("tbody",{children:e.jsxs(G,{children:[e.jsx($,{mono:!0,children:"value"}),e.jsx($,{children:s.typeName}),e.jsxs($,{children:["Single primitive value — server wraps it as ",e.jsx("code",{children:"{ value: ... }"}),"."]})]})})]}):s.kind==="collection"?e.jsxs(e.Fragment,{children:[e.jsxs(f,{style:{color:n.colorNeutralForeground3,display:"block",padding:"6px 4px"},children:["Returns a collection — body envelope is"," ",e.jsx("code",{children:'{ "@odata.context": "…", "value": [...] }'}),". Composable functions accept"," ",e.jsx("code",{children:"$select"})," / ",e.jsx("code",{children:"$filter"})," on the URL to scope columns.",a.length>0&&o&&e.jsxs(e.Fragment,{children:[" ","Each item is a"," ",e.jsx("code",{children:o.replace(/^(mscrm|Microsoft\.Dynamics\.CRM)\./,"")}),":"]})]}),a.length>0&&c]}):s.kind==="entity"&&a.length===0?e.jsxs(f,{style:{color:n.colorNeutralForeground3,display:"block",padding:"6px 4px"},children:["Returns an entity instance of type"," ",e.jsx("code",{style:{fontFamily:n.fontFamilyMonospace},children:s.typeName}),". Standard entity envelope with ",e.jsx("code",{children:"@odata.etag"}),"."]}):a.length>0?c:e.jsxs(f,{style:{color:n.colorNeutralForeground3,display:"block",padding:"6px 4px",fontStyle:"italic"},children:["Returns ",e.jsx("code",{style:{fontFamily:n.fontFamilyMonospace},children:s.typeName}),". Its properties aren't described in the loaded ",e.jsx("code",{children:"$metadata"}),"."]})]})}function G({children:t,header:r}){return e.jsx("tr",{style:{background:r?n.colorNeutralBackground3:"transparent"},children:t})}function L({children:t}){return e.jsx("th",{style:{textAlign:"left",padding:"6px 8px",fontSize:10,fontWeight:600,color:n.colorNeutralForeground2,borderBottom:`1px solid ${n.colorNeutralStroke2}`},children:t})}function $({children:t,mono:r}){return e.jsx("td",{style:{padding:"6px 8px",borderBottom:`1px solid ${n.colorNeutralStroke3}`,fontFamily:r?n.fontFamilyMonospace:n.fontFamilyBase,verticalAlign:"top"},children:t})}const M="__unbound__",v="";function bt({filter:t,value:r,title:l,sub:s,onChange:a,group:i="execute"}){const[o,c]=y.useState(v),[u,p]=y.useState(""),[j,C]=y.useState(""),[F,B]=y.useState(null),[k,b]=y.useState(null);y.useEffect(()=>{let d=!1;return ze.loadAll().then(m=>{d||B(m)}).catch(m=>{d||b(m instanceof Error?m.message:String(m))}),()=>{d=!0}},[]);const g=F===null&&!k,N=y.useMemo(()=>(F??[]).filter(t),[F,t]),h=y.useMemo(()=>{let d=0,m=0;const S=new Map;for(const T of N){const D=Q(T)?1:0;if(T.binding.kind==="unbound")d++,m+=D;else{const ce=T.binding.entityType,de=S.get(ce)??{count:0,yours:0};S.set(ce,{count:de.count+1,yours:de.yours+D})}}const U=Array.from(S.entries()).sort((T,D)=>T[0].localeCompare(D[0])).map(([T,D])=>({logicalName:T,...D}));return{unboundCount:d,unboundYours:m,entities:U}},[N]),w=u.trim().toLowerCase(),oe=o===v?"":o===M?"Unbound":o,K=w.length>0&&w!==oe.toLowerCase(),se=y.useMemo(()=>{if(!K)return h.entities;const d=w;return h.entities.filter(m=>{if(m.logicalName.toLowerCase().includes(d))return!0;const S=_(m.logicalName);return S?S.displayName.toLowerCase().includes(d):!1})},[h.entities,K,w]),ie=h.unboundCount>0&&(!K||"unbound".includes(w)),z=y.useMemo(()=>o===v?[]:o===M?N.filter(d=>d.binding.kind==="unbound"):N.filter(d=>d.binding.kind!=="unbound"&&d.binding.entityType===o),[N,o]),E=r?N.find(d=>d.name===r):void 0,le=E?.displayName??E?.name??"",ae=j.trim().length>0&&j.trim()!==le,O=y.useMemo(()=>{if(!ae)return z;const d=j.toLowerCase();return z.filter(m=>m.name.toLowerCase().includes(d)||(m.displayName?.toLowerCase().includes(d)??!1)||(m.description?.toLowerCase().includes(d)??!1)||(m.publisher?.name.toLowerCase().includes(d)??!1))},[z,j,ae]),R=y.useMemo(()=>O.some(d=>d.publisher)?{yours:O.filter(Q),microsoft:O.filter(d=>!Q(d))}:null,[O]),Y=d=>e.jsx(I,{value:d.name,text:d.displayName??d.name,children:e.jsx(rt,{action:d})},d.name);return y.useEffect(()=>{C(le)},[r,F]),y.useEffect(()=>{p(oe)},[o]),y.useEffect(()=>{if(!r||o!==v||!F)return;const d=F.find(S=>S.name===r);if(!d)return;const m=d.binding.kind==="unbound"?M:d.binding.entityType;c(m)},[r,F,o]),y.useEffect(()=>{if(!E)return;if(o===v){a(null),C("");return}o===M&&E.binding.kind==="unbound"||o!==M&&E.binding.kind!=="unbound"&&E.binding.entityType===o||(a(null),C(""))},[o]),e.jsxs("div",{children:[e.jsx(Z,{icon:Fe,title:l,sub:s??"Browse the CSDL — pick an operation to populate its typed parameter form.",group:i,children:g?e.jsx(x,{appearance:"ghost",icon:e.jsx(ke,{size:"extra-tiny"}),children:"loading CSDL…"}):e.jsxs(x,{appearance:"ghost",children:[N.length," available"]})}),k&&Oe(k)?e.jsx(A,{intent:"error",layout:"multiline",style:{marginBottom:12,maxWidth:760},children:e.jsxs(W,{children:[e.jsx(De,{children:"This environment's metadata is too large for this version of Power Platform ToolBox"}),"This version of Power Platform ToolBox can't load a ",e.jsx("code",{children:"$metadata"})," document larger than 16 MB, so actions and functions can't be listed here. It will work once a ToolBox release includes the upstream fix (",e.jsx(X,{href:Le,target:"_blank",rel:"noopener noreferrer",children:"desktop-app#736"}),","," ",e.jsx(X,{href:"https://github.com/PowerPlatformToolBox/desktop-app/pull/737",target:"_blank",rel:"noopener noreferrer",children:"#737"}),"). Other request types aren't affected.",e.jsxs("div",{style:{marginTop:6,fontSize:12,opacity:.8},children:["Host error: ",k]})]})}):k&&e.jsx(A,{intent:"error",layout:"multiline",style:{marginBottom:12,maxWidth:760},children:e.jsxs(W,{children:["Couldn't load CSDL metadata: ",k]})}),e.jsxs("div",{style:{maxWidth:760,display:"flex",flexDirection:"column",gap:14},children:[e.jsx(ee,{label:"Scope",hint:"Pick Unbound or a binding entity. Required before choosing an operation.",children:e.jsxs(H,{freeform:!0,clearable:!0,value:u,selectedOptions:o===v?[]:[o],onChange:d=>{const m=d.target.value;p(m),m===""&&o!==v&&c(v)},onOptionSelect:(d,m)=>{const S=m.optionValue??v;c(S),p(S===v?"":S===M?"Unbound":S)},placeholder:g?"Loading…":N.length===0?"No operations available":`Pick scope · ${h.unboundCount} unbound, ${h.entities.length} entit${h.entities.length===1?"y":"ies"}`,disabled:g||N.length===0,listbox:{style:{maxHeight:360}},style:{width:"100%"},children:[ie&&e.jsx(I,{value:M,text:"Unbound",children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx(x,{appearance:"ghost",size:"small",children:"Unbound"}),e.jsxs(f,{style:{color:n.colorNeutralForeground3},children:[h.unboundCount," op",h.unboundCount===1?"":"s",xe(h.unboundYours)," · invoked without a source record"]})]})}),se.map(d=>{const m=_(d.logicalName);return e.jsx(I,{value:d.logicalName,text:d.logicalName,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,minWidth:0},children:[e.jsx("span",{style:{fontFamily:n.fontFamilyMonospace,fontWeight:600},children:d.logicalName}),m&&e.jsx(f,{style:{color:n.colorNeutralForeground3},children:m.displayName}),e.jsx("span",{style:{flexGrow:1}}),e.jsxs(f,{style:{color:n.colorNeutralForeground3},children:[d.count," op",d.count===1?"":"s",xe(d.yours)]})]})},d.logicalName)}),se.length===0&&!ie&&e.jsx(I,{value:"__noscope",text:"",disabled:!0,children:e.jsxs(f,{style:{color:n.colorNeutralForeground3},children:['No scopes match "',w,'"']})})]})}),e.jsx(ee,{label:"Operation",children:e.jsxs(H,{freeform:!0,clearable:!0,value:j,selectedOptions:r?[r]:[],onChange:d=>{const m=d.target.value;C(m),m===""&&r&&a(null)},onOptionSelect:(d,m)=>{const S=m.optionValue??null;if(a(S),S){const U=N.find(T=>T.name===S);C(U?.displayName??U?.name??"")}else C("")},disabled:g||o===v,placeholder:g?"Loading actions from $metadata…":k?"CSDL load failed — see error above":o===v?"Pick a scope above first":z.length===0?`No ${N[0]?.kind?.toLowerCase()??"operation"}s in this scope`:`Search ${z.length} ${N[0]?.kind??"item"}${z.length===1?"":"s"}…`,listbox:{style:{maxHeight:420}},style:{width:"100%"},children:[R?e.jsxs(e.Fragment,{children:[R.yours.length>0&&e.jsx(he,{label:`Your org & ISVs (${R.yours.length})`,children:R.yours.map(Y)}),R.microsoft.length>0&&e.jsx(he,{label:`Microsoft (${R.microsoft.length})`,children:R.microsoft.map(Y)})]}):O.map(Y),O.length===0&&e.jsx(I,{value:"__none",text:"",disabled:!0,children:e.jsx("span",{style:{color:n.colorNeutralForeground3,fontSize:12},children:"No matches"})})]})}),E&&e.jsx("div",{style:{marginTop:16},children:e.jsx(ot,{action:E})})]})]})}function rt({action:t}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontFamily:n.fontFamilyMonospace,fontWeight:600},children:t.name}),e.jsx(x,{appearance:"ghost",size:"small",children:t.kind}),t.isComposable&&e.jsx(x,{appearance:"ghost",size:"small",children:"composable"}),t.publisher&&e.jsx(Re,{publisher:t.publisher}),e.jsx(x,{appearance:"tint",color:"brand",size:"small",style:{marginLeft:"auto"},children:t.kind==="Action"?"POST":"GET"})]}),e.jsxs(f,{style:{color:n.colorNeutralForeground3},children:[Me(t),t.description&&e.jsxs(e.Fragment,{children:[" ","· ",t.description.slice(0,110),t.description.length>110?"…":""]})]})]})}function ot({action:t}){const r=t.binding.kind!=="unbound"?_(t.binding.entityType):void 0;return e.jsxs("div",{style:{border:`1px solid ${n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium,padding:12,background:n.colorNeutralBackground1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[t.kind==="Function"?e.jsx(Se,{style:{color:n.colorBrandForeground1}}):e.jsx(Fe,{style:{color:n.colorBrandForeground1}}),e.jsx("strong",{style:{fontFamily:n.fontFamilyMonospace,fontSize:13},children:t.name}),e.jsx(x,{appearance:"tint",color:"brand",children:t.kind}),t.isComposable&&e.jsx(x,{appearance:"ghost",icon:e.jsx($e,{style:{width:10,height:10}}),children:"composable"}),e.jsx("span",{style:{flexGrow:1}}),e.jsx(x,{appearance:"filled",color:t.kind==="Action"?"success":"brand",style:{fontWeight:700},children:t.kind==="Action"?"POST":"GET"})]}),t.description&&e.jsx(f,{style:{color:n.colorNeutralForeground2,display:"block",marginBottom:8},children:t.description}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",rowGap:4,fontSize:11},children:[e.jsx("span",{style:{color:n.colorNeutralForeground3},children:"Namespace"}),e.jsx("span",{style:{fontFamily:n.fontFamilyMonospace},children:t.namespace}),e.jsx("span",{style:{color:n.colorNeutralForeground3},children:"Binding"}),e.jsxs("span",{children:[Me(t),r&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("span",{style:{fontFamily:n.fontFamilyMonospace,color:n.colorNeutralForeground3},children:r.entitySetName})]})]}),e.jsx("span",{style:{color:n.colorNeutralForeground3},children:"Parameters"}),e.jsx("span",{children:t.parameters.length===0?e.jsx("em",{style:{color:n.colorNeutralForeground3},children:"(none)"}):t.parameters.map(l=>e.jsxs(x,{appearance:"ghost",size:"small",style:{marginRight:4,fontFamily:n.fontFamilyMonospace},children:[l.name,": ",l.type,l.required?" *":""]},l.name))}),e.jsx("span",{style:{color:n.colorNeutralForeground3},children:"Return type"}),e.jsxs("span",{style:{fontFamily:n.fontFamilyMonospace},children:[t.returnType.typeName,e.jsxs(f,{style:{marginLeft:6,color:n.colorNeutralForeground3,fontFamily:n.fontFamilyBase},children:["(",Ee(t.returnType),")"]})]}),e.jsx("span",{style:{color:n.colorNeutralForeground3},children:"Source"}),e.jsx("span",{children:e.jsx(x,{appearance:"ghost",children:t.source})}),t.publisher&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:n.colorNeutralForeground3},children:"Publisher"}),e.jsx("span",{children:e.jsx(Re,{publisher:t.publisher})})]})]})]})}function Q(t){return!!t.publisher&&!t.publisher.microsoft}function xe(t){return t>0?`, ${t} yours`:""}function Re({publisher:t}){return e.jsx(x,{appearance:"outline",color:t.microsoft?"informative":"brand",size:"small",title:`Publisher: ${t.name}`,children:e.jsx("span",{style:{maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.name})})}function Me(t){switch(t.binding.kind){case"unbound":return"Unbound";case"entity":return`Bound to ${t.binding.entityType}`;case"collection":return`Bound to ${t.binding.entityType} collection`}}function st(t){return`https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/${t.kind==="Action"?"actions":"functions"}?view=dataverse-latest`}function St({action:t,values:r,setValue:l,setValues:s,group:a="execute",themeMode:i="light"}){const o=be(),[c,u]=y.useState("form"),[p,j]=y.useState(""),[C,F]=y.useState(null);y.useEffect(()=>{if(c!=="json"){try{j(JSON.stringify(r,null,2))}catch{}return}try{j(JSON.stringify(r,null,2)),F(null)}catch(b){F(b instanceof Error?b.message:String(b))}},[c,r]);const B=st(t);if(t.parameters.length===0)return e.jsxs("div",{children:[e.jsx(Z,{icon:ue,title:"Parameters",sub:"No parameters — this operation can be invoked as-is.",group:a,children:B&&e.jsx(fe,{href:B})}),e.jsx(A,{layout:"multiline",intent:"info",style:{maxWidth:720},children:e.jsxs(W,{children:[e.jsx("code",{children:t.name})," takes no parameters. Click ",e.jsx("strong",{children:"Execute"})," to run it."]})})]});const k=t.parameters.filter(b=>b.required).filter(b=>J(r[b.name]));return e.jsxs("div",{children:[e.jsxs(Z,{icon:ue,title:"Parameters",sub:e.jsxs(e.Fragment,{children:["Required parameters first (marked"," ",e.jsx(x,{appearance:"tint",color:"danger",size:"small",children:"req"}),"). Optional parameters live in the accordion below.",k.length>0&&e.jsxs(e.Fragment,{children:[" · ",k.length," required unset."]})]}),group:a,children:[e.jsxs(x,{appearance:"ghost",children:[t.parameters.filter(b=>!J(r[b.name])).length," of"," ",t.parameters.length," set"]}),k.length>0&&e.jsxs(x,{appearance:"tint",color:"danger",children:[k.length," required unset"]}),B&&e.jsx(fe,{href:B}),s&&e.jsxs(ve,{ariaLabel:"Parameter editor mode",children:[e.jsx(V,{checked:c==="form",icon:e.jsx(te,{}),onClick:()=>u("form"),children:"Form"}),e.jsx(V,{checked:c==="json",icon:e.jsx(_e,{}),onClick:()=>u("json"),children:"JSON"})]})]}),c==="form"?(()=>{const b=t.parameters.filter(h=>h.required),g=t.parameters.filter(h=>!h.required),N=g.filter(h=>!J(r[h.name])).length;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,maxWidth:880},children:[b.map(h=>e.jsx(ge,{action:t,param:h,value:r[h.name],onChange:w=>l(h.name,w),styles:o},h.name)),b.length===0&&g.length>0&&e.jsx(f,{style:{color:n.colorNeutralForeground3,fontStyle:"italic",padding:"4px 2px"},children:"This operation has no required parameters — all inputs below are optional."}),g.length>0&&e.jsx(Ae,{collapsible:!0,multiple:!0,defaultOpenItems:N>0?["optional"]:[],children:e.jsxs(We,{value:"optional",children:[e.jsx(qe,{children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontWeight:600},children:"Optional parameters"}),e.jsxs(x,{appearance:"ghost",size:"small",children:[N," of ",g.length," set"]})]})}),e.jsx(Ue,{children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,paddingTop:6},children:g.map(h=>e.jsx(ge,{action:t,param:h,value:r[h.name],onChange:w=>l(h.name,w),styles:o},h.name))})})]})})]})})():e.jsx(it,{text:p,error:C,themeMode:i,onChange:b=>{j(b);try{const g=JSON.parse(b||"{}");g&&typeof g=="object"&&!Array.isArray(g)?(F(null),s?.(g)):F("Top-level must be a JSON object.")}catch(g){F(g instanceof Error?g.message:String(g))}}})]})}function fe({href:t}){return e.jsx(X,{href:t,target:"_blank",rel:"noopener noreferrer",style:{fontSize:11},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:["MS Learn ",e.jsx(Ge,{style:{width:12,height:12}})]})})}function it({text:t,error:r,themeMode:l,onChange:s}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,maxWidth:880},children:[e.jsx(A,{layout:"multiline",intent:"info",children:e.jsxs(W,{children:["Hand-craft the request body as JSON. Useful when the metadata-driven form can't express the shape — e.g. Int32 params whose values map to documented enums, EntitySpecific params that should be ",e.jsx("code",{children:'{ "@odata.id": "<set>(<id>)" }'})," references instead of inline instances, or Custom API params with domain-specific shapes. Refer to the MS Learn page for the canonical body."]})}),e.jsx("div",{style:{border:`1px solid ${r?n.colorPaletteRedBorder2:n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium,overflow:"hidden",height:360},children:e.jsx(et,{height:"100%",language:"json",value:t,onChange:a=>s(a??""),theme:l==="dark"?"vs-dark":"light",options:{lineNumbers:"on",minimap:{enabled:!1},scrollBeyondLastLine:!1,fontFamily:"Cascadia Mono, Consolas, monospace",fontSize:13,tabSize:2,wordWrap:"on",automaticLayout:!0,padding:{top:12,bottom:12},bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},smoothScrolling:!0,formatOnPaste:!0}})}),r&&e.jsxs(f,{style:{color:n.colorPaletteRedForeground1},children:["Parse error: ",r]})]})}function ge({action:t,param:r,value:l,onChange:s,styles:a}){const i=r.required&&J(l);return e.jsxs("div",{"data-focus-node":`param:${r.name}`,className:Ne(a.inlineCard),style:{padding:12,display:"grid",gridTemplateColumns:"220px 1fr",gap:14,alignItems:"start",borderColor:i?n.colorPaletteRedBorder2:void 0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,paddingTop:4},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontFamily:n.fontFamilyMonospace,fontWeight:600},children:r.name}),r.required&&e.jsx(x,{appearance:"tint",color:"danger",size:"small",children:"req"})]}),e.jsxs(f,{style:{color:n.colorNeutralForeground3,fontSize:10},children:[e.jsx("span",{style:{color:n.colorBrandForeground2,fontFamily:n.fontFamilyMonospace},children:r.type}),r.entityType&&e.jsxs(e.Fragment,{children:[" · ",r.entityType]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[e.jsx(Ie,{action:t,param:r,value:l,onChange:s}),r.description&&e.jsx(f,{style:{color:n.colorNeutralForeground3},children:r.description})]})]})}const q=y.createContext("Parameter value");function Ie(t){return e.jsx(q.Provider,{value:t.param.name,children:e.jsx(lt,{...t})})}function lt({action:t,param:r,value:l,onChange:s}){switch(r.type){case"Edm.String":return e.jsx(P,{"aria-label":r.name,size:"small",value:l??"",onChange:(a,i)=>s(i.value),placeholder:"value"});case"Edm.Guid":return e.jsx(P,{"aria-label":r.name,size:"small",value:l??"",onChange:(a,i)=>s(i.value),placeholder:"00000000-0000-0000-0000-000000000000",style:{fontFamily:n.fontFamilyMonospace}});case"Edm.Int32":case"Edm.Int64":return e.jsx(pe,{"aria-label":r.name,size:"small",value:Number.isFinite(l)?l:0,step:1,precision:0,onChange:(a,i)=>{const o=i.value!=null?i.value:i.displayValue!=null?Number(i.displayValue):NaN;Number.isFinite(o)&&s(Math.trunc(o))}});case"Edm.Decimal":case"Edm.Double":return e.jsx(pe,{"aria-label":r.name,size:"small",value:Number(l??0),step:.01,onChange:(a,i)=>s(i.value??Number(i.displayValue??0))});case"Edm.Boolean":return e.jsx(Je,{checked:l===!0,onChange:(a,i)=>s(i.checked),label:l===!0?"true":"false"});case"Edm.DateTimeOffset":return e.jsx(at,{value:l??"",onChange:s});case"OptionSetValue":return e.jsx(ct,{param:r,value:l,onChange:s});case"Collection(Edm.String)":return e.jsx(je,{value:l??[],onChange:s});case"Collection(Edm.Int32)":return e.jsx(dt,{value:l??[],onChange:s});case"Collection(Edm.Guid)":return e.jsx(je,{value:l??[],onChange:s,mono:!0});case"EntityReference":return e.jsx(Pe,{value:l,onChange:s,param:r,polymorphic:!0});case"EntitySpecific":return e.jsx(pt,{param:r,value:l,onChange:s});case"EntityCollection":return e.jsx(ut,{value:l??[],onChange:s,param:r});case"ComplexType":return e.jsx(yt,{param:r,value:l,onChange:s});case"Edm.Binary":return e.jsx(P,{"aria-label":r.name,size:"small",value:l??"",onChange:(a,i)=>s(i.value),placeholder:"base64-encoded bytes",style:{fontFamily:n.fontFamilyMonospace}})}}function at({value:t,onChange:r}){const l=y.useContext(q),s=t?new Date(t):null,a=s&&!Number.isNaN(s.getTime())?s:null,i=c=>{if(!c){r("");return}const u=new Date(c);a&&u.setHours(a.getHours(),a.getMinutes(),0,0),r(u.toISOString())},o=c=>{if(!c||!a)return;const u=new Date(a);u.setHours(c.getHours(),c.getMinutes(),0,0),r(u.toISOString())};return e.jsxs("span",{style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[e.jsx(Ze,{"aria-label":`${l} (date)`,size:"small",value:a,onSelectDate:i,placeholder:"Date…",formatDate:c=>c?c.toLocaleDateString():"",allowTextInput:!0,style:{minWidth:130}}),e.jsx(Xe,{"aria-label":`${l} (time)`,size:"small",freeform:!0,selectedTime:a,onTimeChange:(c,u)=>o(u.selectedTime),placeholder:"Time…",style:{minWidth:100},hourCycle:"h23"})]})}function ct({param:t,value:r,onChange:l}){const s=t.optionSet??[],a=s.find(i=>i.value===r);return e.jsx(H,{"aria-label":t.name,size:"small",value:a?.label??(r!=null?String(r):""),selectedOptions:r!=null?[String(r)]:[],onOptionSelect:(i,o)=>o.optionValue&&l(Number(o.optionValue)),placeholder:"Pick a value…",children:s.map(i=>e.jsxs(I,{value:String(i.value),text:i.label,children:[i.label,e.jsxs("span",{style:{color:n.colorNeutralForeground3,fontFamily:n.fontFamilyMonospace,fontSize:10,marginLeft:6},children:["· ",i.value]})]},i.value))})}function je({value:t,onChange:r,mono:l}){const s=y.useContext(q),[a,i]=y.useState("");return e.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[t.map((o,c)=>e.jsx(Te,{shape:"rounded",dismissible:!0,onClick:()=>r(t.filter((u,p)=>p!==c)),style:{fontFamily:l?n.fontFamilyMonospace:n.fontFamilyBase},children:o},c)),e.jsx(P,{"aria-label":`${s} item to add`,size:"small",placeholder:"add… (Enter)",style:{width:160,fontFamily:l?n.fontFamilyMonospace:n.fontFamilyBase},value:a,onChange:(o,c)=>i(c.value),onKeyDown:o=>{if(o.key==="Enter"){const c=a.trim();c&&(r([...t,c]),i("")),o.preventDefault()}}})]})}function dt({value:t,onChange:r}){const l=y.useContext(q),[s,a]=y.useState("");return e.jsxs("span",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[t.map((i,o)=>e.jsx(Te,{shape:"rounded",dismissible:!0,onClick:()=>r(t.filter((c,u)=>u!==o)),children:String(i)},o)),e.jsx(P,{"aria-label":`${l} item to add`,size:"small",type:"number",placeholder:"add… (Enter)",style:{width:120},value:s,onChange:(i,o)=>a(o.value),onKeyDown:i=>{if(i.key==="Enter"){const o=s.trim(),c=Number(o);o!==""&&Number.isFinite(c)&&(r([...t,c]),a("")),i.preventDefault()}}})]})}function Pe({value:t,onChange:r,param:l,polymorphic:s}){const a=y.useContext(q),{entities:i}=Qe(),o=t?.entityType??l.entityType??"";ne(o||null);const c=_(o);return e.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[s&&e.jsx(H,{"aria-label":`${a} (table)`,size:"small",value:c?.displayName??o,selectedOptions:[o],onOptionSelect:(u,p)=>{p.optionValue&&r({id:"",entityType:p.optionValue})},placeholder:"Pick target entity…",children:i.map(u=>e.jsx(I,{value:u.logicalName,text:u.displayName,children:e.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[e.jsx("span",{children:u.displayName}),e.jsx(f,{style:{color:n.colorNeutralForeground3,fontFamily:n.fontFamilyMonospace},children:u.logicalName})]})},u.logicalName))}),!s&&e.jsxs(x,{appearance:"ghost",style:{fontFamily:n.fontFamilyMonospace,alignSelf:"flex-start"},children:["→ ",c?.entitySetName??o]}),o&&e.jsx(we,{table:o,selectedId:t?.id||null,onPick:u=>r(u?{id:u.id,entityType:o}:null),placeholder:`Search ${c?.displayName??o} records…`}),o&&e.jsxs(f,{style:{color:n.colorNeutralForeground3,fontSize:10},children:["Emitted as"," ",e.jsxs("code",{style:{fontFamily:n.fontFamilyMonospace},children:["@odata.type=Microsoft.Dynamics.CRM.",o]})]})]})}function ut({value:t,onChange:r,param:l}){const s=l.entityType??"";ne(s||null);const a=_(s),[i,o]=y.useState(0),c=p=>{p&&(t.some(j=>j.id===p)||(r([...t,{id:p,entityType:s}]),o(j=>j+1)))},u=p=>r(t.filter(j=>j.id!==p));return s?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[e.jsxs(x,{appearance:"ghost",style:{fontFamily:n.fontFamilyMonospace,alignSelf:"flex-start"},children:["→ Collection(",s,")"]}),t.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4,padding:6,border:`1px solid ${n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium},children:t.map(p=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(He,{size:"extra-small",name:p.id,avatar:{color:"colorful"}}),e.jsxs("code",{style:{flex:1,minWidth:0,fontFamily:n.fontFamilyMonospace,fontSize:11,color:n.colorNeutralForeground3},children:["/",a?.entitySetName??s,"(",p.id,")"]}),e.jsx(Ve,{size:"small",appearance:"subtle",onClick:()=>u(p.id),children:"Remove"})]},p.id))}),e.jsx(we,{table:s,selectedId:null,onPick:p=>c(p?.id??null),placeholder:`Add ${a?.displayName??s} record…`},i)]}):e.jsx(A,{layout:"multiline",intent:"warning",children:e.jsx(W,{children:"This collection parameter has no entity type declared in CSDL."})})}function pt({param:t,value:r,onChange:l}){const[s,a]=y.useState(null),i=ye(r)?"reference":r!=null&&typeof r=="object"&&Object.keys(r).length>0?"instance":s??Ke(t),o=p=>{p!==i&&(a(p),l(void 0))},c=t.entityType??"",u=ye(r)?r["@ref"]:"";return e.jsxs("span",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[e.jsxs(ve,{ariaLabel:`${t.name}: existing record or new instance`,children:[e.jsx(V,{size:"small",checked:i==="reference",icon:e.jsx(Ye,{}),onClick:()=>o("reference"),children:"Existing record"}),e.jsx(V,{size:"small",checked:i==="instance",icon:e.jsx(te,{}),onClick:()=>o("instance"),children:"New instance"})]}),i==="reference"?e.jsx(Pe,{value:c?{id:u,entityType:c}:void 0,onChange:p=>l(p?.id?{"@ref":p.id}:void 0),param:t,polymorphic:!1}):e.jsx(mt,{param:t,value:r,onChange:l})]})}function mt({param:t,value:r,onChange:l}){const s=y.useContext(q),a=t.entityType??"",{loading:i}=ne(a||null),o=_(a),c=r??{};return o?e.jsxs("div",{style:{padding:10,background:n.colorNeutralBackground2,border:`1px dashed ${n.colorBrandStroke2}`,borderRadius:n.borderRadiusMedium},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:10},children:[e.jsx(te,{style:{width:14,height:14,color:n.colorBrandForeground1}}),e.jsx("strong",{style:{fontSize:11},children:o.displayName}),e.jsx(f,{style:{color:n.colorNeutralForeground3},children:"new entity instance · @odata.type discriminator added automatically"})]}),e.jsx(tt,{table:a,values:c,setValues:u=>l(u),group:"execute"})]}):i?e.jsxs("div",{style:{padding:10,background:n.colorNeutralBackground2,border:`1px dashed ${n.colorBrandStroke2}`,borderRadius:n.borderRadiusMedium,display:"flex",alignItems:"center",gap:8},children:[e.jsx(ke,{size:"extra-tiny"}),e.jsxs(f,{style:{color:n.colorNeutralForeground3},children:["Loading ",e.jsx("code",{children:a})," metadata from Dataverse — typed form will appear shortly…"]})]}):e.jsxs(A,{layout:"multiline",intent:"warning",children:[e.jsxs(W,{children:["No metadata for entity type ",e.jsx("code",{children:a})," — the entity isn't available in this environment. For now, edit the JSON inline:"]}),e.jsx(P,{"aria-label":`${s} (JSON)`,size:"small",value:JSON.stringify(c),onChange:(u,p)=>{try{const j=JSON.parse(p.value||"{}");j&&typeof j=="object"&&l(j)}catch{}},style:{fontFamily:n.fontFamilyMonospace,fontSize:11,marginTop:6}})]})}function yt({param:t,value:r,onChange:l}){const s=t.complexType?.fields??[],a=r??{};return s.length===0?e.jsxs("div",{style:{padding:10,background:n.colorNeutralBackground2,border:`1px dashed ${n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[e.jsx(me,{style:{width:14,height:14,color:n.colorNeutralForeground3}}),e.jsx("strong",{style:{fontSize:11},children:t.complexType?.name??t.name}),e.jsx(f,{style:{color:n.colorNeutralForeground3},children:"complex type · no field schema in mock — edit JSON"})]}),e.jsx(P,{"aria-label":`${t.name} (JSON)`,size:"small",value:JSON.stringify(a),onChange:(i,o)=>{try{const c=JSON.parse(o.value||"{}");c&&typeof c=="object"&&!Array.isArray(c)&&l(c)}catch{}},style:{fontFamily:n.fontFamilyMonospace,fontSize:11,width:"100%"}})]}):e.jsxs("div",{style:{padding:10,background:n.colorNeutralBackground2,border:`1px dashed ${n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium,display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx(me,{style:{width:14,height:14,color:n.colorNeutralForeground3}}),e.jsx("strong",{style:{fontSize:11},children:t.complexType?.name??t.name}),e.jsx(f,{style:{color:n.colorNeutralForeground3},children:"nested complex type"})]}),s.map(i=>e.jsx(ee,{label:e.jsxs("span",{style:{fontFamily:n.fontFamilyMonospace,fontSize:11},children:[i.name," ",e.jsxs("span",{style:{color:n.colorNeutralForeground3},children:["· ",i.type]}),i.required&&e.jsx(x,{appearance:"tint",color:"danger",size:"small",style:{marginLeft:6},children:"req"})]}),hint:i.description,children:e.jsx(Ie,{param:i,value:a[i.name],onChange:o=>l({...a,[i.name]:o})})},i.name))]})}function J(t){return t==null||typeof t=="string"&&t===""||Array.isArray(t)&&t.length===0?!0:typeof t=="object"&&t!==null&&"id"in t?!t.id:!1}export{St as A,jt as R,bt as a};
@@ -0,0 +1 @@
1
+ import{z as j,bb as U,bf as _,R as V,j as e,ay as P,b_ as N,au as B,bt as J,bd as Q,t as a,B as y,C as f,r as E,bg as X,M as O,m as C,aW as M,ca as Y,bS as Z,s as ee,b4 as te,bv as ne,be as ae,aU as re,o as se,an as oe,aG as le,cb as ie}from"./index-NW0Z4UWR.js";function pe({table:t,value:s,onChange:n,group:o="relate",forOperation:l,footer:d}){const u=j(t)?.navigationProperties??[],g=u.find(i=>i.name===s),F=U(),m=u.filter(i=>_(i,F)||i.name===s);return V(g?.targetEntity??null),e.jsxs("div",{children:[e.jsx(P,{icon:N,title:"Navigation property",sub:"Cardinality is detected from metadata — the URL bar verb + shape adapt automatically.",group:o}),e.jsxs("div",{style:{maxWidth:720},children:[e.jsx(B,{label:"Navigation property",children:e.jsx(J,{value:g?.name??"",selectedOptions:g?[g.name]:[],onOptionSelect:(i,k)=>n(k.optionValue??null),placeholder:"Pick a navigation property…",children:m.map(i=>e.jsx(Q,{value:i.name,text:i.name,children:e.jsx(ce,{nav:i,forOperation:l})},i.name))})}),g&&e.jsx("div",{style:{marginTop:16},children:e.jsx(de,{nav:g,forOperation:l})}),d&&e.jsx("div",{style:{marginTop:14},children:d})]})]})}function ce({nav:t,forOperation:s}){const n=j(t.targetEntity),o=W(t,s);return e.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{fontFamily:a.fontFamilyMonospace,fontWeight:600},children:t.name}),e.jsx(y,{appearance:"ghost",size:"small",children:R(t.cardinality)}),e.jsx(y,{appearance:"tint",color:"brand",size:"small",style:{marginLeft:"auto"},children:o})]}),e.jsxs(f,{style:{color:a.colorNeutralForeground3},children:["→ ",n?.displayName??t.targetEntity," · ",he(t.cardinality)]})]})}function de({nav:t,forOperation:s}){const n=j(t.targetEntity),o=W(t,s),l=t.cardinality==="ManyToOne"?"single-valued":"collection-valued",d=o==="POST"?a.colorPaletteGreenForeground1:o==="PATCH"?a.colorPaletteDarkOrangeForeground1:a.colorPaletteRedForeground1;return e.jsxs("div",{style:{border:`1px solid ${a.colorNeutralStroke2}`,borderRadius:a.borderRadiusMedium,padding:12,background:a.colorNeutralBackground1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx(N,{style:{width:18,height:18,color:a.colorBrandForeground1}}),e.jsx("strong",{style:{fontFamily:a.fontFamilyMonospace,fontSize:13},children:t.name}),e.jsx(y,{appearance:"tint",color:"brand",children:R(t.cardinality)}),e.jsx("span",{style:{flexGrow:1}}),e.jsx(y,{appearance:"filled",style:{background:d,color:a.colorNeutralForegroundOnBrand,fontWeight:700},children:o})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",rowGap:4,fontSize:11},children:[e.jsx("span",{style:{color:a.colorNeutralForeground3},children:"Target entity"}),e.jsxs("span",{style:{fontFamily:a.fontFamilyMonospace},children:[n?.entitySetName??t.targetEntity," ",e.jsxs(f,{style:{color:a.colorNeutralForeground3},children:["· ",n?.displayName??t.targetEntity]})]}),e.jsx("span",{style:{color:a.colorNeutralForeground3},children:"Cardinality"}),e.jsxs("span",{children:[l," (",t.cardinality,")"]}),e.jsx("span",{style:{color:a.colorNeutralForeground3},children:"Relationship"}),e.jsx("span",{style:{fontFamily:a.fontFamilyMonospace,fontSize:10},children:t.relationshipName})]})]})}function R(t){switch(t){case"OneToMany":return"1:N";case"ManyToOne":return"N:1";case"ManyToMany":return"N:N"}}function he(t){return t==="ManyToOne"?"single-valued lookup":"collection-valued"}function W(t,s){return t.cardinality==="ManyToOne"?"PATCH":s==="disassociate"?"DELETE":"POST"}function w(t,s){return t||s===1?"Target record":"Target records"}function ye({table:t,navProperty:s,targets:n,setTargets:o,targetNames:l,setTargetNames:d,group:b="relate",resolvedMethod:u,sub:g,verb:F="POST",changeSet:m=!1,footer:i}){const[k,$]=E.useState({}),v=l??k,A=d??$,q=X(),z=j(t),p=s?z?.navigationProperties.find(r=>r.name===s):void 0,x=p?j(p.targetEntity):void 0,c=p?.cardinality==="ManyToOne",D=c?1:1/0,[I,H]=E.useState(0);if(!p)return e.jsxs("div",{children:[e.jsx(P,{icon:N,title:w(!1,n.length),sub:"Pick a navigation property first.",group:b}),e.jsx(O,{layout:"multiline",intent:"info",style:{maxWidth:720},children:e.jsxs(C,{children:["Switch to the ",e.jsx("strong",{children:"Navigation property"})," pane and pick one — the target entity comes from there."]})})]});const S=n.length>=D,L=(r,h)=>{if(!r||n.includes(r)||S)return;const T=c?[r]:[...n,r];o(T),h&&A({...v,[r]:h}),H(K=>K+1)},G=r=>{if(o(n.filter(h=>h!==r)),v[r]!=null){const h={...v};delete h[r],A(h)}};return e.jsxs("div",{children:[e.jsxs(P,{icon:N,title:w(c,n.length),sub:e.jsx("span",{children:g??(c?e.jsxs(e.Fragment,{children:["One target is allowed for ",e.jsx("code",{children:p.cardinality})," nav props — a PATCH with"," ",e.jsxs("code",{children:[p.name,"@odata.bind"]})," sets the lookup."]}):e.jsxs(e.Fragment,{children:["One or more targets —"," ",m?e.jsxs(e.Fragment,{children:["sent together as one ",e.jsx("code",{children:"$batch"})," change set (All or nothing)."]}):e.jsxs(e.Fragment,{children:["each fires a separate POST request. For many targets, Dataverse recommends a"," ",e.jsx("code",{children:"$batch"})," request."]})]}))}),group:b,children:[e.jsxs(y,{appearance:"tint",color:n.length>0?"brand":"subtle",children:[n.length," target",n.length===1?"":"s"]}),u&&e.jsx(y,{appearance:"filled",color:u==="POST"?"success":"informative",style:{fontWeight:700},children:u}),!c&&n.length>1&&e.jsx(M,{content:m?"Sent together as one $batch change set: all succeed or none do.":"Will fire one request per target. Turn on All or nothing to send them as one $batch change set.",relationship:"description",children:e.jsxs(y,{appearance:"ghost",icon:e.jsx(Y,{style:{width:12,height:12}}),children:[n.length," requests ",m?"· 1 change set":"queued"]})})]}),e.jsx("div",{className:ne(q.inlineCard),style:{padding:12,marginBottom:14,maxWidth:880},children:n.length===0?e.jsxs(f,{style:{padding:"12px 4px",color:a.colorNeutralForeground3,fontStyle:"italic",display:"block",textAlign:"center"},children:["No targets selected — use the picker below to choose"," ",c?"one":"one or more"," ",e.jsx("strong",{children:x?.displayName??p.targetEntity})," record",c?"":"s","."]}):e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:n.map((r,h)=>{const T=v[r];return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 4px",borderBottom:h<n.length-1?`1px solid ${a.colorNeutralStroke3}`:"none"},children:[e.jsx(Z,{size:"small",name:T??"?",avatar:{color:"colorful"}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600},children:T??e.jsx("span",{style:{fontStyle:"italic",color:a.colorNeutralForeground3},children:"(name not resolved)"})}),e.jsxs("div",{style:{fontFamily:a.fontFamilyMonospace,fontSize:10,color:a.colorNeutralForeground3},children:["/",x?.entitySetName??"?","(",r,")"]})]}),e.jsx(M,{content:"Remove target",relationship:"label",children:e.jsx(ee,{size:"small",appearance:"subtle",icon:e.jsx(te,{}),onClick:()=>G(r),"aria-label":"Remove target"})})]},r)})})}),!S&&e.jsxs("div",{style:{maxWidth:560},children:[e.jsx(B,{label:c?"Pick target":"Add target",hint:c?`Pick a single ${x?.displayName??"record"} — the PATCH sets this as the lookup value.`:`Each pick queues ${m?"one more request in the change set":`a separate ${F}`}. Currently ${n.length} target${n.length===1?"":"s"} queued.`,children:e.jsx(ae,{table:x?.logicalName??p.targetEntity,selectedId:null,onPick:r=>L(r?.id??null,r?.primary),placeholder:`Search ${x?.displayName??"record"}s…`},I)}),!c&&e.jsxs(f,{style:{display:"block",marginTop:6,color:a.colorNeutralForeground3},children:[e.jsx(re,{style:{width:12,height:12,verticalAlign:"middle"}})," picking a record adds it to the queue and resets the picker for the next pick."]})]}),S&&c&&e.jsx(O,{layout:"multiline",intent:"info",style:{maxWidth:720,marginTop:12},children:e.jsxs(C,{children:[e.jsx(se,{children:"Single-valued nav property — one target only."}),"To change the target, remove the current one first. The PATCH replaces the previous lookup value."]})}),i]})}const ue=()=>le()&&!ie();function me({checked:t,onChange:s,targets:n,verb:o}){const l=ue(),d=o==="POST"?"linked":"unlinked";return e.jsxs("div",{style:{maxWidth:720,marginTop:18},children:[e.jsx(oe,{checked:t&&!l,disabled:l,onChange:(b,u)=>s(!!u.checked),label:"All or nothing"}),e.jsxs(f,{style:{display:"block",marginTop:2,marginLeft:44,color:a.colorNeutralForeground3},children:[t&&!l?e.jsxs(e.Fragment,{children:["The ",o," requests go together as one ",e.jsx("code",{children:"$batch"})," change set: if any target fails, Dataverse rolls back the rest, so nothing is ",d,"."]}):e.jsxs(e.Fragment,{children:["Off: one ",o," per target, in order. A failure part-way leaves the targets before it"," ",d,". Turn on to send them as one ",e.jsx("code",{children:"$batch"})," change set instead."]}),t&&!l&&n<2&&" Takes effect with two or more targets."]}),l&&e.jsx(O,{layout:"multiline",intent:"info",style:{marginTop:8},children:e.jsx(C,{children:"Sending a change set requires Power Platform ToolBox 1.2.7 or later, so the requests go one at a time."})})]})}export{ye as A,pe as N,me as a,w as t};
@@ -0,0 +1 @@
1
+ import{f as ce,bh as ue,r as n,R as ge,u as he,U as be,bT as pe,bU as me,bV as ve,z as ye,bW as fe,bX as Se,bj as xe,W as Ne,bY as X,X as Pe,bZ as Te,bl as je,Y as H,Z as G,_ as we,$ as ke,a0 as Ce,b_ as Ae,b$ as Re,bN as Me,bO as Ie,c0 as L,a7 as $e,a8 as He,j as a,a9 as Fe,M as Le,m as Be,o as Oe,ab as qe,c1 as Ee,ad as Y,ae as Ue,af as We,ag as ze,c2 as F,ah as Ve,ai as De,c3 as Z,b8 as _e,b9 as Xe,ax as Ge,bx as Ye,aj as Ze,bg as Je,ay as Ke,t as w,B as Qe,C as et,bv as tt}from"./index-NW0Z4UWR.js";import{t as at,A as st,a as rt,N as ot}from"./AllOrNothingOption-C7wGq_-r.js";import{C as nt}from"./CodeView-C65Y5vXN.js";import"./multipart-Bd_eOd8a.js";const it=()=>({table:"",sourceId:null,navProperty:null,targets:[],targetNames:{},headers:Ze(),dirty:new Set});function bt({themeMode:l}){const v=ce("associate"),h=ue("associate",Z,it),[e,d]=n.useState(h.state),{table:k}=ge(e.table||null),{allEntities:B}=he(),[O,C]=n.useState("source"),[y,A]=n.useState("builder"),[q,R]=n.useState(null),[K,E]=n.useState(!1),[Q,ee]=be("associate"),[f,S]=n.useState(h.lastSavedId),[x,N]=n.useState(h.lastSavedHash),[U,M]=n.useState(""),b=n.useMemo(()=>pe(e),[e,k]),te=n.useMemo(()=>me(e),[e,k]),r=n.useMemo(()=>ve(e),[e,k]),P=ye(e.table),o=e.navProperty?P?.navigationProperties.find(t=>t.name===e.navProperty):void 0,T=o?fe(o):!1,c=T?"PATCH":"POST",p=!T&&Se(e.allOrNothing,r.length),I=t=>d(s=>{const i=new Set(s.dirty);return i.add(t),{...s,dirty:i}}),m=(t,s,i)=>{d($=>({...$,[t]:s})),i&&I(i)},j=xe([["Source record id",e.sourceId],...e.targets.map(t=>["Target record id",t])],[["Navigation property",e.navProperty]]),W=Ne([{when:!P,id:"assoc-table",title:"Pick a source table first.",focusNode:"source"},{when:!e.sourceId,id:"assoc-source",title:"Pick a source record.",focusNode:"source"},{when:!e.navProperty,id:"assoc-nav",title:"Pick a navigation property.",focusNode:"nav"},{when:e.targets.length===0,id:"assoc-targets",title:"Pick at least one target record.",focusNode:"targets"},{when:p&&r.length>X,id:"assoc-change-set-cap",title:`All or nothing sends at most ${X} requests in one change set; this has ${r.length}. Remove targets or turn it off.`,focusNode:"targets"},{when:e.headers.some(t=>t.enabled&&!t.name),id:"assoc-header-name",title:"Fix empty header name.",focusNode:"headers"},{when:j,id:"assoc-url-part",title:j??"",focusNode:j?.startsWith("Target")?"targets":j?.startsWith("Navigation")?"nav":"source"}]),ae=Pe(W),se=async()=>{E(!0);const t=await Xe.associate(e,Y(e.headers,null));R(t),E(!1),A("results"),ee(Ge({snapshot:u,modeId:"associate",url:b.relativeUrl,method:c,status:t.status,ms:t.ms,rowCount:F(t,r.length)??0,summary:`${F(t,r.length)??0} of ${r.length} linked`})),d(s=>({...s,dirty:new Set}))},u=n.useMemo(()=>Te(e),[e]);je("associate",u,f,x);const re=n.useMemo(()=>H(u),[u]),z=x===null?!0:re!==x,oe=t=>{S(t.id),N(H(t.state))},V=t=>{if(t.modeId!=="associate")return;const s=t.state;if(B.length>0&&!B.some(i=>i.logicalName===s.table)){_e(`Can't load "${t.name}": entity \`${s.table}\` isn't available in this environment. The solution may have been removed or you may be connected to a different org.`);return}d(Z(s)),S(t.id),N(H(s)),R(null),M(""),C("source")},ne=t=>{const s=Ye(t,"associate");if(!s)return;const i=f,$=x;V(s),S(i),N($)},D=G(oe),_=G(V);we(n.useMemo(()=>e.table?{state:u,modeId:"associate",dirty:z,lastSavedId:f,onSaved:D,onLoadSaved:_}:null,[u,z,f,e.table,D,_]));const ie=[{id:"source",label:"Target",meta:P?.displayName??"Pick a table",items:[{id:"source",icon:Ce,iconFilled:ke,label:e.sourceId?U||`${P?.displayName??""} (selected)`:"Pick a record",badge:o?c:null,badgeAppearance:"tint",badgeColor:"brand",dirty:e.dirty.has("source")}]},{id:"relationship",label:"Relationship",meta:o?J(o.cardinality):"pick one",items:[{id:"nav",icon:Re,iconFilled:Ae,label:o?o.name:"Navigation property",code:!!o,badge:o?J(o.cardinality):null,badgeAppearance:"ghost",dirty:e.dirty.has("nav")}]},{id:"targets",label:"Related",meta:e.targets.length?`${e.targets.length} target${e.targets.length===1?"":"s"}`:"none",items:[{id:"targets",icon:Ie,iconFilled:Me,label:at(T,e.targets.length),badge:e.targets.length||null,badgeAppearance:"tint",badgeColor:e.targets.length>0?"success":"subtle",dirty:e.dirty.has("targets")},...r.length>0?[{id:"preview",icon:L,iconFilled:L,label:`${r.length} request${r.length===1?"":"s"}${p?" · all or nothing":""}`,badge:r.length,badgeAppearance:"ghost"}]:[]]},{id:"headers",label:"Headers",meta:`${e.headers.filter(t=>t.enabled).length} active`,items:[{id:"headers",icon:He,iconFilled:$e,label:"HTTP headers",badge:e.headers.filter(t=>t.enabled).length||null,dirty:e.dirty.has("headers")}]}];let g;switch(O){case"source":g=a.jsx(qe,{table:e.table,onTableChange:t=>{d(s=>({...s,table:t,sourceId:null,navProperty:null,targets:[],targetNames:{},dirty:new Set(["source","nav","targets"])})),M(""),R(null),S(void 0),N(null)},recordId:e.sourceId,onRecordChange:(t,s)=>{m("sourceId",t,"source"),M(s??"")},group:"relate",sub:"Pick the source entity and the record that the relationship anchors on."});break;case"nav":g=a.jsx(ot,{table:e.table,value:e.navProperty,onChange:t=>{d(s=>({...s,navProperty:t,targets:[],targetNames:{}})),I("nav"),I("targets")},group:"relate",forOperation:"associate",footer:a.jsx(Le,{layout:"multiline",intent:"info",children:a.jsxs(Be,{children:[a.jsx(Oe,{children:"How cardinality drives the request"}),a.jsx("strong",{children:"Collection-valued"})," (1:N / N:N) → ",a.jsx("code",{children:"POST /…/$ref"})," with one request per target. ",a.jsx("strong",{children:"Single-valued"})," (N:1) →"," ",a.jsx("code",{children:"PATCH /source(id)"})," with body"," ",a.jsx("code",{children:'{ "<nav>@odata.bind": "<target-set>(<id>)" }'})," (one target). This is the docs-preferred shape — the URL bar verb updates automatically. The PATCH is sent with ",a.jsx("code",{children:"If-Match: *"}),", so a wrong source id fails with 404 instead of creating a record; Power Platform ToolBox asks you to approve that header once."," ",a.jsx("a",{href:"https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/associate-disassociate-entities-using-web-api",target:"_blank",rel:"noopener noreferrer",style:{color:"inherit"},children:"MS Learn ↗"})]})})});break;case"targets":g=a.jsx(st,{table:e.table,navProperty:e.navProperty,targets:e.targets,setTargets:t=>m("targets",t,"targets"),targetNames:e.targetNames,setTargetNames:t=>m("targetNames",t),group:"relate",resolvedMethod:o?c:null,changeSet:p,footer:o&&!T?a.jsx(rt,{checked:!!e.allOrNothing,onChange:t=>m("allOrNothing",t||void 0,"targets"),targets:e.targets.length,verb:"POST"}):void 0});break;case"preview":g=a.jsx(lt,{requests:r,changeSet:p});break;case"headers":g=a.jsx(Fe,{policy:"relate",items:e.headers,setItems:t=>m("headers",t,"headers"),group:"relate"});break}const le=Ee(c,Y(e.headers,null)),de={method:c,built:b,headers:le,body:te,entityLogical:b.entityLogical,multiRequests:r.length>1?r.map(t=>({method:t.method,relativeUrl:t.relativeUrl,body:t.body,description:`target ${t.targetId}`})):void 0,changeSet:p};return a.jsx(Ue,{sidebar:a.jsx(De,{type:v,urlPreview:b.relativeNoBase,sections:ie,activeNode:O,onSelect:t=>{C(t),A("builder")},recents:Q,onRecentClick:ne}),urlBar:a.jsx(Ve,{method:c,url:b.relativeUrl,executeVerb:v.executeVerb,writeConfirm:{operation:o?`Associate (${o.name})`:"Associate",table:e.table,scope:{kind:"records",count:Math.max(1,e.targets.length)},highImpact:e.targets.length>1},disabledReason:ae,loading:K,onExecute:se,advisories:W,onAdvisoryFocus:C}),children:a.jsxs(We,{tab:y,onTabChange:A,resultCount:F(q,r.length),children:[y==="builder"&&g,y==="code"&&a.jsx(nt,{themeMode:l,inputs:de}),y==="results"&&a.jsx(ze,{result:q,mode:"single",table:e.table,writeContext:{operation:"associate",table:e.table,recordId:e.sourceId,recordName:U||null,navProperty:e.navProperty??void 0,targetCount:e.targets.length,targetNames:e.targets.map(t=>e.targetNames[t]).filter(t=>!!t),targetNameById:e.targetNames}})]})})}function lt({requests:l,changeSet:v}){const h=Je();return a.jsxs("div",{children:[a.jsx(Ke,{icon:L,title:`Generated requests (${l.length})`,sub:v?"All or nothing: these requests go together as one $batch change set, so all succeed or none do.":"Each target queues a separate HTTP request. For large counts, prefer a $batch request.",group:"relate"}),a.jsxs("div",{className:tt(h.inlineCard),style:{padding:12,maxWidth:980,fontFamily:w.fontFamilyMonospace,fontSize:11},children:[l.map((e,d)=>a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"60px 1fr",gap:8,padding:"8px 0",borderBottom:d<l.length-1?`1px solid ${w.colorNeutralStroke3}`:"none"},children:[a.jsx(Qe,{appearance:"filled",color:e.method==="POST"?"success":"warning",style:{fontWeight:700,justifySelf:"start"},children:e.method}),a.jsxs("div",{style:{minWidth:0},children:[a.jsx("div",{style:{wordBreak:"break-all"},children:e.relativeUrl}),a.jsx("div",{style:{marginTop:4,color:w.colorNeutralForeground3},children:JSON.stringify(e.body)})]})]},e.targetId)),l.length===0&&a.jsx(et,{style:{color:w.colorNeutralForeground3,fontStyle:"italic",padding:"12px 4px",textAlign:"center",display:"block"},children:"No requests queued — pick at least one target on the Related pane."})]})]})}function J(l){switch(l){case"OneToMany":return"1:N";case"ManyToOne":return"N:1";case"ManyToMany":return"N:N"}}export{bt as AssociateMode};