@ankhorage/projects 0.10.1 → 0.11.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/README.md +1 -1
- package/dist/capabilities/index.d.ts +10 -0
- package/dist/capabilities/index.js +8 -0
- package/dist/features/projects/composition/composeGeneratedRuntimeMaterialization.js +4 -1
- package/dist/features/trusted-social-manager-host/composition/createSocialManagerPublicationOperations.js +32 -1
- package/dist/features/worker-materialization/composition/composeWorkerMaterialization.js +1 -1
- package/package.json +18 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# Ankhorage Projects
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Provides standalone project identity, persistence, and repository-oriented project actions.
|
|
9
9
|
|
|
@@ -429,6 +429,16 @@ export declare const CAPABILITIES: readonly [{
|
|
|
429
429
|
};
|
|
430
430
|
readonly label: "List scheduled social publications";
|
|
431
431
|
readonly description: "List active caller-owned social publication executions.";
|
|
432
|
+
}, {
|
|
433
|
+
readonly id: "projects.social.publications.calendar.list";
|
|
434
|
+
readonly owner: "@ankhorage/projects";
|
|
435
|
+
readonly access: readonly ["read"];
|
|
436
|
+
readonly binding: {
|
|
437
|
+
readonly kind: "action";
|
|
438
|
+
readonly bindableAs: readonly ["target"];
|
|
439
|
+
};
|
|
440
|
+
readonly label: "List social publication calendar events";
|
|
441
|
+
readonly description: "List active caller-owned social publications as Calendar events.";
|
|
432
442
|
}, {
|
|
433
443
|
readonly id: "projects.social.publications.history.list";
|
|
434
444
|
readonly owner: "@ankhorage/projects";
|
|
@@ -266,6 +266,14 @@ export const CAPABILITIES = [
|
|
|
266
266
|
label: 'List scheduled social publications',
|
|
267
267
|
description: 'List active caller-owned social publication executions.',
|
|
268
268
|
},
|
|
269
|
+
{
|
|
270
|
+
id: 'projects.social.publications.calendar.list',
|
|
271
|
+
owner: '@ankhorage/projects',
|
|
272
|
+
access: ['read'],
|
|
273
|
+
binding: { kind: 'action', bindableAs: ['target'] },
|
|
274
|
+
label: 'List social publication calendar events',
|
|
275
|
+
description: 'List active caller-owned social publications as Calendar events.',
|
|
276
|
+
},
|
|
269
277
|
{
|
|
270
278
|
id: 'projects.social.publications.history.list',
|
|
271
279
|
owner: '@ankhorage/projects',
|
|
@@ -4,12 +4,15 @@ const generatedDevelopmentDependencies = {
|
|
|
4
4
|
typescript: '~6.0.3',
|
|
5
5
|
};
|
|
6
6
|
const generatedScripts = { 'devtools:sync': 'ankh devtools sync .' };
|
|
7
|
+
const generatedProjectsDependency = '^0.11.0';
|
|
7
8
|
/*** Compose generated Runtime dependencies and bindings with caller-owned Navigator extensions. */
|
|
8
9
|
export function composeGeneratedRuntimeMaterialization(input) {
|
|
9
10
|
assertNoConflictingRuntimeBindings(input.callerBindings, input.runtimeBindings);
|
|
10
11
|
const packageJson = JSON.parse(input.packageSource);
|
|
11
12
|
return {
|
|
12
13
|
navigatorBindings: {
|
|
14
|
+
...input.callerBindings,
|
|
15
|
+
...input.runtimeBindings,
|
|
13
16
|
guards: { ...input.callerBindings.guards, ...input.runtimeBindings.guards },
|
|
14
17
|
screens: { ...input.callerBindings.screens, ...input.runtimeBindings.screens },
|
|
15
18
|
},
|
|
@@ -18,7 +21,7 @@ export function composeGeneratedRuntimeMaterialization(input) {
|
|
|
18
21
|
dependencies: {
|
|
19
22
|
...packageJson.dependencies,
|
|
20
23
|
...input.runtimeDependencies,
|
|
21
|
-
...(input.socialManager ? { '@ankhorage/projects':
|
|
24
|
+
...(input.socialManager ? { '@ankhorage/projects': generatedProjectsDependency } : {}),
|
|
22
25
|
},
|
|
23
26
|
devDependencies: {
|
|
24
27
|
...packageJson.devDependencies,
|
|
@@ -11,6 +11,7 @@ export function createSocialManagerPublicationOperations(input, callerOf) {
|
|
|
11
11
|
'projects.social.publications.approval.status': readOperation((request) => readApprovalAsync(input.runtime, callerOf(request), request.params.runId)),
|
|
12
12
|
'projects.social.publications.approval.resolve': updateOperation((request) => resolveApprovalAsync(input.runtime, callerOf(request), request.params.runId, request.body)),
|
|
13
13
|
'projects.social.publications.scheduled.list': readOperation((request) => listPublicationsAsync(input.runtime, callerOf(request), true)),
|
|
14
|
+
'projects.social.publications.calendar.list': readOperation((request) => listPublicationCalendarEventsAsync(input.runtime, callerOf(request))),
|
|
14
15
|
'projects.social.publications.history.list': readOperation((request) => listPublicationsAsync(input.runtime, callerOf(request), false)),
|
|
15
16
|
'projects.social.publications.receipts.list': readOperation((request) => listReceiptsAsync(input.runtime, callerOf(request))),
|
|
16
17
|
};
|
|
@@ -76,6 +77,14 @@ async function listPublicationsAsync(runtime, caller, scheduled) {
|
|
|
76
77
|
const publications = runs;
|
|
77
78
|
return { body: publications.filter((run) => isActive(run) === scheduled).map(projectRun) };
|
|
78
79
|
}
|
|
80
|
+
/*** Project active caller-owned durable publications into ZORA's canonical timed Calendar events. */
|
|
81
|
+
async function listPublicationCalendarEventsAsync(runtime, caller) {
|
|
82
|
+
if (!caller)
|
|
83
|
+
return { body: [] };
|
|
84
|
+
const runs = await listCallerPublicationRunsAsync(runtime, caller);
|
|
85
|
+
const events = await Promise.all(runs.filter(isActive).map((run) => calendarEventOf(runtime, caller, run)));
|
|
86
|
+
return { body: events.flat() };
|
|
87
|
+
}
|
|
79
88
|
/*** Project redacted Social receipts from terminal or active publication run outputs. */
|
|
80
89
|
async function listReceiptsAsync(runtime, caller) {
|
|
81
90
|
if (!caller)
|
|
@@ -128,7 +137,8 @@ async function isCallerPublicationRunAsync(runtime, caller, run) {
|
|
|
128
137
|
return false;
|
|
129
138
|
try {
|
|
130
139
|
const config = readPublicationConfig(node, caller);
|
|
131
|
-
return (config.caller.
|
|
140
|
+
return (config.caller.actorId === caller.actorId &&
|
|
141
|
+
config.caller.tenantId === caller.tenantId &&
|
|
132
142
|
config.caller.projectId === caller.projectId &&
|
|
133
143
|
config.caller.environmentId === caller.environmentId);
|
|
134
144
|
}
|
|
@@ -136,6 +146,27 @@ async function isCallerPublicationRunAsync(runtime, caller, run) {
|
|
|
136
146
|
return false;
|
|
137
147
|
}
|
|
138
148
|
}
|
|
149
|
+
/*** Convert a configured durable publication run into a short UTC Calendar appointment. */
|
|
150
|
+
async function calendarEventOf(runtime, caller, run) {
|
|
151
|
+
const workflow = await runtime.runtime.getWorkflowAsync(scopeOf(caller), run.flow.id, run.flow.version);
|
|
152
|
+
const node = workflow?.definition.nodes.find((candidate) => candidate.id === 'publication');
|
|
153
|
+
if (!node)
|
|
154
|
+
return [];
|
|
155
|
+
try {
|
|
156
|
+
const { runAt } = readPublicationConfig(node, caller);
|
|
157
|
+
return [
|
|
158
|
+
{
|
|
159
|
+
id: run.id,
|
|
160
|
+
title: 'Social publication',
|
|
161
|
+
status: run.status === 'pending' ? 'tentative' : 'confirmed',
|
|
162
|
+
range: { allDay: false, start: runAt, duration: 'PT1M', timeZone: 'Etc/UTC' },
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
139
170
|
/*** Identify Flow statuses whose durable work is still eligible for future execution. */
|
|
140
171
|
function isActive(run) {
|
|
141
172
|
return !['cancelled', 'failed', 'succeeded', 'timed_out'].includes(run.status);
|
|
@@ -5,7 +5,7 @@ const WORKER_DEPENDENCIES = {
|
|
|
5
5
|
'@ankhorage/auth': '^0.3.0',
|
|
6
6
|
'@ankhorage/auth-neon': '^0.2.0',
|
|
7
7
|
'@ankhorage/db-postgres': '^0.2.0',
|
|
8
|
-
'@ankhorage/projects': '^0.
|
|
8
|
+
'@ankhorage/projects': '^0.11.0',
|
|
9
9
|
};
|
|
10
10
|
const WORKER_SCRIPTS = {
|
|
11
11
|
'build:web': `expo export --platform web --output-dir ${WORKER_WEB_DIRECTORY}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/projects",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Standalone project identity and repository actions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ankhorage",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"@ankhorage/api": "^0.8.0",
|
|
69
69
|
"@ankhorage/api-fastify": "^0.4.0",
|
|
70
70
|
"@ankhorage/connection": "^0.3.0",
|
|
71
|
-
"@ankhorage/contracts": "^28.
|
|
71
|
+
"@ankhorage/contracts": "^28.4.0",
|
|
72
72
|
"@ankhorage/data-sources": "^2.4.0",
|
|
73
73
|
"@ankhorage/expo-runtime": "^7.11.0",
|
|
74
74
|
"@ankhorage/flow": "^0.12.0",
|
|
75
|
-
"@ankhorage/navigator": "^3.9.
|
|
75
|
+
"@ankhorage/navigator": "^3.9.7",
|
|
76
76
|
"@ankhorage/permissions": "^0.2.64",
|
|
77
77
|
"@ankhorage/runtime": "^5.8.1",
|
|
78
78
|
"@ankhorage/secrets": "^0.3.2",
|
|
@@ -728,6 +728,21 @@
|
|
|
728
728
|
"label": "List scheduled social publications",
|
|
729
729
|
"description": "List active caller-owned social publication executions."
|
|
730
730
|
},
|
|
731
|
+
{
|
|
732
|
+
"id": "projects.social.publications.calendar.list",
|
|
733
|
+
"owner": "@ankhorage/projects",
|
|
734
|
+
"access": [
|
|
735
|
+
"read"
|
|
736
|
+
],
|
|
737
|
+
"binding": {
|
|
738
|
+
"kind": "action",
|
|
739
|
+
"bindableAs": [
|
|
740
|
+
"target"
|
|
741
|
+
]
|
|
742
|
+
},
|
|
743
|
+
"label": "List social publication calendar events",
|
|
744
|
+
"description": "List active caller-owned social publications as Calendar events."
|
|
745
|
+
},
|
|
731
746
|
{
|
|
732
747
|
"id": "projects.social.publications.history.list",
|
|
733
748
|
"owner": "@ankhorage/projects",
|