@norskvideo/ctl-sdk 0.1.43 → 0.1.44
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 +1 -1
- package/parsing.d.ts +6 -0
- package/parsing.js +10 -0
package/package.json
CHANGED
package/parsing.d.ts
CHANGED
|
@@ -6,4 +6,10 @@ export declare function parseSpec(raw: unknown, where: string, path: string): Pr
|
|
|
6
6
|
export interface ProductsFile {
|
|
7
7
|
products: ProductRegistration[];
|
|
8
8
|
}
|
|
9
|
+
/** The products file's schema version. Unstamped files are version 0 (every
|
|
10
|
+
* file written so far); a file stamped with a higher version was written by
|
|
11
|
+
* a newer norsk-ctl or norsk-mgr and is refused rather than misread, the
|
|
12
|
+
* rule every other store follows. Bump when the shape changes and add the
|
|
13
|
+
* migration at the store. */
|
|
14
|
+
export declare const PRODUCTS_FILE_VERSION = 0;
|
|
9
15
|
export declare function parseProductsFile(raw: unknown, path: string): ProductsFile;
|
package/parsing.js
CHANGED
|
@@ -60,9 +60,19 @@ function parseLicense(raw, where, path) {
|
|
|
60
60
|
}
|
|
61
61
|
throw new ProductsParseError(path, `${where}.license.mode must be 'byol' or 'marketplace'`);
|
|
62
62
|
}
|
|
63
|
+
/** The products file's schema version. Unstamped files are version 0 (every
|
|
64
|
+
* file written so far); a file stamped with a higher version was written by
|
|
65
|
+
* a newer norsk-ctl or norsk-mgr and is refused rather than misread, the
|
|
66
|
+
* rule every other store follows. Bump when the shape changes and add the
|
|
67
|
+
* migration at the store. */
|
|
68
|
+
export const PRODUCTS_FILE_VERSION = 0;
|
|
63
69
|
export function parseProductsFile(raw, path) {
|
|
64
70
|
if (!isRecord(raw))
|
|
65
71
|
throw new ProductsParseError(path, "file is not a YAML object");
|
|
72
|
+
if (typeof raw.version === "number" && raw.version > PRODUCTS_FILE_VERSION) {
|
|
73
|
+
throw new ProductsParseError(path, `is at version ${raw.version}, written by a newer norsk-ctl/norsk-mgr; this one understands up to ${PRODUCTS_FILE_VERSION}. ` +
|
|
74
|
+
"Run the newer one, or restore the pre-upgrade copy kept beside the file.");
|
|
75
|
+
}
|
|
66
76
|
const products = raw.products;
|
|
67
77
|
if (products === undefined)
|
|
68
78
|
return { products: [] };
|