@ankhorage/projects 0.7.2 → 0.8.0
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/README.md +19 -12
- package/dist/capabilities/index.d.ts +330 -0
- package/dist/capabilities/index.js +194 -0
- package/dist/capabilities/socialManagerMediaAnalytics.d.ts +92 -0
- package/dist/capabilities/socialManagerMediaAnalytics.js +75 -0
- package/dist/features/projects/composition/composeGeneratedRuntimeMaterialization.d.ts +1 -0
- package/dist/features/projects/composition/composeGeneratedRuntimeMaterialization.js +13 -5
- package/dist/features/projects/composition/createExpoProjectMaterializer.js +27 -23
- package/dist/features/projects/composition/createRootNavigatorGenerationOptions.d.ts +9 -0
- package/dist/features/projects/composition/createRootNavigatorGenerationOptions.js +10 -0
- package/dist/features/projects/composition/createSocialManagerServerFiles.d.ts +6 -0
- package/dist/features/projects/composition/createSocialManagerServerFiles.js +16 -0
- package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemRepositories.d.ts +16 -0
- package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemRepositories.js +201 -0
- package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemStoreAsync.d.ts +25 -0
- package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemStoreAsync.js +72 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerDraftStoreAsync.d.ts +7 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerDraftStoreAsync.js +160 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerFlowSecurityAsync.d.ts +19 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerFlowSecurityAsync.js +176 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaPreflight.d.ts +4 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaPreflight.js +37 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaStoreAsync.d.ts +7 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaStoreAsync.js +242 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialOperationStoresAsync.d.ts +13 -0
- package/dist/features/trusted-social-manager-host/adapters/createSocialOperationStoresAsync.js +244 -0
- package/dist/features/trusted-social-manager-host/adapters/projectSocialManagerConnection.d.ts +53 -0
- package/dist/features/trusted-social-manager-host/adapters/projectSocialManagerConnection.js +42 -0
- package/dist/features/trusted-social-manager-host/application/createSocialManagerPublicationRuntime.d.ts +10 -0
- package/dist/features/trusted-social-manager-host/application/createSocialManagerPublicationRuntime.js +240 -0
- package/dist/features/trusted-social-manager-host/application/resolveSocialManagerPublication.d.ts +22 -0
- package/dist/features/trusted-social-manager-host/application/resolveSocialManagerPublication.js +97 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerCapabilityOperations.d.ts +22 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerCapabilityOperations.js +224 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerConnectionOperations.d.ts +20 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerConnectionOperations.js +152 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerLocalProviderFixtures.d.ts +22 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerLocalProviderFixtures.js +271 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerMediaOperations.d.ts +14 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerMediaOperations.js +72 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerProvider.d.ts +20 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerProvider.js +20 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerPublicationOperations.d.ts +15 -0
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerPublicationOperations.js +185 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerFileSystemPersistenceAsync.d.ts +14 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerFileSystemPersistenceAsync.js +17 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerHost.d.ts +51 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerHost.js +188 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalHostAsync.d.ts +18 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalHostAsync.js +177 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalServerAsync.d.ts +26 -0
- package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalServerAsync.js +66 -0
- package/dist/features/trusted-social-manager-host/domain/publicationConfig.d.ts +18 -0
- package/dist/features/trusted-social-manager-host/domain/publicationConfig.js +77 -0
- package/dist/features/trusted-social-manager-host/domain/readSocialManagerConnectionRequest.d.ts +54 -0
- package/dist/features/trusted-social-manager-host/domain/readSocialManagerConnectionRequest.js +77 -0
- package/dist/features/trusted-social-manager-host/domain/readSocialManagerDraftContent.d.ts +3 -0
- package/dist/features/trusted-social-manager-host/domain/readSocialManagerDraftContent.js +47 -0
- package/dist/features/trusted-social-manager-host/domain/socialManagerConnectionIdentity.d.ts +17 -0
- package/dist/features/trusted-social-manager-host/domain/socialManagerConnectionIdentity.js +17 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +14 -0
- package/dist/types/socialManager.d.ts +77 -0
- package/dist/types/socialManager.js +1 -0
- package/dist/types/socialManagerPublication.d.ts +27 -0
- package/dist/types/socialManagerPublication.js +1 -0
- package/package.json +507 -9
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { createSocialManagerProvider } from './createSocialManagerProvider.js';
|
|
2
|
+
/***
|
|
3
|
+
* Compose deterministic local protocol boundaries for explicitly selected development fixtures.
|
|
4
|
+
* This factory never receives credentials or network endpoints; production hosts must inject their
|
|
5
|
+
* own provider boundaries instead.
|
|
6
|
+
*/
|
|
7
|
+
export function createSocialManagerLocalProviderFixtures(input) {
|
|
8
|
+
const providers = createProviders(input);
|
|
9
|
+
return {
|
|
10
|
+
authorization: createAuthorizationFixture(input.now),
|
|
11
|
+
healthAsync: (connection) => Promise.resolve({
|
|
12
|
+
tenantId: connection.tenantId,
|
|
13
|
+
projectId: connection.projectId,
|
|
14
|
+
environmentId: connection.environmentId,
|
|
15
|
+
actorId: connection.actorId,
|
|
16
|
+
provider: connection.provider,
|
|
17
|
+
connectionId: connection.connectionId,
|
|
18
|
+
accountId: connection.accountId,
|
|
19
|
+
targetId: connection.targets[0]?.targetId ?? 'local-target',
|
|
20
|
+
authorizationId: connection.authorizationId,
|
|
21
|
+
confirmed: connection.status === 'connected',
|
|
22
|
+
providerStatus: connection.status === 'connected' ? 'active' : 'reconnect-required',
|
|
23
|
+
grantedScopes: connection.grantedScopes,
|
|
24
|
+
}),
|
|
25
|
+
revocation: {
|
|
26
|
+
provider: createRevocationProvider(),
|
|
27
|
+
credentials: { removeExactCredentialAsync: () => Promise.resolve('removed') },
|
|
28
|
+
},
|
|
29
|
+
providers: {
|
|
30
|
+
facebook: providers.facebook.provider,
|
|
31
|
+
instagram: providers.instagram.provider,
|
|
32
|
+
linkedin: providers.linkedin.provider,
|
|
33
|
+
pinterest: providers.pinterest.provider,
|
|
34
|
+
},
|
|
35
|
+
analytics: {
|
|
36
|
+
facebook: providers.facebook.analytics,
|
|
37
|
+
instagram: providers.instagram.analytics,
|
|
38
|
+
linkedin: providers.linkedin.analytics,
|
|
39
|
+
pinterest: providers.pinterest.analytics,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/*** Construct each published provider adapter over an explicit local-only protocol response boundary. */
|
|
44
|
+
function createProviders(input) {
|
|
45
|
+
return {
|
|
46
|
+
facebook: createFacebookProvider(input.operations),
|
|
47
|
+
instagram: createInstagramProvider(input.operations),
|
|
48
|
+
linkedin: createLinkedinProvider(input.operations),
|
|
49
|
+
pinterest: createPinterestProvider(input.operations, input.now),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/*** Bind the published Facebook Pages adapter to deterministic Graph responses and durable operations. */
|
|
53
|
+
function createFacebookProvider(operations) {
|
|
54
|
+
return createSocialManagerProvider({
|
|
55
|
+
provider: 'facebook',
|
|
56
|
+
input: {
|
|
57
|
+
operations: operations.facebookPages,
|
|
58
|
+
transport: {
|
|
59
|
+
requestAsync: facebookResponse,
|
|
60
|
+
uploadMediaAsync: (request) => Promise.resolve({ status: 200, body: { id: `media:${request.mediaId}` } }),
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/*** Bind the published Instagram adapter to deterministic account, media, and protocol responses. */
|
|
66
|
+
function createInstagramProvider(operations) {
|
|
67
|
+
return createSocialManagerProvider({
|
|
68
|
+
provider: 'instagram',
|
|
69
|
+
input: {
|
|
70
|
+
account: { getAccountAsync: (target) => Promise.resolve(instagramAccount(target)) },
|
|
71
|
+
mediaSource: {
|
|
72
|
+
resolveAsync: (_command, _authorizationRef, media) => Promise.resolve(media.map((item) => ({
|
|
73
|
+
mediaId: item.mediaId,
|
|
74
|
+
url: `https://social-manager.local/media/${encodeURIComponent(item.mediaId)}`,
|
|
75
|
+
}))),
|
|
76
|
+
},
|
|
77
|
+
operations: operations.instagramProfessional,
|
|
78
|
+
transport: { requestAsync: instagramResponse },
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/*** Resolve only a matching local Instagram professional account without storing a credential. */
|
|
83
|
+
function instagramAccount(target) {
|
|
84
|
+
if (target.provider !== 'instagram' || target.accountId !== target.destinationId)
|
|
85
|
+
return null;
|
|
86
|
+
if (target.accountType === 'business')
|
|
87
|
+
return socialInstagramAccount(target.accountId, 'business');
|
|
88
|
+
if (target.accountType === 'creator')
|
|
89
|
+
return socialInstagramAccount(target.accountId, 'creator');
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/*** Construct one narrowed local Instagram account from an authenticated target identity. */
|
|
93
|
+
function socialInstagramAccount(accountId, accountType) {
|
|
94
|
+
return {
|
|
95
|
+
authorizationMode: 'instagram-login',
|
|
96
|
+
accountType,
|
|
97
|
+
instagramAccountId: accountId,
|
|
98
|
+
carouselEnabled: true,
|
|
99
|
+
carouselVideoEnabled: true,
|
|
100
|
+
commentsEnabled: true,
|
|
101
|
+
insightsEnabled: true,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/*** Bind the published LinkedIn adapter to deterministic authenticated transport and media source ports. */
|
|
105
|
+
function createLinkedinProvider(operations) {
|
|
106
|
+
return createSocialManagerProvider({
|
|
107
|
+
provider: 'linkedin',
|
|
108
|
+
input: {
|
|
109
|
+
apiVersion: '202601',
|
|
110
|
+
identity: { kind: 'member', author: 'urn:li:person:local-social-manager' },
|
|
111
|
+
access: { communityManagement: 'confirmed', commentsAndReactions: true, analytics: true },
|
|
112
|
+
mediaSource: {
|
|
113
|
+
loadAsync: () => Promise.resolve({ owner: 'urn:li:person:local-social-manager', bytes: new Uint8Array() }),
|
|
114
|
+
},
|
|
115
|
+
operations: operations.linkedin,
|
|
116
|
+
transport: { requestAsync: linkedinResponse },
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/*** Bind the published Pinterest adapter to deterministic public-board and media resolver ports. */
|
|
121
|
+
function createPinterestProvider(operations, now) {
|
|
122
|
+
return createSocialManagerProvider({
|
|
123
|
+
provider: 'pinterest',
|
|
124
|
+
input: {
|
|
125
|
+
accessTier: 'standard',
|
|
126
|
+
mediaResolver: { resolveAsync: (media) => Promise.resolve(pinterestMedia(media)) },
|
|
127
|
+
now,
|
|
128
|
+
operations: operations.pinterest,
|
|
129
|
+
transport: { requestAsync: (request) => pinterestResponse(request.path) },
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/*** Resolve a local opaque Social media reference to its deterministic Pinterest source shape. */
|
|
134
|
+
function pinterestMedia(media) {
|
|
135
|
+
const path = `https://social-manager.local/media/${encodeURIComponent(media.mediaId)}`;
|
|
136
|
+
return media.kind === 'image'
|
|
137
|
+
? { kind: 'image', url: path }
|
|
138
|
+
: { kind: 'video', mediaId: `media:${media.mediaId}`, coverImageUrl: `${path}/cover` };
|
|
139
|
+
}
|
|
140
|
+
/*** Build deterministic credential-free delegated authorization fixtures for local development only. */
|
|
141
|
+
function createAuthorizationFixture(now) {
|
|
142
|
+
return {
|
|
143
|
+
startAsync: (attempt) => Promise.resolve({
|
|
144
|
+
attemptId: attempt.attemptId,
|
|
145
|
+
authorizationUrl: `local-fixture://social-manager/authorize/${attempt.provider}/${attempt.attemptId}`,
|
|
146
|
+
expiresAt: attempt.expiresAt,
|
|
147
|
+
}),
|
|
148
|
+
completeAsync: (attempt, callback) => Promise.resolve(callback.payload === localCallbackPayload(attempt.provider)
|
|
149
|
+
? completedAuthorization(attempt, now())
|
|
150
|
+
: { kind: 'cancelled' }),
|
|
151
|
+
cancelAsync: () => Promise.resolve(),
|
|
152
|
+
refreshAsync: (connection) => Promise.resolve({
|
|
153
|
+
kind: 'refreshed',
|
|
154
|
+
authorizationRef: `${connection.authorizationRef}:refreshed`,
|
|
155
|
+
grantedScopes: connection.grantedScopes,
|
|
156
|
+
authorizationRevision: `local:${now()}`,
|
|
157
|
+
}),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/*** Return an explicit fixture callback payload so local authorization cannot be mistaken for OAuth. */
|
|
161
|
+
function localCallbackPayload(provider) {
|
|
162
|
+
return `local-fixture:${provider}:authorized`;
|
|
163
|
+
}
|
|
164
|
+
/*** Construct one complete provider-confirmed local connection without representing a credential. */
|
|
165
|
+
function completedAuthorization(attempt, now) {
|
|
166
|
+
const target = fixtureTarget(attempt.provider, attempt);
|
|
167
|
+
return {
|
|
168
|
+
tenantId: attempt.tenantId,
|
|
169
|
+
projectId: attempt.projectId,
|
|
170
|
+
environmentId: attempt.environmentId,
|
|
171
|
+
actorId: attempt.actorId,
|
|
172
|
+
connectionId: attempt.connectionId,
|
|
173
|
+
provider: attempt.provider,
|
|
174
|
+
requestedScopes: attempt.requestedScopes,
|
|
175
|
+
authorizationId: `local:${attempt.connectionId}`,
|
|
176
|
+
authorizationRef: `local:${attempt.connectionId}:${attempt.provider}`,
|
|
177
|
+
accountId: target.accountId,
|
|
178
|
+
grantedScopes: fixtureScopes(attempt.provider),
|
|
179
|
+
targets: [target],
|
|
180
|
+
authorizationRevision: `local:${now}`,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/*** Derive a stable local target descriptor for the selected provider protocol. */
|
|
184
|
+
function fixtureTarget(provider, attempt) {
|
|
185
|
+
const accountId = provider === 'linkedin' ? 'urn:li:person:local-social-manager' : 'local-account';
|
|
186
|
+
const targetId = provider === 'pinterest' ? 'local-board' : accountId;
|
|
187
|
+
return {
|
|
188
|
+
tenantId: attempt.tenantId,
|
|
189
|
+
projectId: attempt.projectId,
|
|
190
|
+
environmentId: attempt.environmentId,
|
|
191
|
+
actorId: attempt.actorId,
|
|
192
|
+
provider,
|
|
193
|
+
connectionId: attempt.connectionId,
|
|
194
|
+
accountId,
|
|
195
|
+
targetId,
|
|
196
|
+
connectionStatus: 'connected',
|
|
197
|
+
roles: provider === 'linkedin' ? ['ADMINISTRATOR'] : ['CREATE_CONTENT'],
|
|
198
|
+
scopes: fixtureScopes(provider),
|
|
199
|
+
capabilities: [{ operation: 'publish', status: 'confirmed' }],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/*** Declare the provider scopes represented by the deliberately local fixture protocol. */
|
|
203
|
+
function fixtureScopes(provider) {
|
|
204
|
+
switch (provider) {
|
|
205
|
+
case 'facebook-login':
|
|
206
|
+
return ['pages_show_list', 'pages_read_engagement', 'pages_manage_posts'];
|
|
207
|
+
case 'instagram-login':
|
|
208
|
+
return ['instagram_business_basic', 'instagram_business_content_publishing'];
|
|
209
|
+
case 'linkedin':
|
|
210
|
+
return ['w_member_social'];
|
|
211
|
+
case 'pinterest':
|
|
212
|
+
return ['boards:read', 'pins:write', 'pins:read'];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/*** Supply deterministic verified revocation evidence bound to the exact durable revocation operation. */
|
|
216
|
+
function createRevocationProvider() {
|
|
217
|
+
return {
|
|
218
|
+
findVerifiedEvidenceAsync: () => Promise.resolve(null),
|
|
219
|
+
revokeAsync: (operation) => Promise.resolve({
|
|
220
|
+
kind: 'revoked',
|
|
221
|
+
evidence: { evidenceId: `local-revocation:${operation.effectId}`, operation },
|
|
222
|
+
}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/*** Respond to only the Facebook Graph shapes exercised by the published Pages adapter. */
|
|
226
|
+
function facebookResponse(request) {
|
|
227
|
+
if (request.method === 'GET' && request.path === '/me/accounts')
|
|
228
|
+
return Promise.resolve({
|
|
229
|
+
status: 200,
|
|
230
|
+
body: { data: [{ id: 'local-account', name: 'Local Page', tasks: ['CREATE_CONTENT'] }] },
|
|
231
|
+
});
|
|
232
|
+
return Promise.resolve({
|
|
233
|
+
status: 200,
|
|
234
|
+
body: { id: `facebook:${request.path.replaceAll('/', ':')}` },
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/*** Return completed local Instagram container and publication records without external transport. */
|
|
238
|
+
function instagramResponse(request) {
|
|
239
|
+
return Promise.resolve(request.method === 'GET'
|
|
240
|
+
? { status: 200, body: { status_code: 'FINISHED' } }
|
|
241
|
+
: { status: 200, body: { id: `instagram:${request.path.replaceAll('/', ':')}` } });
|
|
242
|
+
}
|
|
243
|
+
/*** Return the exact headers and initialization body expected by the published LinkedIn adapter. */
|
|
244
|
+
function linkedinResponse(request) {
|
|
245
|
+
if (request.method === 'POST' && request.url.includes('initializeUpload'))
|
|
246
|
+
return Promise.resolve({
|
|
247
|
+
status: 200,
|
|
248
|
+
headers: {},
|
|
249
|
+
body: {
|
|
250
|
+
value: {
|
|
251
|
+
uploadUrl: 'https://social-manager.local/linkedin/upload',
|
|
252
|
+
image: 'urn:li:image:local',
|
|
253
|
+
video: 'urn:li:video:local',
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
return Promise.resolve({ status: 201, headers: { 'x-restli-id': 'local-linkedin-resource' } });
|
|
258
|
+
}
|
|
259
|
+
/*** Return public local Pinterest boards and deterministic Pin records for published adapter paths. */
|
|
260
|
+
function pinterestResponse(path) {
|
|
261
|
+
if (path === '/v5/boards')
|
|
262
|
+
return Promise.resolve({
|
|
263
|
+
status: 200,
|
|
264
|
+
body: { items: [{ id: 'local-board', privacy: 'public' }] },
|
|
265
|
+
});
|
|
266
|
+
if (path.includes('/sections'))
|
|
267
|
+
return Promise.resolve({ status: 200, body: { items: [] } });
|
|
268
|
+
if (path === '/v5/boards/local-board')
|
|
269
|
+
return Promise.resolve({ status: 200, body: { id: 'local-board', privacy: 'public' } });
|
|
270
|
+
return Promise.resolve({ status: 201, body: { id: 'local-pin' } });
|
|
271
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ApiHandler } from '@ankhorage/api';
|
|
2
|
+
import type { SocialManagerCaller, SocialManagerMediaStore } from '../../../types/socialManager.js';
|
|
3
|
+
type MediaOperation = Readonly<{
|
|
4
|
+
intent: 'create' | 'delete' | 'read';
|
|
5
|
+
method: 'DELETE' | 'GET' | 'POST';
|
|
6
|
+
handler: ApiHandler;
|
|
7
|
+
}>;
|
|
8
|
+
export type SocialManagerMediaHostDependencies = Readonly<{
|
|
9
|
+
store: SocialManagerMediaStore;
|
|
10
|
+
isReferencedAsync: (caller: SocialManagerCaller, mediaId: string) => Promise<boolean>;
|
|
11
|
+
}>;
|
|
12
|
+
/*** Bind immutable caller-owned media operations to authenticated HTTP delivery. */
|
|
13
|
+
export declare function createSocialManagerMediaOperations(input: SocialManagerMediaHostDependencies, callerOf: (request: Parameters<ApiHandler>[0]) => SocialManagerCaller | undefined): Readonly<Record<string, MediaOperation>>;
|
|
14
|
+
export {};
|
package/dist/features/trusted-social-manager-host/composition/createSocialManagerMediaOperations.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { isRecord } from '@ankhorage/utility/object';
|
|
3
|
+
/*** Bind immutable caller-owned media operations to authenticated HTTP delivery. */
|
|
4
|
+
export function createSocialManagerMediaOperations(input, callerOf) {
|
|
5
|
+
return {
|
|
6
|
+
'projects.social.media.upload': createOperation((request) => uploadMediaAsync(input, callerOf(request), request.body)),
|
|
7
|
+
'projects.social.media.list': readOperation((request) => listMediaAsync(input, callerOf(request))),
|
|
8
|
+
'projects.social.media.read': readOperation((request) => readMediaAsync(input, callerOf(request), request.params.mediaId)),
|
|
9
|
+
'projects.social.media.remove': deleteOperation((request) => removeMediaAsync(input, callerOf(request), request.params.mediaId)),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/*** Persist a bounded base64 upload without accepting client-supplied media identity. */
|
|
13
|
+
async function uploadMediaAsync(input, caller, value) {
|
|
14
|
+
const upload = readUpload(value);
|
|
15
|
+
if (!caller || !upload)
|
|
16
|
+
return invalidResponse();
|
|
17
|
+
try {
|
|
18
|
+
return { status: 201, body: await input.store.uploadAsync(caller, upload) };
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return invalidResponse();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/*** List redaction-safe immutable media metadata for the authenticated caller. */
|
|
25
|
+
async function listMediaAsync(input, caller) {
|
|
26
|
+
return caller ? { body: await input.store.listAsync(caller) } : missingResponse();
|
|
27
|
+
}
|
|
28
|
+
/*** Resolve exactly one immutable media metadata record in the caller's scope. */
|
|
29
|
+
async function readMediaAsync(input, caller, mediaId) {
|
|
30
|
+
const media = caller && mediaId ? await input.store.readAsync(caller, mediaId) : undefined;
|
|
31
|
+
return media ? { body: media } : missingResponse();
|
|
32
|
+
}
|
|
33
|
+
/*** Remove media only when no immutable draft or retained publication reference requires it. */
|
|
34
|
+
async function removeMediaAsync(input, caller, mediaId) {
|
|
35
|
+
if (!caller || !mediaId)
|
|
36
|
+
return missingResponse();
|
|
37
|
+
const result = await input.store.removeAsync(caller, mediaId, (media) => input.isReferencedAsync(caller, media.mediaId));
|
|
38
|
+
return result === 'removed'
|
|
39
|
+
? { status: 204 }
|
|
40
|
+
: result === 'referenced'
|
|
41
|
+
? { status: 409, body: { error: { code: 'social_media_referenced' } } }
|
|
42
|
+
: missingResponse();
|
|
43
|
+
}
|
|
44
|
+
/*** Decode only canonical nonempty base64 JSON input before durable media validation. */
|
|
45
|
+
function readUpload(value) {
|
|
46
|
+
if (!isRecord(value) || typeof value.contentType !== 'string' || typeof value.base64 !== 'string')
|
|
47
|
+
return undefined;
|
|
48
|
+
if (!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value.base64))
|
|
49
|
+
return undefined;
|
|
50
|
+
const bytes = new Uint8Array(Buffer.from(value.base64, 'base64'));
|
|
51
|
+
return bytes.byteLength > 0 ? { contentType: value.contentType, bytes } : undefined;
|
|
52
|
+
}
|
|
53
|
+
/*** Declare a canonical immutable-media read operation. */
|
|
54
|
+
function readOperation(handler) {
|
|
55
|
+
return { intent: 'read', method: 'GET', handler };
|
|
56
|
+
}
|
|
57
|
+
/*** Declare a canonical immutable-media upload operation. */
|
|
58
|
+
function createOperation(handler) {
|
|
59
|
+
return { intent: 'create', method: 'POST', handler };
|
|
60
|
+
}
|
|
61
|
+
/*** Declare a canonical immutable-media removal operation. */
|
|
62
|
+
function deleteOperation(handler) {
|
|
63
|
+
return { intent: 'delete', method: 'DELETE', handler };
|
|
64
|
+
}
|
|
65
|
+
/*** Return a stable request validation response without echoing untrusted media data. */
|
|
66
|
+
function invalidResponse() {
|
|
67
|
+
return { status: 400, body: { error: { code: 'invalid_social_media' } } };
|
|
68
|
+
}
|
|
69
|
+
/*** Hide media existence outside the authenticated caller scope. */
|
|
70
|
+
function missingResponse() {
|
|
71
|
+
return { status: 404, body: { error: { code: 'social_media_not_found' } } };
|
|
72
|
+
}
|
package/dist/features/trusted-social-manager-host/composition/createSocialManagerProvider.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SocialAnalyticsAdapter, SocialProviderPort } from '@ankhorage/social';
|
|
2
|
+
import { createFacebookPagesProvider, createInstagramProfessionalProvider, createLinkedinProviderAdapter, createPinterestProvider } from '@ankhorage/social';
|
|
3
|
+
export type SocialManagerProviderConfiguration = {
|
|
4
|
+
readonly provider: 'facebook';
|
|
5
|
+
readonly input: Parameters<typeof createFacebookPagesProvider>[0];
|
|
6
|
+
} | {
|
|
7
|
+
readonly provider: 'instagram';
|
|
8
|
+
readonly input: Parameters<typeof createInstagramProfessionalProvider>[0];
|
|
9
|
+
} | {
|
|
10
|
+
readonly provider: 'linkedin';
|
|
11
|
+
readonly input: Parameters<typeof createLinkedinProviderAdapter>[0];
|
|
12
|
+
} | {
|
|
13
|
+
readonly provider: 'pinterest';
|
|
14
|
+
readonly input: Parameters<typeof createPinterestProvider>[0];
|
|
15
|
+
};
|
|
16
|
+
/*** Construct a provider bound to one trusted authorization, never from browser-supplied transport options. */
|
|
17
|
+
export declare function createSocialManagerProvider(configuration: SocialManagerProviderConfiguration): {
|
|
18
|
+
readonly provider: SocialProviderPort;
|
|
19
|
+
readonly analytics: SocialAnalyticsAdapter;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createFacebookPagesProvider, createInstagramProfessionalProvider, createLinkedinProviderAdapter, createPinterestProvider, } from '@ankhorage/social';
|
|
2
|
+
/*** Construct a provider bound to one trusted authorization, never from browser-supplied transport options. */
|
|
3
|
+
export function createSocialManagerProvider(configuration) {
|
|
4
|
+
switch (configuration.provider) {
|
|
5
|
+
case 'facebook':
|
|
6
|
+
return createFacebookPagesProvider(configuration.input);
|
|
7
|
+
case 'instagram': {
|
|
8
|
+
const provider = createInstagramProfessionalProvider(configuration.input);
|
|
9
|
+
return { provider, analytics: provider };
|
|
10
|
+
}
|
|
11
|
+
case 'linkedin': {
|
|
12
|
+
const provider = createLinkedinProviderAdapter(configuration.input);
|
|
13
|
+
return { provider, analytics: provider };
|
|
14
|
+
}
|
|
15
|
+
case 'pinterest': {
|
|
16
|
+
const provider = createPinterestProvider(configuration.input);
|
|
17
|
+
return { provider, analytics: provider };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ApiHandler } from '@ankhorage/api';
|
|
2
|
+
import type { SocialManagerCaller } from '../../../types/socialManager.js';
|
|
3
|
+
import type { createSocialManagerPublicationRuntime } from '../application/createSocialManagerPublicationRuntime.js';
|
|
4
|
+
type PublicationRuntime = ReturnType<typeof createSocialManagerPublicationRuntime>;
|
|
5
|
+
type PublicationOperation = Readonly<{
|
|
6
|
+
intent: 'create' | 'delete' | 'read' | 'update';
|
|
7
|
+
method: 'DELETE' | 'GET' | 'POST';
|
|
8
|
+
handler: ApiHandler;
|
|
9
|
+
}>;
|
|
10
|
+
export type SocialManagerPublicationHostDependencies = Readonly<{
|
|
11
|
+
runtime: PublicationRuntime;
|
|
12
|
+
}>;
|
|
13
|
+
/*** Bind protected Flow publication lifecycle operations to the authenticated caller. */
|
|
14
|
+
export declare function createSocialManagerPublicationOperations(input: SocialManagerPublicationHostDependencies, callerOf: (request: Parameters<ApiHandler>[0]) => SocialManagerCaller | undefined): Readonly<Record<string, PublicationOperation>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { isRecord } from '@ankhorage/utility/object';
|
|
2
|
+
import { readPublicationConfig } from '../domain/publicationConfig.js';
|
|
3
|
+
/*** Bind protected Flow publication lifecycle operations to the authenticated caller. */
|
|
4
|
+
export function createSocialManagerPublicationOperations(input, callerOf) {
|
|
5
|
+
return {
|
|
6
|
+
'projects.social.publications.prepare': createOperation((request) => schedulePublicationAsync(input.runtime, callerOf(request), request.body, true)),
|
|
7
|
+
'projects.social.publications.publish': createOperation((request) => schedulePublicationAsync(input.runtime, callerOf(request), request.body, false)),
|
|
8
|
+
'projects.social.publications.schedule': createOperation((request) => schedulePublicationAsync(input.runtime, callerOf(request), request.body, true)),
|
|
9
|
+
'projects.social.publications.cancel': deleteOperation((request) => cancelPublicationAsync(input.runtime, callerOf(request), request.params.runId)),
|
|
10
|
+
'projects.social.publications.execution.status': readOperation((request) => readPublicationAsync(input.runtime, callerOf(request), request.params.runId)),
|
|
11
|
+
'projects.social.publications.approval.status': readOperation((request) => readApprovalAsync(input.runtime, callerOf(request), request.params.runId)),
|
|
12
|
+
'projects.social.publications.approval.resolve': updateOperation((request) => resolveApprovalAsync(input.runtime, callerOf(request), request.params.runId, request.body)),
|
|
13
|
+
'projects.social.publications.scheduled.list': readOperation((request) => listPublicationsAsync(input.runtime, callerOf(request), true)),
|
|
14
|
+
'projects.social.publications.history.list': readOperation((request) => listPublicationsAsync(input.runtime, callerOf(request), false)),
|
|
15
|
+
'projects.social.publications.receipts.list': readOperation((request) => listReceiptsAsync(input.runtime, callerOf(request))),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/*** Prepare a server-owned Flow run and its exact approval without trusting caller identity JSON. */
|
|
19
|
+
async function schedulePublicationAsync(runtime, caller, body, scheduled) {
|
|
20
|
+
const request = caller && readPublicationRequest(body, caller, scheduled);
|
|
21
|
+
if (!request)
|
|
22
|
+
return invalidResponse();
|
|
23
|
+
try {
|
|
24
|
+
return { status: 202, body: await runtime.scheduleAsync(request) };
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return invalidResponse();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/*** Cancel only a nonterminal Social publication run in the authenticated caller scope. */
|
|
31
|
+
async function cancelPublicationAsync(runtime, caller, runId) {
|
|
32
|
+
const run = caller && runId ? await readCallerPublicationAsync(runtime, caller, runId) : undefined;
|
|
33
|
+
if (!caller || !run)
|
|
34
|
+
return missingResponse();
|
|
35
|
+
const cancelled = await runtime.runtime.cancelRunAsync(scopeOf(caller), run.id);
|
|
36
|
+
return cancelled ? { body: projectRun(cancelled) } : missingResponse();
|
|
37
|
+
}
|
|
38
|
+
/*** Project one caller-owned Social publication execution without exposing Flow node configuration. */
|
|
39
|
+
async function readPublicationAsync(runtime, caller, runId) {
|
|
40
|
+
const run = caller && runId ? await readCallerPublicationAsync(runtime, caller, runId) : undefined;
|
|
41
|
+
return run ? { body: projectRun(run) } : missingResponse();
|
|
42
|
+
}
|
|
43
|
+
/*** Read approval availability only after resolving the caller-owned durable publication run. */
|
|
44
|
+
async function readApprovalAsync(runtime, caller, runId) {
|
|
45
|
+
const run = caller && runId ? await readCallerPublicationAsync(runtime, caller, runId) : undefined;
|
|
46
|
+
if (!caller || !run)
|
|
47
|
+
return missingResponse();
|
|
48
|
+
const approval = await runtime.runtime.getApprovalAvailabilityAsync({
|
|
49
|
+
scope: scopeOf(caller),
|
|
50
|
+
flowId: run.flow.id,
|
|
51
|
+
flowVersion: run.flow.version,
|
|
52
|
+
runId: run.id,
|
|
53
|
+
approvalId: `social-approval:${run.id}`,
|
|
54
|
+
});
|
|
55
|
+
return approval ? { body: approval } : missingResponse();
|
|
56
|
+
}
|
|
57
|
+
/*** Resolve the exact pending approval as the authenticated actor, never an actor supplied by JSON. */
|
|
58
|
+
async function resolveApprovalAsync(runtime, caller, runId, body) {
|
|
59
|
+
const run = caller && runId ? await readCallerPublicationAsync(runtime, caller, runId) : undefined;
|
|
60
|
+
const approved = isRecord(body) && typeof body.approved === 'boolean' ? body.approved : undefined;
|
|
61
|
+
if (!caller || !run || approved === undefined)
|
|
62
|
+
return missingResponse();
|
|
63
|
+
const approval = await runtime.runtime.resolveApprovalAsync({
|
|
64
|
+
scope: scopeOf(caller),
|
|
65
|
+
actorId: caller.actorId,
|
|
66
|
+
approvalId: `social-approval:${run.id}`,
|
|
67
|
+
approved,
|
|
68
|
+
});
|
|
69
|
+
return approval ? { body: approval } : missingResponse();
|
|
70
|
+
}
|
|
71
|
+
/*** List only the caller's Social runs, partitioned into active queue and completed history. */
|
|
72
|
+
async function listPublicationsAsync(runtime, caller, scheduled) {
|
|
73
|
+
if (!caller)
|
|
74
|
+
return { body: [] };
|
|
75
|
+
const runs = await listCallerPublicationRunsAsync(runtime, caller);
|
|
76
|
+
const publications = runs;
|
|
77
|
+
return { body: publications.filter((run) => isActive(run) === scheduled).map(projectRun) };
|
|
78
|
+
}
|
|
79
|
+
/*** Project redacted Social receipts from terminal or active publication run outputs. */
|
|
80
|
+
async function listReceiptsAsync(runtime, caller) {
|
|
81
|
+
if (!caller)
|
|
82
|
+
return { body: [] };
|
|
83
|
+
const runs = await listCallerPublicationRunsAsync(runtime, caller);
|
|
84
|
+
return {
|
|
85
|
+
body: runs.flatMap((run) => receiptOf(run) ?? []),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/*** Parse only the serializable request fields whose ownership begins at the authenticated caller. */
|
|
89
|
+
function readPublicationRequest(body, caller, scheduled) {
|
|
90
|
+
if (!isRecord(body) || typeof body.draftId !== 'string' || !body.draftId.trim())
|
|
91
|
+
return undefined;
|
|
92
|
+
const { revision, destinationIndex, runAt } = body;
|
|
93
|
+
if (typeof revision !== 'number' ||
|
|
94
|
+
typeof destinationIndex !== 'number' ||
|
|
95
|
+
!Number.isSafeInteger(revision) ||
|
|
96
|
+
!Number.isSafeInteger(destinationIndex))
|
|
97
|
+
return undefined;
|
|
98
|
+
if (scheduled && typeof runAt !== 'string')
|
|
99
|
+
return undefined;
|
|
100
|
+
if (!scheduled && runAt !== undefined)
|
|
101
|
+
return undefined;
|
|
102
|
+
return {
|
|
103
|
+
caller,
|
|
104
|
+
draftId: body.draftId,
|
|
105
|
+
revision,
|
|
106
|
+
destinationIndex,
|
|
107
|
+
...(typeof runAt === 'string' ? { runAt } : {}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/*** Load a caller-scoped publication and reject unrelated Flow runs from this host projection. */
|
|
111
|
+
async function readCallerPublicationAsync(runtime, caller, runId) {
|
|
112
|
+
const run = await runtime.runtime.getRunAsync(scopeOf(caller), runId);
|
|
113
|
+
return run && (await isCallerPublicationRunAsync(runtime, caller, run)) ? run : undefined;
|
|
114
|
+
}
|
|
115
|
+
/*** List only runs whose immutable config matches the current environment and authorized project. */
|
|
116
|
+
async function listCallerPublicationRunsAsync(runtime, caller) {
|
|
117
|
+
const runs = await runtime.runtime.listRunsAsync(scopeOf(caller));
|
|
118
|
+
const matches = await Promise.all(runs.map(async (run) => (await isCallerPublicationRunAsync(runtime, caller, run)) ? run : undefined));
|
|
119
|
+
return matches.filter((run) => run !== undefined);
|
|
120
|
+
}
|
|
121
|
+
/*** Bind a Flow run to the configured environment; host authorization retains collaborator access. */
|
|
122
|
+
async function isCallerPublicationRunAsync(runtime, caller, run) {
|
|
123
|
+
if (!run.flow.id.startsWith('social-'))
|
|
124
|
+
return false;
|
|
125
|
+
const workflow = await runtime.runtime.getWorkflowAsync(scopeOf(caller), run.flow.id, run.flow.version);
|
|
126
|
+
const node = workflow?.definition.nodes.find((candidate) => candidate.id === 'publication');
|
|
127
|
+
if (!node)
|
|
128
|
+
return false;
|
|
129
|
+
try {
|
|
130
|
+
const config = readPublicationConfig(node, caller);
|
|
131
|
+
return (config.caller.tenantId === caller.tenantId &&
|
|
132
|
+
config.caller.projectId === caller.projectId &&
|
|
133
|
+
config.caller.environmentId === caller.environmentId);
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/*** Identify Flow statuses whose durable work is still eligible for future execution. */
|
|
140
|
+
function isActive(run) {
|
|
141
|
+
return !['cancelled', 'failed', 'succeeded', 'timed_out'].includes(run.status);
|
|
142
|
+
}
|
|
143
|
+
/*** Project only redaction-safe execution status from the canonical Flow run snapshot. */
|
|
144
|
+
function projectRun(run) {
|
|
145
|
+
return {
|
|
146
|
+
id: run.id,
|
|
147
|
+
status: run.status,
|
|
148
|
+
createdAt: run.createdAt,
|
|
149
|
+
...(run.startedAt === undefined ? {} : { startedAt: run.startedAt }),
|
|
150
|
+
...(run.completedAt === undefined ? {} : { completedAt: run.completedAt }),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/*** Extract the existing redacted publication receipt output without surfacing arbitrary step values. */
|
|
154
|
+
function receiptOf(run) {
|
|
155
|
+
const value = run.steps.find((step) => step.nodeId === 'publication')?.output?.receipt;
|
|
156
|
+
return value?.kind === 'inline' && isRecord(value.value) ? [value.value] : undefined;
|
|
157
|
+
}
|
|
158
|
+
/*** Derive the server-authoritative Flow resource scope from the authenticated caller. */
|
|
159
|
+
function scopeOf(caller) {
|
|
160
|
+
return { tenantId: caller.tenantId, projectId: caller.projectId };
|
|
161
|
+
}
|
|
162
|
+
/*** Declare one read operation using the canonical HTTP method and data intent. */
|
|
163
|
+
function readOperation(handler) {
|
|
164
|
+
return { intent: 'read', method: 'GET', handler };
|
|
165
|
+
}
|
|
166
|
+
/*** Declare one creation operation using the canonical HTTP method and data intent. */
|
|
167
|
+
function createOperation(handler) {
|
|
168
|
+
return { intent: 'create', method: 'POST', handler };
|
|
169
|
+
}
|
|
170
|
+
/*** Declare one resolution operation using the canonical update intent. */
|
|
171
|
+
function updateOperation(handler) {
|
|
172
|
+
return { intent: 'update', method: 'POST', handler };
|
|
173
|
+
}
|
|
174
|
+
/*** Declare one cancellation operation using the canonical delete method and intent. */
|
|
175
|
+
function deleteOperation(handler) {
|
|
176
|
+
return { intent: 'delete', method: 'DELETE', handler };
|
|
177
|
+
}
|
|
178
|
+
/*** Return a stable validation error without reflecting untrusted publication input. */
|
|
179
|
+
function invalidResponse() {
|
|
180
|
+
return { status: 400, body: { error: { code: 'invalid_publication_request' } } };
|
|
181
|
+
}
|
|
182
|
+
/*** Hide caller ownership and publication existence behind one stable response. */
|
|
183
|
+
function missingResponse() {
|
|
184
|
+
return { status: 404, body: { error: { code: 'publication_not_found' } } };
|
|
185
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SocialManagerDraftStore, SocialManagerMediaStore } from '../../../types/socialManager.js';
|
|
2
|
+
import { type ConnectionFileSystemStore } from '../adapters/createConnectionFileSystemStoreAsync.js';
|
|
3
|
+
import { type SocialOperationStores } from '../adapters/createSocialOperationStoresAsync.js';
|
|
4
|
+
export type TrustedSocialManagerFileSystemPersistence = Readonly<{
|
|
5
|
+
drafts: SocialManagerDraftStore;
|
|
6
|
+
media: SocialManagerMediaStore;
|
|
7
|
+
connection: ConnectionFileSystemStore;
|
|
8
|
+
operations: SocialOperationStores;
|
|
9
|
+
}>;
|
|
10
|
+
/***
|
|
11
|
+
* Compose the private, single-writer local stores required by a trusted Social Manager host.
|
|
12
|
+
* Credentials remain behind the injected trusted authorization and provider boundaries.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTrustedSocialManagerFileSystemPersistenceAsync(directory: string): Promise<TrustedSocialManagerFileSystemPersistence>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createConnectionFileSystemStoreAsync, } from '../adapters/createConnectionFileSystemStoreAsync.js';
|
|
2
|
+
import { createSocialManagerDraftStoreAsync } from '../adapters/createSocialManagerDraftStoreAsync.js';
|
|
3
|
+
import { createSocialManagerMediaStoreAsync } from '../adapters/createSocialManagerMediaStoreAsync.js';
|
|
4
|
+
import { createSocialOperationStoresAsync, } from '../adapters/createSocialOperationStoresAsync.js';
|
|
5
|
+
/***
|
|
6
|
+
* Compose the private, single-writer local stores required by a trusted Social Manager host.
|
|
7
|
+
* Credentials remain behind the injected trusted authorization and provider boundaries.
|
|
8
|
+
*/
|
|
9
|
+
export async function createTrustedSocialManagerFileSystemPersistenceAsync(directory) {
|
|
10
|
+
const [drafts, media, connection, operations] = await Promise.all([
|
|
11
|
+
createSocialManagerDraftStoreAsync(directory),
|
|
12
|
+
createSocialManagerMediaStoreAsync(directory),
|
|
13
|
+
createConnectionFileSystemStoreAsync(directory),
|
|
14
|
+
createSocialOperationStoresAsync(directory),
|
|
15
|
+
]);
|
|
16
|
+
return { drafts, media, connection, operations };
|
|
17
|
+
}
|