@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.
- package/LICENSE +17 -0
- package/README.md +229 -2
- package/bin/nuwah-contract-check-rules.d.mts +41 -0
- package/bin/nuwah-contract-check-rules.mjs +333 -0
- package/bin/nuwah-contract-check.mjs +64 -0
- package/dist/accounting.d.ts +1417 -0
- package/dist/accounting.js +274 -0
- package/dist/active-org.d.ts +13 -0
- package/dist/active-org.js +59 -0
- package/dist/actors.d.ts +448 -0
- package/dist/actors.js +143 -0
- package/dist/ai.d.ts +359 -0
- package/dist/ai.js +229 -0
- package/dist/analytics.d.ts +37 -0
- package/dist/analytics.js +8 -0
- package/dist/atlas.d.ts +291 -0
- package/dist/atlas.js +78 -0
- package/dist/audit.d.ts +193 -0
- package/dist/audit.js +26 -0
- package/dist/authentication.d.ts +119 -0
- package/dist/authentication.js +83 -0
- package/dist/awards.d.ts +38 -0
- package/dist/awards.js +10 -0
- package/dist/blueprint/document.d.ts +178 -0
- package/dist/blueprint/document.js +17 -0
- package/dist/blueprint/index.d.ts +3 -0
- package/dist/blueprint/index.js +5 -0
- package/dist/blueprint/manifest.d.ts +105 -0
- package/dist/blueprint/manifest.js +11 -0
- package/dist/blueprint/validate.d.ts +14 -0
- package/dist/blueprint/validate.js +416 -0
- package/dist/bookings-directory.d.ts +118 -0
- package/dist/bookings-directory.js +289 -0
- package/dist/bookings-extra.d.ts +1448 -0
- package/dist/bookings-extra.js +582 -0
- package/dist/bookings.d.ts +1365 -0
- package/dist/bookings.js +305 -0
- package/dist/builder-code.d.ts +164 -0
- package/dist/builder-code.js +12 -0
- package/dist/builder-core-gaps.d.ts +83 -0
- package/dist/builder-core-gaps.js +8 -0
- package/dist/builder-repos.d.ts +73 -0
- package/dist/builder-repos.js +37 -0
- package/dist/builder.d.ts +730 -0
- package/dist/builder.js +105 -0
- package/dist/campaigns.d.ts +105 -0
- package/dist/campaigns.js +25 -0
- package/dist/catalogs.d.ts +188 -0
- package/dist/catalogs.js +36 -0
- package/dist/commerce-ai.d.ts +182 -0
- package/dist/commerce-ai.js +27 -0
- package/dist/connections.d.ts +278 -0
- package/dist/connections.js +96 -0
- package/dist/content-control.d.ts +121 -0
- package/dist/content-control.js +23 -0
- package/dist/contributions.d.ts +560 -0
- package/dist/contributions.js +140 -0
- package/dist/conversation-assist.d.ts +154 -0
- package/dist/conversation-assist.js +51 -0
- package/dist/conversation-info.d.ts +219 -0
- package/dist/conversation-info.js +43 -0
- package/dist/crm.d.ts +533 -0
- package/dist/crm.js +142 -0
- package/dist/dashboards.d.ts +119 -0
- package/dist/dashboards.js +22 -0
- package/dist/delegations.d.ts +161 -0
- package/dist/delegations.js +39 -0
- package/dist/docs.d.ts +289 -0
- package/dist/docs.js +49 -0
- package/dist/documents.d.ts +317 -0
- package/dist/documents.js +84 -0
- package/dist/drafts.d.ts +132 -0
- package/dist/drafts.js +56 -0
- package/dist/engagements.d.ts +133 -0
- package/dist/engagements.js +15 -0
- package/dist/event-stream.d.ts +54 -0
- package/dist/event-stream.js +228 -0
- package/dist/exchanges.d.ts +447 -0
- package/dist/exchanges.js +145 -0
- package/dist/exports.d.ts +113 -0
- package/dist/exports.js +81 -0
- package/dist/feeds.d.ts +228 -0
- package/dist/feeds.js +52 -0
- package/dist/files.d.ts +56 -0
- package/dist/files.js +55 -0
- package/dist/finance-insights.d.ts +41 -0
- package/dist/finance-insights.js +61 -0
- package/dist/fixed-assets.d.ts +155 -0
- package/dist/fixed-assets.js +28 -0
- package/dist/fulfilment-jobs.d.ts +405 -0
- package/dist/fulfilment-jobs.js +76 -0
- package/dist/fulfilment.d.ts +205 -0
- package/dist/fulfilment.js +39 -0
- package/dist/hr.d.ts +350 -0
- package/dist/hr.js +94 -0
- package/dist/http.d.ts +124 -0
- package/dist/http.js +392 -0
- package/dist/inbox.d.ts +206 -0
- package/dist/inbox.js +36 -0
- package/dist/index.d.ts +384 -0
- package/dist/index.js +294 -0
- package/dist/insights.d.ts +176 -0
- package/dist/insights.js +52 -0
- package/dist/inventory.d.ts +797 -0
- package/dist/inventory.js +120 -0
- package/dist/list-query.d.ts +211 -0
- package/dist/list-query.js +158 -0
- package/dist/listings.d.ts +381 -0
- package/dist/listings.js +173 -0
- package/dist/location-sharing.d.ts +83 -0
- package/dist/location-sharing.js +20 -0
- package/dist/marketplace.d.ts +268 -0
- package/dist/marketplace.js +59 -0
- package/dist/matching.d.ts +103 -0
- package/dist/matching.js +22 -0
- package/dist/media.d.ts +221 -0
- package/dist/media.js +239 -0
- package/dist/metrics.d.ts +125 -0
- package/dist/metrics.js +45 -0
- package/dist/moderation.d.ts +240 -0
- package/dist/moderation.js +40 -0
- package/dist/money.d.ts +41 -0
- package/dist/money.js +79 -0
- package/dist/my-data.d.ts +266 -0
- package/dist/my-data.js +32 -0
- package/dist/names.d.ts +14 -0
- package/dist/names.js +17 -0
- package/dist/occasions.d.ts +256 -0
- package/dist/occasions.js +40 -0
- package/dist/onboarding.d.ts +88 -0
- package/dist/onboarding.js +38 -0
- package/dist/pagination.d.ts +204 -0
- package/dist/pagination.js +141 -0
- package/dist/party-baseline-attributes.d.ts +245 -0
- package/dist/party-baseline-attributes.js +36 -0
- package/dist/party.d.ts +401 -0
- package/dist/party.js +56 -0
- package/dist/patient.d.ts +161 -0
- package/dist/patient.js +45 -0
- package/dist/payroll.d.ts +378 -0
- package/dist/payroll.js +60 -0
- package/dist/person-addresses.d.ts +88 -0
- package/dist/person-addresses.js +18 -0
- package/dist/person-cart.d.ts +250 -0
- package/dist/person-cart.js +63 -0
- package/dist/person-chat-assist.d.ts +47 -0
- package/dist/person-chat-assist.js +13 -0
- package/dist/person-data-webhooks.d.ts +72 -0
- package/dist/person-data-webhooks.js +86 -0
- package/dist/person-data.d.ts +212 -0
- package/dist/person-data.js +162 -0
- package/dist/person-locations.d.ts +54 -0
- package/dist/person-locations.js +6 -0
- package/dist/person-messaging.d.ts +405 -0
- package/dist/person-messaging.js +112 -0
- package/dist/person-notifications.d.ts +319 -0
- package/dist/person-notifications.js +164 -0
- package/dist/personalisation.d.ts +21 -0
- package/dist/personalisation.js +8 -0
- package/dist/platform.d.ts +63 -0
- package/dist/platform.js +45 -0
- package/dist/portfolio.d.ts +163 -0
- package/dist/portfolio.js +28 -0
- package/dist/pos.d.ts +743 -0
- package/dist/pos.js +129 -0
- package/dist/procurement.d.ts +664 -0
- package/dist/procurement.js +157 -0
- package/dist/promotions.d.ts +169 -0
- package/dist/promotions.js +39 -0
- package/dist/publications.d.ts +583 -0
- package/dist/publications.js +164 -0
- package/dist/ranking.d.ts +43 -0
- package/dist/ranking.js +34 -0
- package/dist/ratings.d.ts +293 -0
- package/dist/ratings.js +109 -0
- package/dist/reactions.d.ts +123 -0
- package/dist/reactions.js +41 -0
- package/dist/recipient-orders.d.ts +294 -0
- package/dist/recipient-orders.js +73 -0
- package/dist/relationships.d.ts +18 -0
- package/dist/relationships.js +8 -0
- package/dist/reporting.d.ts +107 -0
- package/dist/reporting.js +56 -0
- package/dist/sales.d.ts +270 -0
- package/dist/sales.js +66 -0
- package/dist/shares.d.ts +105 -0
- package/dist/shares.js +27 -0
- package/dist/shop.d.ts +993 -0
- package/dist/shop.js +215 -0
- package/dist/shopping-assistant.d.ts +65 -0
- package/dist/shopping-assistant.js +14 -0
- package/dist/spaces.d.ts +422 -0
- package/dist/spaces.js +118 -0
- package/dist/stored-value.d.ts +754 -0
- package/dist/stored-value.js +177 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +2 -0
- package/dist/vault.d.ts +290 -0
- package/dist/vault.js +55 -0
- package/dist/vertical-runtime.d.ts +17 -0
- package/dist/vertical-runtime.js +8 -0
- package/dist/vite/build-manifest-plugin.d.ts +42 -0
- package/dist/vite/build-manifest-plugin.js +42 -0
- package/dist/vite/first-paint-plugin.d.ts +26 -0
- package/dist/vite/first-paint-plugin.js +57 -0
- package/dist/wishlists.d.ts +591 -0
- package/dist/wishlists.js +188 -0
- package/dist/workbench.d.ts +114 -0
- package/dist/workbench.js +22 -0
- package/dist/workspace.d.ts +190 -0
- package/dist/workspace.js +41 -0
- package/package.json +52 -4
- package/templates/extension-image.Dockerfile +38 -0
- package/templates/nuwah-vertical.yml +102 -0
- package/templates/vertical-app/.env.example +34 -0
- package/templates/vertical-app/README.md +108 -0
- package/templates/vertical-app/github/workflows/ci.yml +51 -0
- package/templates/vertical-app/gitignore +5 -0
- package/templates/vertical-app/index.html +12 -0
- package/templates/vertical-app/package.json +28 -0
- package/templates/vertical-app/src/App.tsx +64 -0
- package/templates/vertical-app/src/blueprint/blueprint.ts +45 -0
- package/templates/vertical-app/src/blueprint/screens.ts +15 -0
- package/templates/vertical-app/src/env.d.ts +18 -0
- package/templates/vertical-app/src/index.css +139 -0
- package/templates/vertical-app/src/lib/i18n.ts +5 -0
- package/templates/vertical-app/src/lib/iam.ts +19 -0
- package/templates/vertical-app/src/lib/operations.ts +93 -0
- package/templates/vertical-app/src/lib/router.ts +24 -0
- package/templates/vertical-app/src/lib/sdk.ts +21 -0
- package/templates/vertical-app/src/lib/theme.ts +18 -0
- package/templates/vertical-app/src/lib/words.ts +39 -0
- package/templates/vertical-app/src/main.tsx +25 -0
- package/templates/vertical-app/src/pages/AppScreens.tsx +71 -0
- package/templates/vertical-app/src/pages/AuthCallback.tsx +44 -0
- package/templates/vertical-app/src/pages/Home.tsx +36 -0
- package/templates/vertical-app/tsconfig.json +24 -0
- package/templates/vertical-app/vite.config.ts +23 -0
- package/templates/vertical-ci.yml +192 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { personDomainRequest, } from './actors.js';
|
|
2
|
+
import { listQueryParams } from './list-query.js';
|
|
3
|
+
export const STORED_VALUE_MESSAGED_TRANSFER_ROLES = ['sender', 'recipient'];
|
|
4
|
+
|
|
5
|
+
export function storedValueCashOutOffered(unit) {
|
|
6
|
+
return unit.payout.available && (unit.payout.person_method ?? 'off') !== 'off';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const STORED_VALUE_AMOUNT_PATTERN = /^\d{1,15}(\.\d{1,4})?$/;
|
|
10
|
+
const PERSON_BASE = '/api/person/stored-value';
|
|
11
|
+
const ORGANISATION_BASE = '/api/stored-value';
|
|
12
|
+
export function createStoredValueNamespace(http) {
|
|
13
|
+
const read = (options, params) => personDomainRequest(options, false, params);
|
|
14
|
+
const write = (options) => personDomainRequest(options, true);
|
|
15
|
+
const segment = encodeURIComponent;
|
|
16
|
+
return {
|
|
17
|
+
units: {
|
|
18
|
+
|
|
19
|
+
show: (unitKey, options) => http.get(`${PERSON_BASE}/units/${segment(unitKey)}`, read(options)),
|
|
20
|
+
|
|
21
|
+
acceptors: (unitKey, query = {}, options) => http.get(`${PERSON_BASE}/units/${segment(unitKey)}/acceptors`, read(options, { cursor: query.cursor ?? undefined, limit: query.limit })),
|
|
22
|
+
|
|
23
|
+
acceptance: (unitKey, party, options) => http.get(`${PERSON_BASE}/units/${segment(unitKey)}/acceptance`, read(options, { party })),
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
balances: (options) => http.get(`${PERSON_BASE}/balances`, read(options)),
|
|
27
|
+
|
|
28
|
+
statement: (unitKey, query = {}, options) => http.get(`${PERSON_BASE}/statements/${segment(unitKey)}`, read(options, listQueryParams(query))),
|
|
29
|
+
|
|
30
|
+
transfer: (request, options) => http.post(`${PERSON_BASE}/transfers`, request, write(options)),
|
|
31
|
+
|
|
32
|
+
receipt: (entryId, options) => http.get(`${PERSON_BASE}/entries/${segment(entryId)}`, read(options)),
|
|
33
|
+
|
|
34
|
+
messagedTransfers: {
|
|
35
|
+
|
|
36
|
+
send: (request, options) => http.post(`${PERSON_BASE}/messaged-transfers`, request, write(options)),
|
|
37
|
+
|
|
38
|
+
list: (query = {}, options) => http.get(`${PERSON_BASE}/messaged-transfers`, read(options, listQueryParams(query))),
|
|
39
|
+
show: (id, options) => http.get(`${PERSON_BASE}/messaged-transfers/${segment(id)}`, read(options)),
|
|
40
|
+
|
|
41
|
+
open: (id, options) => http.post(`${PERSON_BASE}/messaged-transfers/${segment(id)}/opening`, undefined, write(options)),
|
|
42
|
+
|
|
43
|
+
thank: (id, message, options) => http.post(`${PERSON_BASE}/messaged-transfers/${segment(id)}/thanks`, { message }, write(options)),
|
|
44
|
+
|
|
45
|
+
cancel: (id, options) => http.post(`${PERSON_BASE}/messaged-transfers/${segment(id)}/cancellation`, undefined, write(options)),
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
creditRequests: {
|
|
49
|
+
create: (request, options) => http.post(`${PERSON_BASE}/credit-requests`, request, write(options)),
|
|
50
|
+
list: (query = {}, options) => http.get(`${PERSON_BASE}/credit-requests`, read(options, listQueryParams(query))),
|
|
51
|
+
show: (id, options) => http.get(`${PERSON_BASE}/credit-requests/${segment(id)}`, read(options)),
|
|
52
|
+
|
|
53
|
+
accept: (id, options) => http.post(`${PERSON_BASE}/credit-requests/${segment(id)}/acceptance`, undefined, write(options)),
|
|
54
|
+
decline: (id, options) => http.post(`${PERSON_BASE}/credit-requests/${segment(id)}/declination`, undefined, write(options)),
|
|
55
|
+
|
|
56
|
+
cancel: (id, options) => http.post(`${PERSON_BASE}/credit-requests/${segment(id)}/cancellation`, undefined, write(options)),
|
|
57
|
+
},
|
|
58
|
+
holds: {
|
|
59
|
+
|
|
60
|
+
list: (query = {}, options) => {
|
|
61
|
+
const { open, ...listQuery } = query;
|
|
62
|
+
|
|
63
|
+
return http.get(`${PERSON_BASE}/holds`, read(options, { ...listQueryParams(listQuery), open }));
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
place: (request, options) => http.post(`${PERSON_BASE}/holds`, request, write(options)),
|
|
67
|
+
|
|
68
|
+
release: (holdId, options) => http.post(`${PERSON_BASE}/holds/${segment(holdId)}/release`, undefined, write(options)),
|
|
69
|
+
},
|
|
70
|
+
payouts: {
|
|
71
|
+
|
|
72
|
+
list: (options) => http.get(`${PERSON_BASE}/payouts`, read(options)),
|
|
73
|
+
|
|
74
|
+
page: (query = {}, options) => http.get(`${PERSON_BASE}/payouts`, read(options, listQueryParams(query))),
|
|
75
|
+
|
|
76
|
+
request: (request, options) => http.post(`${PERSON_BASE}/payouts`, request, write(options)),
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
organisation: {
|
|
80
|
+
units: {
|
|
81
|
+
|
|
82
|
+
list: (query = {}, options) => http.get(`${ORGANISATION_BASE}/units`, read(options, listQueryParams(query))),
|
|
83
|
+
|
|
84
|
+
lifecycle: (unitKey, request, options) => http.post(`${ORGANISATION_BASE}/units/${segment(unitKey)}/lifecycle`, request, write(options)),
|
|
85
|
+
declare: (request, options) => http.post(`${ORGANISATION_BASE}/units`, request, write(options)),
|
|
86
|
+
show: (unitKey, options) => http.get(`${ORGANISATION_BASE}/units/${segment(unitKey)}`, read(options)),
|
|
87
|
+
update: (unitKey, changes, options) => http.patch(`${ORGANISATION_BASE}/units/${segment(unitKey)}`, changes, write(options)),
|
|
88
|
+
|
|
89
|
+
link: (unitKey, networkKey, options) => http.post(`${ORGANISATION_BASE}/units/${segment(unitKey)}/networks`, { network_key: networkKey }, write(options)),
|
|
90
|
+
|
|
91
|
+
unlink: (unitKey, networkKey, options) => http.post(`${ORGANISATION_BASE}/units/${segment(unitKey)}/networks/withdrawal`, { network_key: networkKey }, write(options)),
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
issue: (request, options) => http.post(`${ORGANISATION_BASE}/issues`, request, write(options)),
|
|
95
|
+
|
|
96
|
+
reverseIssue: (entryId, options) => http.post(`${ORGANISATION_BASE}/entries/${segment(entryId)}/reversal`, undefined, write(options)),
|
|
97
|
+
|
|
98
|
+
entries: {
|
|
99
|
+
list: (query = {}, options) => http.get(`${ORGANISATION_BASE}/entries`, read(options, listQueryParams(query))),
|
|
100
|
+
},
|
|
101
|
+
dashboard: {
|
|
102
|
+
|
|
103
|
+
liability: (options) => http.get(`${ORGANISATION_BASE}/dashboard/liability`, read(options)),
|
|
104
|
+
|
|
105
|
+
activity: (query = {}, options) => http.get(`${ORGANISATION_BASE}/dashboard/activity`, read(options, {
|
|
106
|
+
granularity: query.granularity,
|
|
107
|
+
from: query.from,
|
|
108
|
+
to: query.to,
|
|
109
|
+
unit: query.unit,
|
|
110
|
+
})),
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
issueBatches: {
|
|
114
|
+
|
|
115
|
+
create: (request, options) => {
|
|
116
|
+
if ('file' in request) {
|
|
117
|
+
const form = new FormData();
|
|
118
|
+
form.append('unit_key', request.unit_key);
|
|
119
|
+
form.append('file', request.file);
|
|
120
|
+
return http.post(`${ORGANISATION_BASE}/issue-batches`, form, write(options));
|
|
121
|
+
}
|
|
122
|
+
return http.post(`${ORGANISATION_BASE}/issue-batches`, request, write(options));
|
|
123
|
+
},
|
|
124
|
+
list: (query = {}, options) => http.get(`${ORGANISATION_BASE}/issue-batches`, read(options, listQueryParams(query))),
|
|
125
|
+
show: (batchId, options) => http.get(`${ORGANISATION_BASE}/issue-batches/${segment(batchId)}`, read(options)),
|
|
126
|
+
|
|
127
|
+
rows: (batchId, query = {}, options) => http.get(`${ORGANISATION_BASE}/issue-batches/${segment(batchId)}/rows`, read(options, listQueryParams(query))),
|
|
128
|
+
|
|
129
|
+
submit: (batchId, skipInvalid = false, options) => http.post(`${ORGANISATION_BASE}/issue-batches/${segment(batchId)}/submission`, { skip_invalid: skipInvalid }, write(options)),
|
|
130
|
+
},
|
|
131
|
+
holds: {
|
|
132
|
+
|
|
133
|
+
list: (query = {}, options) => http.get(`${ORGANISATION_BASE}/holds`, read(options, listQueryParams(query))),
|
|
134
|
+
|
|
135
|
+
show: (holdId, options) => http.get(`${ORGANISATION_BASE}/holds/${segment(holdId)}`, read(options)),
|
|
136
|
+
|
|
137
|
+
capture: (holdId, amount = null, options) => http.post(`${ORGANISATION_BASE}/holds/${segment(holdId)}/capture`, amount === null ? {} : { amount }, write(options)),
|
|
138
|
+
release: (holdId, options) => http.post(`${ORGANISATION_BASE}/holds/${segment(holdId)}/release`, undefined, write(options)),
|
|
139
|
+
},
|
|
140
|
+
payouts: {
|
|
141
|
+
|
|
142
|
+
list: (query = {}, options) => {
|
|
143
|
+
const { status, ...listQuery } = query;
|
|
144
|
+
const params = listQueryParams(status && !listQuery.filter?.status
|
|
145
|
+
? { ...listQuery, filter: { ...listQuery.filter, status: [status] } }
|
|
146
|
+
: listQuery);
|
|
147
|
+
return http.get(`${ORGANISATION_BASE}/payouts`, read(options, params));
|
|
148
|
+
},
|
|
149
|
+
decide: (payoutId, decision, options) => http.post(`${ORGANISATION_BASE}/payouts/${segment(payoutId)}/decision`, decision, write(options)),
|
|
150
|
+
confirm: (payoutId, outcome, options) => http.post(`${ORGANISATION_BASE}/payouts/${segment(payoutId)}/confirmation`, outcome, write(options)),
|
|
151
|
+
},
|
|
152
|
+
networks: {
|
|
153
|
+
|
|
154
|
+
list: (query = {}, options) => http.get(`${ORGANISATION_BASE}/networks`, read(options, listQueryParams(query))),
|
|
155
|
+
|
|
156
|
+
members: (networkKey, query = {}, options) => http.get(`${ORGANISATION_BASE}/networks/${segment(networkKey)}/members`, read(options, listQueryParams(query))),
|
|
157
|
+
declare: (request, options) => http.post(`${ORGANISATION_BASE}/networks`, request, write(options)),
|
|
158
|
+
show: (networkKey, options) => http.get(`${ORGANISATION_BASE}/networks/${segment(networkKey)}`, read(options)),
|
|
159
|
+
join: (networkKey, options) => http.post(`${ORGANISATION_BASE}/networks/${segment(networkKey)}/join`, undefined, write(options)),
|
|
160
|
+
leave: (networkKey, options) => http.post(`${ORGANISATION_BASE}/networks/${segment(networkKey)}/leave`, undefined, write(options)),
|
|
161
|
+
decideMembership: (networkKey, membershipId, decision, options) => http.post(`${ORGANISATION_BASE}/networks/${segment(networkKey)}/members/${segment(membershipId)}/decision`, { decision }, write(options)),
|
|
162
|
+
},
|
|
163
|
+
settlementBatches: {
|
|
164
|
+
|
|
165
|
+
list: (query = {}, options) => {
|
|
166
|
+
const { status, ...listQuery } = query;
|
|
167
|
+
const params = listQueryParams(status && !listQuery.filter?.status
|
|
168
|
+
? { ...listQuery, filter: { ...listQuery.filter, status: [status] } }
|
|
169
|
+
: listQuery);
|
|
170
|
+
return http.get(`${ORGANISATION_BASE}/settlement-batches`, read(options, params));
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
markPaid: (batchId, paymentReference, options) => http.post(`${ORGANISATION_BASE}/settlement-batches/${segment(batchId)}/payment`, { payment_reference: paymentReference }, write(options)),
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** Shared shapes across core modules. */
|
|
2
|
+
/**
|
|
3
|
+
* A Spatie translatable field. On WRITE, core expects the full `{en, ar}` map.
|
|
4
|
+
* On READ, Eloquent serialises translatable models to the ACTIVE-locale string
|
|
5
|
+
* (driven by the request's `Accept-Language`), so response fields are plain
|
|
6
|
+
* strings — see each module's response interfaces.
|
|
7
|
+
*/
|
|
8
|
+
export interface Translatable {
|
|
9
|
+
en: string;
|
|
10
|
+
ar?: string | null;
|
|
11
|
+
[locale: string]: string | null | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** The `{data, meta}` envelope core's hand-rolled paginators return. */
|
|
14
|
+
export interface Paginated<T> {
|
|
15
|
+
data: T[];
|
|
16
|
+
meta: PaginationMeta;
|
|
17
|
+
}
|
|
18
|
+
export interface PaginationMeta {
|
|
19
|
+
current_page: number;
|
|
20
|
+
last_page: number;
|
|
21
|
+
per_page: number;
|
|
22
|
+
total: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Laravel's default API-Resource collection envelope (`Resource::collection`
|
|
26
|
+
* over a paginator) — used by HR's employee list. Note the richer `meta` and the
|
|
27
|
+
* top-level `links`.
|
|
28
|
+
*/
|
|
29
|
+
export interface LaravelResourceCollection<T> {
|
|
30
|
+
data: T[];
|
|
31
|
+
links: {
|
|
32
|
+
first: string | null;
|
|
33
|
+
last: string | null;
|
|
34
|
+
prev: string | null;
|
|
35
|
+
next: string | null;
|
|
36
|
+
};
|
|
37
|
+
meta: {
|
|
38
|
+
current_page: number;
|
|
39
|
+
from: number | null;
|
|
40
|
+
last_page: number;
|
|
41
|
+
path: string;
|
|
42
|
+
per_page: number;
|
|
43
|
+
to: number | null;
|
|
44
|
+
total: number;
|
|
45
|
+
links: Array<{
|
|
46
|
+
url: string | null;
|
|
47
|
+
label: string;
|
|
48
|
+
active: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Core's RAW Laravel `LengthAwarePaginator` JSON — pagination fields are
|
|
54
|
+
* SIBLINGS of `data` (no `meta` key). Returned by modules that ship no API
|
|
55
|
+
* Resource and simply `response()->json($query->paginate())` (Fixed Assets,
|
|
56
|
+
* Payroll, and the Inventory/Bookings-insurance raw-paginator endpoints).
|
|
57
|
+
*/
|
|
58
|
+
export interface LaravelPaginator<T> {
|
|
59
|
+
current_page: number;
|
|
60
|
+
data: T[];
|
|
61
|
+
first_page_url: string | null;
|
|
62
|
+
from: number | null;
|
|
63
|
+
last_page: number;
|
|
64
|
+
last_page_url: string | null;
|
|
65
|
+
links: Array<{
|
|
66
|
+
url: string | null;
|
|
67
|
+
label: string;
|
|
68
|
+
active: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
next_page_url: string | null;
|
|
71
|
+
path: string;
|
|
72
|
+
per_page: number;
|
|
73
|
+
prev_page_url: string | null;
|
|
74
|
+
to: number | null;
|
|
75
|
+
total: number;
|
|
76
|
+
}
|
|
77
|
+
/** Common list query knobs (each module also accepts its own filters). */
|
|
78
|
+
export interface ListQuery {
|
|
79
|
+
page?: number;
|
|
80
|
+
per_page?: number;
|
|
81
|
+
search?: string;
|
|
82
|
+
[param: string]: string | number | boolean | null | undefined | Array<string | number>;
|
|
83
|
+
}
|
package/dist/types.js
ADDED
package/dist/vault.d.ts
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import type { Http } from './http.js';
|
|
2
|
+
import { type BilingualText, type PersonDomainCallOptions, type PersonDomainEnvelope } from './actors.js';
|
|
3
|
+
import { type ListPage, type ListQueryState } from './list-query.js';
|
|
4
|
+
export type VaultProvenance = 'claimed' | 'evidenced' | (string & {});
|
|
5
|
+
export type VaultVisibility = 'private' | 'circle' | (string & {});
|
|
6
|
+
export type VaultProposalState = 'pending' | 'accepted' | 'declined' | 'expired' | 'withdrawn' | (string & {});
|
|
7
|
+
export type VaultTransferState = 'proposed' | 'accepted' | 'declined' | 'disputed' | 'cancelled' | 'completed' | (string & {});
|
|
8
|
+
/** How much of the item's past goes with it: nothing, only how it was proven, or the whole chain. */
|
|
9
|
+
export type VaultHistoryScope = 'none' | 'provenance_only' | 'full';
|
|
10
|
+
export type VaultTransferDisputeReason = 'not_received' | 'not_as_described' | 'sender_not_the_owner' | 'stolen' | 'fraud' | 'other';
|
|
11
|
+
export type VaultFieldType = 'string' | 'text' | 'int' | 'decimal' | 'money' | 'bool' | 'date' | 'datetime' | 'enum' | 'ref' | (string & {});
|
|
12
|
+
/** A pointer to the business record the value rests on (`Projections\EvidenceRef`). */
|
|
13
|
+
export interface VaultEvidence {
|
|
14
|
+
type: string;
|
|
15
|
+
id: string;
|
|
16
|
+
org_id: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface VaultAttachment {
|
|
19
|
+
file: VaultEvidence;
|
|
20
|
+
label: BilingualText;
|
|
21
|
+
}
|
|
22
|
+
/** A five-minute signed link to one attachment. */
|
|
23
|
+
export interface VaultSignedAttachment {
|
|
24
|
+
url: string;
|
|
25
|
+
expires_at: string;
|
|
26
|
+
label: BilingualText;
|
|
27
|
+
}
|
|
28
|
+
export interface VaultField {
|
|
29
|
+
key: string;
|
|
30
|
+
type: VaultFieldType;
|
|
31
|
+
label: BilingualText;
|
|
32
|
+
required: boolean;
|
|
33
|
+
/** Type-specific: `options` (enum), `min`/`max`, `scale`, `currency`. */
|
|
34
|
+
config: Record<string, unknown>;
|
|
35
|
+
/** A plate, a serial: identifies exactly which item (sensitive category `possession_identifiers`). */
|
|
36
|
+
identifier: boolean;
|
|
37
|
+
data_category: string;
|
|
38
|
+
}
|
|
39
|
+
/** A declared entry type and its live fields in the bound vertical. */
|
|
40
|
+
export interface VaultEntryType {
|
|
41
|
+
key: string;
|
|
42
|
+
label: BilingualText;
|
|
43
|
+
category: string;
|
|
44
|
+
cardinality: 'one' | 'many';
|
|
45
|
+
transferable: boolean;
|
|
46
|
+
identifier_fields: string[];
|
|
47
|
+
storage: 'vault_entry' | 'applied' | (string & {});
|
|
48
|
+
/** Offer it in the "add" form; types without it arrive only by a business's proposal. */
|
|
49
|
+
person_may_create: boolean;
|
|
50
|
+
/** The product-taxonomy category a listing of this type starts in, or null. */
|
|
51
|
+
market_category_key: string | null;
|
|
52
|
+
fields: VaultField[];
|
|
53
|
+
}
|
|
54
|
+
/** How an entry came to the person, as far as each earlier sender allowed. */
|
|
55
|
+
export interface VaultEntryHistoryStep {
|
|
56
|
+
transfer_id: string | null;
|
|
57
|
+
received_at: string | null;
|
|
58
|
+
history_scope: VaultHistoryScope;
|
|
59
|
+
sender_person_id: string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface VaultEntry {
|
|
62
|
+
id: string;
|
|
63
|
+
type_key: string;
|
|
64
|
+
vertical_key: string | null;
|
|
65
|
+
attributes: Record<string, unknown>;
|
|
66
|
+
provenance: VaultProvenance;
|
|
67
|
+
evidence: VaultEvidence | null;
|
|
68
|
+
source_organisation_id: string | null;
|
|
69
|
+
attachments: VaultAttachment[];
|
|
70
|
+
visibility: VaultVisibility;
|
|
71
|
+
listed_for_sale: boolean;
|
|
72
|
+
archived_at: string | null;
|
|
73
|
+
archived_reason: string | null;
|
|
74
|
+
origin_transfer_id: string | null;
|
|
75
|
+
/** A transfer holds it: no edit, listing or deletion while set. */
|
|
76
|
+
held_by_transfer_id: string | null;
|
|
77
|
+
version: number;
|
|
78
|
+
created_at: string | null;
|
|
79
|
+
updated_at: string | null;
|
|
80
|
+
/** On the single read only. */
|
|
81
|
+
history?: VaultEntryHistoryStep[];
|
|
82
|
+
}
|
|
83
|
+
export interface VaultProposerSummary {
|
|
84
|
+
reference: string;
|
|
85
|
+
display_name: BilingualText;
|
|
86
|
+
handle?: string | null;
|
|
87
|
+
avatar_url?: string | null;
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
}
|
|
90
|
+
export interface VaultProposal {
|
|
91
|
+
id: string;
|
|
92
|
+
type_key: string;
|
|
93
|
+
state: VaultProposalState;
|
|
94
|
+
proposer: {
|
|
95
|
+
organisation_id: string;
|
|
96
|
+
app_id: string;
|
|
97
|
+
summary: VaultProposerSummary;
|
|
98
|
+
};
|
|
99
|
+
attributes: Record<string, unknown>;
|
|
100
|
+
evidence: VaultEvidence | null;
|
|
101
|
+
attachments: VaultAttachment[];
|
|
102
|
+
/** An entry this proposal updates (cardinality one, or a correction). */
|
|
103
|
+
target_entry_id: string | null;
|
|
104
|
+
/** The entry it became, once accepted. */
|
|
105
|
+
entry_id: string | null;
|
|
106
|
+
expires_at: string | null;
|
|
107
|
+
decided_at: string | null;
|
|
108
|
+
created_at: string | null;
|
|
109
|
+
}
|
|
110
|
+
export interface VaultTransfer {
|
|
111
|
+
id: string;
|
|
112
|
+
type_key: string;
|
|
113
|
+
state: VaultTransferState;
|
|
114
|
+
/** Read against the viewer. */
|
|
115
|
+
direction: 'incoming' | 'outgoing';
|
|
116
|
+
from: string;
|
|
117
|
+
to: string;
|
|
118
|
+
/** The sender sees the entry offered; the receiver sees the entry received. */
|
|
119
|
+
entry_id: string | null;
|
|
120
|
+
history_scope: VaultHistoryScope;
|
|
121
|
+
exchange_id: string | null;
|
|
122
|
+
closing_reason: string | null;
|
|
123
|
+
dispute: {
|
|
124
|
+
reason: VaultTransferDisputeReason;
|
|
125
|
+
/** Only to the party who wrote it. */
|
|
126
|
+
note: string | null;
|
|
127
|
+
disputed_by_me: boolean;
|
|
128
|
+
case_reference: string | null;
|
|
129
|
+
outcome: 'transfer_stands' | 'transfer_reversed' | null;
|
|
130
|
+
disputed_at: string | null;
|
|
131
|
+
resolved_at: string | null;
|
|
132
|
+
} | null;
|
|
133
|
+
expires_at: string | null;
|
|
134
|
+
decided_at: string | null;
|
|
135
|
+
completed_at: string | null;
|
|
136
|
+
created_at: string | null;
|
|
137
|
+
updated_at: string | null;
|
|
138
|
+
}
|
|
139
|
+
export interface VaultCircleGrant {
|
|
140
|
+
id: string;
|
|
141
|
+
person_id: string;
|
|
142
|
+
granted_at: string;
|
|
143
|
+
}
|
|
144
|
+
/** An entry someone in my circle shared with me. Identifier fields are never included. */
|
|
145
|
+
export interface VaultSharedEntry {
|
|
146
|
+
entry_id: string;
|
|
147
|
+
owner: string;
|
|
148
|
+
type_key: string;
|
|
149
|
+
attributes: Record<string, unknown>;
|
|
150
|
+
provenance: VaultProvenance;
|
|
151
|
+
shared_at: string;
|
|
152
|
+
updated_at: string | null;
|
|
153
|
+
}
|
|
154
|
+
export interface CreateVaultEntryInput {
|
|
155
|
+
type_key: string;
|
|
156
|
+
attributes: Record<string, unknown>;
|
|
157
|
+
visibility?: 'private' | 'circle';
|
|
158
|
+
}
|
|
159
|
+
export interface UpdateVaultEntryInput {
|
|
160
|
+
attributes?: Record<string, unknown> | null;
|
|
161
|
+
visibility?: 'private' | 'circle' | null;
|
|
162
|
+
/** The version on screen; a stale one answers 409 `entry_changed`. */
|
|
163
|
+
version?: number | null;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The person a share or a hand-over is for: the handle picked in the person directory (or typed),
|
|
167
|
+
* or the person id a directory pick returned. An unknown handle answers like an unknown person.
|
|
168
|
+
*/
|
|
169
|
+
export type VaultRecipient = {
|
|
170
|
+
handle: string;
|
|
171
|
+
person_id?: never;
|
|
172
|
+
} | {
|
|
173
|
+
person_id: string;
|
|
174
|
+
handle?: never;
|
|
175
|
+
};
|
|
176
|
+
/** A marketplace listing draft prefilled from a possession: the body for `listings.create`, minus price and photos. */
|
|
177
|
+
export interface VaultListingDraft {
|
|
178
|
+
source: {
|
|
179
|
+
vault_entry_id: string;
|
|
180
|
+
type_key: string;
|
|
181
|
+
};
|
|
182
|
+
/** The marketplace kind (`item`), or null when the marketplace does not declare it. */
|
|
183
|
+
kind: string | null;
|
|
184
|
+
title: string;
|
|
185
|
+
description: null;
|
|
186
|
+
/** From the entry type's declared market category, when the active taxonomy has it; else the person picks. */
|
|
187
|
+
category_id: string | null;
|
|
188
|
+
category: {
|
|
189
|
+
key: string;
|
|
190
|
+
label: {
|
|
191
|
+
en: string;
|
|
192
|
+
ar: string;
|
|
193
|
+
};
|
|
194
|
+
} | null;
|
|
195
|
+
/** Non-identifier, non-sensitive fields only. */
|
|
196
|
+
attributes: Record<string, unknown>;
|
|
197
|
+
media: string[];
|
|
198
|
+
/**
|
|
199
|
+
* The person's own ready photos of the entry. Put the confirmed `media_id`s in the listing's
|
|
200
|
+
* `media`; the listing attaches each as a reference to the same bytes (the entry keeps its photos).
|
|
201
|
+
*/
|
|
202
|
+
photo_candidates: VaultEntryPhoto[];
|
|
203
|
+
}
|
|
204
|
+
/** One of the person's own photos of a possession (owner-only). */
|
|
205
|
+
export interface VaultEntryPhoto {
|
|
206
|
+
media_id: string;
|
|
207
|
+
status?: string;
|
|
208
|
+
width: number | null;
|
|
209
|
+
height: number | null;
|
|
210
|
+
position?: number;
|
|
211
|
+
placeholder: unknown;
|
|
212
|
+
sources: unknown;
|
|
213
|
+
}
|
|
214
|
+
/** The numbers behind a navigation badge. */
|
|
215
|
+
export interface VaultPendingCount {
|
|
216
|
+
pending_proposals: number;
|
|
217
|
+
incoming_transfers: number;
|
|
218
|
+
}
|
|
219
|
+
export interface ProposeVaultTransferInput {
|
|
220
|
+
/** The receiver's id, when a directory pick returned it. */
|
|
221
|
+
to_person_id?: string;
|
|
222
|
+
/** The receiver's handle, as picked or typed; used when `to_person_id` is absent. */
|
|
223
|
+
to_handle?: string;
|
|
224
|
+
history_scope: VaultHistoryScope;
|
|
225
|
+
/** An open exchange between the two people; the transfer completes when it does. */
|
|
226
|
+
exchange_id?: string | null;
|
|
227
|
+
}
|
|
228
|
+
export declare function createVaultNamespace(http: Http): {
|
|
229
|
+
/** Declared entry types with their fields (render the add form from `fields`). */
|
|
230
|
+
entryTypes: (options?: PersonDomainCallOptions) => Promise<{
|
|
231
|
+
data: VaultEntryType[];
|
|
232
|
+
}>;
|
|
233
|
+
entries: (query?: ListQueryState, options?: PersonDomainCallOptions) => Promise<ListPage<VaultEntry>>;
|
|
234
|
+
/** One entry, with its `history`. */
|
|
235
|
+
entry: (entryId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultEntry>>;
|
|
236
|
+
/** Add a claimed entry (types with `person_may_create`). */
|
|
237
|
+
create: (input: CreateVaultEntryInput, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultEntry>>;
|
|
238
|
+
update: (entryId: string, input: UpdateVaultEntryInput, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultEntry>>;
|
|
239
|
+
/** Delete for good: the entry, its circle grants and its photos are erased. Not undoable. */
|
|
240
|
+
remove: (entryId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
241
|
+
/** Remove (restorable): it moves to "no longer mine" with `archived_reason: 'removed'`. */
|
|
242
|
+
archive: (entryId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultEntry>>;
|
|
243
|
+
/** Undo a remove. A transferred entry answers 409 `vault_entry_not_restorable`. */
|
|
244
|
+
restore: (entryId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultEntry>>;
|
|
245
|
+
/** Offer it for sale: Listings prefills a listing; plates and serials never go public. */
|
|
246
|
+
listForSale: (entryId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultEntry>>;
|
|
247
|
+
unlist: (entryId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultEntry>>;
|
|
248
|
+
/** A listing draft prefilled from the possession; post it with `listings.create` after adding price and photos. */
|
|
249
|
+
listingDraft: (entryId: string, options?: PersonDomainCallOptions) => Promise<{
|
|
250
|
+
data: VaultListingDraft;
|
|
251
|
+
}>;
|
|
252
|
+
/** My own photos of the entry. */
|
|
253
|
+
photos: (entryId: string, options?: PersonDomainCallOptions) => Promise<{
|
|
254
|
+
data: VaultEntryPhoto[];
|
|
255
|
+
}>;
|
|
256
|
+
/** Set the photos: uploaded media ids (purpose `vault.entry_photo`), in order; replaces the list. */
|
|
257
|
+
setPhotos: (entryId: string, mediaIds: string[], options?: PersonDomainCallOptions) => Promise<{
|
|
258
|
+
data: VaultEntryPhoto[];
|
|
259
|
+
}>;
|
|
260
|
+
/** Proposals and transfer offers waiting for me, for a navigation badge. */
|
|
261
|
+
pendingCount: (options?: PersonDomainCallOptions) => Promise<{
|
|
262
|
+
data: VaultPendingCount;
|
|
263
|
+
}>;
|
|
264
|
+
/** Offer the entry to another person. A blocked person or yourself is refused. */
|
|
265
|
+
proposeTransfer: (entryId: string, input: ProposeVaultTransferInput, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultTransfer>>;
|
|
266
|
+
entryAttachment: (entryId: string, position: number, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultSignedAttachment>>;
|
|
267
|
+
circle: (entryId: string, options?: PersonDomainCallOptions) => Promise<{
|
|
268
|
+
data: VaultCircleGrant[];
|
|
269
|
+
}>;
|
|
270
|
+
/** Show the entry to one person: a `VaultRecipient` (handle or person id), or a person id string. */
|
|
271
|
+
share: (entryId: string, recipient: string | VaultRecipient, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultCircleGrant>>;
|
|
272
|
+
unshare: (entryId: string, grantId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
273
|
+
sharedWithMe: (options?: PersonDomainCallOptions) => Promise<{
|
|
274
|
+
data: VaultSharedEntry[];
|
|
275
|
+
}>;
|
|
276
|
+
proposals: (query?: ListQueryState, options?: PersonDomainCallOptions) => Promise<ListPage<VaultProposal>>;
|
|
277
|
+
proposal: (proposalId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultProposal>>;
|
|
278
|
+
/** Accept: the evidence is checked again; 409 `evidence_gone` when it no longer holds. */
|
|
279
|
+
acceptProposal: (proposalId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultProposal>>;
|
|
280
|
+
declineProposal: (proposalId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultProposal>>;
|
|
281
|
+
proposalAttachment: (proposalId: string, position: number, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultSignedAttachment>>;
|
|
282
|
+
transfers: (query?: ListQueryState, options?: PersonDomainCallOptions) => Promise<ListPage<VaultTransfer>>;
|
|
283
|
+
transfer: (transferId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultTransfer>>;
|
|
284
|
+
acceptTransfer: (transferId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultTransfer>>;
|
|
285
|
+
declineTransfer: (transferId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultTransfer>>;
|
|
286
|
+
cancelTransfer: (transferId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultTransfer>>;
|
|
287
|
+
/** A dispute freezes the entry and opens a case; the note is seen by the case, never by the other party. */
|
|
288
|
+
disputeTransfer: (transferId: string, reason: VaultTransferDisputeReason, note?: string | null, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<VaultTransfer>>;
|
|
289
|
+
};
|
|
290
|
+
export type VaultNamespace = ReturnType<typeof createVaultNamespace>;
|
package/dist/vault.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { personDomainRequest } from './actors.js';
|
|
2
|
+
import { listQueryParams } from './list-query.js';
|
|
3
|
+
const BASE = '/api/person/vault';
|
|
4
|
+
export function createVaultNamespace(http) {
|
|
5
|
+
const read = (options, params) => personDomainRequest(options, false, params);
|
|
6
|
+
const write = (options) => personDomainRequest(options, true);
|
|
7
|
+
return {
|
|
8
|
+
|
|
9
|
+
entryTypes: (options) => http.get(`${BASE}/entry-types`, read(options)),
|
|
10
|
+
entries: (query = {}, options) => http.get(`${BASE}/entries`, read(options, listQueryParams(query))),
|
|
11
|
+
|
|
12
|
+
entry: (entryId, options) => http.get(`${BASE}/entries/${entryId}`, read(options)),
|
|
13
|
+
|
|
14
|
+
create: (input, options) => http.post(`${BASE}/entries`, input, write(options)),
|
|
15
|
+
update: (entryId, input, options) => http.put(`${BASE}/entries/${entryId}`, input, write(options)),
|
|
16
|
+
|
|
17
|
+
remove: (entryId, options) => http.delete(`${BASE}/entries/${entryId}`, write(options)),
|
|
18
|
+
|
|
19
|
+
archive: (entryId, options) => http.post(`${BASE}/entries/${entryId}/archive`, undefined, write(options)),
|
|
20
|
+
|
|
21
|
+
restore: (entryId, options) => http.post(`${BASE}/entries/${entryId}/restore`, undefined, write(options)),
|
|
22
|
+
|
|
23
|
+
listForSale: (entryId, options) => http.post(`${BASE}/entries/${entryId}/list-for-sale`, undefined, write(options)),
|
|
24
|
+
unlist: (entryId, options) => http.delete(`${BASE}/entries/${entryId}/list-for-sale`, write(options)),
|
|
25
|
+
|
|
26
|
+
listingDraft: (entryId, options) => http.get(`${BASE}/entries/${entryId}/listing-draft`, read(options)),
|
|
27
|
+
|
|
28
|
+
photos: (entryId, options) => http.get(`${BASE}/entries/${entryId}/photos`, read(options)),
|
|
29
|
+
|
|
30
|
+
setPhotos: (entryId, mediaIds, options) => http.put(`${BASE}/entries/${entryId}/photos`, { media_ids: mediaIds }, write(options)),
|
|
31
|
+
|
|
32
|
+
pendingCount: (options) => http.get(`${BASE}/pending-count`, read(options)),
|
|
33
|
+
|
|
34
|
+
proposeTransfer: (entryId, input, options) => http.post(`${BASE}/entries/${entryId}/transfers`, input, write(options)),
|
|
35
|
+
entryAttachment: (entryId, position, options) => http.get(`${BASE}/entries/${entryId}/attachments/${position}`, read(options)),
|
|
36
|
+
circle: (entryId, options) => http.get(`${BASE}/entries/${entryId}/circle`, read(options)),
|
|
37
|
+
|
|
38
|
+
share: (entryId, recipient, options) => http.post(`${BASE}/entries/${entryId}/circle`, typeof recipient === 'string' ? { person_id: recipient } : recipient, write(options)),
|
|
39
|
+
unshare: (entryId, grantId, options) => http.delete(`${BASE}/entries/${entryId}/circle/${grantId}`, write(options)),
|
|
40
|
+
sharedWithMe: (options) => http.get(`${BASE}/shared-with-me`, read(options)),
|
|
41
|
+
proposals: (query = {}, options) => http.get(`${BASE}/proposals`, read(options, listQueryParams(query))),
|
|
42
|
+
proposal: (proposalId, options) => http.get(`${BASE}/proposals/${proposalId}`, read(options)),
|
|
43
|
+
|
|
44
|
+
acceptProposal: (proposalId, options) => http.post(`${BASE}/proposals/${proposalId}/accept`, undefined, write(options)),
|
|
45
|
+
declineProposal: (proposalId, options) => http.post(`${BASE}/proposals/${proposalId}/decline`, undefined, write(options)),
|
|
46
|
+
proposalAttachment: (proposalId, position, options) => http.get(`${BASE}/proposals/${proposalId}/attachments/${position}`, read(options)),
|
|
47
|
+
transfers: (query = {}, options) => http.get(`${BASE}/transfers`, read(options, listQueryParams(query))),
|
|
48
|
+
transfer: (transferId, options) => http.get(`${BASE}/transfers/${transferId}`, read(options)),
|
|
49
|
+
acceptTransfer: (transferId, options) => http.post(`${BASE}/transfers/${transferId}/accept`, undefined, write(options)),
|
|
50
|
+
declineTransfer: (transferId, options) => http.post(`${BASE}/transfers/${transferId}/decline`, undefined, write(options)),
|
|
51
|
+
cancelTransfer: (transferId, options) => http.post(`${BASE}/transfers/${transferId}/cancel`, undefined, write(options)),
|
|
52
|
+
|
|
53
|
+
disputeTransfer: (transferId, reason, note, options) => http.post(`${BASE}/transfers/${transferId}/dispute`, { reason, note: note ?? null }, write(options)),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BlueprintDocument } from './blueprint/document.js';
|
|
2
|
+
import type { RuntimeInterpretation, RuntimeManifest } from './blueprint/manifest.js';
|
|
3
|
+
import type { Http, RequestOptions } from './http.js';
|
|
4
|
+
export type { RuntimeInterpretation, RuntimeManifest, RuntimeNavigationEntry, RuntimeMode } from './blueprint/manifest.js';
|
|
5
|
+
export interface VerticalRuntimeNamespace {
|
|
6
|
+
published(key: string, options?: RequestOptions): Promise<{
|
|
7
|
+
data: RuntimeManifest;
|
|
8
|
+
}>;
|
|
9
|
+
preview(sessionId: string, options?: RequestOptions): Promise<{
|
|
10
|
+
data: RuntimeInterpretation;
|
|
11
|
+
}>;
|
|
12
|
+
/** A draft may be partial, so any object is accepted; core names what is wrong. */
|
|
13
|
+
interpret(document: BlueprintDocument | Record<string, unknown>, options?: RequestOptions): Promise<{
|
|
14
|
+
data: RuntimeInterpretation;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export declare function createVerticalRuntimeNamespace(http: Http): VerticalRuntimeNamespace;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function createVerticalRuntimeNamespace(http) {
|
|
2
|
+
const segment = encodeURIComponent;
|
|
3
|
+
return {
|
|
4
|
+
published: (key, options) => http.get(`/api/vertical-runtime/apps/${segment(key)}`, options),
|
|
5
|
+
preview: (sessionId, options) => http.get(`/api/vertical-runtime/previews/${segment(sessionId)}`, options),
|
|
6
|
+
interpret: (document, options) => http.post('/api/vertical-runtime/interpret', { document }, options),
|
|
7
|
+
};
|
|
8
|
+
}
|