@ankhorage/projects 0.7.3 → 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.
Files changed (67) hide show
  1. package/README.md +19 -12
  2. package/dist/capabilities/index.d.ts +330 -0
  3. package/dist/capabilities/index.js +194 -0
  4. package/dist/capabilities/socialManagerMediaAnalytics.d.ts +92 -0
  5. package/dist/capabilities/socialManagerMediaAnalytics.js +75 -0
  6. package/dist/features/projects/composition/composeGeneratedRuntimeMaterialization.d.ts +1 -0
  7. package/dist/features/projects/composition/composeGeneratedRuntimeMaterialization.js +13 -5
  8. package/dist/features/projects/composition/createExpoProjectMaterializer.js +27 -23
  9. package/dist/features/projects/composition/createRootNavigatorGenerationOptions.d.ts +9 -0
  10. package/dist/features/projects/composition/createRootNavigatorGenerationOptions.js +10 -0
  11. package/dist/features/projects/composition/createSocialManagerServerFiles.d.ts +6 -0
  12. package/dist/features/projects/composition/createSocialManagerServerFiles.js +16 -0
  13. package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemRepositories.d.ts +16 -0
  14. package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemRepositories.js +201 -0
  15. package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemStoreAsync.d.ts +25 -0
  16. package/dist/features/trusted-social-manager-host/adapters/createConnectionFileSystemStoreAsync.js +72 -0
  17. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerDraftStoreAsync.d.ts +7 -0
  18. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerDraftStoreAsync.js +160 -0
  19. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerFlowSecurityAsync.d.ts +19 -0
  20. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerFlowSecurityAsync.js +176 -0
  21. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaPreflight.d.ts +4 -0
  22. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaPreflight.js +37 -0
  23. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaStoreAsync.d.ts +7 -0
  24. package/dist/features/trusted-social-manager-host/adapters/createSocialManagerMediaStoreAsync.js +242 -0
  25. package/dist/features/trusted-social-manager-host/adapters/createSocialOperationStoresAsync.d.ts +13 -0
  26. package/dist/features/trusted-social-manager-host/adapters/createSocialOperationStoresAsync.js +244 -0
  27. package/dist/features/trusted-social-manager-host/adapters/projectSocialManagerConnection.d.ts +53 -0
  28. package/dist/features/trusted-social-manager-host/adapters/projectSocialManagerConnection.js +42 -0
  29. package/dist/features/trusted-social-manager-host/application/createSocialManagerPublicationRuntime.d.ts +10 -0
  30. package/dist/features/trusted-social-manager-host/application/createSocialManagerPublicationRuntime.js +240 -0
  31. package/dist/features/trusted-social-manager-host/application/resolveSocialManagerPublication.d.ts +22 -0
  32. package/dist/features/trusted-social-manager-host/application/resolveSocialManagerPublication.js +97 -0
  33. package/dist/features/trusted-social-manager-host/composition/createSocialManagerCapabilityOperations.d.ts +22 -0
  34. package/dist/features/trusted-social-manager-host/composition/createSocialManagerCapabilityOperations.js +224 -0
  35. package/dist/features/trusted-social-manager-host/composition/createSocialManagerConnectionOperations.d.ts +20 -0
  36. package/dist/features/trusted-social-manager-host/composition/createSocialManagerConnectionOperations.js +152 -0
  37. package/dist/features/trusted-social-manager-host/composition/createSocialManagerLocalProviderFixtures.d.ts +22 -0
  38. package/dist/features/trusted-social-manager-host/composition/createSocialManagerLocalProviderFixtures.js +271 -0
  39. package/dist/features/trusted-social-manager-host/composition/createSocialManagerMediaOperations.d.ts +14 -0
  40. package/dist/features/trusted-social-manager-host/composition/createSocialManagerMediaOperations.js +72 -0
  41. package/dist/features/trusted-social-manager-host/composition/createSocialManagerProvider.d.ts +20 -0
  42. package/dist/features/trusted-social-manager-host/composition/createSocialManagerProvider.js +20 -0
  43. package/dist/features/trusted-social-manager-host/composition/createSocialManagerPublicationOperations.d.ts +15 -0
  44. package/dist/features/trusted-social-manager-host/composition/createSocialManagerPublicationOperations.js +185 -0
  45. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerFileSystemPersistenceAsync.d.ts +14 -0
  46. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerFileSystemPersistenceAsync.js +17 -0
  47. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerHost.d.ts +51 -0
  48. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerHost.js +188 -0
  49. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalHostAsync.d.ts +18 -0
  50. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalHostAsync.js +177 -0
  51. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalServerAsync.d.ts +26 -0
  52. package/dist/features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalServerAsync.js +66 -0
  53. package/dist/features/trusted-social-manager-host/domain/publicationConfig.d.ts +18 -0
  54. package/dist/features/trusted-social-manager-host/domain/publicationConfig.js +77 -0
  55. package/dist/features/trusted-social-manager-host/domain/readSocialManagerConnectionRequest.d.ts +54 -0
  56. package/dist/features/trusted-social-manager-host/domain/readSocialManagerConnectionRequest.js +77 -0
  57. package/dist/features/trusted-social-manager-host/domain/readSocialManagerDraftContent.d.ts +3 -0
  58. package/dist/features/trusted-social-manager-host/domain/readSocialManagerDraftContent.js +47 -0
  59. package/dist/features/trusted-social-manager-host/domain/socialManagerConnectionIdentity.d.ts +17 -0
  60. package/dist/features/trusted-social-manager-host/domain/socialManagerConnectionIdentity.js +17 -0
  61. package/dist/index.d.ts +16 -0
  62. package/dist/index.js +14 -0
  63. package/dist/types/socialManager.d.ts +77 -0
  64. package/dist/types/socialManager.js +1 -0
  65. package/dist/types/socialManagerPublication.d.ts +27 -0
  66. package/dist/types/socialManagerPublication.js +1 -0
  67. package/package.json +506 -8
@@ -0,0 +1,54 @@
1
+ import type { DelegatedAuthorizationProvider, ManagedConnection } from '@ankhorage/connection';
2
+ import type { SocialManagerCaller } from '../../../types/socialManager.js';
3
+ /*** Parse a narrow connection request while always retaining the authenticated caller identity. */
4
+ export declare function readSocialManagerConnectRequest(body: unknown, caller: SocialManagerCaller, connectionId: string): {
5
+ connectionId: string;
6
+ provider: DelegatedAuthorizationProvider;
7
+ requestedScopes: readonly string[];
8
+ actorId: string;
9
+ tenantId: string;
10
+ projectId: string;
11
+ environmentId: string;
12
+ } | undefined;
13
+ /*** Parse the opaque provider callback envelope without interpreting provider-owned payload data. */
14
+ export declare function readSocialManagerConnectionCallback(body: unknown): {
15
+ attemptId: string;
16
+ payload: string;
17
+ } | undefined;
18
+ /*** Parse an authorized target discovery requirement below a trusted durable connection. */
19
+ export declare function readSocialManagerDiscoveryRequirement(query: Readonly<Record<string, string | readonly string[]>>, connection: ManagedConnection): {
20
+ connection: {
21
+ tenantId: string;
22
+ projectId: string;
23
+ environmentId: string;
24
+ actorId: string;
25
+ provider: DelegatedAuthorizationProvider;
26
+ connectionId: string;
27
+ accountId: string;
28
+ };
29
+ operation: string;
30
+ roles: readonly string[];
31
+ scopes: readonly string[];
32
+ } | undefined;
33
+ /*** Read an opaque target identifier that is later resolved below a caller-owned connection. */
34
+ export declare function readSocialManagerTargetId(body: unknown): string | undefined;
35
+ /*** Build the durable identity shared by target discovery and revocation use cases. */
36
+ export declare function socialManagerConnectionReference(connection: ManagedConnection): {
37
+ tenantId: string;
38
+ projectId: string;
39
+ environmentId: string;
40
+ actorId: string;
41
+ provider: DelegatedAuthorizationProvider;
42
+ connectionId: string;
43
+ accountId: string;
44
+ };
45
+ /*** Build a reconnect request from durable connection ownership rather than client supplied state. */
46
+ export declare function socialManagerReconnectInput(connection: ManagedConnection): {
47
+ tenantId: string;
48
+ projectId: string;
49
+ environmentId: string;
50
+ actorId: string;
51
+ connectionId: string;
52
+ provider: DelegatedAuthorizationProvider;
53
+ requestedScopes: readonly string[];
54
+ };
@@ -0,0 +1,77 @@
1
+ import { isRecord } from '@ankhorage/utility/object';
2
+ /*** Parse a narrow connection request while always retaining the authenticated caller identity. */
3
+ export function readSocialManagerConnectRequest(body, caller, connectionId) {
4
+ if (!isRecord(body) || !isProvider(body.provider) || !isStringArray(body.requestedScopes))
5
+ return undefined;
6
+ return {
7
+ ...caller,
8
+ connectionId,
9
+ provider: body.provider,
10
+ requestedScopes: body.requestedScopes,
11
+ };
12
+ }
13
+ /*** Parse the opaque provider callback envelope without interpreting provider-owned payload data. */
14
+ export function readSocialManagerConnectionCallback(body) {
15
+ return isRecord(body) && typeof body.attemptId === 'string' && typeof body.payload === 'string'
16
+ ? { attemptId: body.attemptId, payload: body.payload }
17
+ : undefined;
18
+ }
19
+ /*** Parse an authorized target discovery requirement below a trusted durable connection. */
20
+ export function readSocialManagerDiscoveryRequirement(query, connection) {
21
+ const { operation } = query;
22
+ return typeof operation === 'string' && operation.trim()
23
+ ? {
24
+ connection: socialManagerConnectionReference(connection),
25
+ operation,
26
+ roles: splitQuery(query.roles),
27
+ scopes: splitQuery(query.scopes),
28
+ }
29
+ : undefined;
30
+ }
31
+ /*** Read an opaque target identifier that is later resolved below a caller-owned connection. */
32
+ export function readSocialManagerTargetId(body) {
33
+ return isRecord(body) && typeof body.targetId === 'string' && body.targetId.trim()
34
+ ? body.targetId
35
+ : undefined;
36
+ }
37
+ /*** Build the durable identity shared by target discovery and revocation use cases. */
38
+ export function socialManagerConnectionReference(connection) {
39
+ return {
40
+ tenantId: connection.tenantId,
41
+ projectId: connection.projectId,
42
+ environmentId: connection.environmentId,
43
+ actorId: connection.actorId,
44
+ provider: connection.provider,
45
+ connectionId: connection.connectionId,
46
+ accountId: connection.accountId,
47
+ };
48
+ }
49
+ /*** Build a reconnect request from durable connection ownership rather than client supplied state. */
50
+ export function socialManagerReconnectInput(connection) {
51
+ return {
52
+ tenantId: connection.tenantId,
53
+ projectId: connection.projectId,
54
+ environmentId: connection.environmentId,
55
+ actorId: connection.actorId,
56
+ connectionId: connection.connectionId,
57
+ provider: connection.provider,
58
+ requestedScopes: connection.grantedScopes,
59
+ };
60
+ }
61
+ /*** Admit only the released delegated-authorization providers. */
62
+ function isProvider(value) {
63
+ return (value === 'facebook-login' ||
64
+ value === 'instagram-login' ||
65
+ value === 'linkedin' ||
66
+ value === 'pinterest');
67
+ }
68
+ /*** Reject empty or non-string requested scopes before authorization state is persisted. */
69
+ function isStringArray(value) {
70
+ return (Array.isArray(value) &&
71
+ value.length > 0 &&
72
+ value.every((item) => typeof item === 'string' && item.trim()));
73
+ }
74
+ /*** Split optional comma-separated query values into nonempty canonical requirement entries. */
75
+ function splitQuery(value) {
76
+ return (typeof value === 'string' ? value.split(',') : (value ?? [])).filter((item) => item.trim().length > 0);
77
+ }
@@ -0,0 +1,3 @@
1
+ import type { SocialManagerDraftContent } from '../../../types/socialManager.js';
2
+ /*** Validate and project only the permitted draft fields; selections confer no authorization. */
3
+ export declare function readSocialManagerDraftContent(value: unknown): SocialManagerDraftContent | undefined;
@@ -0,0 +1,47 @@
1
+ import { isRecord } from '@ankhorage/utility/object';
2
+ /*** Validate and project only the permitted draft fields; selections confer no authorization. */
3
+ export function readSocialManagerDraftContent(value) {
4
+ if (!isRecord(value) ||
5
+ typeof value.title !== 'string' ||
6
+ typeof value.text !== 'string' ||
7
+ !isStringList(value.mediaIds) ||
8
+ !Array.isArray(value.destinations) ||
9
+ (value.link !== undefined && typeof value.link !== 'string')) {
10
+ return undefined;
11
+ }
12
+ const destinations = value.destinations.map(readDestination);
13
+ if (!destinations.every((destination) => destination !== undefined))
14
+ return undefined;
15
+ return {
16
+ title: value.title,
17
+ text: value.text,
18
+ mediaIds: value.mediaIds,
19
+ ...(value.link === undefined ? {} : { link: value.link }),
20
+ destinations,
21
+ };
22
+ }
23
+ /*** Read a credential-free destination selection and its channel-specific content. */
24
+ function readDestination(value) {
25
+ if (!isRecord(value) ||
26
+ typeof value.connectionId !== 'string' ||
27
+ !value.connectionId.trim() ||
28
+ typeof value.targetId !== 'string' ||
29
+ !value.targetId.trim() ||
30
+ typeof value.text !== 'string' ||
31
+ !isStringList(value.mediaIds) ||
32
+ (value.link !== undefined && typeof value.link !== 'string')) {
33
+ return undefined;
34
+ }
35
+ return {
36
+ connectionId: value.connectionId,
37
+ targetId: value.targetId,
38
+ text: value.text,
39
+ mediaIds: value.mediaIds,
40
+ ...(value.link === undefined ? {} : { link: value.link }),
41
+ };
42
+ }
43
+ /*** Accept only opaque, non-empty string identifiers in a media selection. */
44
+ function isStringList(value) {
45
+ return (Array.isArray(value) &&
46
+ value.every((item) => typeof item === 'string' && item.trim().length > 0));
47
+ }
@@ -0,0 +1,17 @@
1
+ import type { ManagedConnection } from '@ankhorage/connection';
2
+ import type { SocialManagerCaller } from '../../../types/socialManager.js';
3
+ /*** Compare the authenticated caller with every durable authorization ownership dimension. */
4
+ export declare function isSocialManagerConnectionOwner(value: Pick<ManagedConnection, keyof SocialManagerCaller>, caller: SocialManagerCaller): boolean;
5
+ /*** Construct one exact server-owned revocation operation for a caller-owned target. */
6
+ export declare function socialManagerRevocationOperation(connection: ManagedConnection, targetId: string): {
7
+ targetId: string;
8
+ authorizationId: string;
9
+ effectId: string;
10
+ tenantId: string;
11
+ projectId: string;
12
+ environmentId: string;
13
+ actorId: string;
14
+ provider: import("@ankhorage/connection").DelegatedAuthorizationProvider;
15
+ connectionId: string;
16
+ accountId: string;
17
+ };
@@ -0,0 +1,17 @@
1
+ import { socialManagerConnectionReference } from './readSocialManagerConnectionRequest.js';
2
+ /*** Compare the authenticated caller with every durable authorization ownership dimension. */
3
+ export function isSocialManagerConnectionOwner(value, caller) {
4
+ return (value.tenantId === caller.tenantId &&
5
+ value.projectId === caller.projectId &&
6
+ value.environmentId === caller.environmentId &&
7
+ value.actorId === caller.actorId);
8
+ }
9
+ /*** Construct one exact server-owned revocation operation for a caller-owned target. */
10
+ export function socialManagerRevocationOperation(connection, targetId) {
11
+ return {
12
+ ...socialManagerConnectionReference(connection),
13
+ targetId,
14
+ authorizationId: connection.authorizationId,
15
+ effectId: `social-revocation:${connection.connectionId}:${connection.authorizationId}:${targetId}`,
16
+ };
17
+ }
package/dist/index.d.ts CHANGED
@@ -3,5 +3,21 @@ export { projects } from './features/projects/application/projects.js';
3
3
  export { createExpoProjectMaterializer, type CreateExpoProjectMaterializerInput, type ExpoProjectMaterializationResult, type ExpoProjectMaterializer, } from './features/projects/composition/createExpoProjectMaterializer.js';
4
4
  export { createProjectsApiHandlerResolver } from './features/projects/composition/createProjectsApiHandlerResolver.js';
5
5
  export type { ProjectMaterializer, ProjectRepository, } from './features/projects/ports/ProjectRepository.js';
6
+ export { type ConnectionFileSystemStore, createConnectionFileSystemStoreAsync, } from './features/trusted-social-manager-host/adapters/createConnectionFileSystemStoreAsync.js';
7
+ export { createSocialManagerDraftStoreAsync } from './features/trusted-social-manager-host/adapters/createSocialManagerDraftStoreAsync.js';
8
+ export { createSocialManagerFlowSecurityAsync, type CreateSocialManagerFlowSecurityInput, } from './features/trusted-social-manager-host/adapters/createSocialManagerFlowSecurityAsync.js';
9
+ export { createSocialManagerMediaPreflight } from './features/trusted-social-manager-host/adapters/createSocialManagerMediaPreflight.js';
10
+ export { createSocialManagerMediaStoreAsync } from './features/trusted-social-manager-host/adapters/createSocialManagerMediaStoreAsync.js';
11
+ export { createSocialOperationStoresAsync, type SocialOperationStores, } from './features/trusted-social-manager-host/adapters/createSocialOperationStoresAsync.js';
12
+ export { createSocialManagerPublicationRuntime } from './features/trusted-social-manager-host/application/createSocialManagerPublicationRuntime.js';
13
+ export { createSocialManagerCapabilityOperations, type SocialManagerCapabilityHostDependencies, } from './features/trusted-social-manager-host/composition/createSocialManagerCapabilityOperations.js';
14
+ export { createSocialManagerLocalProviderFixtures, type SocialManagerLocalProviderFixtures, } from './features/trusted-social-manager-host/composition/createSocialManagerLocalProviderFixtures.js';
15
+ export { createSocialManagerMediaOperations, type SocialManagerMediaHostDependencies, } from './features/trusted-social-manager-host/composition/createSocialManagerMediaOperations.js';
16
+ export { createSocialManagerProvider, type SocialManagerProviderConfiguration, } from './features/trusted-social-manager-host/composition/createSocialManagerProvider.js';
17
+ export { createTrustedSocialManagerFileSystemPersistenceAsync, type TrustedSocialManagerFileSystemPersistence, } from './features/trusted-social-manager-host/composition/createTrustedSocialManagerFileSystemPersistenceAsync.js';
18
+ export { createTrustedSocialManagerHost, createTrustedSocialManagerHostAsync, type CreateTrustedSocialManagerHostAsyncInput, type CreateTrustedSocialManagerHostInput, } from './features/trusted-social-manager-host/composition/createTrustedSocialManagerHost.js';
19
+ export { createTrustedSocialManagerLocalServerAsync, type CreateTrustedSocialManagerLocalServerAsyncInput, findTrustedSocialManagerApiDefinition, type TrustedSocialManagerLocalServer, } from './features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalServerAsync.js';
6
20
  export { createTrustedZefixHost, type CreateTrustedZefixHostInput, type TrustedZefixHost, } from './features/trusted-zefix-host/composition/createTrustedZefixHost.js';
7
21
  export type { CreateProjectInput, MaterializeProjectRevisionInput, Project, ProjectManifest, ProjectManifestDraft, ProjectManifestRevision, ReloadProjectManifestInput, SaveProjectManifestInput, UpdateProjectInput, } from './types/projects.js';
22
+ export type { SocialManagerCaller, SocialManagerDestination, SocialManagerDraft, SocialManagerDraftContent, SocialManagerDraftStore, SocialManagerDraftUpdate, SocialManagerMedia, SocialManagerMediaStore, SocialManagerMediaUpload, SocialManagerScope, } from './types/socialManager.js';
23
+ export type { SocialManagerPublicationBinding, SocialManagerPublicationDependencies, SocialManagerPublicationRequest, } from './types/socialManagerPublication.js';
package/dist/index.js CHANGED
@@ -2,4 +2,18 @@ export { createProjectRepositoryFileSystemAsync } from './features/projects/adap
2
2
  export { projects } from './features/projects/application/projects.js';
3
3
  export { createExpoProjectMaterializer, } from './features/projects/composition/createExpoProjectMaterializer.js';
4
4
  export { createProjectsApiHandlerResolver } from './features/projects/composition/createProjectsApiHandlerResolver.js';
5
+ export { createConnectionFileSystemStoreAsync, } from './features/trusted-social-manager-host/adapters/createConnectionFileSystemStoreAsync.js';
6
+ export { createSocialManagerDraftStoreAsync } from './features/trusted-social-manager-host/adapters/createSocialManagerDraftStoreAsync.js';
7
+ export { createSocialManagerFlowSecurityAsync, } from './features/trusted-social-manager-host/adapters/createSocialManagerFlowSecurityAsync.js';
8
+ export { createSocialManagerMediaPreflight } from './features/trusted-social-manager-host/adapters/createSocialManagerMediaPreflight.js';
9
+ export { createSocialManagerMediaStoreAsync } from './features/trusted-social-manager-host/adapters/createSocialManagerMediaStoreAsync.js';
10
+ export { createSocialOperationStoresAsync, } from './features/trusted-social-manager-host/adapters/createSocialOperationStoresAsync.js';
11
+ export { createSocialManagerPublicationRuntime } from './features/trusted-social-manager-host/application/createSocialManagerPublicationRuntime.js';
12
+ export { createSocialManagerCapabilityOperations, } from './features/trusted-social-manager-host/composition/createSocialManagerCapabilityOperations.js';
13
+ export { createSocialManagerLocalProviderFixtures, } from './features/trusted-social-manager-host/composition/createSocialManagerLocalProviderFixtures.js';
14
+ export { createSocialManagerMediaOperations, } from './features/trusted-social-manager-host/composition/createSocialManagerMediaOperations.js';
15
+ export { createSocialManagerProvider, } from './features/trusted-social-manager-host/composition/createSocialManagerProvider.js';
16
+ export { createTrustedSocialManagerFileSystemPersistenceAsync, } from './features/trusted-social-manager-host/composition/createTrustedSocialManagerFileSystemPersistenceAsync.js';
17
+ export { createTrustedSocialManagerHost, createTrustedSocialManagerHostAsync, } from './features/trusted-social-manager-host/composition/createTrustedSocialManagerHost.js';
18
+ export { createTrustedSocialManagerLocalServerAsync, findTrustedSocialManagerApiDefinition, } from './features/trusted-social-manager-host/composition/createTrustedSocialManagerLocalServerAsync.js';
5
19
  export { createTrustedZefixHost, } from './features/trusted-zefix-host/composition/createTrustedZefixHost.js';
@@ -0,0 +1,77 @@
1
+ /*** The server-resolved boundary within which collaborators may access drafts. */
2
+ export interface SocialManagerScope {
3
+ readonly tenantId: string;
4
+ readonly projectId: string;
5
+ readonly environmentId: string;
6
+ }
7
+ /*** An untrusted selection, not an authorization grant. Resolve it before provider execution. */
8
+ export interface SocialManagerDestination {
9
+ readonly connectionId: string;
10
+ readonly targetId: string;
11
+ readonly text: string;
12
+ readonly mediaIds: readonly string[];
13
+ readonly link?: string;
14
+ }
15
+ /*** Editable content contains opaque destination and media references, never credentials. */
16
+ export interface SocialManagerDraftContent {
17
+ readonly title: string;
18
+ readonly text: string;
19
+ readonly mediaIds: readonly string[];
20
+ readonly link?: string;
21
+ readonly destinations: readonly SocialManagerDestination[];
22
+ }
23
+ /*** An immutable draft revision suitable for binding subsequent approval to exact content. */
24
+ export interface SocialManagerDraft {
25
+ readonly id: string;
26
+ readonly revision: number;
27
+ readonly createdAt: string;
28
+ readonly updatedAt: string;
29
+ readonly content: SocialManagerDraftContent;
30
+ }
31
+ export type SocialManagerDraftUpdate = {
32
+ readonly status: 'updated';
33
+ readonly draft: SocialManagerDraft;
34
+ } | {
35
+ readonly status: 'not-found' | 'conflict';
36
+ };
37
+ /*** Durable host-owned draft persistence; scope is supplied by the trusted server, never the body. */
38
+ export interface SocialManagerDraftStore {
39
+ readonly createAsync: (scope: SocialManagerScope, content: SocialManagerDraftContent) => Promise<SocialManagerDraft>;
40
+ readonly listAsync: (scope: SocialManagerScope) => Promise<readonly SocialManagerDraft[]>;
41
+ readonly readAsync: (scope: SocialManagerScope, id: string, revision?: number) => Promise<SocialManagerDraft | undefined>;
42
+ readonly updateAsync: (scope: SocialManagerScope, id: string, expectedRevision: number, content: SocialManagerDraftContent) => Promise<SocialManagerDraftUpdate>;
43
+ readonly isMediaReferencedAsync: (scope: SocialManagerScope, mediaId: string) => Promise<boolean>;
44
+ }
45
+ /*** Identity obtained from a trusted authenticator, not from operation input. */
46
+ export interface SocialManagerCaller extends SocialManagerScope {
47
+ readonly actorId: string;
48
+ }
49
+ /*** Immutable metadata for host-owned media selected by a Social Manager draft. */
50
+ export interface SocialManagerMedia {
51
+ readonly mediaId: string;
52
+ readonly kind: 'image' | 'video';
53
+ readonly contentType: string;
54
+ readonly byteLength: number;
55
+ readonly createdAt: string;
56
+ }
57
+ /*** Raw upload content accepted only at the trusted Social Manager host boundary. */
58
+ export interface SocialManagerMediaUpload {
59
+ readonly contentType: string;
60
+ readonly bytes: Uint8Array;
61
+ }
62
+ /*** Durable caller-scoped media persistence with immutable content references. */
63
+ export interface SocialManagerMediaStore {
64
+ readonly uploadAsync: (caller: SocialManagerCaller, upload: SocialManagerMediaUpload) => Promise<SocialManagerMedia>;
65
+ readonly listAsync: (caller: SocialManagerCaller) => Promise<readonly SocialManagerMedia[]>;
66
+ readonly readAsync: (caller: SocialManagerCaller, mediaId: string) => Promise<SocialManagerMedia | undefined>;
67
+ readonly loadAsync: (caller: SocialManagerCaller, mediaId: string) => Promise<Readonly<{
68
+ media: SocialManagerMedia;
69
+ bytes: Uint8Array;
70
+ }> | undefined>;
71
+ readonly readForPublicationAsync: (input: Readonly<{
72
+ tenantId: string;
73
+ actorId: string;
74
+ mediaId: string;
75
+ }>) => Promise<SocialManagerMedia | undefined>;
76
+ readonly removeAsync: (caller: SocialManagerCaller, mediaId: string, isReferencedAsync: (media: SocialManagerMedia) => Promise<boolean>) => Promise<'removed' | 'not-found' | 'referenced'>;
77
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { ConnectionTargetDiscoveryPort, ManagedConnection } from '@ankhorage/connection';
2
+ import type { FlowRuntimeDependencies, FlowSecurityPort } from '@ankhorage/flow';
3
+ import type { SocialMediaPreflightPort, SocialMediaRef, SocialProviderPort, SocialTargetRef } from '@ankhorage/social';
4
+ import type { SocialManagerCaller, SocialManagerDestination, SocialManagerDraftStore, SocialManagerScope } from './socialManager.js';
5
+ export interface SocialManagerPublicationBinding {
6
+ readonly connection: ManagedConnection;
7
+ readonly target: SocialTargetRef;
8
+ readonly provider: SocialProviderPort;
9
+ }
10
+ export interface SocialManagerPublicationDependencies {
11
+ readonly scope: SocialManagerScope;
12
+ readonly drafts: SocialManagerDraftStore;
13
+ readonly flow: Omit<FlowRuntimeDependencies, 'nodeRegistry' | 'security'> & {
14
+ readonly security: FlowSecurityPort;
15
+ };
16
+ readonly discovery: ConnectionTargetDiscoveryPort;
17
+ readonly resolveBindingAsync: (caller: SocialManagerCaller, destination: SocialManagerDestination) => Promise<SocialManagerPublicationBinding | undefined>;
18
+ readonly resolveMediaAsync: (caller: SocialManagerCaller, mediaIds: readonly string[]) => Promise<readonly SocialMediaRef[]>;
19
+ readonly mediaPreflight: SocialMediaPreflightPort;
20
+ }
21
+ export interface SocialManagerPublicationRequest {
22
+ readonly caller: SocialManagerCaller;
23
+ readonly draftId: string;
24
+ readonly revision: number;
25
+ readonly destinationIndex: number;
26
+ readonly runAt?: string;
27
+ }
@@ -0,0 +1 @@
1
+ export {};