Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@finos/legend-server-sdlc

Package Overview
Dependencies
Maintainers
4
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finos/legend-server-sdlc - npm Package Compare versions

Comparing version 0.0.17 to 0.1.0

6

CHANGELOG.md
# @finos/legend-server-sdlc
## 0.1.0
### Minor Changes
- [#778](https://github.com/finos/legend-studio/pull/778) [`b8ee4134`](https://github.com/finos/legend-studio/commit/b8ee4134b62ddfde08993b9d4a327f2f2c5e0d8e) ([@MauricioUyaguari](https://github.com/MauricioUyaguari)) - Add workflow APIs for project versions.
## 0.0.17

@@ -4,0 +10,0 @@

4

lib/models/entity/EntityChangeUtils.d.ts

@@ -16,5 +16,7 @@ /**

*/
import { Entity } from '@finos/legend-model-storage';
import type { Entity } from '@finos/legend-model-storage';
import type { EntityDiff } from '../comparison/EntityDiff';
import { type EntityChange } from './EntityChange';
export declare const applyEntityChanges: (entities: Entity[], changes: EntityChange[]) => Entity[];
export declare const convertEntityDiffsToEntityChanges: (diffs: EntityDiff[], toEntityGetter: (entityPath: string | undefined) => Entity | undefined) => EntityChange[];
//# sourceMappingURL=EntityChangeUtils.d.ts.map

@@ -16,3 +16,2 @@ /**

*/
import { Entity } from '@finos/legend-model-storage';
import { UnsupportedOperationError } from '@finos/legend-shared';

@@ -41,6 +40,7 @@ import { EntityChangeType } from './EntityChange';

if (!entities.find((e) => e.path === change.entityPath)) {
const entity = new Entity();
entity.content = change.content ?? {};
entity.path = change.entityPath;
entity.classifierPath = change.classifierPath ?? '';
const entity = {
classifierPath: change.classifierPath ?? '',
path: change.entityPath,
content: change.content ?? {},
};
entities.push(entity);

@@ -64,2 +64,47 @@ }

};
export const convertEntityDiffsToEntityChanges = (diffs, toEntityGetter) => {
const entityChanges = [];
diffs.forEach((diff) => {
switch (diff.entityChangeType) {
case EntityChangeType.DELETE:
entityChanges.push({
type: diff.entityChangeType,
entityPath: diff.entityPath,
});
break;
case EntityChangeType.CREATE:
case EntityChangeType.MODIFY:
{
const entity = toEntityGetter(diff.entityPath);
if (entity) {
entityChanges.push({
type: diff.entityChangeType,
entityPath: entity.path,
content: entity.content,
});
}
}
break;
case EntityChangeType.RENAME:
{
const entity = toEntityGetter(diff.entityPath);
if (entity) {
entityChanges.push({
type: EntityChangeType.DELETE,
entityPath: diff.oldPath ?? '',
});
entityChanges.push({
type: EntityChangeType.CREATE,
entityPath: entity.path,
content: entity.content,
});
}
}
break;
default:
throw new UnsupportedOperationError(`Can't convert entity diff to entity change`, diff);
}
});
return entityChanges;
};
//# sourceMappingURL=EntityChangeUtils.js.map

@@ -81,3 +81,3 @@ /**

private _revision;
getRevisions: (projectId: string, workspace: Workspace | undefined) => Promise<PlainObject<Revision>[]>;
getRevisions: (projectId: string, workspace: Workspace | undefined, since: Date | undefined, until: Date | undefined) => Promise<PlainObject<Revision>[]>;
getRevision: (projectId: string, workspace: Workspace | undefined, revisionId: string | RevisionAlias) => Promise<PlainObject<Revision>>;

@@ -93,2 +93,3 @@ private _versions;

getConfigurationByVersion: (projectId: string, versionId: string) => Promise<PlainObject<ProjectConfiguration>>;
getConfigurationByRevision: (projectId: string, workspace: Workspace | undefined, revisionId: string) => Promise<PlainObject<ProjectConfiguration>>;
updateConfiguration: (projectId: string, workspace: Workspace | undefined, command: PlainObject<UpdateProjectConfigurationCommand>) => Promise<PlainObject<Revision>>;

@@ -109,2 +110,14 @@ getLatestProjectStructureVersion: () => Promise<PlainObject<ProjectStructureVersion>>;

runManualWorkflowJob: (projectId: string, workspace: Workspace | undefined, workflowJob: WorkflowJob) => Promise<PlainObject<WorkflowJob>>;
private _workflowsByVersion;
private _workflowByVersion;
private _workflowJobsByVersion;
private _workflowJobByVersion;
getWorkflowByVersion: (projectId: string, versionId: string, workflowId: string) => Promise<PlainObject<Workflow>>;
getWorkflowsByVersion: (projectId: string, versionId: string, status: WorkflowStatus | undefined, revisionIds: string[] | undefined, limit: number | undefined) => Promise<PlainObject<Workflow>[]>;
getWorkflowJobsByVersion: (projectId: string, versionId: string, workflowId: string, status: WorkflowStatus | undefined, revisionIds: string[] | undefined, limit: number | undefined) => Promise<PlainObject<WorkflowJob>[]>;
getWorkflowJobByVersion: (projectId: string, versionId: string, workflowJob: WorkflowJob) => Promise<PlainObject<WorkflowJob>>;
getWorkflowJobLogsByVersion: (projectId: string, versionId: string, workflowJob: WorkflowJob) => Promise<string>;
cancelWorkflowJobByVersion: (projectId: string, versionId: string, workflowJob: WorkflowJob) => Promise<PlainObject<WorkflowJob>>;
retryWorkflowJobByVersion: (projectId: string, versionId: string, workflowJob: WorkflowJob) => Promise<PlainObject<WorkflowJob>>;
runManualWorkflowJobByVersion: (projectId: string, versionId: string, workflowJob: WorkflowJob) => Promise<PlainObject<WorkflowJob>>;
private _entities;

@@ -111,0 +124,0 @@ getEntities: (projectId: string, workspace: Workspace | undefined) => Promise<PlainObject<Entity>[]>;

@@ -109,3 +109,3 @@ /**

_revision = (projectId, workspace, revisionId) => `${this._adaptiveWorkspace(projectId, workspace)}/revisions/${encodeURIComponent(revisionId)}`;
getRevisions = (projectId, workspace) => this.get(this._revisions(projectId, workspace));
getRevisions = (projectId, workspace, since, until) => this.get(this._revisions(projectId, workspace), {}, {}, { since: since?.toISOString(), until: until?.toISOString() });
getRevision = (projectId, workspace, revisionId) => this.get(this._revision(projectId, workspace, revisionId));

@@ -123,2 +123,3 @@ // ------------------------------------------- Version -------------------------------------------

getConfigurationByVersion = (projectId, versionId) => this.get(`${this._version(projectId, versionId)}/configuration`);
getConfigurationByRevision = (projectId, workspace, revisionId) => this.get(`${this._revision(projectId, workspace, revisionId)}/configuration`);
updateConfiguration = (projectId, workspace, command) => this.postWithTracing(this.getTraceData(SDLC_TRACER_SPAN.UPDATE_CONFIGURATION), this._configuration(projectId, workspace), command);

@@ -146,2 +147,18 @@ getLatestProjectStructureVersion = () => this.get(`${this.baseUrl}/configuration/latestProjectStructureVersion`);

runManualWorkflowJob = (projectId, workspace, workflowJob) => this.post(`${this._workflowJob(projectId, workspace, workflowJob.workflowId, workflowJob.id)}/run`);
_workflowsByVersion = (projectId, versionId) => `${this._version(projectId, versionId)}/workflows`;
_workflowByVersion = (projectId, versionId, workflowId) => `${this._workflowsByVersion(projectId, versionId)}/${encodeURIComponent(workflowId)}`;
_workflowJobsByVersion = (projectId, versionId, workflowId) => `${this._workflowByVersion(projectId, versionId, workflowId)}/jobs`;
_workflowJobByVersion = (projectId, versionId, workflowId, workflowJobId) => `${this._workflowJobsByVersion(projectId, versionId, workflowId)}/${encodeURIComponent(workflowJobId)}`;
getWorkflowByVersion = (projectId, versionId, workflowId) => this.get(this._workflowByVersion(projectId, versionId, workflowId));
getWorkflowsByVersion = (projectId, versionId, status, revisionIds, limit) => this.get(this._workflowsByVersion(projectId, versionId), undefined, undefined, {
status,
revisionIds,
limit,
});
getWorkflowJobsByVersion = (projectId, versionId, workflowId, status, revisionIds, limit) => this.get(this._workflowJobsByVersion(projectId, versionId, workflowId), undefined, undefined, { status, revisionIds, limit });
getWorkflowJobByVersion = (projectId, versionId, workflowJob) => this.get(`${this._workflowJobByVersion(projectId, versionId, workflowJob.workflowId, workflowJob.id)}`);
getWorkflowJobLogsByVersion = (projectId, versionId, workflowJob) => this.get(`${this._workflowJobByVersion(projectId, versionId, workflowJob.workflowId, workflowJob.id)}/logs`, {}, { Accept: ContentType.TEXT_PLAIN });
cancelWorkflowJobByVersion = (projectId, versionId, workflowJob) => this.post(`${this._workflowJobByVersion(projectId, versionId, workflowJob.workflowId, workflowJob.id)}/cancel`);
retryWorkflowJobByVersion = (projectId, versionId, workflowJob) => this.post(`${this._workflowJobByVersion(projectId, versionId, workflowJob.workflowId, workflowJob.id)}/retry`);
runManualWorkflowJobByVersion = (projectId, versionId, workflowJob) => this.post(`${this._workflowJobByVersion(projectId, versionId, workflowJob.workflowId, workflowJob.id)}/run`);
// ------------------------------------------- Entity -------------------------------------------

@@ -148,0 +165,0 @@ _entities = (projectId, workspace) => `${this._adaptiveWorkspace(projectId, workspace)}/entities`;

{
"name": "@finos/legend-server-sdlc",
"version": "0.0.17",
"version": "0.1.0",
"description": "Legend SDLC server client",

@@ -41,4 +41,4 @@ "keywords": [

"dependencies": {
"@finos/legend-model-storage": "0.0.15",
"@finos/legend-shared": "1.1.1",
"@finos/legend-model-storage": "0.0.16",
"@finos/legend-shared": "1.1.2",
"mobx": "6.3.13",

@@ -50,5 +50,5 @@ "mobx-react-lite": "3.2.3",

"devDependencies": {
"@finos/legend-dev-utils": "0.3.7",
"@finos/legend-dev-utils": "0.3.8",
"cross-env": "7.0.3",
"eslint": "8.7.0",
"eslint": "8.8.0",
"jest": "27.4.7",

@@ -55,0 +55,0 @@ "npm-run-all": "4.1.5",

@@ -17,4 +17,5 @@ /**

import { Entity } from '@finos/legend-model-storage';
import type { Entity } from '@finos/legend-model-storage';
import { UnsupportedOperationError } from '@finos/legend-shared';
import type { EntityDiff } from '../comparison/EntityDiff';
import { type EntityChange, EntityChangeType } from './EntityChange';

@@ -48,6 +49,7 @@

if (!entities.find((e) => e.path === change.entityPath)) {
const entity = new Entity();
entity.content = change.content ?? {};
entity.path = change.entityPath;
entity.classifierPath = change.classifierPath ?? '';
const entity = {
classifierPath: change.classifierPath ?? '',
path: change.entityPath,
content: change.content ?? {},
};
entities.push(entity);

@@ -74,1 +76,53 @@ }

};
export const convertEntityDiffsToEntityChanges = (
diffs: EntityDiff[],
toEntityGetter: (entityPath: string | undefined) => Entity | undefined,
): EntityChange[] => {
const entityChanges: EntityChange[] = [];
diffs.forEach((diff) => {
switch (diff.entityChangeType) {
case EntityChangeType.DELETE:
entityChanges.push({
type: diff.entityChangeType,
entityPath: diff.entityPath,
});
break;
case EntityChangeType.CREATE:
case EntityChangeType.MODIFY:
{
const entity = toEntityGetter(diff.entityPath);
if (entity) {
entityChanges.push({
type: diff.entityChangeType,
entityPath: entity.path,
content: entity.content,
});
}
}
break;
case EntityChangeType.RENAME:
{
const entity = toEntityGetter(diff.entityPath);
if (entity) {
entityChanges.push({
type: EntityChangeType.DELETE,
entityPath: diff.oldPath ?? '',
});
entityChanges.push({
type: EntityChangeType.CREATE,
entityPath: entity.path,
content: entity.content,
});
}
}
break;
default:
throw new UnsupportedOperationError(
`Can't convert entity diff to entity change`,
diff,
);
}
});
return entityChanges;
};

@@ -278,4 +278,11 @@ /**

workspace: Workspace | undefined,
since: Date | undefined,
until: Date | undefined,
): Promise<PlainObject<Revision>[]> =>
this.get(this._revisions(projectId, workspace));
this.get(
this._revisions(projectId, workspace),
{},
{},
{ since: since?.toISOString(), until: until?.toISOString() },
);
getRevision = (

@@ -333,2 +340,10 @@ projectId: string,

this.get(`${this._version(projectId, versionId)}/configuration`);
getConfigurationByRevision = (
projectId: string,
workspace: Workspace | undefined,
revisionId: string,
): Promise<PlainObject<ProjectConfiguration>> =>
this.get(
`${this._revision(projectId, workspace, revisionId)}/configuration`,
);
updateConfiguration = (

@@ -487,2 +502,138 @@ projectId: string,

);
private _workflowsByVersion = (
projectId: string,
versionId: string,
): string => `${this._version(projectId, versionId)}/workflows`;
private _workflowByVersion = (
projectId: string,
versionId: string,
workflowId: string,
): string =>
`${this._workflowsByVersion(projectId, versionId)}/${encodeURIComponent(
workflowId,
)}`;
private _workflowJobsByVersion = (
projectId: string,
versionId: string,
workflowId: string,
): string =>
`${this._workflowByVersion(projectId, versionId, workflowId)}/jobs`;
private _workflowJobByVersion = (
projectId: string,
versionId: string,
workflowId: string,
workflowJobId: string,
): string =>
`${this._workflowJobsByVersion(
projectId,
versionId,
workflowId,
)}/${encodeURIComponent(workflowJobId)}`;
getWorkflowByVersion = (
projectId: string,
versionId: string,
workflowId: string,
): Promise<PlainObject<Workflow>> =>
this.get(this._workflowByVersion(projectId, versionId, workflowId));
getWorkflowsByVersion = (
projectId: string,
versionId: string,
status: WorkflowStatus | undefined,
revisionIds: string[] | undefined,
limit: number | undefined,
): Promise<PlainObject<Workflow>[]> =>
this.get(
this._workflowsByVersion(projectId, versionId),
undefined,
undefined,
{
status,
revisionIds,
limit,
},
);
getWorkflowJobsByVersion = (
projectId: string,
versionId: string,
workflowId: string,
status: WorkflowStatus | undefined,
revisionIds: string[] | undefined,
limit: number | undefined,
): Promise<PlainObject<WorkflowJob>[]> =>
this.get(
this._workflowJobsByVersion(projectId, versionId, workflowId),
undefined,
undefined,
{ status, revisionIds, limit },
);
getWorkflowJobByVersion = (
projectId: string,
versionId: string,
workflowJob: WorkflowJob,
): Promise<PlainObject<WorkflowJob>> =>
this.get(
`${this._workflowJobByVersion(
projectId,
versionId,
workflowJob.workflowId,
workflowJob.id,
)}`,
);
getWorkflowJobLogsByVersion = (
projectId: string,
versionId: string,
workflowJob: WorkflowJob,
): Promise<string> =>
this.get(
`${this._workflowJobByVersion(
projectId,
versionId,
workflowJob.workflowId,
workflowJob.id,
)}/logs`,
{},
{ Accept: ContentType.TEXT_PLAIN },
);
cancelWorkflowJobByVersion = (
projectId: string,
versionId: string,
workflowJob: WorkflowJob,
): Promise<PlainObject<WorkflowJob>> =>
this.post(
`${this._workflowJobByVersion(
projectId,
versionId,
workflowJob.workflowId,
workflowJob.id,
)}/cancel`,
);
retryWorkflowJobByVersion = (
projectId: string,
versionId: string,
workflowJob: WorkflowJob,
): Promise<PlainObject<WorkflowJob>> =>
this.post(
`${this._workflowJobByVersion(
projectId,
versionId,
workflowJob.workflowId,
workflowJob.id,
)}/retry`,
);
runManualWorkflowJobByVersion = (
projectId: string,
versionId: string,
workflowJob: WorkflowJob,
): Promise<PlainObject<WorkflowJob>> =>
this.post(
`${this._workflowJobByVersion(
projectId,
versionId,
workflowJob.workflowId,
workflowJob.id,
)}/run`,
);
// ------------------------------------------- Entity -------------------------------------------

@@ -489,0 +640,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc