@noldova/checkpoints.protocol 0.0.4 → 0.0.5
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": "@noldova/checkpoints.protocol",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "The checkpoints module's protocol: the requests, results and events of its runtime methods, with the folders and checkpoints they name.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"registry": "https://registry.npmjs.org/"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@noldova/context.core": ">=0.0.
|
|
34
|
-
"@noldova/context.exceptions": ">=0.0.
|
|
35
|
-
"@noldova/context.json": ">=0.0.
|
|
33
|
+
"@noldova/context.core": ">=0.0.18 <0.1.0",
|
|
34
|
+
"@noldova/context.exceptions": ">=0.0.18 <0.1.0",
|
|
35
|
+
"@noldova/context.json": ">=0.0.18 <0.1.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "f195c110c2f32f8cc3fca566a9ac332a403e9a07"
|
|
38
38
|
}
|
package/src/api/index.d.ts
CHANGED
|
@@ -1390,12 +1390,24 @@ export declare class CaptureRequest {
|
|
|
1390
1390
|
*/
|
|
1391
1391
|
public readonly label: string | null;
|
|
1392
1392
|
|
|
1393
|
+
/**
|
|
1394
|
+
* The paths the capture is limited to, relative to the folder with "/" between names, or `null` for the whole folder. Each must equal
|
|
1395
|
+
* the module's own path for it exactly, letter case and Unicode normalisation included; one holding "\" is refused on every system. The
|
|
1396
|
+
* checkpoint holds each path, and everything at or under one that is a folder, as the capture reads it, an absent path as absent, and
|
|
1397
|
+
* every other path as the newest checkpoint held it; the content limit and the free space count only what the capture reads. A preview
|
|
1398
|
+
* or restore of the checkpoint changes only those paths. The wire form holds the paths, as `null` for the whole folder, and a wire form
|
|
1399
|
+
* without them reads as `null`.
|
|
1400
|
+
*/
|
|
1401
|
+
public readonly paths: readonly string[] | null;
|
|
1402
|
+
|
|
1393
1403
|
/**
|
|
1394
1404
|
* @param folder The folder to take a checkpoint of.
|
|
1395
1405
|
* @param label The label to attach, of up to 1,024 characters, or `null`.
|
|
1396
1406
|
* @param asOf The time the checkpoint stands for, or `null`, the default, for the folder as the capture reads it; the request keeps a
|
|
1397
1407
|
* copy.
|
|
1398
|
-
* @
|
|
1408
|
+
* @param paths The paths the capture is limited to, or `null`, the default, for the whole folder; the request keeps a copy.
|
|
1409
|
+
* @throws {ProtocolException} Thrown synchronously when the label is longer than 1,024 characters, the time is no date, or a path has
|
|
1410
|
+
* an empty name, "." or "..", or holds "\" on any system.
|
|
1399
1411
|
* @example
|
|
1400
1412
|
* ```ts
|
|
1401
1413
|
* import { CaptureRequest, FolderReference } from "@noldova/checkpoints.protocol";
|
|
@@ -1404,7 +1416,7 @@ export declare class CaptureRequest {
|
|
|
1404
1416
|
* console.log(CaptureRequest.method, request.toJson());
|
|
1405
1417
|
* ```
|
|
1406
1418
|
*/
|
|
1407
|
-
public constructor(folder: FolderReference, label: string | null, asOf?: Date | null);
|
|
1419
|
+
public constructor(folder: FolderReference, label: string | null, asOf?: Date | null, paths?: readonly string[] | null);
|
|
1408
1420
|
|
|
1409
1421
|
/**
|
|
1410
1422
|
* Reads a request from its wire form.
|
|
@@ -2828,7 +2840,8 @@ export declare class PreviewRequest {
|
|
|
2828
2840
|
* the module's own path for it exactly, as a comparison gives it, letter case and Unicode normalisation included; one holding "\"
|
|
2829
2841
|
* is refused on every system. The wire form always holds the paths, as `null` for the whole folder, and a wire form without them is
|
|
2830
2842
|
* refused. The plan changes only paths at or under one of them, and a folder above one that the checkpoint holds as a folder and the
|
|
2831
|
-
* folder now holds as something else; everything else stays as it is now and is left out of the plan's state.
|
|
2843
|
+
* folder now holds as something else; everything else stays as it is now and is left out of the plan's state. A checkpoint captured
|
|
2844
|
+
* with paths is restored only at or under those, whatever paths the preview gives.
|
|
2832
2845
|
*/
|
|
2833
2846
|
public readonly paths: readonly string[] | null;
|
|
2834
2847
|
|
|
@@ -9,15 +9,17 @@ import "@noldova/context.core";
|
|
|
9
9
|
import { InvalidDateException } from "../exceptions/invalid-date.exception.js";
|
|
10
10
|
import { LabelTooLongException } from "../exceptions/label-too-long.exception.js";
|
|
11
11
|
import { Resources } from "../resources.js";
|
|
12
|
+
import { ScopePaths } from "../services/scope-paths.js";
|
|
12
13
|
import { WireForm } from "../services/wire-form.js";
|
|
13
14
|
import { FolderReference } from "./folder-reference.js";
|
|
14
15
|
export class CaptureRequest {
|
|
15
16
|
static method = Resources.captureMethod;
|
|
16
|
-
static FIELDS = [Resources.folderField, Resources.labelField, Resources.asOfField];
|
|
17
|
+
static FIELDS = [Resources.folderField, Resources.labelField, Resources.asOfField, Resources.pathsField];
|
|
17
18
|
asOf;
|
|
18
19
|
folder;
|
|
19
20
|
label;
|
|
20
|
-
|
|
21
|
+
paths;
|
|
22
|
+
constructor(folder, label, asOf = null, paths = null) {
|
|
21
23
|
if (!Object.isNull(label) && label.length > Resources.maximumLabelLength)
|
|
22
24
|
throw new LabelTooLongException(label.length);
|
|
23
25
|
if (!Object.isNull(asOf) && Number.isNaN(asOf.getTime()))
|
|
@@ -25,16 +27,18 @@ export class CaptureRequest {
|
|
|
25
27
|
this.asOf = Object.isNull(asOf) ? null : new Date(asOf.getTime());
|
|
26
28
|
this.folder = folder;
|
|
27
29
|
this.label = label;
|
|
30
|
+
this.paths = ScopePaths.of(paths);
|
|
28
31
|
}
|
|
29
32
|
static fromJson(value) {
|
|
30
33
|
const reader = WireForm.read(value, Resources.captureRequestModel, CaptureRequest.FIELDS);
|
|
31
|
-
return new CaptureRequest(FolderReference.fromJson(reader.readValue(Resources.folderField)), reader.readNullableString(Resources.labelField), WireForm.readNullableTime(reader, Resources.asOfField));
|
|
34
|
+
return new CaptureRequest(FolderReference.fromJson(reader.readValue(Resources.folderField)), reader.readNullableString(Resources.labelField), WireForm.readNullableTime(reader, Resources.asOfField), reader.hasField(Resources.pathsField) ? WireForm.readNullableStringArray(reader, Resources.pathsField) : null);
|
|
32
35
|
}
|
|
33
36
|
toJson() {
|
|
34
37
|
return {
|
|
35
38
|
[Resources.folderField]: this.folder.toJson(),
|
|
36
39
|
[Resources.labelField]: this.label,
|
|
37
|
-
[Resources.asOfField]: Object.isNull(this.asOf) ? null : this.asOf.toISOString()
|
|
40
|
+
[Resources.asOfField]: Object.isNull(this.asOf) ? null : this.asOf.toISOString(),
|
|
41
|
+
[Resources.pathsField]: ScopePaths.toJson(this.paths)
|
|
38
42
|
};
|
|
39
43
|
}
|
|
40
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/capture-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAG/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,OAAO,cAAc;IAClB,MAAM,CAAU,MAAM,GAAW,SAAS,CAAC,aAAa,CAAC;IACxD,MAAM,CAAU,MAAM,GAAsB,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"capture-request.js","sourceRoot":"","sources":["../../../../../src/noldova.checkpoints.protocol/src/models/capture-request.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uB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