@shipfox/api-definitions 5.0.0 → 6.0.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 +4 -4
- package/CHANGELOG.md +36 -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 +6 -10
- package/dist/temporal/activities/sync-activities.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +16 -14
- 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 +9 -6
- package/src/temporal/activities/sync-activities.ts +14 -29
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AgentToolSelectionCatalogs,
|
|
3
|
-
IntegrationSourceControlService,
|
|
4
|
-
LoadWorkspaceConnectionSnapshot,
|
|
5
|
-
} from '@shipfox/api-integration-core';
|
|
1
|
+
import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';
|
|
6
2
|
import {Context} from '@temporalio/activity';
|
|
7
3
|
import {ApplicationFailure} from '@temporalio/common';
|
|
8
4
|
import type {DefinitionSyncErrorCode} from '#core/entities/sync-state.js';
|
|
@@ -13,6 +9,8 @@ import {
|
|
|
13
9
|
resolveSyncSource,
|
|
14
10
|
UNRESOLVED_SYNC_REF,
|
|
15
11
|
} from '#core/index.js';
|
|
12
|
+
import type {DefinitionsSourceControl} from '#core/integrations.js';
|
|
13
|
+
import {loadIntegrationValidationContext} from '#core/integrations.js';
|
|
16
14
|
import {applyVcsDefinitionsBatch, markDefinitionSyncState} from '#db/index.js';
|
|
17
15
|
|
|
18
16
|
export interface SyncWorkflowInput {
|
|
@@ -52,29 +50,20 @@ export interface FetchAndApplyActivityResult {
|
|
|
52
50
|
deletedCount: number;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
export interface DefinitionSyncIntegrationValidationOptions {
|
|
56
|
-
agentToolSelectionCatalogs: AgentToolSelectionCatalogs;
|
|
57
|
-
loadWorkspaceConnectionSnapshot: LoadWorkspaceConnectionSnapshot;
|
|
58
|
-
getIntegrationConnectionById: (id: string) => Promise<{slug: string} | undefined>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
53
|
export function createDefinitionSyncActivities(
|
|
62
|
-
sourceControl:
|
|
63
|
-
|
|
54
|
+
sourceControl: DefinitionsSourceControl,
|
|
55
|
+
integrations?: IntegrationsModuleClient | undefined,
|
|
64
56
|
) {
|
|
65
57
|
return {
|
|
66
58
|
prepareDefinitionSync: createPrepareDefinitionSyncActivity(sourceControl),
|
|
67
59
|
discoverDefinitionWorkflows: createDiscoverDefinitionWorkflowsActivity(sourceControl),
|
|
68
|
-
fetchAndApplyDefinitionWorkflows: createFetchAndApplyActivity(
|
|
69
|
-
sourceControl,
|
|
70
|
-
integrationValidation,
|
|
71
|
-
),
|
|
60
|
+
fetchAndApplyDefinitionWorkflows: createFetchAndApplyActivity(sourceControl, integrations),
|
|
72
61
|
markDefinitionSyncSucceeded: createMarkSyncSucceededActivity(),
|
|
73
62
|
markDefinitionSyncFailed: createMarkSyncFailedActivity(),
|
|
74
63
|
};
|
|
75
64
|
}
|
|
76
65
|
|
|
77
|
-
function createPrepareDefinitionSyncActivity(sourceControl:
|
|
66
|
+
function createPrepareDefinitionSyncActivity(sourceControl: DefinitionsSourceControl) {
|
|
78
67
|
return async function prepareDefinitionSync(
|
|
79
68
|
input: SyncWorkflowInput,
|
|
80
69
|
): Promise<PrepareSyncResult> {
|
|
@@ -98,7 +87,7 @@ function createPrepareDefinitionSyncActivity(sourceControl: IntegrationSourceCon
|
|
|
98
87
|
};
|
|
99
88
|
}
|
|
100
89
|
|
|
101
|
-
function createDiscoverDefinitionWorkflowsActivity(sourceControl:
|
|
90
|
+
function createDiscoverDefinitionWorkflowsActivity(sourceControl: DefinitionsSourceControl) {
|
|
102
91
|
return async function discoverDefinitionWorkflows(
|
|
103
92
|
input: SyncRefScopedInput,
|
|
104
93
|
): Promise<DiscoverWorkflowsActivityResult> {
|
|
@@ -113,8 +102,8 @@ function createDiscoverDefinitionWorkflowsActivity(sourceControl: IntegrationSou
|
|
|
113
102
|
}
|
|
114
103
|
|
|
115
104
|
function createFetchAndApplyActivity(
|
|
116
|
-
sourceControl:
|
|
117
|
-
|
|
105
|
+
sourceControl: DefinitionsSourceControl,
|
|
106
|
+
integrations?: IntegrationsModuleClient | undefined,
|
|
118
107
|
) {
|
|
119
108
|
return async function fetchAndApplyDefinitionWorkflows(
|
|
120
109
|
input: FetchAndApplyActivityInput,
|
|
@@ -126,18 +115,14 @@ function createFetchAndApplyActivity(
|
|
|
126
115
|
sourceControl,
|
|
127
116
|
onProgress: (path) => Context.current().heartbeat({path}),
|
|
128
117
|
loadIntegrationValidationContext:
|
|
129
|
-
|
|
118
|
+
integrations === undefined
|
|
130
119
|
? undefined
|
|
131
120
|
: async () => {
|
|
132
|
-
|
|
121
|
+
return await loadIntegrationValidationContext(
|
|
122
|
+
integrations,
|
|
123
|
+
input.workspaceId,
|
|
133
124
|
input.sourceConnectionId,
|
|
134
125
|
);
|
|
135
|
-
return {
|
|
136
|
-
agentToolSelectionCatalogs: integrationValidation.agentToolSelectionCatalogs,
|
|
137
|
-
workspaceConnectionSnapshot:
|
|
138
|
-
await integrationValidation.loadWorkspaceConnectionSnapshot(input.workspaceId),
|
|
139
|
-
defaultConnectionSlug: sourceConnection?.slug,
|
|
140
|
-
};
|
|
141
126
|
},
|
|
142
127
|
});
|
|
143
128
|
|