@shipfox/api-definitions 5.0.0 → 7.1.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/.turbo/turbo-build.log +11 -13
- package/CHANGELOG.md +49 -0
- package/dist/core/entities/workflow-definition.d.ts +2 -5
- package/dist/core/entities/workflow-definition.d.ts.map +1 -1
- package/dist/core/entities/workflow-definition.js.map +1 -1
- package/dist/core/entities/workflow-model.d.ts +1 -137
- package/dist/core/entities/workflow-model.d.ts.map +1 -1
- package/dist/core/entities/workflow-model.js.map +1 -1
- package/dist/core/integrations.d.ts +25 -0
- package/dist/core/integrations.d.ts.map +1 -0
- package/dist/core/integrations.js +30 -0
- package/dist/core/integrations.js.map +1 -0
- package/dist/core/sync-definitions.d.ts +2 -2
- package/dist/core/sync-definitions.d.ts.map +1 -1
- package/dist/core/sync-definitions.js +23 -14
- package/dist/core/sync-definitions.js.map +1 -1
- package/dist/core/workflow-model/constants.d.ts +1 -1
- package/dist/core/workflow-model/constants.d.ts.map +1 -1
- package/dist/core/workflow-model/constants.js +1 -1
- package/dist/core/workflow-model/constants.js.map +1 -1
- package/dist/core/workflow-model/normalize-job-checkout.d.ts +2 -2
- package/dist/core/workflow-model/normalize-job-checkout.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-job-checkout.js +2 -6
- package/dist/core/workflow-model/normalize-job-checkout.js.map +1 -1
- package/dist/core/workflow-model/normalize-job-success.d.ts +2 -1
- package/dist/core/workflow-model/normalize-job-success.d.ts.map +1 -1
- package/dist/core/workflow-model/normalize-job-success.js +2 -1
- package/dist/core/workflow-model/normalize-job-success.js.map +1 -1
- package/dist/db/db.d.ts +2 -2
- package/dist/db/schema/sync-states.d.ts +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/presentation/index.d.ts +1 -1
- package/dist/presentation/index.d.ts.map +1 -1
- package/dist/presentation/index.js +1 -1
- package/dist/presentation/index.js.map +1 -1
- package/dist/presentation/inter-module.d.ts +4 -0
- package/dist/presentation/inter-module.d.ts.map +1 -0
- package/dist/presentation/inter-module.js +25 -0
- package/dist/presentation/inter-module.js.map +1 -0
- package/dist/presentation/routes/create-definition.d.ts +5 -6
- package/dist/presentation/routes/create-definition.d.ts.map +1 -1
- package/dist/presentation/routes/create-definition.js +7 -19
- package/dist/presentation/routes/create-definition.js.map +1 -1
- package/dist/presentation/routes/get-definition.d.ts +2 -1
- package/dist/presentation/routes/get-definition.d.ts.map +1 -1
- package/dist/presentation/routes/get-definition.js +26 -35
- package/dist/presentation/routes/get-definition.js.map +1 -1
- package/dist/presentation/routes/index.d.ts +1 -2
- package/dist/presentation/routes/index.d.ts.map +1 -1
- package/dist/presentation/routes/index.js +5 -6
- package/dist/presentation/routes/index.js.map +1 -1
- package/dist/presentation/routes/list-definitions.d.ts +2 -1
- package/dist/presentation/routes/list-definitions.d.ts.map +1 -1
- package/dist/presentation/routes/list-definitions.js +36 -45
- package/dist/presentation/routes/list-definitions.js.map +1 -1
- package/dist/presentation/routes/project-access.d.ts +10 -0
- package/dist/presentation/routes/project-access.d.ts.map +1 -0
- package/dist/presentation/routes/project-access.js +17 -0
- package/dist/presentation/routes/project-access.js.map +1 -0
- package/dist/temporal/activities/sync-activities.d.ts +3 -9
- package/dist/temporal/activities/sync-activities.d.ts.map +1 -1
- package/dist/temporal/activities/sync-activities.js +10 -14
- package/dist/temporal/activities/sync-activities.js.map +1 -1
- package/dist/temporal/workflows/index.bundle.js +17195 -3337
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +16 -32
- package/src/core/entities/workflow-definition.ts +3 -6
- package/src/core/entities/workflow-model.ts +1 -162
- package/src/core/integrations.ts +39 -0
- package/src/core/sync-definitions.test.ts +19 -17
- package/src/core/sync-definitions.ts +26 -20
- package/src/core/workflow-model/constants.ts +1 -1
- package/src/core/workflow-model/normalize-job-checkout.ts +2 -5
- package/src/core/workflow-model/normalize-job-success.ts +2 -1
- package/src/db/definitions.test.ts +68 -7
- package/src/index.ts +12 -31
- package/src/presentation/index.ts +1 -1
- package/src/presentation/inter-module.ts +25 -0
- package/src/presentation/routes/create-definition.test.ts +59 -63
- package/src/presentation/routes/create-definition.ts +15 -34
- package/src/presentation/routes/get-definition.test.ts +14 -8
- package/src/presentation/routes/get-definition.ts +25 -28
- package/src/presentation/routes/index.test.ts +8 -1
- package/src/presentation/routes/index.ts +5 -7
- package/src/presentation/routes/list-definitions.test.ts +8 -7
- package/src/presentation/routes/list-definitions.ts +33 -36
- package/src/presentation/routes/project-access.ts +16 -0
- package/src/temporal/activities/sync-activities.test.ts +14 -6
- package/src/temporal/activities/sync-activities.ts +20 -33
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
IntegrationSourceControlService,
|
|
4
|
-
LoadWorkspaceConnectionSnapshot,
|
|
5
|
-
} from '@shipfox/api-integration-core';
|
|
1
|
+
import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
|
|
2
|
+
import {markErrorReported} from '@shipfox/node-error-monitoring';
|
|
6
3
|
import {Context} from '@temporalio/activity';
|
|
7
4
|
import {ApplicationFailure} from '@temporalio/common';
|
|
8
5
|
import type {DefinitionSyncErrorCode} from '#core/entities/sync-state.js';
|
|
@@ -13,6 +10,8 @@ import {
|
|
|
13
10
|
resolveSyncSource,
|
|
14
11
|
UNRESOLVED_SYNC_REF,
|
|
15
12
|
} from '#core/index.js';
|
|
13
|
+
import type {DefinitionsSourceControl} from '#core/integrations.js';
|
|
14
|
+
import {loadIntegrationValidationContext} from '#core/integrations.js';
|
|
16
15
|
import {applyVcsDefinitionsBatch, markDefinitionSyncState} from '#db/index.js';
|
|
17
16
|
|
|
18
17
|
export interface SyncWorkflowInput {
|
|
@@ -52,29 +51,20 @@ export interface FetchAndApplyActivityResult {
|
|
|
52
51
|
deletedCount: number;
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
export interface DefinitionSyncIntegrationValidationOptions {
|
|
56
|
-
agentToolSelectionCatalogs: AgentToolSelectionCatalogs;
|
|
57
|
-
loadWorkspaceConnectionSnapshot: LoadWorkspaceConnectionSnapshot;
|
|
58
|
-
getIntegrationConnectionById: (id: string) => Promise<{slug: string} | undefined>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
54
|
export function createDefinitionSyncActivities(
|
|
62
|
-
sourceControl:
|
|
63
|
-
|
|
55
|
+
sourceControl: DefinitionsSourceControl,
|
|
56
|
+
integrations?: IntegrationsModuleClient | undefined,
|
|
64
57
|
) {
|
|
65
58
|
return {
|
|
66
59
|
prepareDefinitionSync: createPrepareDefinitionSyncActivity(sourceControl),
|
|
67
60
|
discoverDefinitionWorkflows: createDiscoverDefinitionWorkflowsActivity(sourceControl),
|
|
68
|
-
fetchAndApplyDefinitionWorkflows: createFetchAndApplyActivity(
|
|
69
|
-
sourceControl,
|
|
70
|
-
integrationValidation,
|
|
71
|
-
),
|
|
61
|
+
fetchAndApplyDefinitionWorkflows: createFetchAndApplyActivity(sourceControl, integrations),
|
|
72
62
|
markDefinitionSyncSucceeded: createMarkSyncSucceededActivity(),
|
|
73
63
|
markDefinitionSyncFailed: createMarkSyncFailedActivity(),
|
|
74
64
|
};
|
|
75
65
|
}
|
|
76
66
|
|
|
77
|
-
function createPrepareDefinitionSyncActivity(sourceControl:
|
|
67
|
+
function createPrepareDefinitionSyncActivity(sourceControl: DefinitionsSourceControl) {
|
|
78
68
|
return async function prepareDefinitionSync(
|
|
79
69
|
input: SyncWorkflowInput,
|
|
80
70
|
): Promise<PrepareSyncResult> {
|
|
@@ -98,7 +88,7 @@ function createPrepareDefinitionSyncActivity(sourceControl: IntegrationSourceCon
|
|
|
98
88
|
};
|
|
99
89
|
}
|
|
100
90
|
|
|
101
|
-
function createDiscoverDefinitionWorkflowsActivity(sourceControl:
|
|
91
|
+
function createDiscoverDefinitionWorkflowsActivity(sourceControl: DefinitionsSourceControl) {
|
|
102
92
|
return async function discoverDefinitionWorkflows(
|
|
103
93
|
input: SyncRefScopedInput,
|
|
104
94
|
): Promise<DiscoverWorkflowsActivityResult> {
|
|
@@ -113,8 +103,8 @@ function createDiscoverDefinitionWorkflowsActivity(sourceControl: IntegrationSou
|
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
function createFetchAndApplyActivity(
|
|
116
|
-
sourceControl:
|
|
117
|
-
|
|
106
|
+
sourceControl: DefinitionsSourceControl,
|
|
107
|
+
integrations?: IntegrationsModuleClient | undefined,
|
|
118
108
|
) {
|
|
119
109
|
return async function fetchAndApplyDefinitionWorkflows(
|
|
120
110
|
input: FetchAndApplyActivityInput,
|
|
@@ -126,18 +116,14 @@ function createFetchAndApplyActivity(
|
|
|
126
116
|
sourceControl,
|
|
127
117
|
onProgress: (path) => Context.current().heartbeat({path}),
|
|
128
118
|
loadIntegrationValidationContext:
|
|
129
|
-
|
|
119
|
+
integrations === undefined
|
|
130
120
|
? undefined
|
|
131
121
|
: async () => {
|
|
132
|
-
|
|
122
|
+
return await loadIntegrationValidationContext(
|
|
123
|
+
integrations,
|
|
124
|
+
input.workspaceId,
|
|
133
125
|
input.sourceConnectionId,
|
|
134
126
|
);
|
|
135
|
-
return {
|
|
136
|
-
agentToolSelectionCatalogs: integrationValidation.agentToolSelectionCatalogs,
|
|
137
|
-
workspaceConnectionSnapshot:
|
|
138
|
-
await integrationValidation.loadWorkspaceConnectionSnapshot(input.workspaceId),
|
|
139
|
-
defaultConnectionSlug: sourceConnection?.slug,
|
|
140
|
-
};
|
|
141
127
|
},
|
|
142
128
|
});
|
|
143
129
|
|
|
@@ -198,9 +184,10 @@ async function runWithPermanentTranslation<T>(operation: () => Promise<T>): Prom
|
|
|
198
184
|
throw error;
|
|
199
185
|
}
|
|
200
186
|
const failure = classifySyncFailure(error);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
187
|
+
const translatedError = failure.retryable
|
|
188
|
+
? ApplicationFailure.retryable(failure.message, failure.code)
|
|
189
|
+
: ApplicationFailure.nonRetryable(failure.message, failure.code);
|
|
190
|
+
if (failure.code !== 'unknown') markErrorReported(translatedError);
|
|
191
|
+
throw translatedError;
|
|
205
192
|
}
|
|
206
193
|
}
|