@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
package/dist/actors.d.ts
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { type Http, type QueryParams, type RequestOptions } from './http.js';
|
|
2
|
+
import { type ListPage, type ListQueryState } from './list-query.js';
|
|
3
|
+
import type { MediaAsset, MediaNamespace, MediaUploadBody, MediaUploadOptions } from './media.js';
|
|
4
|
+
/** The vendor media type the person-domain routes are written against: the same v1 every call names. */
|
|
5
|
+
export declare const PERSON_DOMAIN_MEDIA_TYPE = "application/vnd.nuwah.v1+json";
|
|
6
|
+
/** The header core reads the acting profile from (`ResolvesActingContext::HEADER`). */
|
|
7
|
+
export declare const ACTING_AS_HEADER = "X-Acting-As";
|
|
8
|
+
/** Which kind of party a reference names. */
|
|
9
|
+
export type PartyKind = 'person' | 'actor' | 'organisation';
|
|
10
|
+
/** A party as a string: `actor:6f1c…`, `person:0b2e…`. The form request bodies and headers use. */
|
|
11
|
+
export type PartyReferenceString = `${PartyKind}:${string}`;
|
|
12
|
+
/** A party as an object: the form connection, reaction and publication rows use. */
|
|
13
|
+
export interface PartyReference {
|
|
14
|
+
kind: PartyKind;
|
|
15
|
+
id: string;
|
|
16
|
+
}
|
|
17
|
+
/** `{kind, id}` → `kind:id`. */
|
|
18
|
+
export declare function partyReferenceToString(party: PartyReference): PartyReferenceString;
|
|
19
|
+
/** `kind:id` → `{kind, id}`; null for anything that is not a well-formed reference. */
|
|
20
|
+
export declare function parsePartyReference(value: string): PartyReference | null;
|
|
21
|
+
/** Per-call options shared by every person-domain namespace. */
|
|
22
|
+
export interface PersonDomainCallOptions {
|
|
23
|
+
/** Act through this profile (`actor:<uuid>`). Absent or null: act as the bare person. */
|
|
24
|
+
actingAs?: PartyReferenceString | null;
|
|
25
|
+
/** Writes only. Pass the SAME key when retrying the same intent. */
|
|
26
|
+
idempotencyKey?: string;
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
/** A fresh idempotency key: a UUID where the runtime has one, a random token where it does not. */
|
|
30
|
+
export declare function newIdempotencyKey(): string;
|
|
31
|
+
/**
|
|
32
|
+
* The request options for one person-domain call: the version Accept header, the acting header
|
|
33
|
+
* when given, and — for writes — an `Idempotency-Key` (the caller's, or a minted one).
|
|
34
|
+
*/
|
|
35
|
+
export declare function personDomainRequest(options?: PersonDomainCallOptions, write?: boolean, params?: QueryParams): RequestOptions;
|
|
36
|
+
/** `{data: T}` — the envelope a single JsonResource answers with. */
|
|
37
|
+
export interface PersonDomainEnvelope<T> {
|
|
38
|
+
data: T;
|
|
39
|
+
}
|
|
40
|
+
/** A cursor page: `{data, next_cursor}`. Follow `next_cursor` until null; never count rows. */
|
|
41
|
+
export interface PersonDomainCursorPage<T> {
|
|
42
|
+
data: T[];
|
|
43
|
+
next_cursor: string | null;
|
|
44
|
+
}
|
|
45
|
+
/** A pair in both languages. */
|
|
46
|
+
export interface BilingualText {
|
|
47
|
+
en: string;
|
|
48
|
+
ar: string;
|
|
49
|
+
}
|
|
50
|
+
export type ActorVisibility = 'public' | 'private';
|
|
51
|
+
export type ActorStatus = 'active' | 'suspended' | 'closed';
|
|
52
|
+
export type ActorMembershipState = 'invited' | 'awaiting_confirmation' | 'active' | 'declined' | 'ended';
|
|
53
|
+
export type ActorMembershipEnding = 'removed' | 'left' | 'erased' | 'actor_closed' | 'invitation_withdrawn';
|
|
54
|
+
/** The display summary of one party: what a feed row, a list or a mention renders. */
|
|
55
|
+
export interface ActorSummary {
|
|
56
|
+
reference: PartyReferenceString;
|
|
57
|
+
handle: string | null;
|
|
58
|
+
display_name: BilingualText;
|
|
59
|
+
personal_name: string | null;
|
|
60
|
+
avatar_url: string | null;
|
|
61
|
+
profile_kind: string;
|
|
62
|
+
verified: boolean;
|
|
63
|
+
visibility: ActorVisibility;
|
|
64
|
+
}
|
|
65
|
+
/** A profile picture as the Media pipeline describes it — the image fields of {@link MediaAsset}. */
|
|
66
|
+
export type ActorPictureView = Pick<MediaAsset, 'id' | 'kind' | 'status' | 'mime_type' | 'width' | 'height' | 'alt_text' | 'placeholder' | 'sources'> & {
|
|
67
|
+
duration_milliseconds: null;
|
|
68
|
+
poster: [];
|
|
69
|
+
renditions: [];
|
|
70
|
+
};
|
|
71
|
+
/** One actor as the viewer may see it. Member-only fields are null for a stranger. */
|
|
72
|
+
export interface Actor {
|
|
73
|
+
id: string;
|
|
74
|
+
reference: PartyReferenceString;
|
|
75
|
+
handle: string;
|
|
76
|
+
profile_kind: string;
|
|
77
|
+
display_name: BilingualText;
|
|
78
|
+
personal_name: string | null;
|
|
79
|
+
bio: string | null;
|
|
80
|
+
avatar_url: string | null;
|
|
81
|
+
visibility: ActorVisibility;
|
|
82
|
+
verified: boolean;
|
|
83
|
+
status: ActorStatus;
|
|
84
|
+
linked_to_organisation: boolean;
|
|
85
|
+
organisation_id: string | null;
|
|
86
|
+
attributes: Record<string, unknown>;
|
|
87
|
+
viewer: {
|
|
88
|
+
is_member: boolean;
|
|
89
|
+
capabilities: string[];
|
|
90
|
+
};
|
|
91
|
+
/** Set when the actor was reached through a retired handle. */
|
|
92
|
+
redirected_from_handle: string | null;
|
|
93
|
+
created_at: string;
|
|
94
|
+
updated_at: string;
|
|
95
|
+
avatar?: ActorPictureView | null;
|
|
96
|
+
cover_url?: string | null;
|
|
97
|
+
cover?: ActorPictureView | null;
|
|
98
|
+
category?: ActorCategory | null;
|
|
99
|
+
tags?: string[];
|
|
100
|
+
languages?: string[];
|
|
101
|
+
links?: ActorLink[];
|
|
102
|
+
contact_actions?: ActorContactAction[];
|
|
103
|
+
/** Members see the exact location; strangers the coarsened public one (or null). */
|
|
104
|
+
location?: ActorLocation | null;
|
|
105
|
+
opening_hours?: ActorOpeningHours;
|
|
106
|
+
directory_listing?: ActorDirectoryListing;
|
|
107
|
+
/** Members only: the kind's required fields still empty (advisory, never a refusal). */
|
|
108
|
+
missing_required_fields?: ActorProfileFieldKey[];
|
|
109
|
+
}
|
|
110
|
+
/** A core profile field a kind may offer or require. */
|
|
111
|
+
export type ActorProfileFieldKey = 'bio' | 'avatar' | 'cover' | 'category' | 'links' | 'contact_actions' | 'location' | 'opening_hours' | 'languages';
|
|
112
|
+
export type ActorLocationPrecision = 'exact' | 'approximate' | 'locality' | 'hidden';
|
|
113
|
+
export type ActorDirectoryListing = 'listed' | 'unlisted';
|
|
114
|
+
export type ActorContactValueKind = 'phone' | 'email' | 'url' | 'none';
|
|
115
|
+
export type WeekdayKey = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
|
|
116
|
+
export interface ActorCategory {
|
|
117
|
+
key: string;
|
|
118
|
+
label: BilingualText;
|
|
119
|
+
}
|
|
120
|
+
export interface ActorLink {
|
|
121
|
+
/** `https://` or `http://` only; the order given is the order shown. */
|
|
122
|
+
url: string;
|
|
123
|
+
label: string | null;
|
|
124
|
+
}
|
|
125
|
+
export interface ActorContactAction {
|
|
126
|
+
/** A declared type key (`GET /declarations` → `contact_action_types`). */
|
|
127
|
+
type: string;
|
|
128
|
+
value: string | null;
|
|
129
|
+
label?: BilingualText;
|
|
130
|
+
value_kind?: ActorContactValueKind;
|
|
131
|
+
}
|
|
132
|
+
export interface ActorAddress {
|
|
133
|
+
line1?: string;
|
|
134
|
+
line2?: string;
|
|
135
|
+
locality?: string;
|
|
136
|
+
region?: string;
|
|
137
|
+
postal_code?: string;
|
|
138
|
+
country_code?: string;
|
|
139
|
+
}
|
|
140
|
+
export interface ActorLocation {
|
|
141
|
+
address: ActorAddress;
|
|
142
|
+
latitude: number | null;
|
|
143
|
+
longitude: number | null;
|
|
144
|
+
precision: ActorLocationPrecision;
|
|
145
|
+
/** True for members (the stored point); false for the public view. */
|
|
146
|
+
exact: boolean;
|
|
147
|
+
}
|
|
148
|
+
/** Local wall times `HH:MM`; `closes` earlier than `opens` runs past midnight; `24:00` ends the day. */
|
|
149
|
+
export interface OpeningInterval {
|
|
150
|
+
opens: string;
|
|
151
|
+
closes: string;
|
|
152
|
+
}
|
|
153
|
+
export type WeeklyHours = Partial<Record<WeekdayKey, OpeningInterval[]>>;
|
|
154
|
+
export interface ActorOpeningStatus {
|
|
155
|
+
state: 'open' | 'closed' | 'unknown';
|
|
156
|
+
/** When the state next changes (ISO 8601 with offset), when known. */
|
|
157
|
+
changes_at: string | null;
|
|
158
|
+
}
|
|
159
|
+
export interface ActorOpeningHours {
|
|
160
|
+
time_zone: string | null;
|
|
161
|
+
weekly: WeeklyHours | null;
|
|
162
|
+
status: ActorOpeningStatus;
|
|
163
|
+
}
|
|
164
|
+
export interface ActorContactActionType {
|
|
165
|
+
key: string;
|
|
166
|
+
label: BilingualText;
|
|
167
|
+
value_kind: ActorContactValueKind;
|
|
168
|
+
requires_location: boolean;
|
|
169
|
+
}
|
|
170
|
+
export interface ActorProfileKindDeclaration {
|
|
171
|
+
key: string;
|
|
172
|
+
label: BilingualText;
|
|
173
|
+
personal_name: boolean;
|
|
174
|
+
may_link_organisation: boolean;
|
|
175
|
+
offered_fields?: ActorProfileFieldKey[];
|
|
176
|
+
required_fields?: ActorProfileFieldKey[];
|
|
177
|
+
}
|
|
178
|
+
/** One directory or mention hit: the summary plus the PUBLIC rich profile. */
|
|
179
|
+
export interface ActorDirectoryEntry {
|
|
180
|
+
actor: ActorSummary;
|
|
181
|
+
cover_url: string | null;
|
|
182
|
+
category: ActorCategory | null;
|
|
183
|
+
tags: string[];
|
|
184
|
+
languages: string[];
|
|
185
|
+
links: ActorLink[];
|
|
186
|
+
contact_actions: ActorContactAction[];
|
|
187
|
+
location: ActorLocation | null;
|
|
188
|
+
opening_hours: ActorOpeningHours;
|
|
189
|
+
directory_listing: ActorDirectoryListing;
|
|
190
|
+
missing_required_fields: ActorProfileFieldKey[];
|
|
191
|
+
distance_metres: number | null;
|
|
192
|
+
/** 0–100: how close the viewer is (mentions); 0 in the directory. */
|
|
193
|
+
proximity: number;
|
|
194
|
+
}
|
|
195
|
+
/** `near` beside the directory list: radius 0.1–100 km, default 10. */
|
|
196
|
+
export interface ActorDirectoryNear {
|
|
197
|
+
latitude: number;
|
|
198
|
+
longitude: number;
|
|
199
|
+
radius_kilometres?: number;
|
|
200
|
+
}
|
|
201
|
+
export interface ActorLocationRequest {
|
|
202
|
+
address?: ActorAddress | null;
|
|
203
|
+
latitude?: number | null;
|
|
204
|
+
longitude?: number | null;
|
|
205
|
+
/** Absent: keeps the current precision, or the declared default for a new location. */
|
|
206
|
+
precision?: ActorLocationPrecision | null;
|
|
207
|
+
}
|
|
208
|
+
export interface ActorOpeningExceptionRequest {
|
|
209
|
+
closed: boolean;
|
|
210
|
+
intervals?: OpeningInterval[];
|
|
211
|
+
label?: Partial<BilingualText> | null;
|
|
212
|
+
}
|
|
213
|
+
export type ActorVerificationState = 'pending' | 'approved' | 'rejected' | 'withdrawn';
|
|
214
|
+
export interface ActorVerificationRequest {
|
|
215
|
+
id: string;
|
|
216
|
+
actor: PartyReferenceString;
|
|
217
|
+
state: ActorVerificationState;
|
|
218
|
+
evidence_note: string | null;
|
|
219
|
+
evidence_links: string[];
|
|
220
|
+
requested_at: string;
|
|
221
|
+
decided_at: string | null;
|
|
222
|
+
decision_reason: string | null;
|
|
223
|
+
withdrawn_at: string | null;
|
|
224
|
+
/** Operator reads only; always null for members. */
|
|
225
|
+
decided_by_operator: string | null;
|
|
226
|
+
}
|
|
227
|
+
/** The fields a profile can carry beyond its names — sent on create (the wizard) and on PATCH. */
|
|
228
|
+
export interface ActorProfileDetailChanges {
|
|
229
|
+
category_key?: string | null;
|
|
230
|
+
tags?: string[] | null;
|
|
231
|
+
languages?: string[] | null;
|
|
232
|
+
links?: Array<{
|
|
233
|
+
url: string;
|
|
234
|
+
label?: string | null;
|
|
235
|
+
}> | null;
|
|
236
|
+
contact_actions?: Array<{
|
|
237
|
+
type: string;
|
|
238
|
+
value?: string | null;
|
|
239
|
+
}> | null;
|
|
240
|
+
directory_listing?: ActorDirectoryListing;
|
|
241
|
+
}
|
|
242
|
+
export interface ActorMembership {
|
|
243
|
+
membership_id: string;
|
|
244
|
+
actor_id: string;
|
|
245
|
+
person_id: string;
|
|
246
|
+
role_key: string;
|
|
247
|
+
capabilities: string[];
|
|
248
|
+
state: ActorMembershipState;
|
|
249
|
+
requires_confirmation: boolean;
|
|
250
|
+
invited_at: string;
|
|
251
|
+
accepted_at: string | null;
|
|
252
|
+
confirmed_at: string | null;
|
|
253
|
+
ended_at: string | null;
|
|
254
|
+
ending_reason: ActorMembershipEnding | null;
|
|
255
|
+
}
|
|
256
|
+
/** One row of "my profiles": the membership, and the actor (null when it cannot be described). */
|
|
257
|
+
export interface MyActorRow {
|
|
258
|
+
membership: ActorMembership;
|
|
259
|
+
actor: ActorSummary | null;
|
|
260
|
+
}
|
|
261
|
+
export interface ActorInvitation {
|
|
262
|
+
membership_id: string;
|
|
263
|
+
actor: ActorSummary;
|
|
264
|
+
role_key: string;
|
|
265
|
+
requires_confirmation: boolean;
|
|
266
|
+
invited_at: string;
|
|
267
|
+
}
|
|
268
|
+
export interface ActorDeclarations {
|
|
269
|
+
profile_kinds: ActorProfileKindDeclaration[];
|
|
270
|
+
roles: Array<{
|
|
271
|
+
key: string;
|
|
272
|
+
label: BilingualText;
|
|
273
|
+
capabilities: string[];
|
|
274
|
+
}>;
|
|
275
|
+
capabilities: Array<{
|
|
276
|
+
key: string;
|
|
277
|
+
label: BilingualText;
|
|
278
|
+
}>;
|
|
279
|
+
contact_action_types?: ActorContactActionType[];
|
|
280
|
+
location_precisions?: Array<{
|
|
281
|
+
key: ActorLocationPrecision;
|
|
282
|
+
label: BilingualText;
|
|
283
|
+
}>;
|
|
284
|
+
}
|
|
285
|
+
export interface ActorPolicyChoice {
|
|
286
|
+
key: string;
|
|
287
|
+
label: BilingualText;
|
|
288
|
+
options: unknown;
|
|
289
|
+
/** The answer in force for this actor. */
|
|
290
|
+
value: string;
|
|
291
|
+
/** The actor's own choice; null when inherited. */
|
|
292
|
+
chosen: string | null;
|
|
293
|
+
}
|
|
294
|
+
export interface CreateActorRequest extends ActorProfileDetailChanges {
|
|
295
|
+
handle: string;
|
|
296
|
+
profile_kind: string;
|
|
297
|
+
display_name?: Partial<BilingualText> | null;
|
|
298
|
+
personal_name?: string | null;
|
|
299
|
+
bio?: string | null;
|
|
300
|
+
visibility?: ActorVisibility;
|
|
301
|
+
attributes?: Record<string, unknown>;
|
|
302
|
+
}
|
|
303
|
+
/** Only the keys sent are changed. */
|
|
304
|
+
export interface UpdateActorRequest extends ActorProfileDetailChanges {
|
|
305
|
+
display_name?: Partial<BilingualText> | null;
|
|
306
|
+
personal_name?: string | null;
|
|
307
|
+
bio?: string | null;
|
|
308
|
+
visibility?: ActorVisibility;
|
|
309
|
+
attributes?: Record<string, unknown>;
|
|
310
|
+
}
|
|
311
|
+
export interface InviteActorMemberRequest {
|
|
312
|
+
/** The invitee by HANDLE, never by person id. */
|
|
313
|
+
handle: string;
|
|
314
|
+
role_key: string;
|
|
315
|
+
}
|
|
316
|
+
export interface HandleAvailability {
|
|
317
|
+
handle: string;
|
|
318
|
+
available: boolean;
|
|
319
|
+
}
|
|
320
|
+
export interface MembershipEndingResult {
|
|
321
|
+
membership_id: string;
|
|
322
|
+
ending_reason: ActorMembershipEnding;
|
|
323
|
+
}
|
|
324
|
+
export interface InvitationAnswer {
|
|
325
|
+
membership_id: string;
|
|
326
|
+
state: ActorMembershipState;
|
|
327
|
+
}
|
|
328
|
+
export interface OrganisationLinkResult {
|
|
329
|
+
actor_id: string;
|
|
330
|
+
organisation_id: string;
|
|
331
|
+
linked: boolean;
|
|
332
|
+
}
|
|
333
|
+
export declare function createActorsNamespace(http: Http): {
|
|
334
|
+
/** GET /api/person/actors — the caller's own memberships ("my profiles"). */
|
|
335
|
+
mine: (options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<MyActorRow[]>>;
|
|
336
|
+
/** GET /declarations — profile kinds, roles and capabilities, for the create and invite forms. */
|
|
337
|
+
declarations: (options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorDeclarations>>;
|
|
338
|
+
/** POST — create a profile owned by the caller. A taken handle answers 409. */
|
|
339
|
+
create: (request: CreateActorRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
340
|
+
/**
|
|
341
|
+
* POST /describe — at most 200 references in one call. A party the viewer may not see is
|
|
342
|
+
* ABSENT from the answer (hidden and missing read the same).
|
|
343
|
+
*/
|
|
344
|
+
describe: (references: PartyReferenceString[], options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorSummary[]>>;
|
|
345
|
+
/** GET /handles/{handle} — is a handle free. Throttled; call on pause, not per keystroke. */
|
|
346
|
+
handleAvailability: (handle: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<HandleAvailability>>;
|
|
347
|
+
/** GET /by-handle/{handle} — follows a retired handle (`redirected_from_handle`). */
|
|
348
|
+
byHandle: (handle: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
349
|
+
/** GET /{actor}. */
|
|
350
|
+
show: (actorId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
351
|
+
/** PATCH /{actor} — `changed_fields` names what actually changed. */
|
|
352
|
+
update: (actorId: string, changes: UpdateActorRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor> & {
|
|
353
|
+
changed_fields: string[];
|
|
354
|
+
}>;
|
|
355
|
+
/** PUT /{actor}/handle — the old handle is held and redirects for the policy's period. */
|
|
356
|
+
changeHandle: (actorId: string, handle: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
357
|
+
/**
|
|
358
|
+
* POST /{actor}/avatar — `{media_id}`: a file uploaded through `media.upload` under purpose
|
|
359
|
+
* `actors.avatar` WHILE ACTING AS THE ACTOR (it must own the file). Use
|
|
360
|
+
* {@link uploadActorPicture} for the whole flow. Setting the same file twice is a no-op.
|
|
361
|
+
*/
|
|
362
|
+
setAvatar: (actorId: string, mediaId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
363
|
+
/** DELETE /{actor}/avatar. */
|
|
364
|
+
removeAvatar: (actorId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
365
|
+
/** POST /{actor}/close — owners only; terminal. */
|
|
366
|
+
close: (actorId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
367
|
+
/** GET /{actor}/policies — members only. */
|
|
368
|
+
policies: (actorId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorPolicyChoice[]>>;
|
|
369
|
+
/** PUT /{actor}/policies/{key} — `null` returns to the inherited answer. */
|
|
370
|
+
choosePolicy: (actorId: string, policyKey: string, value: string | null, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<{
|
|
371
|
+
key: string;
|
|
372
|
+
chosen: string | null;
|
|
373
|
+
}>>;
|
|
374
|
+
/**
|
|
375
|
+
* GET /directory — the `actors.directory` list: `sort` newest|handle|relevance|distance,
|
|
376
|
+
* `filter` profile_kind / category / verified / open_now, `search`, plus `near`.
|
|
377
|
+
* Follow `next_cursor`; a page may be shorter than `limit` (blocked rows removed).
|
|
378
|
+
*/
|
|
379
|
+
directory: (query?: ListQueryState, near?: ActorDirectoryNear | null, options?: PersonDomainCallOptions) => Promise<ListPage<ActorDirectoryEntry>>;
|
|
380
|
+
/** GET /mentions?prefix= — at most 10 suggestions while typing `@…`, closest first. */
|
|
381
|
+
mentions: (prefix: string, limit?: number, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorDirectoryEntry[]>>;
|
|
382
|
+
/** PUT /{actor}/location — replaces the whole location. */
|
|
383
|
+
changeLocation: (actorId: string, location: ActorLocationRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor> & {
|
|
384
|
+
changed_fields: string[];
|
|
385
|
+
}>;
|
|
386
|
+
clearLocation: (actorId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
387
|
+
/** PUT /{actor}/opening-hours — the weekly schedule in an IANA zone. */
|
|
388
|
+
changeOpeningHours: (actorId: string, weekly: WeeklyHours, timeZone: string | null, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
389
|
+
clearOpeningHours: (actorId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
390
|
+
/** PUT /{actor}/opening-hours/exceptions/{YYYY-MM-DD} — a holiday or a short day. */
|
|
391
|
+
setOpeningException: (actorId: string, localDate: string, exception: ActorOpeningExceptionRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
392
|
+
removeOpeningException: (actorId: string, localDate: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
393
|
+
/** POST /{actor}/cover — `{media_id}` uploaded under purpose `actors.cover`, owned by the actor. */
|
|
394
|
+
setCover: (actorId: string, mediaId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
395
|
+
removeCover: (actorId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
396
|
+
verification: {
|
|
397
|
+
/** GET /{actor}/verification — members only, newest first. */
|
|
398
|
+
history: (actorId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorVerificationRequest[]>>;
|
|
399
|
+
/** POST /{actor}/verification — apply; 409 when pending, verified or too soon. */
|
|
400
|
+
request: (actorId: string, evidence: {
|
|
401
|
+
evidence_note?: string | null;
|
|
402
|
+
evidence_links?: string[];
|
|
403
|
+
}, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorVerificationRequest>>;
|
|
404
|
+
/** POST /{actor}/verification/{request}/withdraw — idempotent. */
|
|
405
|
+
withdraw: (actorId: string, requestId: string, options?: PersonDomainCallOptions) => Promise<void>;
|
|
406
|
+
};
|
|
407
|
+
members: {
|
|
408
|
+
/** GET /{actor}/members — members only; the `actors.members` list (role / state filters). */
|
|
409
|
+
list: (actorId: string, query?: ListQueryState, options?: PersonDomainCallOptions) => Promise<ListPage<ActorMembership>>;
|
|
410
|
+
/** POST /{actor}/members — invite by handle. */
|
|
411
|
+
invite: (actorId: string, request: InviteActorMemberRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorMembership>>;
|
|
412
|
+
/** POST /{actor}/members/{membership}/confirm — owners, under `owner_confirms`. */
|
|
413
|
+
confirm: (actorId: string, membershipId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorMembership>>;
|
|
414
|
+
/** PATCH /{actor}/members/{membership}. */
|
|
415
|
+
changeRole: (actorId: string, membershipId: string, roleKey: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<ActorMembership>>;
|
|
416
|
+
/** DELETE /{actor}/members/{membership} — leave, remove, or withdraw an invitation. */
|
|
417
|
+
end: (actorId: string, membershipId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<MembershipEndingResult>>;
|
|
418
|
+
};
|
|
419
|
+
invitations: {
|
|
420
|
+
/** GET /invitations — the caller's open invitations; the `actors.invitations` list. */
|
|
421
|
+
list: (query?: ListQueryState, options?: PersonDomainCallOptions) => Promise<ListPage<ActorInvitation>>;
|
|
422
|
+
accept: (membershipId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InvitationAnswer>>;
|
|
423
|
+
decline: (membershipId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InvitationAnswer>>;
|
|
424
|
+
};
|
|
425
|
+
/** The organisation plane: the bound tenant's own actors (`iam.permission:actors.manage`). */
|
|
426
|
+
organisation: {
|
|
427
|
+
list: () => Promise<PersonDomainEnvelope<Actor[]>>;
|
|
428
|
+
create: (request: CreateActorRequest, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<Actor>>;
|
|
429
|
+
link: (actorId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<OrganisationLinkResult>>;
|
|
430
|
+
unlink: (actorId: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<OrganisationLinkResult>>;
|
|
431
|
+
};
|
|
432
|
+
};
|
|
433
|
+
export type ActorsNamespace = ReturnType<typeof createActorsNamespace>;
|
|
434
|
+
/** The media purposes of an actor's two pictures (core `ActorMediaPurposes`). */
|
|
435
|
+
export declare const ACTOR_PICTURE_PURPOSES: {
|
|
436
|
+
readonly avatar: "actors.avatar";
|
|
437
|
+
readonly cover: "actors.cover";
|
|
438
|
+
};
|
|
439
|
+
export type ActorPictureSlot = keyof typeof ACTOR_PICTURE_PURPOSES;
|
|
440
|
+
/**
|
|
441
|
+
* The whole "change a profile picture" flow: upload through the Media pipeline ACTING AS THE
|
|
442
|
+
* ACTOR (so the actor owns the file — `media.upload` on it is needed), then set it. Pass the SDK's
|
|
443
|
+
* `media` and `actors` namespaces. The answer is the actor with its new `avatar` / `cover` view.
|
|
444
|
+
*/
|
|
445
|
+
export declare function uploadActorPicture(namespaces: {
|
|
446
|
+
media: Pick<MediaNamespace, 'upload'>;
|
|
447
|
+
actors: Pick<ActorsNamespace, 'setAvatar' | 'setCover'>;
|
|
448
|
+
}, actorId: string, slot: ActorPictureSlot, file: MediaUploadBody, options?: Omit<MediaUploadOptions, 'purpose' | 'actingAs'>): Promise<PersonDomainEnvelope<Actor>>;
|
package/dist/actors.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { NUWAH_API_MEDIA_TYPE } from './http.js';
|
|
4
|
+
import { listQueryParams } from './list-query.js';
|
|
5
|
+
|
|
6
|
+
export const PERSON_DOMAIN_MEDIA_TYPE = NUWAH_API_MEDIA_TYPE;
|
|
7
|
+
|
|
8
|
+
export const ACTING_AS_HEADER = 'X-Acting-As';
|
|
9
|
+
|
|
10
|
+
export function partyReferenceToString(party) {
|
|
11
|
+
return `${party.kind}:${party.id.toLowerCase()}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function parsePartyReference(value) {
|
|
15
|
+
const match = /^(person|actor|organisation):([0-9a-fA-F-]{36})$/.exec(value.trim());
|
|
16
|
+
return match ? { kind: match[1], id: match[2].toLowerCase() } : null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function newIdempotencyKey() {
|
|
20
|
+
const cryptoObject = globalThis.crypto;
|
|
21
|
+
if (cryptoObject && typeof cryptoObject.randomUUID === 'function')
|
|
22
|
+
return cryptoObject.randomUUID();
|
|
23
|
+
let token = '';
|
|
24
|
+
for (let index = 0; index < 32; index++)
|
|
25
|
+
token += Math.floor(Math.random() * 16).toString(16);
|
|
26
|
+
return token;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function personDomainRequest(options = {}, write = false, params) {
|
|
30
|
+
const headers = { Accept: PERSON_DOMAIN_MEDIA_TYPE };
|
|
31
|
+
if (options.actingAs)
|
|
32
|
+
headers[ACTING_AS_HEADER] = options.actingAs;
|
|
33
|
+
if (write)
|
|
34
|
+
headers['Idempotency-Key'] = options.idempotencyKey ?? newIdempotencyKey();
|
|
35
|
+
return {
|
|
36
|
+
headers,
|
|
37
|
+
...(params ? { params } : {}),
|
|
38
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const BASE = '/api/person/actors';
|
|
42
|
+
const ORGANISATION_BASE = '/api/actors/organisation';
|
|
43
|
+
export function createActorsNamespace(http) {
|
|
44
|
+
const read = (options, params) => personDomainRequest(options, false, params);
|
|
45
|
+
const write = (options) => personDomainRequest(options, true);
|
|
46
|
+
return {
|
|
47
|
+
|
|
48
|
+
mine: (options) => http.get(BASE, read(options)),
|
|
49
|
+
|
|
50
|
+
declarations: (options) => http.get(`${BASE}/declarations`, read(options)),
|
|
51
|
+
|
|
52
|
+
create: (request, options) => http.post(BASE, request, write(options)),
|
|
53
|
+
|
|
54
|
+
describe: (references, options) => http.post(`${BASE}/describe`, { references }, read(options)),
|
|
55
|
+
|
|
56
|
+
handleAvailability: (handle, options) => http.get(`${BASE}/handles/${encodeURIComponent(handle)}`, read(options)),
|
|
57
|
+
|
|
58
|
+
byHandle: (handle, options) => http.get(`${BASE}/by-handle/${encodeURIComponent(handle)}`, read(options)),
|
|
59
|
+
|
|
60
|
+
show: (actorId, options) => http.get(`${BASE}/${actorId}`, read(options)),
|
|
61
|
+
|
|
62
|
+
update: (actorId, changes, options) => http.patch(`${BASE}/${actorId}`, changes, write(options)),
|
|
63
|
+
|
|
64
|
+
changeHandle: (actorId, handle, options) => http.put(`${BASE}/${actorId}/handle`, { handle }, write(options)),
|
|
65
|
+
|
|
66
|
+
setAvatar: (actorId, mediaId, options) => http.post(`${BASE}/${actorId}/avatar`, { media_id: mediaId }, write(options)),
|
|
67
|
+
|
|
68
|
+
removeAvatar: (actorId, options) => http.delete(`${BASE}/${actorId}/avatar`, write(options)),
|
|
69
|
+
|
|
70
|
+
close: (actorId, options) => http.post(`${BASE}/${actorId}/close`, undefined, write(options)),
|
|
71
|
+
|
|
72
|
+
policies: (actorId, options) => http.get(`${BASE}/${actorId}/policies`, read(options)),
|
|
73
|
+
|
|
74
|
+
choosePolicy: (actorId, policyKey, value, options) => http.put(`${BASE}/${actorId}/policies/${encodeURIComponent(policyKey)}`, { value }, write(options)),
|
|
75
|
+
|
|
76
|
+
directory: (query = {}, near, options) => http.get(`${BASE}/directory`, read({
|
|
77
|
+
...options,
|
|
78
|
+
}, {
|
|
79
|
+
...listQueryParams(query),
|
|
80
|
+
...(near ? {
|
|
81
|
+
'near[latitude]': near.latitude,
|
|
82
|
+
'near[longitude]': near.longitude,
|
|
83
|
+
...(near.radius_kilometres !== undefined ? { 'near[radius_kilometres]': near.radius_kilometres } : {}),
|
|
84
|
+
} : {}),
|
|
85
|
+
})),
|
|
86
|
+
|
|
87
|
+
mentions: (prefix, limit = 8, options) => http.get(`${BASE}/mentions`, read(options, { prefix, limit })),
|
|
88
|
+
|
|
89
|
+
changeLocation: (actorId, location, options) => http.put(`${BASE}/${actorId}/location`, location, write(options)),
|
|
90
|
+
clearLocation: (actorId, options) => http.delete(`${BASE}/${actorId}/location`, write(options)),
|
|
91
|
+
|
|
92
|
+
changeOpeningHours: (actorId, weekly, timeZone, options) => http.put(`${BASE}/${actorId}/opening-hours`, { weekly, time_zone: timeZone }, write(options)),
|
|
93
|
+
clearOpeningHours: (actorId, options) => http.delete(`${BASE}/${actorId}/opening-hours`, write(options)),
|
|
94
|
+
|
|
95
|
+
setOpeningException: (actorId, localDate, exception, options) => http.put(`${BASE}/${actorId}/opening-hours/exceptions/${encodeURIComponent(localDate)}`, exception, write(options)),
|
|
96
|
+
removeOpeningException: (actorId, localDate, options) => http.delete(`${BASE}/${actorId}/opening-hours/exceptions/${encodeURIComponent(localDate)}`, write(options)),
|
|
97
|
+
|
|
98
|
+
setCover: (actorId, mediaId, options) => http.post(`${BASE}/${actorId}/cover`, { media_id: mediaId }, write(options)),
|
|
99
|
+
removeCover: (actorId, options) => http.delete(`${BASE}/${actorId}/cover`, write(options)),
|
|
100
|
+
verification: {
|
|
101
|
+
|
|
102
|
+
history: (actorId, options) => http.get(`${BASE}/${actorId}/verification`, read(options)),
|
|
103
|
+
|
|
104
|
+
request: (actorId, evidence, options) => http.post(`${BASE}/${actorId}/verification`, evidence, write(options)),
|
|
105
|
+
|
|
106
|
+
withdraw: (actorId, requestId, options) => http.post(`${BASE}/${actorId}/verification/${requestId}/withdraw`, undefined, write(options)),
|
|
107
|
+
},
|
|
108
|
+
members: {
|
|
109
|
+
|
|
110
|
+
list: (actorId, query = {}, options) => http.get(`${BASE}/${actorId}/members`, read(options, listQueryParams(query))),
|
|
111
|
+
|
|
112
|
+
invite: (actorId, request, options) => http.post(`${BASE}/${actorId}/members`, request, write(options)),
|
|
113
|
+
|
|
114
|
+
confirm: (actorId, membershipId, options) => http.post(`${BASE}/${actorId}/members/${membershipId}/confirm`, undefined, write(options)),
|
|
115
|
+
|
|
116
|
+
changeRole: (actorId, membershipId, roleKey, options) => http.patch(`${BASE}/${actorId}/members/${membershipId}`, { role_key: roleKey }, write(options)),
|
|
117
|
+
|
|
118
|
+
end: (actorId, membershipId, options) => http.delete(`${BASE}/${actorId}/members/${membershipId}`, write(options)),
|
|
119
|
+
},
|
|
120
|
+
invitations: {
|
|
121
|
+
|
|
122
|
+
list: (query = {}, options) => http.get(`${BASE}/invitations`, read(options, listQueryParams(query))),
|
|
123
|
+
accept: (membershipId, options) => http.post(`${BASE}/invitations/${membershipId}/accept`, undefined, write(options)),
|
|
124
|
+
decline: (membershipId, options) => http.post(`${BASE}/invitations/${membershipId}/decline`, undefined, write(options)),
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
organisation: {
|
|
128
|
+
list: () => http.get(ORGANISATION_BASE, personDomainRequest()),
|
|
129
|
+
create: (request, options) => http.post(ORGANISATION_BASE, request, write(options)),
|
|
130
|
+
link: (actorId, options) => http.post(`${ORGANISATION_BASE}/${actorId}/link`, undefined, write(options)),
|
|
131
|
+
unlink: (actorId, options) => http.delete(`${ORGANISATION_BASE}/${actorId}/link`, write(options)),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const ACTOR_PICTURE_PURPOSES = { avatar: 'actors.avatar', cover: 'actors.cover' };
|
|
137
|
+
|
|
138
|
+
export async function uploadActorPicture(namespaces, actorId, slot, file, options = {}) {
|
|
139
|
+
const asset = await namespaces.media.upload(file, { ...options, purpose: ACTOR_PICTURE_PURPOSES[slot], actingAs: `actor:${actorId}` });
|
|
140
|
+
return slot === 'avatar'
|
|
141
|
+
? namespaces.actors.setAvatar(actorId, asset.id, { signal: options.signal })
|
|
142
|
+
: namespaces.actors.setCover(actorId, asset.id, { signal: options.signal });
|
|
143
|
+
}
|