@nuwah/vertical-sdk 0.0.0-stage → 0.2.0-rc.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 (239) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +229 -2
  3. package/bin/nuwah-contract-check-rules.d.mts +41 -0
  4. package/bin/nuwah-contract-check-rules.mjs +333 -0
  5. package/bin/nuwah-contract-check.mjs +64 -0
  6. package/dist/accounting.d.ts +1417 -0
  7. package/dist/accounting.js +274 -0
  8. package/dist/active-org.d.ts +13 -0
  9. package/dist/active-org.js +59 -0
  10. package/dist/actors.d.ts +448 -0
  11. package/dist/actors.js +143 -0
  12. package/dist/ai.d.ts +359 -0
  13. package/dist/ai.js +229 -0
  14. package/dist/analytics.d.ts +37 -0
  15. package/dist/analytics.js +8 -0
  16. package/dist/atlas.d.ts +291 -0
  17. package/dist/atlas.js +78 -0
  18. package/dist/audit.d.ts +193 -0
  19. package/dist/audit.js +26 -0
  20. package/dist/authentication.d.ts +119 -0
  21. package/dist/authentication.js +83 -0
  22. package/dist/awards.d.ts +38 -0
  23. package/dist/awards.js +10 -0
  24. package/dist/blueprint/document.d.ts +178 -0
  25. package/dist/blueprint/document.js +17 -0
  26. package/dist/blueprint/index.d.ts +3 -0
  27. package/dist/blueprint/index.js +5 -0
  28. package/dist/blueprint/manifest.d.ts +105 -0
  29. package/dist/blueprint/manifest.js +11 -0
  30. package/dist/blueprint/validate.d.ts +14 -0
  31. package/dist/blueprint/validate.js +416 -0
  32. package/dist/bookings-directory.d.ts +118 -0
  33. package/dist/bookings-directory.js +289 -0
  34. package/dist/bookings-extra.d.ts +1448 -0
  35. package/dist/bookings-extra.js +582 -0
  36. package/dist/bookings.d.ts +1365 -0
  37. package/dist/bookings.js +305 -0
  38. package/dist/builder-code.d.ts +164 -0
  39. package/dist/builder-code.js +12 -0
  40. package/dist/builder-core-gaps.d.ts +83 -0
  41. package/dist/builder-core-gaps.js +8 -0
  42. package/dist/builder-repos.d.ts +73 -0
  43. package/dist/builder-repos.js +37 -0
  44. package/dist/builder.d.ts +730 -0
  45. package/dist/builder.js +105 -0
  46. package/dist/campaigns.d.ts +105 -0
  47. package/dist/campaigns.js +25 -0
  48. package/dist/catalogs.d.ts +188 -0
  49. package/dist/catalogs.js +36 -0
  50. package/dist/commerce-ai.d.ts +182 -0
  51. package/dist/commerce-ai.js +27 -0
  52. package/dist/connections.d.ts +278 -0
  53. package/dist/connections.js +96 -0
  54. package/dist/content-control.d.ts +121 -0
  55. package/dist/content-control.js +23 -0
  56. package/dist/contributions.d.ts +560 -0
  57. package/dist/contributions.js +140 -0
  58. package/dist/conversation-assist.d.ts +154 -0
  59. package/dist/conversation-assist.js +51 -0
  60. package/dist/conversation-info.d.ts +219 -0
  61. package/dist/conversation-info.js +43 -0
  62. package/dist/crm.d.ts +533 -0
  63. package/dist/crm.js +142 -0
  64. package/dist/dashboards.d.ts +119 -0
  65. package/dist/dashboards.js +22 -0
  66. package/dist/delegations.d.ts +161 -0
  67. package/dist/delegations.js +39 -0
  68. package/dist/docs.d.ts +289 -0
  69. package/dist/docs.js +49 -0
  70. package/dist/documents.d.ts +317 -0
  71. package/dist/documents.js +84 -0
  72. package/dist/drafts.d.ts +132 -0
  73. package/dist/drafts.js +56 -0
  74. package/dist/engagements.d.ts +133 -0
  75. package/dist/engagements.js +15 -0
  76. package/dist/event-stream.d.ts +54 -0
  77. package/dist/event-stream.js +228 -0
  78. package/dist/exchanges.d.ts +447 -0
  79. package/dist/exchanges.js +145 -0
  80. package/dist/exports.d.ts +113 -0
  81. package/dist/exports.js +81 -0
  82. package/dist/feeds.d.ts +228 -0
  83. package/dist/feeds.js +52 -0
  84. package/dist/files.d.ts +56 -0
  85. package/dist/files.js +55 -0
  86. package/dist/finance-insights.d.ts +41 -0
  87. package/dist/finance-insights.js +61 -0
  88. package/dist/fixed-assets.d.ts +155 -0
  89. package/dist/fixed-assets.js +28 -0
  90. package/dist/fulfilment-jobs.d.ts +405 -0
  91. package/dist/fulfilment-jobs.js +76 -0
  92. package/dist/fulfilment.d.ts +205 -0
  93. package/dist/fulfilment.js +39 -0
  94. package/dist/hr.d.ts +350 -0
  95. package/dist/hr.js +94 -0
  96. package/dist/http.d.ts +124 -0
  97. package/dist/http.js +392 -0
  98. package/dist/inbox.d.ts +206 -0
  99. package/dist/inbox.js +36 -0
  100. package/dist/index.d.ts +384 -0
  101. package/dist/index.js +294 -0
  102. package/dist/insights.d.ts +176 -0
  103. package/dist/insights.js +52 -0
  104. package/dist/inventory.d.ts +797 -0
  105. package/dist/inventory.js +120 -0
  106. package/dist/list-query.d.ts +211 -0
  107. package/dist/list-query.js +158 -0
  108. package/dist/listings.d.ts +381 -0
  109. package/dist/listings.js +173 -0
  110. package/dist/location-sharing.d.ts +83 -0
  111. package/dist/location-sharing.js +20 -0
  112. package/dist/marketplace.d.ts +268 -0
  113. package/dist/marketplace.js +59 -0
  114. package/dist/matching.d.ts +103 -0
  115. package/dist/matching.js +22 -0
  116. package/dist/media.d.ts +221 -0
  117. package/dist/media.js +239 -0
  118. package/dist/metrics.d.ts +125 -0
  119. package/dist/metrics.js +45 -0
  120. package/dist/moderation.d.ts +240 -0
  121. package/dist/moderation.js +40 -0
  122. package/dist/money.d.ts +41 -0
  123. package/dist/money.js +79 -0
  124. package/dist/my-data.d.ts +266 -0
  125. package/dist/my-data.js +32 -0
  126. package/dist/names.d.ts +14 -0
  127. package/dist/names.js +17 -0
  128. package/dist/occasions.d.ts +256 -0
  129. package/dist/occasions.js +40 -0
  130. package/dist/onboarding.d.ts +88 -0
  131. package/dist/onboarding.js +38 -0
  132. package/dist/pagination.d.ts +204 -0
  133. package/dist/pagination.js +141 -0
  134. package/dist/party-baseline-attributes.d.ts +245 -0
  135. package/dist/party-baseline-attributes.js +36 -0
  136. package/dist/party.d.ts +401 -0
  137. package/dist/party.js +56 -0
  138. package/dist/patient.d.ts +161 -0
  139. package/dist/patient.js +45 -0
  140. package/dist/payroll.d.ts +378 -0
  141. package/dist/payroll.js +60 -0
  142. package/dist/person-addresses.d.ts +88 -0
  143. package/dist/person-addresses.js +18 -0
  144. package/dist/person-cart.d.ts +250 -0
  145. package/dist/person-cart.js +63 -0
  146. package/dist/person-chat-assist.d.ts +47 -0
  147. package/dist/person-chat-assist.js +13 -0
  148. package/dist/person-data-webhooks.d.ts +72 -0
  149. package/dist/person-data-webhooks.js +86 -0
  150. package/dist/person-data.d.ts +212 -0
  151. package/dist/person-data.js +162 -0
  152. package/dist/person-locations.d.ts +54 -0
  153. package/dist/person-locations.js +6 -0
  154. package/dist/person-messaging.d.ts +405 -0
  155. package/dist/person-messaging.js +112 -0
  156. package/dist/person-notifications.d.ts +319 -0
  157. package/dist/person-notifications.js +164 -0
  158. package/dist/personalisation.d.ts +21 -0
  159. package/dist/personalisation.js +8 -0
  160. package/dist/platform.d.ts +63 -0
  161. package/dist/platform.js +45 -0
  162. package/dist/portfolio.d.ts +163 -0
  163. package/dist/portfolio.js +28 -0
  164. package/dist/pos.d.ts +743 -0
  165. package/dist/pos.js +129 -0
  166. package/dist/procurement.d.ts +664 -0
  167. package/dist/procurement.js +157 -0
  168. package/dist/promotions.d.ts +169 -0
  169. package/dist/promotions.js +39 -0
  170. package/dist/publications.d.ts +583 -0
  171. package/dist/publications.js +164 -0
  172. package/dist/ranking.d.ts +43 -0
  173. package/dist/ranking.js +34 -0
  174. package/dist/ratings.d.ts +293 -0
  175. package/dist/ratings.js +109 -0
  176. package/dist/reactions.d.ts +123 -0
  177. package/dist/reactions.js +41 -0
  178. package/dist/recipient-orders.d.ts +294 -0
  179. package/dist/recipient-orders.js +73 -0
  180. package/dist/relationships.d.ts +18 -0
  181. package/dist/relationships.js +8 -0
  182. package/dist/reporting.d.ts +107 -0
  183. package/dist/reporting.js +56 -0
  184. package/dist/sales.d.ts +270 -0
  185. package/dist/sales.js +66 -0
  186. package/dist/shares.d.ts +105 -0
  187. package/dist/shares.js +27 -0
  188. package/dist/shop.d.ts +993 -0
  189. package/dist/shop.js +215 -0
  190. package/dist/shopping-assistant.d.ts +65 -0
  191. package/dist/shopping-assistant.js +14 -0
  192. package/dist/spaces.d.ts +422 -0
  193. package/dist/spaces.js +118 -0
  194. package/dist/stored-value.d.ts +754 -0
  195. package/dist/stored-value.js +177 -0
  196. package/dist/types.d.ts +83 -0
  197. package/dist/types.js +2 -0
  198. package/dist/vault.d.ts +290 -0
  199. package/dist/vault.js +55 -0
  200. package/dist/vertical-runtime.d.ts +17 -0
  201. package/dist/vertical-runtime.js +8 -0
  202. package/dist/vite/build-manifest-plugin.d.ts +42 -0
  203. package/dist/vite/build-manifest-plugin.js +42 -0
  204. package/dist/vite/first-paint-plugin.d.ts +26 -0
  205. package/dist/vite/first-paint-plugin.js +57 -0
  206. package/dist/wishlists.d.ts +591 -0
  207. package/dist/wishlists.js +188 -0
  208. package/dist/workbench.d.ts +114 -0
  209. package/dist/workbench.js +22 -0
  210. package/dist/workspace.d.ts +190 -0
  211. package/dist/workspace.js +41 -0
  212. package/package.json +52 -4
  213. package/templates/extension-image.Dockerfile +38 -0
  214. package/templates/nuwah-vertical.yml +102 -0
  215. package/templates/vertical-app/.env.example +34 -0
  216. package/templates/vertical-app/README.md +108 -0
  217. package/templates/vertical-app/github/workflows/ci.yml +51 -0
  218. package/templates/vertical-app/gitignore +5 -0
  219. package/templates/vertical-app/index.html +12 -0
  220. package/templates/vertical-app/package.json +28 -0
  221. package/templates/vertical-app/src/App.tsx +64 -0
  222. package/templates/vertical-app/src/blueprint/blueprint.ts +45 -0
  223. package/templates/vertical-app/src/blueprint/screens.ts +15 -0
  224. package/templates/vertical-app/src/env.d.ts +18 -0
  225. package/templates/vertical-app/src/index.css +139 -0
  226. package/templates/vertical-app/src/lib/i18n.ts +5 -0
  227. package/templates/vertical-app/src/lib/iam.ts +19 -0
  228. package/templates/vertical-app/src/lib/operations.ts +93 -0
  229. package/templates/vertical-app/src/lib/router.ts +24 -0
  230. package/templates/vertical-app/src/lib/sdk.ts +21 -0
  231. package/templates/vertical-app/src/lib/theme.ts +18 -0
  232. package/templates/vertical-app/src/lib/words.ts +39 -0
  233. package/templates/vertical-app/src/main.tsx +25 -0
  234. package/templates/vertical-app/src/pages/AppScreens.tsx +71 -0
  235. package/templates/vertical-app/src/pages/AuthCallback.tsx +44 -0
  236. package/templates/vertical-app/src/pages/Home.tsx +36 -0
  237. package/templates/vertical-app/tsconfig.json +24 -0
  238. package/templates/vertical-app/vite.config.ts +23 -0
  239. package/templates/vertical-ci.yml +192 -0
@@ -0,0 +1,730 @@
1
+ import { type AiBilingualText, type AiProposal, type AiRunEvent } from './ai.js';
2
+ import type { Http, NuwahClientConfig, RequestOptions } from './http.js';
3
+ import type { BlueprintBlockType, BlueprintComposedScreen, BlueprintNavigationEntry } from './blueprint/document.js';
4
+ import type { ShoppingAssistantAnswer } from './shopping-assistant.js';
5
+ export type BuilderBlueprintStatus = 'draft' | 'in_review' | 'published' | 'suspended';
6
+ export type BuilderSessionState = 'provisioning' | 'ready' | 'idle' | 'expired' | 'closed' | 'failed';
7
+ export type BuilderSessionFilter = 'active' | 'archived' | 'all';
8
+ export type BuilderChangeStatus = 'proposed' | 'applied' | 'rejected' | 'expired' | 'reverted';
9
+ export type BuilderVersionOrigin = 'ai' | 'developer' | 'import' | 'revert';
10
+ export interface BuilderName {
11
+ en?: string;
12
+ ar?: string;
13
+ }
14
+ /** The blueprint document: `blueprint.v1.json`. Sections are optional while it is a draft. */
15
+ export interface BuilderBlueprintDocument {
16
+ schema_version: '1';
17
+ key: string;
18
+ identity: {
19
+ name: BuilderName;
20
+ tagline?: BuilderName | null;
21
+ primary_language?: 'en' | 'ar' | null;
22
+ };
23
+ branding?: {
24
+ primary_color?: string;
25
+ accent_color?: string;
26
+ };
27
+ modules?: string[];
28
+ vocabulary?: Record<string, AiBilingualText>;
29
+ policies?: Record<string, string>;
30
+ roles?: {
31
+ key: string;
32
+ label: BuilderName;
33
+ capabilities: string[];
34
+ bookable: boolean;
35
+ compliance: boolean;
36
+ }[];
37
+ session_types?: {
38
+ key: string;
39
+ label: BuilderName;
40
+ duration_minutes: number;
41
+ }[];
42
+ field_sets?: {
43
+ key: string;
44
+ label: BuilderName;
45
+ applies_to: 'client' | 'staff' | 'booking' | 'item';
46
+ fields: {
47
+ key: string;
48
+ label: BuilderName;
49
+ type: string;
50
+ options?: BuilderName[];
51
+ required: boolean;
52
+ }[];
53
+ }[];
54
+ data_requests?: {
55
+ category: string;
56
+ purpose: string;
57
+ retention: string;
58
+ recipient_mode: 'whole_app' | 'per_business';
59
+ why: AiBilingualText;
60
+ }[];
61
+ onboarding_steps?: {
62
+ key: string;
63
+ label: BuilderName;
64
+ }[];
65
+ site?: {
66
+ headline: AiBilingualText;
67
+ about?: AiBilingualText;
68
+ };
69
+ screens?: string[];
70
+ composed_screens?: BlueprintComposedScreen[];
71
+ nav?: BlueprintNavigationEntry[];
72
+ demo_profile?: 'none' | 'small' | 'realistic';
73
+ }
74
+ export interface BuilderIssue {
75
+ path: string;
76
+ message: AiBilingualText;
77
+ }
78
+ export interface BuilderBlueprintSummary {
79
+ id: string;
80
+ key: string;
81
+ name: AiBilingualText;
82
+ status: BuilderBlueprintStatus;
83
+ current_version: number;
84
+ published_version?: number | null;
85
+ archived_at?: string | null;
86
+ created_at?: string;
87
+ updated_at?: string;
88
+ }
89
+ export interface BuilderPublication {
90
+ id: string;
91
+ state: 'submitted' | 'approved' | 'rejected' | 'withdrawn';
92
+ version: number;
93
+ submitted_at: string | null;
94
+ decided_at: string | null;
95
+ review_notes?: string | null;
96
+ }
97
+ export interface BuilderBlueprintDetail extends BuilderBlueprintSummary {
98
+ document: BuilderBlueprintDocument;
99
+ issues: BuilderIssue[];
100
+ readiness: BuilderIssue[];
101
+ /** Bound operations that were removed or deprecated; shown beside readiness, never blocking submit. */
102
+ composition_flags?: BuilderComposition['flags'];
103
+ publication: BuilderPublication | null;
104
+ }
105
+ export interface BuilderVersion {
106
+ version: number;
107
+ created_via: BuilderVersionOrigin;
108
+ change_id: string | null;
109
+ changed_sections: string[];
110
+ created_at: string;
111
+ digest: string;
112
+ }
113
+ export interface BuilderSessionSummary {
114
+ id: string;
115
+ title: string;
116
+ state: BuilderSessionState;
117
+ level: number;
118
+ archived_at: string | null;
119
+ started_at: string;
120
+ last_active_at: string;
121
+ pending_changes: number;
122
+ /**
123
+ * The sandbox organisation composed screens run against in the preview (B-UX2); null when
124
+ * none is connected, and the preview then shows sample rows. `name` is the organisation's
125
+ * name (also after a reload, OMG-SHOPPER); null when IAM could not say.
126
+ */
127
+ sandbox?: BuilderSessionSandbox | null;
128
+ blueprint: BuilderBlueprintSummary;
129
+ }
130
+ export interface BuilderSessionSandbox {
131
+ organisation_id: string;
132
+ name?: string | null;
133
+ }
134
+ /** One item the sample shopper sees: the sandbox shop's public facts, or a marked sample. */
135
+ export interface BuilderSampleShopperItem {
136
+ id: string;
137
+ name: AiBilingualText;
138
+ description: AiBilingualText | null;
139
+ price: string | null;
140
+ currency_code: string;
141
+ image_url: string | null;
142
+ }
143
+ /**
144
+ * The sample shopper the preview acts as on person screens (OMG-SHOPPER): never the developer's
145
+ * own records. Its wallet, lists and cart are invented and live in the preview only.
146
+ */
147
+ export interface BuilderSampleShopper {
148
+ persona: {
149
+ key: 'sample_shopper';
150
+ name: AiBilingualText;
151
+ notice: AiBilingualText;
152
+ friend_name: AiBilingualText;
153
+ };
154
+ sandbox_organisation_id: string | null;
155
+ /** `sandbox`: the sandbox shop's visible items; `samples`: the marked sample catalogue. */
156
+ catalogue_source: 'sandbox' | 'samples';
157
+ currency_code: string;
158
+ wallet: {
159
+ balance: string;
160
+ entries: {
161
+ operation: string;
162
+ amount: string;
163
+ days_ago: number;
164
+ note: AiBilingualText;
165
+ }[];
166
+ };
167
+ items: BuilderSampleShopperItem[];
168
+ }
169
+ /**
170
+ * One turn of the shopping assistant block in the preview, as the sample shopper (OMG-FINISH,
171
+ * `POST …/sample-shopper/assistant`): the same answer the real assistant gives, over the sample
172
+ * shopper's catalogue only. It writes nothing and keeps nothing: `history` is the last turns
173
+ * (at most 10), and a proposal (`sample-` id) is decided by the preview on its own records.
174
+ */
175
+ export interface BuilderSampleShopperAssistantInput {
176
+ message: string;
177
+ locale?: 'en' | 'ar';
178
+ conversationId?: string | null;
179
+ history?: {
180
+ role: 'user' | 'assistant';
181
+ content: string;
182
+ }[];
183
+ }
184
+ /** A proposal as the conversation surface shows it, plus the builder's own fields. */
185
+ export interface BuilderChange extends AiProposal {
186
+ change_status: BuilderChangeStatus;
187
+ version_from: number;
188
+ version_to: number | null;
189
+ session_id: string | null;
190
+ }
191
+ export interface BuilderMessage {
192
+ id: string;
193
+ role: 'person' | 'assistant';
194
+ content: string;
195
+ change_ids: string[];
196
+ stop_reason: string | null;
197
+ created_at: string;
198
+ }
199
+ export interface BuilderAssistantAvailability {
200
+ available: boolean;
201
+ reason: 'disabled' | 'unavailable' | null;
202
+ message: string | null;
203
+ }
204
+ export interface BuilderSessionDetail extends BuilderSessionSummary {
205
+ document: BuilderBlueprintDocument;
206
+ issues: BuilderIssue[];
207
+ readiness: BuilderIssue[];
208
+ /** Bound operations that were removed or deprecated; shown beside readiness, never blocking submit. */
209
+ composition_flags?: BuilderComposition['flags'];
210
+ publication: BuilderPublication | null;
211
+ messages: BuilderMessage[];
212
+ changes: BuilderChange[];
213
+ assistant: BuilderAssistantAvailability;
214
+ spend?: BuilderSpend;
215
+ }
216
+ /** One AI budget as core reports it (`AiBudgetData::toArray`); amounts in nano units of `BuilderSpend.currency`. */
217
+ export interface BuilderBudget {
218
+ scope_type: string;
219
+ scope_id: string;
220
+ period: string;
221
+ period_key: string;
222
+ cap_nano: number | null;
223
+ mode: 'none' | 'soft_alert' | 'hard_cap';
224
+ alert_at_percent: number;
225
+ spent_nano: number;
226
+ remaining_nano: number | null;
227
+ used_percent: number | null;
228
+ }
229
+ export interface BuilderSpend {
230
+ session: BuilderBudget | null;
231
+ account: BuilderBudget | null;
232
+ currency: string;
233
+ }
234
+ export interface BuilderCatalog {
235
+ availability: 'off' | 'level_1' | 'level_2' | 'level_3';
236
+ /** A module the builder may switch on: its name, what it does, and the buildable modules it brings in. */
237
+ modules: {
238
+ key: string;
239
+ label: AiBilingualText;
240
+ description: AiBilingualText;
241
+ requires: string[];
242
+ }[];
243
+ vocabulary: {
244
+ key: string;
245
+ default: AiBilingualText;
246
+ }[];
247
+ policies: {
248
+ key: string;
249
+ label: AiBilingualText;
250
+ options: string[];
251
+ option_labels?: Record<string, AiBilingualText>;
252
+ default: string | null;
253
+ }[];
254
+ data_categories: {
255
+ key: string;
256
+ label: AiBilingualText;
257
+ sensitive: boolean;
258
+ parent: string | null;
259
+ }[];
260
+ /** A ready-made screen pack and the module it needs (null: none). */
261
+ screens: {
262
+ key: string;
263
+ label: AiBilingualText;
264
+ description: AiBilingualText;
265
+ needs_module: string | null;
266
+ }[];
267
+ }
268
+ export type BuilderCoreGapCategory = 'module' | 'field' | 'policy_option' | 'endpoint' | 'ui_block' | 'event' | 'other';
269
+ export type BuilderCoreGapWorkaround = 'adapter' | 'extension' | 'manual' | 'none';
270
+ export interface BuilderCoreGap {
271
+ id: string;
272
+ need: AiBilingualText;
273
+ why: AiBilingualText;
274
+ blueprint_id: string | null;
275
+ session_id: string | null;
276
+ category: BuilderCoreGapCategory | string;
277
+ workaround_kind: BuilderCoreGapWorkaround | string;
278
+ adapter_path: string | null;
279
+ contract_refs: string[];
280
+ /** recorded, triaged, duplicate, planned, shipped or wont_do (set by Nuwah's triage). */
281
+ status: string;
282
+ created_at: string;
283
+ }
284
+ /** The ready-made screens whose records the preview keeps (B-UX): only in the preview, never in a business. */
285
+ export type BuilderPreviewPack = 'catalog' | 'clients' | 'invoices';
286
+ export interface BuilderPreviewRecord {
287
+ id: string;
288
+ pack: BuilderPreviewPack;
289
+ fields: Record<string, string | number | null>;
290
+ /** A record "Load sample data" added; "Remove sample data" removes exactly these. */
291
+ is_sample: boolean;
292
+ created_at: string;
293
+ updated_at: string;
294
+ }
295
+ export interface BuilderSubmitInput {
296
+ /** The developer checked that the app needs each personal-data request and each reason is true. */
297
+ personal_data_reviewed?: boolean;
298
+ }
299
+ /** A gap the developer records by hand (the assistant records them through `record_core_gap`). Both languages are required. */
300
+ export interface BuilderRecordCoreGap {
301
+ need: AiBilingualText;
302
+ why: AiBilingualText;
303
+ category: BuilderCoreGapCategory;
304
+ workaround: BuilderCoreGapWorkaround;
305
+ /** Required when `workaround` is `adapter`. */
306
+ adapter_path?: string | null;
307
+ contract_refs?: string[];
308
+ session_id?: string | null;
309
+ }
310
+ export interface BuilderPage<T> {
311
+ data: T[];
312
+ next_cursor: string | null;
313
+ }
314
+ export interface BuilderStartSession {
315
+ /** A new app: its key (3-40 lower-case letters, digits or dashes) and name, in at least one language. */
316
+ key?: string;
317
+ name?: BuilderName;
318
+ /** Or another session on an app the developer already has. */
319
+ blueprint_id?: string;
320
+ title?: string;
321
+ }
322
+ export interface BuilderStreamOptions {
323
+ signal?: AbortSignal;
324
+ headers?: Record<string, string>;
325
+ }
326
+ /** One block type of the closed catalogue (level 2). */
327
+ export interface BuilderBlockTypeView {
328
+ key: BlueprintBlockType;
329
+ label: AiBilingualText;
330
+ description: AiBilingualText;
331
+ /** What it binds: `list` (a list operation), `read`, `write` or `none`. */
332
+ binding: 'list' | 'read' | 'write' | 'none';
333
+ /** Whether it may sit on a public screen. */
334
+ public: boolean;
335
+ /** The screen audiences it may sit on (`staff`, `public`, `person`); person blocks are `person` only. */
336
+ audiences?: Array<'staff' | 'public' | 'person'>;
337
+ /** Modules the blueprint must switch on for it to draw (`shop` for the cart and the catalogue). */
338
+ requires_modules?: string[];
339
+ /** The platform capability a person block wraps (`wishlists`, `stored_value`, …). */
340
+ capability?: string | null;
341
+ /** Its yes/no options: default and words. */
342
+ options?: Record<string, {
343
+ default: boolean;
344
+ en: string;
345
+ ar: string;
346
+ }>;
347
+ }
348
+ export interface BuilderCompositionCatalogue {
349
+ blocks: BuilderBlockTypeView[];
350
+ limits: {
351
+ maximum_screens: number;
352
+ maximum_blocks: number;
353
+ maximum_navigation_entries: number;
354
+ maximum_navigation_depth: number;
355
+ maximum_actions: number;
356
+ maximum_fields: number;
357
+ maximum_limit: number;
358
+ };
359
+ /** Whether composing is open to this developer (`builder.availability` level 2 or 3). */
360
+ open: boolean;
361
+ /** When the pinned OpenAPI snapshot was taken; null before the first `openapi:snapshot`. */
362
+ snapshot_at: string | null;
363
+ }
364
+ export interface BuilderComposableList {
365
+ sorts: string[];
366
+ filters: string[];
367
+ search: boolean;
368
+ maximum_limit?: number | null;
369
+ pagination?: 'cursor' | 'page';
370
+ /** The filters a viewer may set, with their words (OMG-LAST): a fixed set of values, a yes/no, or a date. */
371
+ filter_options?: {
372
+ key: string;
373
+ type: 'one_of' | 'boolean' | 'date';
374
+ label: AiBilingualText | null;
375
+ options: {
376
+ value: string;
377
+ label: AiBilingualText | null;
378
+ }[] | null;
379
+ }[];
380
+ parameters?: {
381
+ filters: Record<string, string>;
382
+ search: string | null;
383
+ sort: string | null;
384
+ direction: string | null;
385
+ limit: string;
386
+ page: string;
387
+ } | null;
388
+ }
389
+ /** An operation a block may bind: marked `x-nuwah-compose` in the pinned snapshot. */
390
+ export interface BuilderComposableOperation {
391
+ id: string;
392
+ method: string;
393
+ path: string;
394
+ summary: string | null;
395
+ tags: string[];
396
+ deprecated: boolean;
397
+ permission: string | null;
398
+ public: boolean;
399
+ person_data_gate: boolean;
400
+ /** A person-plane operation (`/api/person/…`): the signed-in person's own records, the only kind a person screen binds besides public ones. */
401
+ person_plane?: boolean;
402
+ list: BuilderComposableList | null;
403
+ /** The module that owns it; a blueprint binds it only when its `modules` switch that module on (gaps 4 and 5). */
404
+ module?: string;
405
+ /** What it does on a screen: `create` is an Add button and a form, `update` a row's Edit, `delete`/`action` row-menu entries. */
406
+ kind?: 'list' | 'read' | 'create' | 'update' | 'delete' | 'action';
407
+ /** The words of its button or menu entry. */
408
+ label?: AiBilingualText | null;
409
+ /** The screen asks before sending (every delete does). */
410
+ confirm?: boolean;
411
+ /** The operation id that reverses it, offered as Undo. */
412
+ undo?: string | null;
413
+ /** Honours `Idempotency-Key`. */
414
+ idempotent?: boolean;
415
+ /** Rows one use may carry (at most 200). */
416
+ batch_limit?: number;
417
+ /** The row states it applies in (`{status: ['new']}`); null when it applies to any row. */
418
+ available_when?: Record<string, string[]> | null;
419
+ /** It may be applied to several selected rows at once (a block opts in per action with `bulk: true`). */
420
+ bulk?: boolean;
421
+ /** Path parameter → the row field that fills it. */
422
+ row_parameters?: Record<string, string> | null;
423
+ /** `label`: the field's words (declared on its Resource, else the platform's translation); `system`: tenant key, identifier or row timestamp; `enum`: its choices; `format`: e.g. `date`. A `bilingual` type is a name in English and Arabic. */
424
+ request_fields: {
425
+ name: string;
426
+ type: string;
427
+ required: boolean;
428
+ person: boolean;
429
+ label?: AiBilingualText;
430
+ system?: boolean;
431
+ enum?: (string | number)[];
432
+ format?: string;
433
+ }[];
434
+ response_fields: {
435
+ name: string;
436
+ type: string;
437
+ person: boolean;
438
+ label?: AiBilingualText;
439
+ system?: boolean;
440
+ }[];
441
+ }
442
+ /**
443
+ * A blueprint's composed screens as one role sees them: each block `ready`, `unavailable` (its
444
+ * operation was removed or deprecated) or `hidden` (the role lacks the permission). The shape
445
+ * `@nuwah/ui/solid/composer` draws (`ComposedResolutionView`), plus core's issues.
446
+ */
447
+ export interface BuilderComposition {
448
+ screens: {
449
+ key: string;
450
+ title: BuilderName;
451
+ audience: 'staff' | 'public' | 'person';
452
+ roles: string[];
453
+ visible: boolean;
454
+ blocks: {
455
+ key: string;
456
+ type: BlueprintBlockType;
457
+ type_label?: AiBilingualText;
458
+ title: BuilderName | null;
459
+ text: AiBilingualText | null;
460
+ state: 'ready' | 'unavailable' | 'hidden';
461
+ reason: AiBilingualText | null;
462
+ operation: Record<string, unknown> & {
463
+ id: string;
464
+ } | null;
465
+ binding: {
466
+ sort: string | null;
467
+ filters: Record<string, string | number | boolean>;
468
+ limit: number | null;
469
+ fields: string[];
470
+ measure: string | null;
471
+ categories: string[];
472
+ } | null;
473
+ actions: {
474
+ key: string;
475
+ label: BuilderName | null;
476
+ state: 'ready' | 'unavailable' | 'hidden';
477
+ reason: AiBilingualText | null;
478
+ operation: Record<string, unknown> & {
479
+ id: string;
480
+ };
481
+ }[];
482
+ open_screen: string | null;
483
+ /** Person blocks: their yes/no choices with the defaults filled in. */
484
+ options?: Record<string, boolean>;
485
+ /** The platform capability a person block wraps (`wishlists`, `stored_value`, …). */
486
+ capability?: string | null;
487
+ }[];
488
+ }[];
489
+ navigation: {
490
+ key: string;
491
+ label: BuilderName;
492
+ screen: string | null;
493
+ pack: string | null;
494
+ parent: string | null;
495
+ depth: number;
496
+ visible: boolean;
497
+ }[];
498
+ flags: {
499
+ path: string;
500
+ operation: string;
501
+ reason: string;
502
+ message: AiBilingualText;
503
+ }[];
504
+ roles: {
505
+ key: string;
506
+ label: BuilderName;
507
+ }[];
508
+ role: string | null;
509
+ /** How the app writes things (OMG-LAST): its digits, from the `presentation.numeral_system` policy (Latin by default). */
510
+ presentation?: {
511
+ numeral_system: 'latin' | 'arabic_indic';
512
+ };
513
+ snapshot_at: string | null;
514
+ issues: BuilderIssue[];
515
+ }
516
+ export interface BuilderNamespace {
517
+ catalog(query?: {
518
+ vocabulary_search?: string;
519
+ vocabulary_prefix?: string;
520
+ policy_search?: string;
521
+ }, options?: RequestOptions): Promise<{
522
+ data: BuilderCatalog;
523
+ }>;
524
+ keyCheck(key: string, blueprintId?: string, options?: RequestOptions): Promise<{
525
+ data: {
526
+ key: string;
527
+ well_formed: boolean;
528
+ available: boolean;
529
+ };
530
+ }>;
531
+ sessions: {
532
+ list(query?: {
533
+ filter?: BuilderSessionFilter;
534
+ search?: string;
535
+ cursor?: string | null;
536
+ limit?: number;
537
+ }, options?: RequestOptions): Promise<BuilderPage<BuilderSessionSummary>>;
538
+ start(input: BuilderStartSession, options?: RequestOptions): Promise<{
539
+ data: BuilderSessionDetail;
540
+ }>;
541
+ get(id: string, options?: RequestOptions): Promise<{
542
+ data: BuilderSessionDetail;
543
+ }>;
544
+ update(id: string, input: {
545
+ title?: string;
546
+ archived?: boolean;
547
+ }, options?: RequestOptions): Promise<{
548
+ data: BuilderSessionSummary;
549
+ }>;
550
+ remove(id: string, discardDraft?: boolean, options?: RequestOptions): Promise<{
551
+ data: {
552
+ deleted: boolean;
553
+ draft_discarded: boolean;
554
+ };
555
+ }>;
556
+ close(id: string, options?: RequestOptions): Promise<{
557
+ data: BuilderSessionSummary;
558
+ }>;
559
+ /**
560
+ * Connects the session's preview to one of the developer's sandbox organisations (IAM
561
+ * `is_sandbox`, the developer its owner or a member), or disconnects it with null.
562
+ * Refused 422 `not_your_sandbox`. New sessions start on the sandbox connected last.
563
+ */
564
+ connectSandbox(id: string, organisationId: string | null, options?: RequestOptions): Promise<{
565
+ data: BuilderSessionSummary;
566
+ }>;
567
+ /** The sample shopper the preview acts as on person screens (`GET …/sample-shopper`). */
568
+ sampleShopper(id: string, options?: RequestOptions): Promise<{
569
+ data: BuilderSampleShopper;
570
+ }>;
571
+ /** The shopping assistant block answering in the preview as the sample shopper (writes nothing). */
572
+ sampleShopperAssistant(id: string, input: BuilderSampleShopperAssistantInput, options?: RequestOptions): Promise<ShoppingAssistantAnswer>;
573
+ /** The developer's own edit; 409 `version_conflict` when the draft moved since `expectedVersion`. */
574
+ editBlueprint(id: string, sections: Partial<BuilderBlueprintDocument>, expectedVersion: number, options?: RequestOptions): Promise<{
575
+ data: BuilderSessionDetail;
576
+ }>;
577
+ /** One assistant turn as run events. Never throws: a refusal or failure is an `error` event. */
578
+ askAsEvents(id: string, message: string, locale?: 'en' | 'ar', options?: BuilderStreamOptions): AsyncGenerator<AiRunEvent>;
579
+ };
580
+ changes: {
581
+ /** Refused with 409 `depends_on_waiting_changes` (details `waiting_change_ids`) when it was prepared on top of changes still waiting. */
582
+ confirm(id: string, options?: RequestOptions): Promise<{
583
+ data: BuilderChange;
584
+ }>;
585
+ reject(id: string, options?: RequestOptions): Promise<{
586
+ data: BuilderChange;
587
+ }>;
588
+ undo(id: string, options?: RequestOptions): Promise<{
589
+ data: BuilderChange;
590
+ }>;
591
+ /** Every waiting change of the session (or `ids` of them), in the order prepared, in one transaction: all apply or none. */
592
+ confirmAll(sessionId: string, ids?: string[], options?: RequestOptions): Promise<{
593
+ data: BuilderChange[];
594
+ }>;
595
+ /** Undo several applied changes together, back to before the first; 409 when the draft moved since the last. */
596
+ undoAll(sessionId: string, ids: string[], options?: RequestOptions): Promise<{
597
+ data: BuilderChange[];
598
+ }>;
599
+ };
600
+ /** The blueprint's preview store (B-UX): records the ready-made screens show in the preview, and marked sample data. */
601
+ preview: {
602
+ list(blueprintId: string, pack: BuilderPreviewPack, options?: RequestOptions): Promise<{
603
+ data: BuilderPreviewRecord[];
604
+ }>;
605
+ create(blueprintId: string, pack: BuilderPreviewPack, fields: BuilderPreviewRecord['fields'], options?: RequestOptions): Promise<{
606
+ data: BuilderPreviewRecord;
607
+ }>;
608
+ update(blueprintId: string, pack: BuilderPreviewPack, recordId: string, fields: BuilderPreviewRecord['fields'], options?: RequestOptions): Promise<{
609
+ data: BuilderPreviewRecord;
610
+ }>;
611
+ remove(blueprintId: string, pack: BuilderPreviewPack, recordId: string, options?: RequestOptions): Promise<void>;
612
+ loadSamples(blueprintId: string, options?: RequestOptions): Promise<{
613
+ data: {
614
+ counts: Partial<Record<BuilderPreviewPack, number>>;
615
+ };
616
+ }>;
617
+ removeSamples(blueprintId: string, options?: RequestOptions): Promise<{
618
+ data: {
619
+ removed: number;
620
+ };
621
+ }>;
622
+ };
623
+ blueprints: {
624
+ /** Unarchived by default; `archived`, `all` or one status. */
625
+ list(status?: BuilderBlueprintStatus | 'archived' | 'all', options?: RequestOptions): Promise<{
626
+ data: BuilderBlueprintSummary[];
627
+ }>;
628
+ /** A new draft from the current document under a new key. */
629
+ duplicate(id: string, input: {
630
+ key: string;
631
+ name?: BuilderName;
632
+ }, options?: RequestOptions): Promise<{
633
+ data: BuilderBlueprintDetail;
634
+ }>;
635
+ /** Hide and freeze edits (refused while in review); `restore` undoes it. */
636
+ archive(id: string, options?: RequestOptions): Promise<{
637
+ data: BuilderBlueprintDetail;
638
+ }>;
639
+ restore(id: string, options?: RequestOptions): Promise<{
640
+ data: BuilderBlueprintDetail;
641
+ }>;
642
+ get(id: string, options?: RequestOptions): Promise<{
643
+ data: BuilderBlueprintDetail;
644
+ }>;
645
+ versions(id: string, options?: RequestOptions): Promise<{
646
+ data: BuilderVersion[];
647
+ }>;
648
+ version(id: string, version: number, options?: RequestOptions): Promise<{
649
+ data: {
650
+ version: number;
651
+ document: BuilderBlueprintDocument;
652
+ };
653
+ }>;
654
+ /** A NEW version equal to `version`; history is never rewritten. */
655
+ revert(id: string, version: number, options?: RequestOptions): Promise<{
656
+ data: BuilderBlueprintDetail;
657
+ }>;
658
+ /** Refused with `standards_not_accepted`, `standards_organisation_required` or `personal_data_review_required` (details carry a `link` key). */
659
+ submit(id: string, input?: BuilderSubmitInput, options?: RequestOptions): Promise<{
660
+ data: BuilderBlueprintDetail;
661
+ }>;
662
+ withdraw(id: string, options?: RequestOptions): Promise<{
663
+ data: BuilderBlueprintDetail;
664
+ }>;
665
+ };
666
+ coreGaps: {
667
+ list(blueprintId?: string, options?: RequestOptions): Promise<{
668
+ data: BuilderCoreGap[];
669
+ }>;
670
+ record(input: BuilderRecordCoreGap, options?: RequestOptions): Promise<{
671
+ data: {
672
+ id: string;
673
+ };
674
+ }>;
675
+ };
676
+ compose: {
677
+ catalogue(options?: RequestOptions): Promise<{
678
+ data: BuilderCompositionCatalogue;
679
+ }>;
680
+ operations(query?: {
681
+ search?: string;
682
+ kind?: 'list' | 'read' | 'write';
683
+ public_only?: boolean;
684
+ }, options?: RequestOptions): Promise<{
685
+ data: BuilderComposableOperation[];
686
+ meta: {
687
+ snapshot_at: string | null;
688
+ };
689
+ }>;
690
+ /** A session's draft (`{ session }`) or any document (`{ document }`), as `role` sees it; no role: every block as the owner would. */
691
+ resolve(input: {
692
+ session: string;
693
+ role?: string | null;
694
+ } | {
695
+ document: BuilderBlueprintDocument;
696
+ role?: string | null;
697
+ }, options?: RequestOptions): Promise<{
698
+ data: BuilderComposition;
699
+ }>;
700
+ /**
701
+ * Runs one block of the session's draft in the preview (gaps 4 and 5): its list, or the
702
+ * write its form, its "Add" button or a row action (`action`) sends. Only in the session's
703
+ * SANDBOX organisation (refused `no_sandbox_tenant` without one), through the operation's
704
+ * own route; the answer is that route's answer. Pass `idempotencyKey` on writes.
705
+ */
706
+ run<T = unknown>(input: BuilderComposeRunInput, options?: RequestOptions & {
707
+ idempotencyKey?: string;
708
+ }): Promise<T>;
709
+ };
710
+ }
711
+ /** One run of a composed block (`client.builder.compose.run`). */
712
+ export interface BuilderComposeRunInput {
713
+ session: string;
714
+ screen: string;
715
+ block: string;
716
+ /** The block's action key; omitted for the block's own binding (its list, or its form). */
717
+ action?: string | null;
718
+ /** The row a row action applies to: fills the operation's path (`{id}`). */
719
+ row?: Record<string, unknown>;
720
+ /** The form's values; only the fields the operation declares are sent on. */
721
+ values?: Record<string, unknown>;
722
+ cursor?: string | null;
723
+ page?: number | null;
724
+ search?: string | null;
725
+ /** The viewer's order on a list: one of the operation's declared sorts (`-placed_at`). */
726
+ sort?: string | null;
727
+ /** The viewer's filters on a list: declared keys only; a filter the block's binding fixes stays fixed. */
728
+ filters?: Record<string, string | boolean | null> | null;
729
+ }
730
+ export declare function createBuilderNamespace(http: Http, config: NuwahClientConfig): BuilderNamespace;