Skip to content

Commit

Permalink
restrict Migrator migrate function to manifest types
Browse files Browse the repository at this point in the history
  • Loading branch information
pileks committed Sep 30, 2022
1 parent 373e84b commit 49b29ca
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/js/manifests/polywrap/src/__tests__/migrations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ describe("Manifest migration pathfinding", () => {
{
from: "0.1.0",
to: "0.2.0",
migrate: () => {},
migrate: (x) => x,
},
{
from: "0.2.0",
to: "0.3.0",
migrate: () => {},
migrate: (x) => x,
},
{
from: "0.3.0",
to: "0.4.0",
migrate: () => {},
migrate: (x) => x,
},
{
from: "0.4.0",
to: "0.5.0",
migrate: () => {},
migrate: (x) => x,
},
{
from: "0.2.0",
to: "0.4.0",
migrate: () => {},
migrate: (x) => x,
},
];

Expand Down
23 changes: 22 additions & 1 deletion packages/js/manifests/polywrap/src/migrations/migration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
import {
AnyAppManifest,
AnyBuildManifest,
AnyDeployManifest,
AnyInfraManifest,
AnyMetaManifest,
AnyPluginManifest,
AnyPolywrapManifest,
AnyPolywrapWorkflow,
} from "../formats";

type AnyManifest =
| AnyPolywrapManifest
| AnyPluginManifest
| AnyAppManifest
| AnyInfraManifest
| AnyDeployManifest
| AnyBuildManifest
| AnyMetaManifest
| AnyPolywrapWorkflow;

export type Migrator = {
from: string;
to: string;
migrate: (manifest: unknown) => unknown;
migrate: (manifest: AnyManifest) => AnyManifest;
};

0 comments on commit 49b29ca

Please sign in to comment.