@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,141 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_PAGE_SIZE = 100;
|
|
4
|
+
|
|
5
|
+
export const MAXIMUM_PAGES_WALKED = 50;
|
|
6
|
+
|
|
7
|
+
export const MAXIMUM_ROWS_WALKED = DEFAULT_PAGE_SIZE * MAXIMUM_PAGES_WALKED;
|
|
8
|
+
|
|
9
|
+
function isEnvelope(value) {
|
|
10
|
+
return !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function paginationField(response, field) {
|
|
14
|
+
if (!response || !isEnvelope(response))
|
|
15
|
+
return undefined;
|
|
16
|
+
const nested = response.meta;
|
|
17
|
+
if (nested && typeof nested[field] === 'number')
|
|
18
|
+
return nested[field];
|
|
19
|
+
const flat = response[field];
|
|
20
|
+
return typeof flat === 'number' ? flat : undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function items(response) {
|
|
24
|
+
if (!response)
|
|
25
|
+
return [];
|
|
26
|
+
if (Array.isArray(response))
|
|
27
|
+
return response;
|
|
28
|
+
return response.data ?? [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function totalCount(response) {
|
|
32
|
+
if (!response)
|
|
33
|
+
return 0;
|
|
34
|
+
if (Array.isArray(response))
|
|
35
|
+
return response.length;
|
|
36
|
+
return paginationField(response, 'total') ?? items(response).length;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function currentPage(response) {
|
|
40
|
+
return paginationField(response, 'current_page') ?? 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function lastPage(response) {
|
|
44
|
+
return paginationField(response, 'last_page') ?? 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function hasMorePages(response) {
|
|
48
|
+
return currentPage(response) < lastPage(response);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function withPageQuery(path, page, perPage = DEFAULT_PAGE_SIZE) {
|
|
52
|
+
const separator = path.includes('?') ? '&' : '?';
|
|
53
|
+
return `${path}${separator}page=${page}&per_page=${perPage}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function walkAllPages(fetchPage, bounds = {}) {
|
|
57
|
+
const perPage = bounds.perPage ?? DEFAULT_PAGE_SIZE;
|
|
58
|
+
const maxPages = bounds.maxPages ?? MAXIMUM_PAGES_WALKED;
|
|
59
|
+
const maxRows = bounds.maxRows ?? MAXIMUM_ROWS_WALKED;
|
|
60
|
+
const rows = [];
|
|
61
|
+
let page = 1;
|
|
62
|
+
let rowsTotal = 0;
|
|
63
|
+
for (;;) {
|
|
64
|
+
const response = await fetchPage(page, perPage);
|
|
65
|
+
rows.push(...items(response));
|
|
66
|
+
rowsTotal = totalCount(response);
|
|
67
|
+
const stop = (outcome) => ({
|
|
68
|
+
rows,
|
|
69
|
+
complete: outcome === 'exhausted',
|
|
70
|
+
outcome,
|
|
71
|
+
rowsLoaded: rows.length,
|
|
72
|
+
|
|
73
|
+
rowsTotal: outcome === 'exhausted' ? rows.length : rowsTotal,
|
|
74
|
+
pagesFetched: page,
|
|
75
|
+
});
|
|
76
|
+
if (!hasMorePages(response))
|
|
77
|
+
return stop('exhausted');
|
|
78
|
+
if (page >= maxPages)
|
|
79
|
+
return stop('page-cap');
|
|
80
|
+
if (rows.length >= maxRows)
|
|
81
|
+
return stop('row-cap');
|
|
82
|
+
page += 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export async function listAllPages(list, query, bounds = {}) {
|
|
87
|
+
let lastResponse;
|
|
88
|
+
const walk = await walkAllPages(async (page, perPage) => {
|
|
89
|
+
lastResponse = await list({ ...(query ?? {}), page, per_page: perPage });
|
|
90
|
+
|
|
91
|
+
if (page > 1 && hasMorePages(lastResponse) && currentPage(lastResponse) !== page) {
|
|
92
|
+
throw new Error(`listAllPages asked for page ${page} and received page ${currentPage(lastResponse)}; the list function does not forward \`page\`.`);
|
|
93
|
+
}
|
|
94
|
+
return lastResponse;
|
|
95
|
+
}, bounds);
|
|
96
|
+
const { rows, ...report } = walk;
|
|
97
|
+
if (!walk.complete) {
|
|
98
|
+
console.warn(`listAllPages stopped at a bound (${walk.outcome}): ${walk.rowsLoaded} of ${walk.rowsTotal} rows loaded.`);
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(lastResponse)) {
|
|
101
|
+
return Object.assign(rows, { pageWalk: report });
|
|
102
|
+
}
|
|
103
|
+
const envelope = { ...lastResponse, data: rows, pageWalk: report };
|
|
104
|
+
const rangeFields = { from: rows.length > 0 ? 1 : null, to: rows.length };
|
|
105
|
+
if (envelope.meta && typeof envelope.meta === 'object') {
|
|
106
|
+
const meta = envelope.meta;
|
|
107
|
+
envelope.meta = 'from' in meta ? { ...meta, ...rangeFields } : { ...meta };
|
|
108
|
+
}
|
|
109
|
+
else if ('from' in envelope) {
|
|
110
|
+
Object.assign(envelope, rangeFields);
|
|
111
|
+
}
|
|
112
|
+
return envelope;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export async function fetchAllPages(fetchPage, onTruncated, perPage = DEFAULT_PAGE_SIZE) {
|
|
116
|
+
const walk = await walkAllPages(fetchPage, { perPage });
|
|
117
|
+
if (!walk.complete)
|
|
118
|
+
onTruncated(walk.rowsLoaded, walk.rowsTotal);
|
|
119
|
+
return walk.rows;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const SEARCH_PAGE_SIZE = 20;
|
|
123
|
+
|
|
124
|
+
export async function searchFirstPage(list, text, query, pageSize = SEARCH_PAGE_SIZE) {
|
|
125
|
+
const trimmed = text.trim();
|
|
126
|
+
const request = { ...(query ?? {}), page: 1, per_page: pageSize };
|
|
127
|
+
if (trimmed !== '')
|
|
128
|
+
request.search = trimmed;
|
|
129
|
+
return items(await list(request));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function singleRecord(response) {
|
|
133
|
+
if (response === null || response === undefined)
|
|
134
|
+
return null;
|
|
135
|
+
if (typeof response === 'object' && 'data' in response) {
|
|
136
|
+
const inner = response.data;
|
|
137
|
+
if (inner !== null && typeof inner === 'object' && !Array.isArray(inner))
|
|
138
|
+
return inner;
|
|
139
|
+
}
|
|
140
|
+
return response;
|
|
141
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/** The ten attribute types (`FieldType` in core). */
|
|
2
|
+
export type PartyFieldType = 'string' | 'text' | 'int' | 'decimal' | 'money' | 'bool' | 'date' | 'datetime' | 'enum' | 'ref';
|
|
3
|
+
/** How personal a field is. Decides what erasure clears and what the audit trail redacts. */
|
|
4
|
+
export type PartyPiiClass = 'none' | 'personal' | 'sensitive';
|
|
5
|
+
/** One baseline definition, exactly as the lock file records it. */
|
|
6
|
+
export interface PartyBaselineDefinition {
|
|
7
|
+
/** `party:person`, `party:organization`, `party:*`, `role:<role>` or `role:*`. */
|
|
8
|
+
targets: readonly string[];
|
|
9
|
+
type: PartyFieldType;
|
|
10
|
+
pii: PartyPiiClass;
|
|
11
|
+
/** Where the value lives: on the party row, or on a role span. */
|
|
12
|
+
scope: 'party' | 'role';
|
|
13
|
+
}
|
|
14
|
+
/** The lock file, key for key. Sorted as the lock file is. */
|
|
15
|
+
export declare const PARTY_BASELINE_DEFINITIONS: {
|
|
16
|
+
readonly address_city: {
|
|
17
|
+
readonly targets: readonly ["party:*"];
|
|
18
|
+
readonly type: "string";
|
|
19
|
+
readonly pii: "personal";
|
|
20
|
+
readonly scope: "party";
|
|
21
|
+
};
|
|
22
|
+
readonly address_country: {
|
|
23
|
+
readonly targets: readonly ["party:*"];
|
|
24
|
+
readonly type: "string";
|
|
25
|
+
readonly pii: "personal";
|
|
26
|
+
readonly scope: "party";
|
|
27
|
+
};
|
|
28
|
+
readonly address_line1: {
|
|
29
|
+
readonly targets: readonly ["party:*"];
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
readonly pii: "personal";
|
|
32
|
+
readonly scope: "party";
|
|
33
|
+
};
|
|
34
|
+
readonly address_line2: {
|
|
35
|
+
readonly targets: readonly ["party:*"];
|
|
36
|
+
readonly type: "string";
|
|
37
|
+
readonly pii: "personal";
|
|
38
|
+
readonly scope: "party";
|
|
39
|
+
};
|
|
40
|
+
readonly address_postcode: {
|
|
41
|
+
readonly targets: readonly ["party:*"];
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly pii: "personal";
|
|
44
|
+
readonly scope: "party";
|
|
45
|
+
};
|
|
46
|
+
readonly address_region: {
|
|
47
|
+
readonly targets: readonly ["party:*"];
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
readonly pii: "personal";
|
|
50
|
+
readonly scope: "party";
|
|
51
|
+
};
|
|
52
|
+
readonly company_size: {
|
|
53
|
+
readonly targets: readonly ["party:organization"];
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
readonly pii: "none";
|
|
56
|
+
readonly scope: "party";
|
|
57
|
+
};
|
|
58
|
+
readonly date_of_birth: {
|
|
59
|
+
readonly targets: readonly ["party:person"];
|
|
60
|
+
readonly type: "date";
|
|
61
|
+
readonly pii: "personal";
|
|
62
|
+
readonly scope: "party";
|
|
63
|
+
};
|
|
64
|
+
readonly default_duration_minutes: {
|
|
65
|
+
readonly targets: readonly ["role:client"];
|
|
66
|
+
readonly type: "int";
|
|
67
|
+
readonly pii: "none";
|
|
68
|
+
readonly scope: "role";
|
|
69
|
+
};
|
|
70
|
+
readonly display_name_ar: {
|
|
71
|
+
readonly targets: readonly ["party:*"];
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly pii: "personal";
|
|
74
|
+
readonly scope: "party";
|
|
75
|
+
};
|
|
76
|
+
readonly employment_type: {
|
|
77
|
+
readonly targets: readonly ["role:employee", "role:practitioner"];
|
|
78
|
+
readonly type: "enum";
|
|
79
|
+
readonly pii: "none";
|
|
80
|
+
readonly scope: "role";
|
|
81
|
+
};
|
|
82
|
+
readonly family_name: {
|
|
83
|
+
readonly targets: readonly ["party:person"];
|
|
84
|
+
readonly type: "string";
|
|
85
|
+
readonly pii: "personal";
|
|
86
|
+
readonly scope: "party";
|
|
87
|
+
};
|
|
88
|
+
readonly family_name_ar: {
|
|
89
|
+
readonly targets: readonly ["party:person"];
|
|
90
|
+
readonly type: "string";
|
|
91
|
+
readonly pii: "personal";
|
|
92
|
+
readonly scope: "party";
|
|
93
|
+
};
|
|
94
|
+
readonly gender: {
|
|
95
|
+
readonly targets: readonly ["party:person"];
|
|
96
|
+
readonly type: "enum";
|
|
97
|
+
readonly pii: "sensitive";
|
|
98
|
+
readonly scope: "party";
|
|
99
|
+
};
|
|
100
|
+
readonly given_name: {
|
|
101
|
+
readonly targets: readonly ["party:person"];
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly pii: "personal";
|
|
104
|
+
readonly scope: "party";
|
|
105
|
+
};
|
|
106
|
+
readonly given_name_ar: {
|
|
107
|
+
readonly targets: readonly ["party:person"];
|
|
108
|
+
readonly type: "string";
|
|
109
|
+
readonly pii: "personal";
|
|
110
|
+
readonly scope: "party";
|
|
111
|
+
};
|
|
112
|
+
readonly industry: {
|
|
113
|
+
readonly targets: readonly ["party:organization"];
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
readonly pii: "none";
|
|
116
|
+
readonly scope: "party";
|
|
117
|
+
};
|
|
118
|
+
readonly is_senior: {
|
|
119
|
+
readonly targets: readonly ["role:practitioner"];
|
|
120
|
+
readonly type: "bool";
|
|
121
|
+
readonly pii: "none";
|
|
122
|
+
readonly scope: "role";
|
|
123
|
+
};
|
|
124
|
+
readonly job_title: {
|
|
125
|
+
readonly targets: readonly ["role:contact", "role:employee"];
|
|
126
|
+
readonly type: "string";
|
|
127
|
+
readonly pii: "none";
|
|
128
|
+
readonly scope: "role";
|
|
129
|
+
};
|
|
130
|
+
readonly last_booked_at: {
|
|
131
|
+
readonly targets: readonly ["role:client"];
|
|
132
|
+
readonly type: "datetime";
|
|
133
|
+
readonly pii: "none";
|
|
134
|
+
readonly scope: "role";
|
|
135
|
+
};
|
|
136
|
+
readonly lead_source_id: {
|
|
137
|
+
readonly targets: readonly ["role:contact"];
|
|
138
|
+
readonly type: "ref";
|
|
139
|
+
readonly pii: "none";
|
|
140
|
+
readonly scope: "role";
|
|
141
|
+
};
|
|
142
|
+
readonly ledger_counterparty_id: {
|
|
143
|
+
readonly targets: readonly ["party:*"];
|
|
144
|
+
readonly type: "ref";
|
|
145
|
+
readonly pii: "none";
|
|
146
|
+
readonly scope: "party";
|
|
147
|
+
};
|
|
148
|
+
readonly legal_name: {
|
|
149
|
+
readonly targets: readonly ["party:*"];
|
|
150
|
+
readonly type: "string";
|
|
151
|
+
readonly pii: "personal";
|
|
152
|
+
readonly scope: "party";
|
|
153
|
+
};
|
|
154
|
+
readonly member_since: {
|
|
155
|
+
readonly targets: readonly ["role:member"];
|
|
156
|
+
readonly type: "date";
|
|
157
|
+
readonly pii: "none";
|
|
158
|
+
readonly scope: "role";
|
|
159
|
+
};
|
|
160
|
+
readonly national_id: {
|
|
161
|
+
readonly targets: readonly ["party:person"];
|
|
162
|
+
readonly type: "string";
|
|
163
|
+
readonly pii: "personal";
|
|
164
|
+
readonly scope: "party";
|
|
165
|
+
};
|
|
166
|
+
readonly nationality: {
|
|
167
|
+
readonly targets: readonly ["party:person"];
|
|
168
|
+
readonly type: "string";
|
|
169
|
+
readonly pii: "personal";
|
|
170
|
+
readonly scope: "party";
|
|
171
|
+
};
|
|
172
|
+
readonly notes: {
|
|
173
|
+
readonly targets: readonly ["role:*"];
|
|
174
|
+
readonly type: "text";
|
|
175
|
+
readonly pii: "personal";
|
|
176
|
+
readonly scope: "role";
|
|
177
|
+
};
|
|
178
|
+
readonly registration_no: {
|
|
179
|
+
readonly targets: readonly ["party:organization"];
|
|
180
|
+
readonly type: "string";
|
|
181
|
+
readonly pii: "none";
|
|
182
|
+
readonly scope: "party";
|
|
183
|
+
};
|
|
184
|
+
readonly specialty: {
|
|
185
|
+
readonly targets: readonly ["role:practitioner"];
|
|
186
|
+
readonly type: "string";
|
|
187
|
+
readonly pii: "none";
|
|
188
|
+
readonly scope: "role";
|
|
189
|
+
};
|
|
190
|
+
readonly standing: {
|
|
191
|
+
readonly targets: readonly ["role:member"];
|
|
192
|
+
readonly type: "enum";
|
|
193
|
+
readonly pii: "none";
|
|
194
|
+
readonly scope: "role";
|
|
195
|
+
};
|
|
196
|
+
readonly tax_number: {
|
|
197
|
+
readonly targets: readonly ["party:*"];
|
|
198
|
+
readonly type: "string";
|
|
199
|
+
readonly pii: "personal";
|
|
200
|
+
readonly scope: "party";
|
|
201
|
+
};
|
|
202
|
+
readonly website: {
|
|
203
|
+
readonly targets: readonly ["party:organization"];
|
|
204
|
+
readonly type: "string";
|
|
205
|
+
readonly pii: "none";
|
|
206
|
+
readonly scope: "party";
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
type Definitions = typeof PARTY_BASELINE_DEFINITIONS;
|
|
210
|
+
/** The wire value of one type, in its stored canonical form. */
|
|
211
|
+
export type PartyFieldValue<T extends PartyFieldType> = T extends 'int' ? number : T extends 'bool' ? boolean : string;
|
|
212
|
+
/** Any attribute value on the wire — what a tenant or app key holds when no type is known. */
|
|
213
|
+
export type PartyAttributeValue = string | number | boolean;
|
|
214
|
+
/** Every baseline key. */
|
|
215
|
+
export type PartyBaselineKey = keyof Definitions;
|
|
216
|
+
/** Baseline keys living on the PARTY row. */
|
|
217
|
+
export type PartyBaselinePartyKey = {
|
|
218
|
+
[K in PartyBaselineKey]: Definitions[K]['scope'] extends 'party' ? K : never;
|
|
219
|
+
}[PartyBaselineKey];
|
|
220
|
+
/** Baseline keys living on a ROLE span. */
|
|
221
|
+
export type PartyBaselineRoleKey = {
|
|
222
|
+
[K in PartyBaselineKey]: Definitions[K]['scope'] extends 'role' ? K : never;
|
|
223
|
+
}[PartyBaselineKey];
|
|
224
|
+
/** The typed half of a party's `attributes`: every baseline party key, optional. */
|
|
225
|
+
export type PartyBaselinePartyAttributes = {
|
|
226
|
+
[K in PartyBaselinePartyKey]?: PartyFieldValue<Definitions[K]['type']>;
|
|
227
|
+
};
|
|
228
|
+
/** The typed half of a role's `attributes`: every baseline role key, optional. */
|
|
229
|
+
export type PartyBaselineRoleAttributes = {
|
|
230
|
+
[K in PartyBaselineRoleKey]?: PartyFieldValue<Definitions[K]['type']>;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* A party's `attributes` as published: baseline keys typed, tenant and app keys open.
|
|
234
|
+
* Every key optional — absent means not recorded or withheld; see `attributes_withheld`.
|
|
235
|
+
*/
|
|
236
|
+
export type PartyAttributes = PartyBaselinePartyAttributes & Record<string, PartyAttributeValue | undefined>;
|
|
237
|
+
/** A role's `attributes` as published. Same rules as {@link PartyAttributes}. */
|
|
238
|
+
export type PartyRoleAttributes = PartyBaselineRoleAttributes & Record<string, PartyAttributeValue | undefined>;
|
|
239
|
+
/**
|
|
240
|
+
* An attribute PATCH: only the keys being changed. `null` CLEARS a key; an omitted key is left
|
|
241
|
+
* untouched. Friendlier spellings are accepted and canonicalised by the server (`17/04/1990`,
|
|
242
|
+
* Arabic-Indic digits, a number for a decimal).
|
|
243
|
+
*/
|
|
244
|
+
export type PartyAttributePatch = Record<string, PartyAttributeValue | null>;
|
|
245
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export const PARTY_BASELINE_DEFINITIONS = {
|
|
4
|
+
address_city: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
5
|
+
address_country: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
6
|
+
address_line1: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
7
|
+
address_line2: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
8
|
+
address_postcode: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
9
|
+
address_region: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
10
|
+
company_size: { targets: ['party:organization'], type: 'string', pii: 'none', scope: 'party' },
|
|
11
|
+
date_of_birth: { targets: ['party:person'], type: 'date', pii: 'personal', scope: 'party' },
|
|
12
|
+
default_duration_minutes: { targets: ['role:client'], type: 'int', pii: 'none', scope: 'role' },
|
|
13
|
+
display_name_ar: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
14
|
+
employment_type: { targets: ['role:employee', 'role:practitioner'], type: 'enum', pii: 'none', scope: 'role' },
|
|
15
|
+
family_name: { targets: ['party:person'], type: 'string', pii: 'personal', scope: 'party' },
|
|
16
|
+
family_name_ar: { targets: ['party:person'], type: 'string', pii: 'personal', scope: 'party' },
|
|
17
|
+
gender: { targets: ['party:person'], type: 'enum', pii: 'sensitive', scope: 'party' },
|
|
18
|
+
given_name: { targets: ['party:person'], type: 'string', pii: 'personal', scope: 'party' },
|
|
19
|
+
given_name_ar: { targets: ['party:person'], type: 'string', pii: 'personal', scope: 'party' },
|
|
20
|
+
industry: { targets: ['party:organization'], type: 'string', pii: 'none', scope: 'party' },
|
|
21
|
+
is_senior: { targets: ['role:practitioner'], type: 'bool', pii: 'none', scope: 'role' },
|
|
22
|
+
job_title: { targets: ['role:contact', 'role:employee'], type: 'string', pii: 'none', scope: 'role' },
|
|
23
|
+
last_booked_at: { targets: ['role:client'], type: 'datetime', pii: 'none', scope: 'role' },
|
|
24
|
+
lead_source_id: { targets: ['role:contact'], type: 'ref', pii: 'none', scope: 'role' },
|
|
25
|
+
ledger_counterparty_id: { targets: ['party:*'], type: 'ref', pii: 'none', scope: 'party' },
|
|
26
|
+
legal_name: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
27
|
+
member_since: { targets: ['role:member'], type: 'date', pii: 'none', scope: 'role' },
|
|
28
|
+
national_id: { targets: ['party:person'], type: 'string', pii: 'personal', scope: 'party' },
|
|
29
|
+
nationality: { targets: ['party:person'], type: 'string', pii: 'personal', scope: 'party' },
|
|
30
|
+
notes: { targets: ['role:*'], type: 'text', pii: 'personal', scope: 'role' },
|
|
31
|
+
registration_no: { targets: ['party:organization'], type: 'string', pii: 'none', scope: 'party' },
|
|
32
|
+
specialty: { targets: ['role:practitioner'], type: 'string', pii: 'none', scope: 'role' },
|
|
33
|
+
standing: { targets: ['role:member'], type: 'enum', pii: 'none', scope: 'role' },
|
|
34
|
+
tax_number: { targets: ['party:*'], type: 'string', pii: 'personal', scope: 'party' },
|
|
35
|
+
website: { targets: ['party:organization'], type: 'string', pii: 'none', scope: 'party' },
|
|
36
|
+
};
|