@finos/legend-server-sdlc
Advanced tools
Comparing version 0.0.6 to 0.0.7
# @finos/legend-server-sdlc | ||
## 0.0.7 | ||
### Patch Changes | ||
- [#568](https://github.com/finos/legend-studio/pull/568) [`46ccd87d`](https://github.com/finos/legend-studio/commit/46ccd87d3bd7c65ab26cb5b1c58d9ed007e5cc78) ([@MauricioUyaguari](https://github.com/MauricioUyaguari)) - Use `Workflow API` instead of the _deprecated_ `Build API`. | ||
## 0.0.6 | ||
@@ -4,0 +10,0 @@ |
@@ -21,3 +21,3 @@ /** | ||
export * from './models/review/ReviewCommands'; | ||
export * from './models/build/Build'; | ||
export * from './models/workflow/Workflow'; | ||
export * from './models/project/Project'; | ||
@@ -27,2 +27,3 @@ export * from './models/project/ImportReport'; | ||
export * from './models/workspace/Workspace'; | ||
export * from './models/workspace/WorkspaceUtil'; | ||
export * from './models/workspace/WorkspaceUpdateReport'; | ||
@@ -29,0 +30,0 @@ export * from './models/revision/Revision'; |
@@ -21,3 +21,3 @@ /** | ||
export * from './models/review/ReviewCommands'; | ||
export * from './models/build/Build'; | ||
export * from './models/workflow/Workflow'; | ||
export * from './models/project/Project'; | ||
@@ -27,2 +27,3 @@ export * from './models/project/ImportReport'; | ||
export * from './models/workspace/Workspace'; | ||
export * from './models/workspace/WorkspaceUtil'; | ||
export * from './models/workspace/WorkspaceUpdateReport'; | ||
@@ -29,0 +30,0 @@ export * from './models/revision/Revision'; |
@@ -18,2 +18,3 @@ /** | ||
import { SerializationFactory } from '@finos/legend-shared'; | ||
import type { WorkspaceType } from '../workspace/Workspace'; | ||
export declare enum ReviewState { | ||
@@ -37,4 +38,5 @@ OPEN = "OPEN", | ||
committedAt?: Date; | ||
workspaceType: WorkspaceType; | ||
static readonly serialization: SerializationFactory<Review>; | ||
} | ||
//# sourceMappingURL=Review.d.ts.map |
@@ -38,9 +38,10 @@ /** | ||
committedAt; | ||
workspaceType; | ||
static serialization = new SerializationFactory(createModelSchema(Review, { | ||
author: usingModelSchema(User.serialization.schema), | ||
closedAt: optional(custom(() => SKIP, (value) => (value ? new Date(value) : undefined))), | ||
committedAt: optional(custom(() => SKIP, (value) => (value ? new Date(value) : undefined))), | ||
closedAt: optional(custom(() => SKIP, (value) => value ? new Date(value) : undefined)), | ||
committedAt: optional(custom(() => SKIP, (value) => value ? new Date(value) : undefined)), | ||
createdAt: custom(() => SKIP, (value) => new Date(value)), | ||
id: primitive(), | ||
lastUpdatedAt: optional(custom(() => SKIP, (value) => (value ? new Date(value) : undefined))), | ||
lastUpdatedAt: optional(custom(() => SKIP, (value) => value ? new Date(value) : undefined)), | ||
projectId: primitive(), | ||
@@ -51,4 +52,5 @@ state: primitive(), | ||
workspaceId: primitive(), | ||
workspaceType: primitive(), | ||
})); | ||
} | ||
//# sourceMappingURL=Review.js.map |
@@ -28,6 +28,7 @@ /** | ||
workspaceId: string; | ||
userId: string; | ||
type: WorkspaceAccessType; | ||
userId?: string | undefined; | ||
accessType: WorkspaceAccessType; | ||
static readonly serialization: SerializationFactory<Workspace>; | ||
get workspaceType(): WorkspaceType; | ||
} | ||
//# sourceMappingURL=Workspace.d.ts.map |
@@ -17,3 +17,3 @@ /** | ||
import { createModelSchema, primitive } from 'serializr'; | ||
import { SerializationFactory } from '@finos/legend-shared'; | ||
import { usingNullableOptionalPrimitiveSchema, SerializationFactory, } from '@finos/legend-shared'; | ||
export var WorkspaceAccessType; | ||
@@ -34,9 +34,12 @@ (function (WorkspaceAccessType) { | ||
userId; | ||
type = WorkspaceAccessType.WORKSPACE; | ||
accessType = WorkspaceAccessType.WORKSPACE; | ||
static serialization = new SerializationFactory(createModelSchema(Workspace, { | ||
projectId: primitive(), | ||
userId: primitive(), | ||
userId: usingNullableOptionalPrimitiveSchema(), | ||
workspaceId: primitive(), | ||
})); | ||
get workspaceType() { | ||
return this.userId ? WorkspaceType.USER : WorkspaceType.GROUP; | ||
} | ||
} | ||
//# sourceMappingURL=Workspace.js.map |
@@ -19,4 +19,5 @@ /** | ||
import type { Workspace } from './models/workspace/Workspace'; | ||
import { WorkspaceType } from './models/workspace/Workspace'; | ||
import type { Revision, RevisionAlias } from './models/revision/Revision'; | ||
import type { Build, BuildStatus } from './models/build/Build'; | ||
import type { Workflow, WorkflowStatus } from './models/workflow/Workflow'; | ||
import type { Review, ReviewState } from './models/review/Review'; | ||
@@ -59,2 +60,4 @@ import type { Version } from './models/version/Version'; | ||
private _workspaces; | ||
private _groupWorkspaces; | ||
private _workspaceByType; | ||
private _workspace; | ||
@@ -68,12 +71,12 @@ /** | ||
getWorkspaces: (projectId: string) => Promise<PlainObject<Workspace>[]>; | ||
getWorkspace: (projectId: string, workspaceId: string) => Promise<PlainObject<Workspace>>; | ||
isWorkspaceOutdated: (projectId: string, workspaceId: string) => Promise<boolean>; | ||
checkIfWorkspaceIsInConflictResolutionMode: (projectId: string, workspaceId: string) => Promise<boolean>; | ||
createWorkspace: (projectId: string, workspaceId: string) => Promise<PlainObject<Workspace>>; | ||
updateWorkspace: (projectId: string, workspaceId: string) => Promise<PlainObject<WorkspaceUpdateReport>>; | ||
deleteWorkspace: (projectId: string, workspaceId: string) => Promise<PlainObject<Workspace>>; | ||
getWorkspace: (projectId: string, workspaceId: string, workspaceType: WorkspaceType) => Promise<PlainObject<Workspace>>; | ||
isWorkspaceOutdated: (projectId: string, workspace: Workspace) => Promise<boolean>; | ||
checkIfWorkspaceIsInConflictResolutionMode: (projectId: string, workspace: Workspace) => Promise<boolean>; | ||
createWorkspace: (projectId: string, workspaceId: string, workspaceType: WorkspaceType) => Promise<PlainObject<Workspace>>; | ||
updateWorkspace: (projectId: string, workspace: Workspace) => Promise<PlainObject<WorkspaceUpdateReport>>; | ||
deleteWorkspace: (projectId: string, workspace: Workspace) => Promise<PlainObject<Workspace>>; | ||
private _revisions; | ||
private _revision; | ||
getRevisions: (projectId: string, workspaceId: string | undefined) => Promise<PlainObject<Revision>[]>; | ||
getRevision: (projectId: string, workspaceId: string | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Revision>>; | ||
getRevisions: (projectId: string, workspace: Workspace | undefined) => Promise<PlainObject<Revision>[]>; | ||
getRevision: (projectId: string, workspace: Workspace | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Revision>>; | ||
private _versions; | ||
@@ -86,15 +89,15 @@ private _version; | ||
private _configuration; | ||
getConfiguration: (projectId: string, workspaceId: string | undefined) => Promise<PlainObject<ProjectConfiguration>>; | ||
getConfiguration: (projectId: string, workspace: Workspace | undefined) => Promise<PlainObject<ProjectConfiguration>>; | ||
getConfigurationByVersion: (projectId: string, versionId: string) => Promise<PlainObject<ProjectConfiguration>>; | ||
updateConfiguration: (projectId: string, workspaceId: string | undefined, command: PlainObject<UpdateProjectConfigurationCommand>) => Promise<PlainObject<Revision>>; | ||
updateConfiguration: (projectId: string, workspace: Workspace | undefined, command: PlainObject<UpdateProjectConfigurationCommand>) => Promise<PlainObject<Revision>>; | ||
getLatestProjectStructureVersion: () => Promise<PlainObject<ProjectStructureVersion>>; | ||
private _builds; | ||
getBuilds: (projectId: string, workspaceId: string | undefined, status: BuildStatus | undefined, revisionIds: string[] | undefined, limit: number | undefined) => Promise<PlainObject<Build>[]>; | ||
getBuildsByRevision: (projectId: string, workspaceId: string | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Build>[]>; | ||
private _workflows; | ||
getWorkflows: (projectId: string, workspace: Workspace | undefined, status: WorkflowStatus | undefined, revisionIds: string[] | undefined, limit: number | undefined) => Promise<PlainObject<Workflow>[]>; | ||
getWorkflowsByRevision: (projectId: string, workspace: Workspace | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Workflow>[]>; | ||
private _entities; | ||
getEntities: (projectId: string, workspaceId: string | undefined) => Promise<PlainObject<Entity>[]>; | ||
getEntitiesByRevision: (projectId: string, workspaceId: string | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Entity>[]>; | ||
getEntities: (projectId: string, workspace: Workspace | undefined) => Promise<PlainObject<Entity>[]>; | ||
getEntitiesByRevision: (projectId: string, workspace: Workspace | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Entity>[]>; | ||
getEntitiesByVersion: (projectId: string, versionId: string) => Promise<PlainObject<Entity>[]>; | ||
updateEntities: (projectId: string, workspaceId: string | undefined, command: PlainObject<UpdateEntitiesCommand>) => Promise<PlainObject<Revision>>; | ||
performEntityChanges: (projectId: string, workspaceId: string | undefined, command: PerformEntitiesChangesCommand) => Promise<PlainObject<Revision>>; | ||
updateEntities: (projectId: string, workspace: Workspace | undefined, command: PlainObject<UpdateEntitiesCommand>) => Promise<PlainObject<Revision>>; | ||
performEntityChanges: (projectId: string, workspace: Workspace | undefined, command: PerformEntitiesChangesCommand) => Promise<PlainObject<Revision>>; | ||
private _reviews; | ||
@@ -115,10 +118,10 @@ private _review; | ||
getWorkspacesInConflictResolutionMode: (projectId: string) => Promise<PlainObject<Workspace>[]>; | ||
abortConflictResolution: (projectId: string, workspaceId: string) => Promise<void>; | ||
discardConflictResolutionChanges: (projectId: string, workspaceId: string) => Promise<void>; | ||
acceptConflictResolution: (projectId: string, workspaceId: string, command: PlainObject<PerformEntitiesChangesCommand>) => Promise<void>; | ||
isConflictResolutionOutdated: (projectId: string, workspaceId: string) => Promise<boolean>; | ||
getConflictResolutionRevision: (projectId: string, workspaceId: string, revisionId: string | RevisionAlias) => Promise<PlainObject<Revision>>; | ||
getEntitiesByRevisionFromWorkspaceInConflictResolutionMode: (projectId: string, workspaceId: string, revisionId: string | RevisionAlias) => Promise<PlainObject<Entity>[]>; | ||
getConfigurationOfWorkspaceInConflictResolutionMode: (projectId: string, workspaceId: string) => Promise<PlainObject<ProjectConfiguration>>; | ||
abortConflictResolution: (projectId: string, workspace: Workspace | undefined) => Promise<void>; | ||
discardConflictResolutionChanges: (projectId: string, workspace: Workspace | undefined) => Promise<void>; | ||
acceptConflictResolution: (projectId: string, workspace: Workspace | undefined, command: PlainObject<PerformEntitiesChangesCommand>) => Promise<void>; | ||
isConflictResolutionOutdated: (projectId: string, workspace: Workspace | undefined) => Promise<boolean>; | ||
getConflictResolutionRevision: (projectId: string, workspace: Workspace | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Revision>>; | ||
getEntitiesByRevisionFromWorkspaceInConflictResolutionMode: (projectId: string, workspace: Workspace | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Entity>[]>; | ||
getConfigurationOfWorkspaceInConflictResolutionMode: (projectId: string, workspace: Workspace | undefined) => Promise<PlainObject<ProjectConfiguration>>; | ||
} | ||
//# sourceMappingURL=SDLCServerClient.d.ts.map |
@@ -16,2 +16,3 @@ /** | ||
*/ | ||
import { WorkspaceType } from './models/workspace/Workspace'; | ||
import { AbstractServerClient } from '@finos/legend-shared'; | ||
@@ -76,3 +77,7 @@ var SDLC_TRACER_SPAN; | ||
_workspaces = (projectId) => `${this._project(projectId)}/workspaces`; | ||
_workspace = (projectId, workspaceId) => `${this._workspaces(projectId)}/${encodeURIComponent(workspaceId)}`; | ||
_groupWorkspaces = (projectId) => `${this._project(projectId)}/groupWorkspaces`; | ||
_workspaceByType = (projectId, workspaceId, workspaceType) => workspaceType === WorkspaceType.GROUP | ||
? `${this._groupWorkspaces(projectId)}/${encodeURIComponent(workspaceId)}` | ||
: `${this._workspaces(projectId)}/${encodeURIComponent(workspaceId)}`; | ||
_workspace = (projectId, workspace) => this._workspaceByType(projectId, workspace.workspaceId, workspace.workspaceType); | ||
/** | ||
@@ -83,17 +88,20 @@ * This method makes it possible that we don't have to repeat the set of endpoints twice for: | ||
*/ | ||
_adaptiveWorkspace = (projectId, workspaceId) => workspaceId | ||
? this._workspace(projectId, workspaceId) | ||
_adaptiveWorkspace = (projectId, workspace) => workspace | ||
? this._workspace(projectId, workspace) | ||
: this._project(projectId); | ||
getWorkspaces = (projectId) => this.networkClient.get(this._workspaces(projectId)); | ||
getWorkspace = (projectId, workspaceId) => this.networkClient.get(this._workspace(projectId, workspaceId)); | ||
isWorkspaceOutdated = (projectId, workspaceId) => this.networkClient.get(`${this._workspace(projectId, workspaceId)}/outdated`); | ||
checkIfWorkspaceIsInConflictResolutionMode = (projectId, workspaceId) => this.networkClient.get(`${this._workspace(projectId, workspaceId)}/inConflictResolutionMode`); | ||
createWorkspace = (projectId, workspaceId) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.CREATE_WORKSPACE), this._workspace(projectId, workspaceId)); | ||
updateWorkspace = (projectId, workspaceId) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.UPDATE_WORKSPACE), `${this._workspace(projectId, workspaceId)}/update`); | ||
deleteWorkspace = (projectId, workspaceId) => this.deleteWithTracing(this.getTraceData(SDLC_TRACER_SPAN.DELETE_WORKSPACE), this._workspace(projectId, workspaceId)); | ||
getWorkspaces = (projectId) => Promise.all([ | ||
this.networkClient.get(this._workspaces(projectId)), | ||
this.networkClient.get(this._groupWorkspaces(projectId)), | ||
]).then((workspaces) => workspaces.flat()); | ||
getWorkspace = (projectId, workspaceId, workspaceType) => this.networkClient.get(this._workspaceByType(projectId, workspaceId, workspaceType)); | ||
isWorkspaceOutdated = (projectId, workspace) => this.networkClient.get(`${this._workspace(projectId, workspace)}/outdated`); | ||
checkIfWorkspaceIsInConflictResolutionMode = (projectId, workspace) => this.networkClient.get(`${this._workspace(projectId, workspace)}/inConflictResolutionMode`); | ||
createWorkspace = (projectId, workspaceId, workspaceType) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.CREATE_WORKSPACE), this._workspaceByType(projectId, workspaceId, workspaceType)); | ||
updateWorkspace = (projectId, workspace) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.UPDATE_WORKSPACE), `${this._workspace(projectId, workspace)}/update`); | ||
deleteWorkspace = (projectId, workspace) => this.deleteWithTracing(this.getTraceData(SDLC_TRACER_SPAN.DELETE_WORKSPACE), this._workspace(projectId, workspace)); | ||
// ------------------------------------------- Revision ------------------------------------------- | ||
_revisions = (projectId, workspaceId) => `${this._adaptiveWorkspace(projectId, workspaceId)}/revisions`; | ||
_revision = (projectId, workspaceId, revisionId) => `${this._adaptiveWorkspace(projectId, workspaceId)}/revisions/${encodeURIComponent(revisionId)}`; | ||
getRevisions = (projectId, workspaceId) => this.networkClient.get(this._revisions(projectId, workspaceId)); | ||
getRevision = (projectId, workspaceId, revisionId) => this.networkClient.get(this._revision(projectId, workspaceId, revisionId)); | ||
_revision = (projectId, workspace, revisionId) => `${this._adaptiveWorkspace(projectId, workspace)}/revisions/${encodeURIComponent(revisionId)}`; | ||
getRevisions = (projectId, workspace) => this.networkClient.get(this._revisions(projectId, workspace)); | ||
getRevision = (projectId, workspace, revisionId) => this.networkClient.get(this._revision(projectId, workspace, revisionId)); | ||
// ------------------------------------------- Version ------------------------------------------- | ||
@@ -107,18 +115,18 @@ _versions = (projectId) => `${this._project(projectId)}/versions`; | ||
// ------------------------------------------- Configuration ------------------------------------------- | ||
_configuration = (projectId, workspaceId) => `${this._adaptiveWorkspace(projectId, workspaceId)}/configuration`; | ||
getConfiguration = (projectId, workspaceId) => this.networkClient.get(this._configuration(projectId, workspaceId)); | ||
_configuration = (projectId, workspace) => `${this._adaptiveWorkspace(projectId, workspace)}/configuration`; | ||
getConfiguration = (projectId, workspace) => this.networkClient.get(this._configuration(projectId, workspace)); | ||
getConfigurationByVersion = (projectId, versionId) => this.networkClient.get(`${this._version(projectId, versionId)}/configuration`); | ||
updateConfiguration = (projectId, workspaceId, command) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.UPDATE_CONFIGURATION), this._configuration(projectId, workspaceId), command); | ||
updateConfiguration = (projectId, workspace, command) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.UPDATE_CONFIGURATION), this._configuration(projectId, workspace), command); | ||
getLatestProjectStructureVersion = () => this.networkClient.get(`${this.networkClient.baseUrl}/configuration/latestProjectStructureVersion`); | ||
// ------------------------------------------- Build ------------------------------------------- | ||
_builds = (projectId, workspaceId) => `${this._adaptiveWorkspace(projectId, workspaceId)}/builds`; | ||
getBuilds = (projectId, workspaceId, status, revisionIds, limit) => this.networkClient.get(this._builds(projectId, workspaceId), undefined, undefined, { status, revisionIds, limit }); | ||
getBuildsByRevision = (projectId, workspaceId, revisionId) => this.networkClient.get(this._builds(projectId, workspaceId), undefined, undefined, { revisionId }); | ||
// ------------------------------------------- Workflow ------------------------------------------- | ||
_workflows = (projectId, workspace) => `${this._adaptiveWorkspace(projectId, workspace)}/workflows`; | ||
getWorkflows = (projectId, workspace, status, revisionIds, limit) => this.networkClient.get(this._workflows(projectId, workspace), undefined, undefined, { status, revisionIds, limit }); | ||
getWorkflowsByRevision = (projectId, workspace, revisionId) => this.networkClient.get(this._workflows(projectId, workspace), undefined, undefined, { revisionId }); | ||
// ------------------------------------------- Entity ------------------------------------------- | ||
_entities = (projectId, workspaceId) => `${this._adaptiveWorkspace(projectId, workspaceId)}/entities`; | ||
getEntities = (projectId, workspaceId) => this.networkClient.get(this._entities(projectId, workspaceId)); | ||
getEntitiesByRevision = (projectId, workspaceId, revisionId) => this.networkClient.get(`${this._revision(projectId, workspaceId, revisionId)}/entities`); | ||
_entities = (projectId, workspace) => `${this._adaptiveWorkspace(projectId, workspace)}/entities`; | ||
getEntities = (projectId, workspace) => this.networkClient.get(this._entities(projectId, workspace)); | ||
getEntitiesByRevision = (projectId, workspace, revisionId) => this.networkClient.get(`${this._revision(projectId, workspace, revisionId)}/entities`); | ||
getEntitiesByVersion = (projectId, versionId) => this.networkClient.get(`${this._version(projectId, versionId)}/entities`); | ||
updateEntities = (projectId, workspaceId, command) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.UPDATE_ENTITIES), this._entities(projectId, workspaceId), command); | ||
performEntityChanges = (projectId, workspaceId, command) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.PERFORM_ENTITY_CHANGES), `${this._adaptiveWorkspace(projectId, workspaceId)}/entityChanges`, command); | ||
updateEntities = (projectId, workspace, command) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.UPDATE_ENTITIES), this._entities(projectId, workspace), command); | ||
performEntityChanges = (projectId, workspace, command) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.PERFORM_ENTITY_CHANGES), `${this._adaptiveWorkspace(projectId, workspace)}/entityChanges`, command); | ||
// ------------------------------------------- Review ------------------------------------------- | ||
@@ -146,12 +154,12 @@ _reviews = (projectId) => `${this._project(projectId)}/reviews`; | ||
// ------------------------------------------- Conflict Resolution ------------------------------------------- | ||
_conflictResolution = (projectId, workspaceId) => `${this._adaptiveWorkspace(projectId, workspaceId)}/conflictResolution`; | ||
_conflictResolution = (projectId, workspace) => `${this._adaptiveWorkspace(projectId, workspace)}/conflictResolution`; | ||
getWorkspacesInConflictResolutionMode = (projectId) => this.networkClient.get(this._conflictResolution(projectId, undefined)); | ||
abortConflictResolution = (projectId, workspaceId) => this.networkClient.delete(this._conflictResolution(projectId, workspaceId)); | ||
discardConflictResolutionChanges = (projectId, workspaceId) => this.networkClient.post(`${this._conflictResolution(projectId, workspaceId)}/discardChanges`); | ||
acceptConflictResolution = (projectId, workspaceId, command) => this.networkClient.post(`${this._conflictResolution(projectId, workspaceId)}/accept`, command); | ||
isConflictResolutionOutdated = (projectId, workspaceId) => this.networkClient.get(`${this._conflictResolution(projectId, workspaceId)}/outdated`); | ||
getConflictResolutionRevision = (projectId, workspaceId, revisionId) => this.networkClient.get(`${this._conflictResolution(projectId, workspaceId)}/revisions/${revisionId}`); | ||
getEntitiesByRevisionFromWorkspaceInConflictResolutionMode = (projectId, workspaceId, revisionId) => this.networkClient.get(`${this._conflictResolution(projectId, workspaceId)}/revisions/${revisionId}/entities`); | ||
getConfigurationOfWorkspaceInConflictResolutionMode = (projectId, workspaceId) => this.networkClient.get(`${this._conflictResolution(projectId, workspaceId)}/configuration`); | ||
abortConflictResolution = (projectId, workspace) => this.networkClient.delete(this._conflictResolution(projectId, workspace)); | ||
discardConflictResolutionChanges = (projectId, workspace) => this.networkClient.post(`${this._conflictResolution(projectId, workspace)}/discardChanges`); | ||
acceptConflictResolution = (projectId, workspace, command) => this.networkClient.post(`${this._conflictResolution(projectId, workspace)}/accept`, command); | ||
isConflictResolutionOutdated = (projectId, workspace) => this.networkClient.get(`${this._conflictResolution(projectId, workspace)}/outdated`); | ||
getConflictResolutionRevision = (projectId, workspace, revisionId) => this.networkClient.get(`${this._conflictResolution(projectId, workspace)}/revisions/${revisionId}`); | ||
getEntitiesByRevisionFromWorkspaceInConflictResolutionMode = (projectId, workspace, revisionId) => this.networkClient.get(`${this._conflictResolution(projectId, workspace)}/revisions/${revisionId}/entities`); | ||
getConfigurationOfWorkspaceInConflictResolutionMode = (projectId, workspace) => this.networkClient.get(`${this._conflictResolution(projectId, workspace)}/configuration`); | ||
} | ||
//# sourceMappingURL=SDLCServerClient.js.map |
{ | ||
"name": "@finos/legend-server-sdlc", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Legend SDLC server client", | ||
@@ -34,2 +34,3 @@ "keywords": [ | ||
"publish:prepare": "node ../../scripts/release/preparePublishContent.js", | ||
"publish:snapshot": "node ../../scripts/release/publishDevSnapshot.js", | ||
"test": "jest", | ||
@@ -39,4 +40,4 @@ "test:watch": "jest --watch" | ||
"dependencies": { | ||
"@finos/legend-model-storage": "0.0.5", | ||
"@finos/legend-shared": "0.0.5", | ||
"@finos/legend-model-storage": "0.0.6", | ||
"@finos/legend-shared": "0.0.6", | ||
"mobx": "6.3.3", | ||
@@ -48,9 +49,9 @@ "mobx-react-lite": "3.2.1", | ||
"devDependencies": { | ||
"@finos/legend-dev-utils": "0.0.11", | ||
"@finos/legend-dev-utils": "0.0.13", | ||
"cross-env": "7.0.3", | ||
"eslint": "7.32.0", | ||
"jest": "27.2.4", | ||
"eslint": "8.0.0", | ||
"jest": "27.2.5", | ||
"npm-run-all": "4.1.5", | ||
"rimraf": "3.0.2", | ||
"typescript": "4.4.3" | ||
"typescript": "4.4.4" | ||
}, | ||
@@ -57,0 +58,0 @@ "publishConfig": { |
@@ -25,3 +25,3 @@ /** | ||
export * from './models/build/Build'; | ||
export * from './models/workflow/Workflow'; | ||
@@ -33,2 +33,3 @@ export * from './models/project/Project'; | ||
export * from './models/workspace/Workspace'; | ||
export * from './models/workspace/WorkspaceUtil'; | ||
export * from './models/workspace/WorkspaceUpdateReport'; | ||
@@ -35,0 +36,0 @@ |
@@ -26,2 +26,3 @@ /** | ||
import { SerializationFactory, usingModelSchema } from '@finos/legend-shared'; | ||
import type { WorkspaceType } from '../workspace/Workspace'; | ||
@@ -47,2 +48,3 @@ export enum ReviewState { | ||
committedAt?: Date; | ||
workspaceType!: WorkspaceType; | ||
@@ -55,3 +57,4 @@ static readonly serialization = new SerializationFactory( | ||
() => SKIP, | ||
(value: string | undefined) => (value ? new Date(value) : undefined), | ||
(value: string | null | undefined) => | ||
value ? new Date(value) : undefined, | ||
), | ||
@@ -62,3 +65,4 @@ ), | ||
() => SKIP, | ||
(value: string | undefined) => (value ? new Date(value) : undefined), | ||
(value: string | null | undefined) => | ||
value ? new Date(value) : undefined, | ||
), | ||
@@ -74,3 +78,4 @@ ), | ||
() => SKIP, | ||
(value: string | undefined) => (value ? new Date(value) : undefined), | ||
(value: string | null | undefined) => | ||
value ? new Date(value) : undefined, | ||
), | ||
@@ -83,4 +88,5 @@ ), | ||
workspaceId: primitive(), | ||
workspaceType: primitive(), | ||
}), | ||
); | ||
} |
@@ -18,3 +18,6 @@ /** | ||
import { createModelSchema, primitive } from 'serializr'; | ||
import { SerializationFactory } from '@finos/legend-shared'; | ||
import { | ||
usingNullableOptionalPrimitiveSchema, | ||
SerializationFactory, | ||
} from '@finos/legend-shared'; | ||
@@ -31,16 +34,20 @@ export enum WorkspaceAccessType { | ||
} | ||
export class Workspace { | ||
projectId!: string; | ||
workspaceId!: string; | ||
userId!: string; | ||
type = WorkspaceAccessType.WORKSPACE; | ||
userId?: string | undefined; | ||
accessType = WorkspaceAccessType.WORKSPACE; | ||
static readonly serialization = new SerializationFactory( | ||
createModelSchema(Workspace, { | ||
projectId: primitive(), | ||
userId: primitive(), | ||
userId: usingNullableOptionalPrimitiveSchema(), | ||
workspaceId: primitive(), | ||
}), | ||
); | ||
get workspaceType(): WorkspaceType { | ||
return this.userId ? WorkspaceType.USER : WorkspaceType.GROUP; | ||
} | ||
} |
@@ -20,4 +20,5 @@ /** | ||
import type { Workspace } from './models/workspace/Workspace'; | ||
import { WorkspaceType } from './models/workspace/Workspace'; | ||
import type { Revision, RevisionAlias } from './models/revision/Revision'; | ||
import type { Build, BuildStatus } from './models/build/Build'; | ||
import type { Workflow, WorkflowStatus } from './models/workflow/Workflow'; | ||
import type { Review, ReviewState } from './models/review/Review'; | ||
@@ -166,4 +167,18 @@ import type { Version } from './models/version/Version'; | ||
`${this._project(projectId)}/workspaces`; | ||
private _workspace = (projectId: string, workspaceId: string): string => | ||
`${this._workspaces(projectId)}/${encodeURIComponent(workspaceId)}`; | ||
private _groupWorkspaces = (projectId: string): string => | ||
`${this._project(projectId)}/groupWorkspaces`; | ||
private _workspaceByType = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspaceType: WorkspaceType, | ||
): string => | ||
workspaceType === WorkspaceType.GROUP | ||
? `${this._groupWorkspaces(projectId)}/${encodeURIComponent(workspaceId)}` | ||
: `${this._workspaces(projectId)}/${encodeURIComponent(workspaceId)}`; | ||
private _workspace = (projectId: string, workspace: Workspace): string => | ||
this._workspaceByType( | ||
projectId, | ||
workspace.workspaceId, | ||
workspace.workspaceType, | ||
); | ||
/** | ||
@@ -176,28 +191,34 @@ * This method makes it possible that we don't have to repeat the set of endpoints twice for: | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
): string => | ||
workspaceId | ||
? this._workspace(projectId, workspaceId) | ||
workspace | ||
? this._workspace(projectId, workspace) | ||
: this._project(projectId); | ||
getWorkspaces = (projectId: string): Promise<PlainObject<Workspace>[]> => | ||
this.networkClient.get(this._workspaces(projectId)); | ||
Promise.all([ | ||
this.networkClient.get(this._workspaces(projectId)), | ||
this.networkClient.get(this._groupWorkspaces(projectId)), | ||
]).then((workspaces) => workspaces.flat()) as Promise< | ||
PlainObject<Workspace>[] | ||
>; | ||
getWorkspace = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspaceType: WorkspaceType, | ||
): Promise<PlainObject<Workspace>> => | ||
this.networkClient.get(this._workspace(projectId, workspaceId)); | ||
this.networkClient.get( | ||
this._workspaceByType(projectId, workspaceId, workspaceType), | ||
); | ||
isWorkspaceOutdated = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace, | ||
): Promise<boolean> => | ||
this.networkClient.get( | ||
`${this._workspace(projectId, workspaceId)}/outdated`, | ||
); | ||
this.networkClient.get(`${this._workspace(projectId, workspace)}/outdated`); | ||
checkIfWorkspaceIsInConflictResolutionMode = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace, | ||
): Promise<boolean> => | ||
this.networkClient.get( | ||
`${this._workspace(projectId, workspaceId)}/inConflictResolutionMode`, | ||
`${this._workspace(projectId, workspace)}/inConflictResolutionMode`, | ||
); | ||
@@ -207,22 +228,23 @@ createWorkspace = ( | ||
workspaceId: string, | ||
workspaceType: WorkspaceType, | ||
): Promise<PlainObject<Workspace>> => | ||
this.postWithTracing( | ||
this.getTraceData(SDLC_TRACER_SPAN.CREATE_WORKSPACE), | ||
this._workspace(projectId, workspaceId), | ||
this._workspaceByType(projectId, workspaceId, workspaceType), | ||
); | ||
updateWorkspace = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace, | ||
): Promise<PlainObject<WorkspaceUpdateReport>> => | ||
this.postWithTracing( | ||
this.getTraceData(SDLC_TRACER_SPAN.UPDATE_WORKSPACE), | ||
`${this._workspace(projectId, workspaceId)}/update`, | ||
`${this._workspace(projectId, workspace)}/update`, | ||
); | ||
deleteWorkspace = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace, | ||
): Promise<PlainObject<Workspace>> => | ||
this.deleteWithTracing( | ||
this.getTraceData(SDLC_TRACER_SPAN.DELETE_WORKSPACE), | ||
this._workspace(projectId, workspaceId), | ||
this._workspace(projectId, workspace), | ||
); | ||
@@ -234,7 +256,7 @@ | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspaceId: Workspace | undefined, | ||
): string => `${this._adaptiveWorkspace(projectId, workspaceId)}/revisions`; | ||
private _revision = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
revisionId: string | RevisionAlias, | ||
@@ -244,3 +266,3 @@ ): string => | ||
projectId, | ||
workspaceId, | ||
workspace, | ||
)}/revisions/${encodeURIComponent(revisionId)}`; | ||
@@ -250,11 +272,11 @@ | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
): Promise<PlainObject<Revision>[]> => | ||
this.networkClient.get(this._revisions(projectId, workspaceId)); | ||
this.networkClient.get(this._revisions(projectId, workspace)); | ||
getRevision = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
revisionId: string | RevisionAlias, | ||
): Promise<PlainObject<Revision>> => | ||
this.networkClient.get(this._revision(projectId, workspaceId, revisionId)); | ||
this.networkClient.get(this._revision(projectId, workspace, revisionId)); | ||
@@ -293,11 +315,10 @@ // ------------------------------------------- Version ------------------------------------------- | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
): string => | ||
`${this._adaptiveWorkspace(projectId, workspaceId)}/configuration`; | ||
workspace: Workspace | undefined, | ||
): string => `${this._adaptiveWorkspace(projectId, workspace)}/configuration`; | ||
getConfiguration = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
): Promise<PlainObject<ProjectConfiguration>> => | ||
this.networkClient.get(this._configuration(projectId, workspaceId)); | ||
this.networkClient.get(this._configuration(projectId, workspace)); | ||
getConfigurationByVersion = ( | ||
@@ -312,3 +333,3 @@ projectId: string, | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
command: PlainObject<UpdateProjectConfigurationCommand>, | ||
@@ -318,3 +339,3 @@ ): Promise<PlainObject<Revision>> => | ||
this.getTraceData(SDLC_TRACER_SPAN.UPDATE_CONFIGURATION), | ||
this._configuration(projectId, workspaceId), | ||
this._configuration(projectId, workspace), | ||
command, | ||
@@ -329,18 +350,18 @@ ); | ||
// ------------------------------------------- Build ------------------------------------------- | ||
// ------------------------------------------- Workflow ------------------------------------------- | ||
private _builds = ( | ||
private _workflows = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
): string => `${this._adaptiveWorkspace(projectId, workspaceId)}/builds`; | ||
workspace: Workspace | undefined, | ||
): string => `${this._adaptiveWorkspace(projectId, workspace)}/workflows`; | ||
getBuilds = ( | ||
getWorkflows = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
status: BuildStatus | undefined, | ||
workspace: Workspace | undefined, | ||
status: WorkflowStatus | undefined, | ||
revisionIds: string[] | undefined, | ||
limit: number | undefined, | ||
): Promise<PlainObject<Build>[]> => | ||
): Promise<PlainObject<Workflow>[]> => | ||
this.networkClient.get( | ||
this._builds(projectId, workspaceId), | ||
this._workflows(projectId, workspace), | ||
undefined, | ||
@@ -350,9 +371,9 @@ undefined, | ||
); | ||
getBuildsByRevision = ( | ||
getWorkflowsByRevision = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
revisionId: string | RevisionAlias, | ||
): Promise<PlainObject<Build>[]> => | ||
): Promise<PlainObject<Workflow>[]> => | ||
this.networkClient.get( | ||
this._builds(projectId, workspaceId), | ||
this._workflows(projectId, workspace), | ||
undefined, | ||
@@ -367,17 +388,17 @@ undefined, | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
): string => `${this._adaptiveWorkspace(projectId, workspaceId)}/entities`; | ||
workspace: Workspace | undefined, | ||
): string => `${this._adaptiveWorkspace(projectId, workspace)}/entities`; | ||
getEntities = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
): Promise<PlainObject<Entity>[]> => | ||
this.networkClient.get(this._entities(projectId, workspaceId)); | ||
this.networkClient.get(this._entities(projectId, workspace)); | ||
getEntitiesByRevision = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
revisionId: string | RevisionAlias, | ||
): Promise<PlainObject<Entity>[]> => | ||
this.networkClient.get( | ||
`${this._revision(projectId, workspaceId, revisionId)}/entities`, | ||
`${this._revision(projectId, workspace, revisionId)}/entities`, | ||
); | ||
@@ -391,3 +412,3 @@ getEntitiesByVersion = ( | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
command: PlainObject<UpdateEntitiesCommand>, | ||
@@ -397,3 +418,3 @@ ): Promise<PlainObject<Revision>> => | ||
this.getTraceData(SDLC_TRACER_SPAN.UPDATE_ENTITIES), | ||
this._entities(projectId, workspaceId), | ||
this._entities(projectId, workspace), | ||
command, | ||
@@ -403,3 +424,3 @@ ); | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
command: PerformEntitiesChangesCommand, | ||
@@ -409,3 +430,3 @@ ): Promise<PlainObject<Revision>> => | ||
this.getTraceData(SDLC_TRACER_SPAN.PERFORM_ENTITY_CHANGES), | ||
`${this._adaptiveWorkspace(projectId, workspaceId)}/entityChanges`, | ||
`${this._adaptiveWorkspace(projectId, workspace)}/entityChanges`, | ||
command, | ||
@@ -504,5 +525,5 @@ ); | ||
projectId: string, | ||
workspaceId: string | undefined, | ||
workspace: Workspace | undefined, | ||
): string => | ||
`${this._adaptiveWorkspace(projectId, workspaceId)}/conflictResolution`; | ||
`${this._adaptiveWorkspace(projectId, workspace)}/conflictResolution`; | ||
@@ -515,19 +536,19 @@ getWorkspacesInConflictResolutionMode = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace | undefined, | ||
): Promise<void> => | ||
this.networkClient.delete(this._conflictResolution(projectId, workspaceId)); | ||
this.networkClient.delete(this._conflictResolution(projectId, workspace)); | ||
discardConflictResolutionChanges = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace | undefined, | ||
): Promise<void> => | ||
this.networkClient.post( | ||
`${this._conflictResolution(projectId, workspaceId)}/discardChanges`, | ||
`${this._conflictResolution(projectId, workspace)}/discardChanges`, | ||
); | ||
acceptConflictResolution = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace | undefined, | ||
command: PlainObject<PerformEntitiesChangesCommand>, | ||
): Promise<void> => | ||
this.networkClient.post( | ||
`${this._conflictResolution(projectId, workspaceId)}/accept`, | ||
`${this._conflictResolution(projectId, workspace)}/accept`, | ||
command, | ||
@@ -537,10 +558,10 @@ ); | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace | undefined, | ||
): Promise<boolean> => | ||
this.networkClient.get( | ||
`${this._conflictResolution(projectId, workspaceId)}/outdated`, | ||
`${this._conflictResolution(projectId, workspace)}/outdated`, | ||
); | ||
getConflictResolutionRevision = ( | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace | undefined, | ||
revisionId: string | RevisionAlias, | ||
@@ -551,3 +572,3 @@ ): Promise<PlainObject<Revision>> => | ||
projectId, | ||
workspaceId, | ||
workspace, | ||
)}/revisions/${revisionId}`, | ||
@@ -557,3 +578,3 @@ ); | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace | undefined, | ||
revisionId: string | RevisionAlias, | ||
@@ -564,3 +585,3 @@ ): Promise<PlainObject<Entity>[]> => | ||
projectId, | ||
workspaceId, | ||
workspace, | ||
)}/revisions/${revisionId}/entities`, | ||
@@ -570,7 +591,7 @@ ); | ||
projectId: string, | ||
workspaceId: string, | ||
workspace: Workspace | undefined, | ||
): Promise<PlainObject<ProjectConfiguration>> => | ||
this.networkClient.get( | ||
`${this._conflictResolution(projectId, workspaceId)}/configuration`, | ||
`${this._conflictResolution(projectId, workspace)}/configuration`, | ||
); | ||
} |
@@ -36,3 +36,2 @@ { | ||
"./src/models/User.ts", | ||
"./src/models/build/Build.ts", | ||
"./src/models/comparison/Comparison.ts", | ||
@@ -56,4 +55,7 @@ "./src/models/comparison/EntityDiff.ts", | ||
"./src/models/version/VersionId.ts", | ||
"./src/models/workflow/Workflow.ts", | ||
"./src/models/workflow/WorkflowJob.ts", | ||
"./src/models/workspace/Workspace.ts", | ||
"./src/models/workspace/WorkspaceUpdateReport.ts", | ||
"./src/models/workspace/WorkspaceUtil.ts", | ||
"./src/SDLCServerClientProvider.tsx", | ||
@@ -60,0 +62,0 @@ "./src/SDLCServerClientTestUtils.tsx" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
243822
145
4240
+ Added@finos/legend-model-storage@0.0.6(transitive)
+ Added@finos/legend-shared@0.0.6(transitive)
+ Addedpretty-format@27.2.5(transitive)
- Removed@finos/legend-model-storage@0.0.5(transitive)
- Removed@finos/legend-shared@0.0.5(transitive)
- Removedpretty-format@27.2.4(transitive)
Updated@finos/legend-shared@0.0.6