@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,291 @@
1
+ import type { Http } from './http.js';
2
+ import type { Paginated } from './types.js';
3
+ export type DesignStage = 'current' | 'proposed' | 'future' | 'custom';
4
+ export type BlockKind = 'module' | 'service' | 'screen' | 'group' | 'note' | 'decision';
5
+ export type BlockStatus = 'draft' | 'in_review' | 'approved' | 'deprecated';
6
+ export type EdgeKind = 'depends' | 'calls' | 'emits';
7
+ export type EdgeMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
8
+ export type VersionChangeType = 'fix' | 'feature' | 'epic';
9
+ export interface AtlasDesign {
10
+ id: string;
11
+ name: string;
12
+ description: string | null;
13
+ stage: DesignStage;
14
+ parentDesignId: string | null;
15
+ settings: Record<string, unknown>;
16
+ createdAt: string | null;
17
+ updatedAt: string | null;
18
+ }
19
+ export interface CreateDesignInput {
20
+ name: string;
21
+ description?: string | null;
22
+ stage: DesignStage;
23
+ parentDesignId?: string | null;
24
+ settings?: Record<string, unknown> | null;
25
+ }
26
+ export type UpdateDesignInput = Partial<CreateDesignInput>;
27
+ export interface ForkDesignInput {
28
+ stage?: DesignStage;
29
+ }
30
+ export interface BlockPosition {
31
+ x?: number;
32
+ y?: number;
33
+ width?: number;
34
+ height?: number;
35
+ }
36
+ export interface BlockSection {
37
+ id?: string;
38
+ title: string;
39
+ body: string;
40
+ }
41
+ export interface AtlasBlock {
42
+ id: string;
43
+ designId: string;
44
+ parentBlockId: string | null;
45
+ kind: BlockKind;
46
+ title: string;
47
+ icon: string | null;
48
+ sections: BlockSection[];
49
+ position: BlockPosition;
50
+ status: BlockStatus;
51
+ coverImage: string | null;
52
+ codeReference: string | null;
53
+ customFields: Record<string, unknown>;
54
+ createdAt: string | null;
55
+ updatedAt: string | null;
56
+ }
57
+ export interface CreateBlockInput {
58
+ title: string;
59
+ kind: BlockKind;
60
+ parentBlockId?: string | null;
61
+ icon?: string | null;
62
+ sections?: BlockSection[] | null;
63
+ position?: BlockPosition | null;
64
+ coverImage?: string | null;
65
+ codeReference?: string | null;
66
+ customFields?: Record<string, unknown> | null;
67
+ }
68
+ /** PATCH block — the backend accepts snake_case keys on update. */
69
+ export interface UpdateBlockInput {
70
+ title?: string;
71
+ kind?: BlockKind;
72
+ parent_block_id?: string | null;
73
+ icon?: string | null;
74
+ sections?: BlockSection[] | null;
75
+ position?: BlockPosition | null;
76
+ cover_image?: string | null;
77
+ code_reference?: string | null;
78
+ custom_fields?: Record<string, unknown> | null;
79
+ }
80
+ export interface EdgeApiMetadata {
81
+ method?: EdgeMethod;
82
+ path?: string;
83
+ payload?: string;
84
+ response?: string;
85
+ responseStatus?: number;
86
+ apiVersion?: string;
87
+ onFailure?: string;
88
+ idempotency?: boolean;
89
+ [key: string]: unknown;
90
+ }
91
+ export interface AtlasEdge {
92
+ id: string;
93
+ designId: string;
94
+ sourceBlockId: string;
95
+ targetBlockId: string;
96
+ sourceHandle: string | null;
97
+ targetHandle: string | null;
98
+ kind: EdgeKind;
99
+ label: string | null;
100
+ /** The `edges.data` jsonb column, exposed under `apiMetadata` (NOT `data`). */
101
+ apiMetadata: EdgeApiMetadata;
102
+ createdAt: string | null;
103
+ updatedAt: string | null;
104
+ }
105
+ export interface CreateEdgeInput {
106
+ sourceBlockId: string;
107
+ targetBlockId: string;
108
+ kind: EdgeKind;
109
+ sourceHandle?: string | null;
110
+ targetHandle?: string | null;
111
+ label?: string | null;
112
+ data?: EdgeApiMetadata | null;
113
+ }
114
+ export type UpdateEdgeInput = Partial<Omit<CreateEdgeInput, 'sourceBlockId' | 'targetBlockId'>>;
115
+ /** The statuses the `/transition` endpoint accepts — `approved` goes through `/approve` instead. */
116
+ export type TransitionableBlockStatus = Exclude<BlockStatus, 'approved'>;
117
+ export interface AtlasVersion {
118
+ id: string;
119
+ designId: string;
120
+ epic: number;
121
+ feature: number;
122
+ fix: number;
123
+ semver: string;
124
+ changeType: VersionChangeType;
125
+ reason: string;
126
+ isBlessed: boolean;
127
+ blessedName: string | null;
128
+ snapshot: Record<string, unknown> | null;
129
+ createdAt: string | null;
130
+ }
131
+ export interface SaveVersionInput {
132
+ changeType: VersionChangeType;
133
+ reason: string;
134
+ }
135
+ export interface BlessVersionInput {
136
+ blessedName: string;
137
+ }
138
+ export interface AtlasGoal {
139
+ id: string;
140
+ designId: string;
141
+ blockId: string | null;
142
+ title: string;
143
+ description: string | null;
144
+ blockIds: string[];
145
+ coverage: number;
146
+ createdAt: string | null;
147
+ updatedAt: string | null;
148
+ }
149
+ export interface CreateGoalInput {
150
+ title: string;
151
+ description?: string | null;
152
+ blockId?: string | null;
153
+ }
154
+ export type DiscussionChannel = 'dev' | 'business' | 'general';
155
+ export interface Discussion {
156
+ id: string;
157
+ discussableType: string;
158
+ discussableId: string;
159
+ channel: DiscussionChannel;
160
+ conversationId: string;
161
+ resolvedAt: string | null;
162
+ createdAt: string | null;
163
+ updatedAt: string | null;
164
+ }
165
+ export interface StartDiscussionInput {
166
+ discussableType: string;
167
+ discussableId: string;
168
+ channel: DiscussionChannel;
169
+ participantPersonIds?: string[];
170
+ }
171
+ export declare function createAtlasNamespace(http: Http): {
172
+ designs: {
173
+ /** GET /api/v1/atlas/designs — `{ data, meta }` paginator. */
174
+ list: (query?: {
175
+ page?: number;
176
+ per_page?: number;
177
+ }) => Promise<Paginated<AtlasDesign>>;
178
+ /** GET /api/v1/atlas/designs/{design} — `{ data }`. */
179
+ get: (designId: string) => Promise<{
180
+ data: AtlasDesign;
181
+ }>;
182
+ /** POST /api/v1/atlas/designs — 201 `{ data }`. */
183
+ create: (input: CreateDesignInput) => Promise<{
184
+ data: AtlasDesign;
185
+ }>;
186
+ /** PATCH /api/v1/atlas/designs/{design} — `{ data }`. */
187
+ update: (designId: string, input: UpdateDesignInput) => Promise<{
188
+ data: AtlasDesign;
189
+ }>;
190
+ /** POST /api/v1/atlas/designs/{design}/fork — 201 `{ data }` child with parentDesignId. */
191
+ fork: (designId: string, input?: ForkDesignInput) => Promise<{
192
+ data: AtlasDesign;
193
+ }>;
194
+ };
195
+ blocks: {
196
+ /** GET /api/v1/atlas/designs/{design}/blocks — `{ data }`. */
197
+ list: (designId: string) => Promise<{
198
+ data: AtlasBlock[];
199
+ }>;
200
+ /** GET /api/v1/atlas/designs/{design}/blocks/{block} — `{ data }`. */
201
+ get: (designId: string, blockId: string) => Promise<{
202
+ data: AtlasBlock;
203
+ }>;
204
+ /** POST /api/v1/atlas/designs/{design}/blocks — 201 `{ data }`. */
205
+ create: (designId: string, input: CreateBlockInput) => Promise<{
206
+ data: AtlasBlock;
207
+ }>;
208
+ /** PATCH /api/v1/atlas/designs/{design}/blocks/{block} — `{ data }`. */
209
+ update: (designId: string, blockId: string, input: UpdateBlockInput) => Promise<{
210
+ data: AtlasBlock;
211
+ }>;
212
+ /**
213
+ * POST /api/v1/atlas/designs/{design}/blocks/{block}/transition — `{ data }`.
214
+ * Core refuses `approved` here (422, TransitionBlockRequest); use {@link approve}.
215
+ */
216
+ transition: (designId: string, blockId: string, status: TransitionableBlockStatus) => Promise<{
217
+ data: AtlasBlock;
218
+ }>;
219
+ /** POST /api/v1/atlas/designs/{design}/blocks/{block}/approve — `{ data }` (perm `.approve`). */
220
+ approve: (designId: string, blockId: string) => Promise<{
221
+ data: AtlasBlock;
222
+ }>;
223
+ };
224
+ edges: {
225
+ /** GET /api/v1/atlas/designs/{design}/edges — `{ data }`. */
226
+ list: (designId: string) => Promise<{
227
+ data: AtlasEdge[];
228
+ }>;
229
+ /** POST /api/v1/atlas/designs/{design}/edges — 201 `{ data }`. */
230
+ create: (designId: string, input: CreateEdgeInput) => Promise<{
231
+ data: AtlasEdge;
232
+ }>;
233
+ /** PATCH /api/v1/atlas/designs/{design}/edges/{edge} — `{ data }`. */
234
+ update: (designId: string, edgeId: string, input: UpdateEdgeInput) => Promise<{
235
+ data: AtlasEdge;
236
+ }>;
237
+ /** DELETE /api/v1/atlas/designs/{design}/edges/{edge} — 204. */
238
+ remove: (designId: string, edgeId: string) => Promise<void>;
239
+ };
240
+ versions: {
241
+ /** GET /api/v1/atlas/designs/{design}/versions — `{ data }`. */
242
+ list: (designId: string) => Promise<{
243
+ data: AtlasVersion[];
244
+ }>;
245
+ /** GET /api/v1/atlas/designs/{design}/versions/{version} — `{ data }` (frozen snapshot). */
246
+ get: (designId: string, versionId: string) => Promise<{
247
+ data: AtlasVersion;
248
+ }>;
249
+ /** POST /api/v1/atlas/designs/{design}/versions — save an immutable version (perm .manage). */
250
+ save: (designId: string, input: SaveVersionInput) => Promise<{
251
+ data: AtlasVersion;
252
+ }>;
253
+ /** POST /api/v1/atlas/designs/{design}/versions/{version}/bless — name a milestone (perm .approve). */
254
+ bless: (designId: string, versionId: string, input: BlessVersionInput) => Promise<{
255
+ data: AtlasVersion;
256
+ }>;
257
+ };
258
+ goals: {
259
+ /** GET /api/v1/atlas/designs/{design}/goals — `{ data }`. */
260
+ list: (designId: string) => Promise<{
261
+ data: AtlasGoal[];
262
+ }>;
263
+ /** POST /api/v1/atlas/designs/{design}/goals — 201 `{ data }`. */
264
+ create: (designId: string, input: CreateGoalInput) => Promise<{
265
+ data: AtlasGoal;
266
+ }>;
267
+ /** POST /api/v1/atlas/designs/{design}/goals/{goal}/blocks — attach a block, `{ data }`. */
268
+ attachBlock: (designId: string, goalId: string, blockId: string) => Promise<{
269
+ data: AtlasGoal;
270
+ }>;
271
+ };
272
+ discussions: {
273
+ /** GET /api/v1/discussions?discussableType&discussableId — `{ data }`. */
274
+ list: (discussableType: string, discussableId: string) => Promise<{
275
+ data: Discussion[];
276
+ }>;
277
+ /** POST /api/v1/discussions — open (or reuse) a channel, 201 `{ data }`. */
278
+ start: (input: StartDiscussionInput) => Promise<{
279
+ data: Discussion;
280
+ }>;
281
+ /** POST /api/v1/discussions/{link}/resolve — `{ data }`. */
282
+ resolve: (linkId: string) => Promise<{
283
+ data: Discussion;
284
+ }>;
285
+ /** POST /api/v1/discussions/{link}/unresolve — `{ data }`. */
286
+ unresolve: (linkId: string) => Promise<{
287
+ data: Discussion;
288
+ }>;
289
+ };
290
+ };
291
+ export type AtlasNamespace = ReturnType<typeof createAtlasNamespace>;
package/dist/atlas.js ADDED
@@ -0,0 +1,78 @@
1
+ export function createAtlasNamespace(http) {
2
+ return {
3
+ designs: {
4
+
5
+ list: (query) => http.get('/api/v1/atlas/designs', { params: query }),
6
+
7
+ get: (designId) => http.get(`/api/v1/atlas/designs/${designId}`),
8
+
9
+ create: (input) => http.post('/api/v1/atlas/designs', input),
10
+
11
+ update: (designId, input) => http.patch(`/api/v1/atlas/designs/${designId}`, input),
12
+
13
+ fork: (designId, input) => http.post(`/api/v1/atlas/designs/${designId}/fork`, input ?? {}),
14
+ },
15
+ blocks: {
16
+
17
+ list: (designId) => http.get(`/api/v1/atlas/designs/${designId}/blocks`),
18
+
19
+ get: (designId, blockId) => http.get(`/api/v1/atlas/designs/${designId}/blocks/${blockId}`),
20
+
21
+ create: (designId, input) => http.post(`/api/v1/atlas/designs/${designId}/blocks`, input),
22
+
23
+ update: (designId, blockId, input) => http.patch(`/api/v1/atlas/designs/${designId}/blocks/${blockId}`, input),
24
+
25
+ transition: (designId, blockId, status) => http.post(`/api/v1/atlas/designs/${designId}/blocks/${blockId}/transition`, { status }),
26
+
27
+ approve: (designId, blockId) => http.post(`/api/v1/atlas/designs/${designId}/blocks/${blockId}/approve`),
28
+ },
29
+ edges: {
30
+
31
+ list: (designId) => http.get(`/api/v1/atlas/designs/${designId}/edges`),
32
+
33
+ create: (designId, input) => http.post(`/api/v1/atlas/designs/${designId}/edges`, input),
34
+
35
+ update: (designId, edgeId, input) => {
36
+
37
+ const { sourceHandle, targetHandle, ...rest } = input;
38
+ return http.patch(`/api/v1/atlas/designs/${designId}/edges/${edgeId}`, {
39
+ ...rest,
40
+ ...(sourceHandle !== undefined ? { sourceHandle, source_handle: sourceHandle } : {}),
41
+ ...(targetHandle !== undefined ? { targetHandle, target_handle: targetHandle } : {}),
42
+ });
43
+ },
44
+
45
+ remove: (designId, edgeId) => http.delete(`/api/v1/atlas/designs/${designId}/edges/${edgeId}`),
46
+ },
47
+ versions: {
48
+
49
+ list: (designId) => http.get(`/api/v1/atlas/designs/${designId}/versions`),
50
+
51
+ get: (designId, versionId) => http.get(`/api/v1/atlas/designs/${designId}/versions/${versionId}`),
52
+
53
+ save: (designId, input) => http.post(`/api/v1/atlas/designs/${designId}/versions`, input),
54
+
55
+ bless: (designId, versionId, input) => http.post(`/api/v1/atlas/designs/${designId}/versions/${versionId}/bless`, input),
56
+ },
57
+ goals: {
58
+
59
+ list: (designId) => http.get(`/api/v1/atlas/designs/${designId}/goals`),
60
+
61
+ create: (designId, input) => http.post(`/api/v1/atlas/designs/${designId}/goals`, input),
62
+
63
+ attachBlock: (designId, goalId, blockId) => http.post(`/api/v1/atlas/designs/${designId}/goals/${goalId}/blocks`, { blockId }),
64
+ },
65
+ discussions: {
66
+
67
+ list: (discussableType, discussableId) => http.get('/api/v1/discussions', {
68
+ params: { discussableType, discussableId },
69
+ }),
70
+
71
+ start: (input) => http.post('/api/v1/discussions', input),
72
+
73
+ resolve: (linkId) => http.post(`/api/v1/discussions/${linkId}/resolve`),
74
+
75
+ unresolve: (linkId) => http.post(`/api/v1/discussions/${linkId}/unresolve`),
76
+ },
77
+ };
78
+ }
@@ -0,0 +1,193 @@
1
+ import type { QueryValue } from './http.js';
2
+ import type { Http } from './http.js';
3
+ import type { Paginated } from './types.js';
4
+ /** Actor / subject reference — a polymorphic {type, id} pair (either may be null). */
5
+ export interface AuditActorRef {
6
+ type: string | null;
7
+ id: string | number | null;
8
+ /** Resolved display name (from the central users store); null → FE falls back to "User #id". */
9
+ name?: string | null;
10
+ }
11
+ export interface AuditSubjectRef {
12
+ type: string | null;
13
+ id: string | number | null;
14
+ }
15
+ /** One Spatie activity_log row, reshaped for the auditor surface. */
16
+ export interface AuditLogEntry {
17
+ id: number;
18
+ log_name: string | null;
19
+ event: string | null;
20
+ description: string | null;
21
+ actor: AuditActorRef;
22
+ subject: AuditSubjectRef;
23
+ /** Model-tracked before/after diffs (Spatie `properties.old` / `.attributes`). */
24
+ changes: {
25
+ old: Record<string, unknown> | null;
26
+ attributes: Record<string, unknown> | null;
27
+ };
28
+ /** The full raw properties bag (includes explicit `withProperties()` payloads). */
29
+ properties: Record<string, unknown>;
30
+ batch_uuid: string | null;
31
+ when: string | null;
32
+ }
33
+ /**
34
+ * `GET /api/audit/changes` — the granular tier's filters, as `AuditEventsController::changes`
35
+ * reads them. It filters the activity's event by `action` (not `event`, which is the
36
+ * `/log` spelling) and the actor by `actor_id` or `causer`. Sharing `AuditLogQuery` with
37
+ * `/log` is how all three verticals came to send `event` here, which the endpoint
38
+ * ignored, so the "show all changes" action filter never filtered anything.
39
+ */
40
+ export interface AuditChangesQuery {
41
+ subject_type?: string;
42
+ subject_id?: string | number;
43
+ /** Actor filter — `actor_id`, or `causer` when `actor_id` is absent. */
44
+ actor_id?: string | number;
45
+ causer?: string | number;
46
+ /** The activity's event (created / updated / deleted …). */
47
+ action?: string;
48
+ log_name?: string;
49
+ date_from?: string;
50
+ date_to?: string;
51
+ page?: number;
52
+ per_page?: number;
53
+ [key: string]: QueryValue;
54
+ }
55
+ export interface AuditLogQuery {
56
+ subject_type?: string;
57
+ subject_id?: string | number;
58
+ /** Actor filter — accepts `causer` or the explicit `causer_id`. */
59
+ causer?: string | number;
60
+ causer_id?: string | number;
61
+ event?: string;
62
+ log_name?: string;
63
+ date_from?: string;
64
+ date_to?: string;
65
+ page?: number;
66
+ per_page?: number;
67
+ [key: string]: QueryValue;
68
+ }
69
+ /** One immutable, hash-chained financial audit entry. */
70
+ export interface AuditLogEntity {
71
+ type: string | null;
72
+ id: string | number | null;
73
+ uuid: string | null;
74
+ }
75
+ export interface FinancialAuditEntry {
76
+ uuid: string;
77
+ /** Monotonic per-tenant chain position. */
78
+ sequence: number;
79
+ event: string;
80
+ entity: AuditLogEntity;
81
+ /** Actor snapshot bag (person_id / user_id / label …), captured at write time. */
82
+ actor: Record<string, unknown> | null;
83
+ before: Record<string, unknown> | null;
84
+ after: Record<string, unknown> | null;
85
+ /** Monetary anchor (bcmath string), when the event carries one. */
86
+ amount: string | null;
87
+ currency: string | null;
88
+ context: Record<string, unknown> | null;
89
+ request_context: Record<string, unknown> | null;
90
+ /** The tamper-evidence chain fields. */
91
+ chain: {
92
+ prev_hash: string | null;
93
+ hash: string;
94
+ };
95
+ occurred_at: string | null;
96
+ }
97
+ export interface FinancialAuditQuery {
98
+ entity_type?: string;
99
+ entity_id?: string | number;
100
+ event?: string;
101
+ /** Matches `actor_snapshot->>'person_id'` OR `->>'user_id'`. */
102
+ actor_id?: string | number;
103
+ date_from?: string;
104
+ date_to?: string;
105
+ per_page?: number;
106
+ [key: string]: QueryValue;
107
+ }
108
+ /** `GET /financial/verify` — the chain-integrity report. */
109
+ export interface FinancialAuditVerification {
110
+ intact: boolean;
111
+ verified_count: number;
112
+ total_count: number;
113
+ /** The first offending sequence when broken; null when intact. */
114
+ broken_at: number | null;
115
+ /** 'sequence_gap' | 'prev_hash_mismatch' | 'hash_mismatch' | null. */
116
+ reason: string | null;
117
+ }
118
+ /** Actor triple on a material audit event. */
119
+ export interface AuditEventActor {
120
+ type: string;
121
+ id: string;
122
+ snapshot: {
123
+ name?: string;
124
+ roles?: string[];
125
+ } & Record<string, unknown>;
126
+ }
127
+ /** Subject reference on a material audit event. */
128
+ export interface AuditEventSubject {
129
+ type: string;
130
+ id: string | number | null;
131
+ uuid: string | null;
132
+ }
133
+ /** One material `audit_events` row (envelope-shaped + chain fields). */
134
+ export interface AuditEventEntry {
135
+ uuid: string;
136
+ event_id: string;
137
+ event_name: string;
138
+ action: string;
139
+ materiality: 'material' | 'change';
140
+ /** Monotonic per-tenant chain position. */
141
+ sequence: number;
142
+ actor: AuditEventActor;
143
+ subject: AuditEventSubject;
144
+ before: Record<string, unknown> | null;
145
+ after: Record<string, unknown> | null;
146
+ amount: string | null;
147
+ currency: string | null;
148
+ context: Record<string, unknown> | null;
149
+ consent_scope: string[] | null;
150
+ /** Tamper-evidence chain. */
151
+ chain: {
152
+ prev_hash: string | null;
153
+ hash: string;
154
+ };
155
+ occurred_at: string | null;
156
+ }
157
+ export interface AuditEventsQuery {
158
+ action?: string;
159
+ actor_id?: string | number;
160
+ subject_type?: string;
161
+ subject_id?: string | number;
162
+ event_name?: string;
163
+ date_from?: string;
164
+ date_to?: string;
165
+ page?: number;
166
+ per_page?: number;
167
+ [key: string]: QueryValue;
168
+ }
169
+ export declare function createAuditNamespace(http: Http): {
170
+ /** The MATERIAL trail — the default `/audit` viewer surface. */
171
+ events: {
172
+ /** GET /api/audit/events — material trail, newest first, paginated `{data, meta}`. */
173
+ list: (query?: AuditEventsQuery) => Promise<Paginated<AuditEventEntry>>;
174
+ /** GET /api/audit/events/{subjectType}/{subjectId} — one entity's material history. */
175
+ history: (subjectType: string, subjectId: string | number, query?: AuditEventsQuery) => Promise<Paginated<AuditEventEntry>>;
176
+ };
177
+ /** The GRANULAR tier — field-level diffs (Spatie activity_log), the "show all changes" drill-down. */
178
+ changes: {
179
+ /** GET /api/audit/changes — granular field-diff trail, newest first, paginated `{data, meta}`. */
180
+ list: (query?: AuditChangesQuery) => Promise<Paginated<AuditLogEntry>>;
181
+ };
182
+ log: {
183
+ /** GET /api/audit/log — the tenant's Spatie activity trail, newest first, paginated `{data, meta}`. */
184
+ list: (query?: AuditLogQuery) => Promise<Paginated<AuditLogEntry>>;
185
+ };
186
+ financial: {
187
+ /** GET /api/audit/financial — the immutable financial trail, newest first, paginated `{data, meta}`. */
188
+ list: (query?: FinancialAuditQuery) => Promise<Paginated<FinancialAuditEntry>>;
189
+ /** GET /api/audit/financial/verify — walk the hash chain and report integrity. */
190
+ verify: () => Promise<FinancialAuditVerification>;
191
+ };
192
+ };
193
+ export type AuditNamespace = ReturnType<typeof createAuditNamespace>;
package/dist/audit.js ADDED
@@ -0,0 +1,26 @@
1
+ export function createAuditNamespace(http) {
2
+ return {
3
+
4
+ events: {
5
+
6
+ list: (query) => http.get('/api/audit/events', { params: query }),
7
+
8
+ history: (subjectType, subjectId, query) => http.get(`/api/audit/events/${encodeURIComponent(subjectType)}/${encodeURIComponent(String(subjectId))}`, { params: query }),
9
+ },
10
+
11
+ changes: {
12
+
13
+ list: (query) => http.get('/api/audit/changes', { params: query }),
14
+ },
15
+ log: {
16
+
17
+ list: (query) => http.get('/api/audit/log', { params: query }),
18
+ },
19
+ financial: {
20
+
21
+ list: (query) => http.get('/api/audit/financial', { params: query }),
22
+
23
+ verify: () => http.get('/api/audit/financial/verify'),
24
+ },
25
+ };
26
+ }