@remit/data-ports 0.0.16 → 0.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/data-ports",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -97,4 +97,34 @@ describe("UpdateManifestSchema", () => {
97
97
  const { summary, ...rest } = GOOD_MANIFEST;
98
98
  assert.throws(() => UpdateManifestSchema.parse(rest));
99
99
  });
100
+
101
+ it("accepts a non-negative integer schemaVersion", () => {
102
+ const withSchema = { ...GOOD_MANIFEST, schemaVersion: 9 };
103
+ assert.deepEqual(UpdateManifestSchema.parse(withSchema), withSchema);
104
+ });
105
+
106
+ it("accepts a manifest without a schemaVersion", () => {
107
+ assert.equal(
108
+ UpdateManifestSchema.parse(GOOD_MANIFEST).schemaVersion,
109
+ undefined,
110
+ );
111
+ });
112
+
113
+ it("rejects a non-integer schemaVersion", () => {
114
+ assert.throws(() =>
115
+ UpdateManifestSchema.parse({ ...GOOD_MANIFEST, schemaVersion: 9.5 }),
116
+ );
117
+ });
118
+
119
+ it("rejects a negative schemaVersion", () => {
120
+ assert.throws(() =>
121
+ UpdateManifestSchema.parse({ ...GOOD_MANIFEST, schemaVersion: -1 }),
122
+ );
123
+ });
124
+
125
+ it("rejects a schemaVersion that is not a number", () => {
126
+ assert.throws(() =>
127
+ UpdateManifestSchema.parse({ ...GOOD_MANIFEST, schemaVersion: "9" }),
128
+ );
129
+ });
100
130
  });
@@ -13,6 +13,12 @@ export const UpdateManifestSchema = z.object({
13
13
  message: "releaseNotesUrl must be an https:// URL",
14
14
  }),
15
15
  registry: z.string().min(1),
16
+ // The highest schema migration the release applies, as a count of the
17
+ // migrations shipped at that release. The updater compares it against the
18
+ // running instance's version to tell whether installing this release runs a
19
+ // migration. Optional so a manifest published before this field validates and
20
+ // reads as an unknown schema version rather than an error.
21
+ schemaVersion: z.number().int().nonnegative().optional(),
16
22
  });
17
23
 
18
24
  export type UpdateManifest = z.infer<typeof UpdateManifestSchema>;