@carlonicora/nestjs-neo4jsonapi 8.15.1 → 8.16.0
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/dist/bootstrap/app.module.factory.d.ts.map +1 -1
- package/dist/bootstrap/app.module.factory.js +9 -0
- package/dist/bootstrap/app.module.factory.js.map +1 -1
- package/dist/bootstrap/bootstrap.options.d.ts +10 -0
- package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
- package/dist/common/helpers/define-entity.d.ts.map +1 -1
- package/dist/common/helpers/define-entity.js +3 -0
- package/dist/common/helpers/define-entity.js.map +1 -1
- package/dist/common/registries/entity-descriptor.registry.d.ts +22 -0
- package/dist/common/registries/entity-descriptor.registry.d.ts.map +1 -0
- package/dist/common/registries/entity-descriptor.registry.js +51 -0
- package/dist/common/registries/entity-descriptor.registry.js.map +1 -0
- package/dist/common/registries/index.d.ts +1 -0
- package/dist/common/registries/index.d.ts.map +1 -1
- package/dist/common/registries/index.js +1 -0
- package/dist/common/registries/index.js.map +1 -1
- package/dist/core/cors/services/cors.service.d.ts +4 -1
- package/dist/core/cors/services/cors.service.d.ts.map +1 -1
- package/dist/core/cors/services/cors.service.js +19 -3
- package/dist/core/cors/services/cors.service.js.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.repository.d.ts +2 -0
- package/dist/core/neo4j/abstracts/abstract.repository.d.ts.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.repository.js +4 -1
- package/dist/core/neo4j/abstracts/abstract.repository.js.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.d.ts +6 -0
- package/dist/core/neo4j/abstracts/abstract.service.d.ts.map +1 -1
- package/dist/core/neo4j/abstracts/abstract.service.js +16 -0
- package/dist/core/neo4j/abstracts/abstract.service.js.map +1 -1
- package/dist/core/neo4j/helpers/build-filter-clauses.d.ts.map +1 -1
- package/dist/core/neo4j/helpers/build-filter-clauses.js +8 -1
- package/dist/core/neo4j/helpers/build-filter-clauses.js.map +1 -1
- package/dist/core/offline/index.d.ts +5 -0
- package/dist/core/offline/index.d.ts.map +1 -0
- package/dist/core/offline/index.js +21 -0
- package/dist/core/offline/index.js.map +1 -0
- package/dist/core/offline/offline-request.context.d.ts +12 -0
- package/dist/core/offline/offline-request.context.d.ts.map +1 -0
- package/dist/core/offline/offline-request.context.js +34 -0
- package/dist/core/offline/offline-request.context.js.map +1 -0
- package/dist/core/offline/offline-request.interceptor.d.ts +15 -0
- package/dist/core/offline/offline-request.interceptor.d.ts.map +1 -0
- package/dist/core/offline/offline-request.interceptor.js +43 -0
- package/dist/core/offline/offline-request.interceptor.js.map +1 -0
- package/dist/core/offline/offline.constants.d.ts +12 -0
- package/dist/core/offline/offline.constants.d.ts.map +1 -0
- package/dist/core/offline/offline.constants.js +12 -0
- package/dist/core/offline/offline.constants.js.map +1 -0
- package/dist/core/offline/offline.module.d.ts +12 -0
- package/dist/core/offline/offline.module.d.ts.map +1 -0
- package/dist/core/offline/offline.module.js +42 -0
- package/dist/core/offline/offline.module.js.map +1 -0
- package/dist/foundations/offline-change-set/decorators/offline-replayable.decorator.d.ts +7 -0
- package/dist/foundations/offline-change-set/decorators/offline-replayable.decorator.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/decorators/offline-replayable.decorator.js +12 -0
- package/dist/foundations/offline-change-set/decorators/offline-replayable.decorator.js.map +1 -0
- package/dist/foundations/offline-change-set/dtos/offline-change-set.post.dto.d.ts +33 -0
- package/dist/foundations/offline-change-set/dtos/offline-change-set.post.dto.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/dtos/offline-change-set.post.dto.js +133 -0
- package/dist/foundations/offline-change-set/dtos/offline-change-set.post.dto.js.map +1 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.d.ts +66 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.js +31 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.js.map +1 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.meta.d.ts +3 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.meta.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.meta.js +10 -0
- package/dist/foundations/offline-change-set/entities/offline-change-set.meta.js.map +1 -0
- package/dist/foundations/offline-change-set/index.d.ts +11 -0
- package/dist/foundations/offline-change-set/index.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/index.js +27 -0
- package/dist/foundations/offline-change-set/index.js.map +1 -0
- package/dist/foundations/offline-change-set/merge/deep-equal.d.ts +6 -0
- package/dist/foundations/offline-change-set/merge/deep-equal.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/merge/deep-equal.js +31 -0
- package/dist/foundations/offline-change-set/merge/deep-equal.js.map +1 -0
- package/dist/foundations/offline-change-set/merge/merge-blocks.d.ts +37 -0
- package/dist/foundations/offline-change-set/merge/merge-blocks.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/merge/merge-blocks.js +108 -0
- package/dist/foundations/offline-change-set/merge/merge-blocks.js.map +1 -0
- package/dist/foundations/offline-change-set/merge/three-way-merge.d.ts +57 -0
- package/dist/foundations/offline-change-set/merge/three-way-merge.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/merge/three-way-merge.js +201 -0
- package/dist/foundations/offline-change-set/merge/three-way-merge.js.map +1 -0
- package/dist/foundations/offline-change-set/offline-change-set.module.d.ts +11 -0
- package/dist/foundations/offline-change-set/offline-change-set.module.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/offline-change-set.module.js +41 -0
- package/dist/foundations/offline-change-set/offline-change-set.module.js.map +1 -0
- package/dist/foundations/offline-change-set/repositories/offline-change-set.repository.d.ts +26 -0
- package/dist/foundations/offline-change-set/repositories/offline-change-set.repository.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/repositories/offline-change-set.repository.js +56 -0
- package/dist/foundations/offline-change-set/repositories/offline-change-set.repository.js.map +1 -0
- package/dist/foundations/offline-change-set/services/offline-change-set.service.d.ts +72 -0
- package/dist/foundations/offline-change-set/services/offline-change-set.service.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/services/offline-change-set.service.js +333 -0
- package/dist/foundations/offline-change-set/services/offline-change-set.service.js.map +1 -0
- package/dist/foundations/offline-change-set/services/offline-route-runner.service.d.ts +61 -0
- package/dist/foundations/offline-change-set/services/offline-route-runner.service.d.ts.map +1 -0
- package/dist/foundations/offline-change-set/services/offline-route-runner.service.js +192 -0
- package/dist/foundations/offline-change-set/services/offline-route-runner.service.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var OfflineModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.OfflineModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const core_1 = require("@nestjs/core");
|
|
13
|
+
const offline_request_context_1 = require("./offline-request.context");
|
|
14
|
+
const offline_request_interceptor_1 = require("./offline-request.interceptor");
|
|
15
|
+
const offline_constants_1 = require("./offline.constants");
|
|
16
|
+
const offline_change_set_module_1 = require("../../foundations/offline-change-set/offline-change-set.module");
|
|
17
|
+
/**
|
|
18
|
+
* Offline support (opt-in through `bootstrap({ offline })`). Global: provides
|
|
19
|
+
* `OfflineRequestContext`, the `OFFLINE_OPTIONS` token, and the interceptor that marks
|
|
20
|
+
* offline replays in CLS. With `changeSets: true` it also loads and re-exports
|
|
21
|
+
* `OfflineChangeSetModule`, so the app's receiving route can inject `OfflineChangeSetService`.
|
|
22
|
+
*/
|
|
23
|
+
let OfflineModule = OfflineModule_1 = class OfflineModule {
|
|
24
|
+
static forRoot(options) {
|
|
25
|
+
return {
|
|
26
|
+
module: OfflineModule_1,
|
|
27
|
+
global: true,
|
|
28
|
+
imports: options.changeSets ? [offline_change_set_module_1.OfflineChangeSetModule] : [],
|
|
29
|
+
providers: [
|
|
30
|
+
{ provide: offline_constants_1.OFFLINE_OPTIONS, useValue: options },
|
|
31
|
+
offline_request_context_1.OfflineRequestContext,
|
|
32
|
+
{ provide: core_1.APP_INTERCEPTOR, useClass: offline_request_interceptor_1.OfflineRequestInterceptor },
|
|
33
|
+
],
|
|
34
|
+
exports: [offline_constants_1.OFFLINE_OPTIONS, offline_request_context_1.OfflineRequestContext, ...(options.changeSets ? [offline_change_set_module_1.OfflineChangeSetModule] : [])],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.OfflineModule = OfflineModule;
|
|
39
|
+
exports.OfflineModule = OfflineModule = OfflineModule_1 = __decorate([
|
|
40
|
+
(0, common_1.Module)({})
|
|
41
|
+
], OfflineModule);
|
|
42
|
+
//# sourceMappingURL=offline.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline.module.js","sourceRoot":"","sources":["../../../src/core/offline/offline.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,uCAA+C;AAC/C,uEAAkE;AAClE,+EAA0E;AAC1E,2DAAsE;AACtE,8GAAwG;AAExG;;;;;GAKG;AAEI,IAAM,aAAa,qBAAnB,MAAM,aAAa;IACxB,MAAM,CAAC,OAAO,CAAC,OAAuB;QACpC,OAAO;YACL,MAAM,EAAE,eAAa;YACrB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,kDAAsB,CAAC,CAAC,CAAC,CAAC,EAAE;YAC3D,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,mCAAe,EAAE,QAAQ,EAAE,OAAO,EAAE;gBAC/C,+CAAqB;gBACrB,EAAE,OAAO,EAAE,sBAAe,EAAE,QAAQ,EAAE,uDAAyB,EAAE;aAClE;YACD,OAAO,EAAE,CAAC,mCAAe,EAAE,+CAAqB,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,kDAAsB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC3G,CAAC;IACJ,CAAC;CACF,CAAA;AAdY,sCAAa;wBAAb,aAAa;IADzB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,aAAa,CAczB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const OFFLINE_REPLAYABLE_METADATA = "offline:replayable";
|
|
2
|
+
/**
|
|
3
|
+
* Marks a write route an offline change set may run. The offline route runner refuses
|
|
4
|
+
* every write whose route handler does not carry it (answered could-not-apply, never run).
|
|
5
|
+
*/
|
|
6
|
+
export declare const OfflineReplayable: () => MethodDecorator;
|
|
7
|
+
//# sourceMappingURL=offline-replayable.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-replayable.decorator.d.ts","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/decorators/offline-replayable.decorator.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,eAAiE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OfflineReplayable = exports.OFFLINE_REPLAYABLE_METADATA = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.OFFLINE_REPLAYABLE_METADATA = "offline:replayable";
|
|
6
|
+
/**
|
|
7
|
+
* Marks a write route an offline change set may run. The offline route runner refuses
|
|
8
|
+
* every write whose route handler does not carry it (answered could-not-apply, never run).
|
|
9
|
+
*/
|
|
10
|
+
const OfflineReplayable = () => (0, common_1.SetMetadata)(exports.OFFLINE_REPLAYABLE_METADATA, true);
|
|
11
|
+
exports.OfflineReplayable = OfflineReplayable;
|
|
12
|
+
//# sourceMappingURL=offline-replayable.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-replayable.decorator.js","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/decorators/offline-replayable.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAEhC,QAAA,2BAA2B,GAAG,oBAAoB,CAAC;AAEhE;;;GAGG;AACI,MAAM,iBAAiB,GAAG,GAAoB,EAAE,CAAC,IAAA,oBAAW,EAAC,mCAA2B,EAAE,IAAI,CAAC,CAAC;AAA1F,QAAA,iBAAiB,qBAAyE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const OFFLINE_CHANGE_METHODS: readonly ["POST", "PUT", "PATCH", "DELETE"];
|
|
2
|
+
export declare const OFFLINE_FIELD_CHOICES: readonly ["mine", "theirs", "merged"];
|
|
3
|
+
export declare class OfflineChangeResolutionDTO {
|
|
4
|
+
kind: "mine" | "merged";
|
|
5
|
+
/** Per conflicting field: whose value wins. */
|
|
6
|
+
choices?: Record<string, (typeof OFFLINE_FIELD_CHOICES)[number]>;
|
|
7
|
+
/** The model-built document holding only the fields chosen "merged". */
|
|
8
|
+
mergedBody?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
/** One queued change. */
|
|
11
|
+
export declare class OfflineChangeDTO {
|
|
12
|
+
seq: number;
|
|
13
|
+
method: (typeof OFFLINE_CHANGE_METHODS)[number];
|
|
14
|
+
path: string;
|
|
15
|
+
body?: Record<string, unknown>;
|
|
16
|
+
recordType?: string;
|
|
17
|
+
recordId?: string;
|
|
18
|
+
base?: Record<string, unknown> | null;
|
|
19
|
+
resolution?: OfflineChangeResolutionDTO;
|
|
20
|
+
}
|
|
21
|
+
export declare class OfflineChangeSetPostAttributesDTO {
|
|
22
|
+
changes: OfflineChangeDTO[];
|
|
23
|
+
}
|
|
24
|
+
export declare class OfflineChangeSetPostDataDTO {
|
|
25
|
+
type: string;
|
|
26
|
+
id: string;
|
|
27
|
+
attributes: OfflineChangeSetPostAttributesDTO;
|
|
28
|
+
}
|
|
29
|
+
/** `POST /offline-change-sets`: every change the device queued, in one package. */
|
|
30
|
+
export declare class OfflineChangeSetPostDTO {
|
|
31
|
+
data: OfflineChangeSetPostDataDTO;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=offline-change-set.post.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-change-set.post.dto.d.ts","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/dtos/offline-change-set.post.dto.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,sBAAsB,6CAA8C,CAAC;AAElF,eAAO,MAAM,qBAAqB,uCAAwC,CAAC;AAoB3E,qBAAa,0BAA0B;IAGrC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IAExB,+CAA+C;IAG/C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEjE,wEAAwE;IAGxE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,yBAAyB;AACzB,qBAAa,gBAAgB;IAI3B,GAAG,EAAE,MAAM,CAAC;IAIZ,MAAM,EAAE,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;IAKhD,IAAI,EAAE,MAAM,CAAC;IAIb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAI/B,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAKtC,UAAU,CAAC,EAAE,0BAA0B,CAAC;CACzC;AAED,qBAAa,iCAAiC;IAK5C,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED,qBAAa,2BAA2B;IAEtC,IAAI,EAAE,MAAM,CAAC;IAGb,EAAE,EAAE,MAAM,CAAC;IAKX,UAAU,EAAE,iCAAiC,CAAC;CAC/C;AAED,mFAAmF;AACnF,qBAAa,uBAAuB;IAIlC,IAAI,EAAE,2BAA2B,CAAC;CACnC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.OfflineChangeSetPostDTO = exports.OfflineChangeSetPostDataDTO = exports.OfflineChangeSetPostAttributesDTO = exports.OfflineChangeDTO = exports.OfflineChangeResolutionDTO = exports.OFFLINE_FIELD_CHOICES = exports.OFFLINE_CHANGE_METHODS = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const offline_change_set_meta_1 = require("../entities/offline-change-set.meta");
|
|
16
|
+
exports.OFFLINE_CHANGE_METHODS = ["POST", "PUT", "PATCH", "DELETE"];
|
|
17
|
+
exports.OFFLINE_FIELD_CHOICES = ["mine", "theirs", "merged"];
|
|
18
|
+
/** An object whose every value is one of `OFFLINE_FIELD_CHOICES`. */
|
|
19
|
+
function IsOfflineFieldChoices(options) {
|
|
20
|
+
return (0, class_validator_1.ValidateBy)({
|
|
21
|
+
name: "isOfflineFieldChoices",
|
|
22
|
+
validator: {
|
|
23
|
+
validate: (value) => !!value &&
|
|
24
|
+
typeof value === "object" &&
|
|
25
|
+
!Array.isArray(value) &&
|
|
26
|
+
Object.values(value).every((choice) => exports.OFFLINE_FIELD_CHOICES.includes(choice)),
|
|
27
|
+
defaultMessage: () => `each choice must be one of ${exports.OFFLINE_FIELD_CHOICES.join(", ")}`,
|
|
28
|
+
},
|
|
29
|
+
}, options);
|
|
30
|
+
}
|
|
31
|
+
class OfflineChangeResolutionDTO {
|
|
32
|
+
}
|
|
33
|
+
exports.OfflineChangeResolutionDTO = OfflineChangeResolutionDTO;
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, class_validator_1.IsDefined)(),
|
|
36
|
+
(0, class_validator_1.IsIn)(["mine", "merged"]),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], OfflineChangeResolutionDTO.prototype, "kind", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, class_validator_1.IsOptional)(),
|
|
41
|
+
IsOfflineFieldChoices(),
|
|
42
|
+
__metadata("design:type", Object)
|
|
43
|
+
], OfflineChangeResolutionDTO.prototype, "choices", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
(0, class_validator_1.IsObject)(),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], OfflineChangeResolutionDTO.prototype, "mergedBody", void 0);
|
|
49
|
+
/** One queued change. */
|
|
50
|
+
class OfflineChangeDTO {
|
|
51
|
+
}
|
|
52
|
+
exports.OfflineChangeDTO = OfflineChangeDTO;
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, class_validator_1.IsDefined)(),
|
|
55
|
+
(0, class_validator_1.IsInt)(),
|
|
56
|
+
(0, class_validator_1.Min)(0),
|
|
57
|
+
__metadata("design:type", Number)
|
|
58
|
+
], OfflineChangeDTO.prototype, "seq", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, class_validator_1.IsDefined)(),
|
|
61
|
+
(0, class_validator_1.IsIn)(exports.OFFLINE_CHANGE_METHODS),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], OfflineChangeDTO.prototype, "method", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, class_validator_1.IsDefined)(),
|
|
66
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
67
|
+
(0, class_validator_1.IsString)(),
|
|
68
|
+
__metadata("design:type", String)
|
|
69
|
+
], OfflineChangeDTO.prototype, "path", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, class_validator_1.IsOptional)(),
|
|
72
|
+
(0, class_validator_1.IsObject)(),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], OfflineChangeDTO.prototype, "body", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, class_validator_1.IsOptional)(),
|
|
77
|
+
(0, class_validator_1.IsString)(),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], OfflineChangeDTO.prototype, "recordType", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, class_validator_1.IsOptional)(),
|
|
82
|
+
(0, class_validator_1.IsString)(),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], OfflineChangeDTO.prototype, "recordId", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, class_validator_1.IsOptional)(),
|
|
87
|
+
(0, class_validator_1.IsObject)(),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], OfflineChangeDTO.prototype, "base", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, class_validator_1.IsOptional)(),
|
|
92
|
+
(0, class_validator_1.ValidateNested)(),
|
|
93
|
+
(0, class_transformer_1.Type)(() => OfflineChangeResolutionDTO),
|
|
94
|
+
__metadata("design:type", OfflineChangeResolutionDTO)
|
|
95
|
+
], OfflineChangeDTO.prototype, "resolution", void 0);
|
|
96
|
+
class OfflineChangeSetPostAttributesDTO {
|
|
97
|
+
}
|
|
98
|
+
exports.OfflineChangeSetPostAttributesDTO = OfflineChangeSetPostAttributesDTO;
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, class_validator_1.IsDefined)(),
|
|
101
|
+
(0, class_validator_1.IsArray)(),
|
|
102
|
+
(0, class_validator_1.ValidateNested)({ each: true }),
|
|
103
|
+
(0, class_transformer_1.Type)(() => OfflineChangeDTO),
|
|
104
|
+
__metadata("design:type", Array)
|
|
105
|
+
], OfflineChangeSetPostAttributesDTO.prototype, "changes", void 0);
|
|
106
|
+
class OfflineChangeSetPostDataDTO {
|
|
107
|
+
}
|
|
108
|
+
exports.OfflineChangeSetPostDataDTO = OfflineChangeSetPostDataDTO;
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, class_validator_1.Equals)(offline_change_set_meta_1.offlineChangeSetMeta.endpoint),
|
|
111
|
+
__metadata("design:type", String)
|
|
112
|
+
], OfflineChangeSetPostDataDTO.prototype, "type", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, class_validator_1.IsUUID)(),
|
|
115
|
+
__metadata("design:type", String)
|
|
116
|
+
], OfflineChangeSetPostDataDTO.prototype, "id", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, class_validator_1.ValidateNested)(),
|
|
119
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
120
|
+
(0, class_transformer_1.Type)(() => OfflineChangeSetPostAttributesDTO),
|
|
121
|
+
__metadata("design:type", OfflineChangeSetPostAttributesDTO)
|
|
122
|
+
], OfflineChangeSetPostDataDTO.prototype, "attributes", void 0);
|
|
123
|
+
/** `POST /offline-change-sets`: every change the device queued, in one package. */
|
|
124
|
+
class OfflineChangeSetPostDTO {
|
|
125
|
+
}
|
|
126
|
+
exports.OfflineChangeSetPostDTO = OfflineChangeSetPostDTO;
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, class_validator_1.ValidateNested)(),
|
|
129
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
130
|
+
(0, class_transformer_1.Type)(() => OfflineChangeSetPostDataDTO),
|
|
131
|
+
__metadata("design:type", OfflineChangeSetPostDataDTO)
|
|
132
|
+
], OfflineChangeSetPostDTO.prototype, "data", void 0);
|
|
133
|
+
//# sourceMappingURL=offline-change-set.post.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-change-set.post.dto.js","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/dtos/offline-change-set.post.dto.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type Entity } from "../../../common";
|
|
2
|
+
/** One change the device queued while offline, as the request carries it. */
|
|
3
|
+
export type OfflineChange = {
|
|
4
|
+
seq: number;
|
|
5
|
+
method: "POST" | "PUT" | "PATCH" | "DELETE";
|
|
6
|
+
/** Relative to the API base, as EndpointCreator built it. */
|
|
7
|
+
path: string;
|
|
8
|
+
/** The JSON:API document the model built when the GM saved. */
|
|
9
|
+
body?: Record<string, unknown>;
|
|
10
|
+
/** Set for an edit or delete of one record. */
|
|
11
|
+
recordType?: string;
|
|
12
|
+
recordId?: string;
|
|
13
|
+
/** The record's JSON:API resource as of the last sync. */
|
|
14
|
+
base?: Record<string, unknown> | null;
|
|
15
|
+
/**
|
|
16
|
+
* The GM's answer to an earlier conflict. The change keeps its original method, path, body
|
|
17
|
+
* and base; the server merges again and settles each conflicting field by its choice.
|
|
18
|
+
*/
|
|
19
|
+
resolution?: OfflineChangeResolution;
|
|
20
|
+
};
|
|
21
|
+
/** Whose value a conflicting field takes: the device's, the server's, or the hand-merged one. */
|
|
22
|
+
export type OfflineFieldChoice = "mine" | "theirs" | "merged";
|
|
23
|
+
export type OfflineChangeResolution = {
|
|
24
|
+
/** "mine" = every conflicting field "mine"; "merged" = per field, from `choices`. */
|
|
25
|
+
kind: "mine" | "merged";
|
|
26
|
+
/** Per conflicting field (attribute or relationship name): whose value wins. */
|
|
27
|
+
choices?: Record<string, OfflineFieldChoice>;
|
|
28
|
+
/**
|
|
29
|
+
* The JSON:API document the record type's model built holding only the fields chosen
|
|
30
|
+
* "merged", with their hand-merged values (read from `data.attributes`).
|
|
31
|
+
*/
|
|
32
|
+
mergedBody?: Record<string, unknown>;
|
|
33
|
+
};
|
|
34
|
+
/** What the server did with one change. */
|
|
35
|
+
export type OfflineChangeResult = {
|
|
36
|
+
seq: number;
|
|
37
|
+
status: "applied" | "conflict" | "could-not-apply" | "waiting";
|
|
38
|
+
conflict?: "fields" | "deleted-on-server" | "changed-on-server";
|
|
39
|
+
/** JSON:API resource as it is now on the server. */
|
|
40
|
+
current?: Record<string, unknown> | null;
|
|
41
|
+
/** Attributes the merge settled (for the conflict screen). */
|
|
42
|
+
merged?: Record<string, unknown>;
|
|
43
|
+
conflictFields?: string[];
|
|
44
|
+
/** Rich-text field → conflicting block ids. */
|
|
45
|
+
conflictBlocks?: Record<string, string[]>;
|
|
46
|
+
/** The server's reason for could-not-apply. */
|
|
47
|
+
detail?: string;
|
|
48
|
+
/** JSON:API document the route answered, when applied. */
|
|
49
|
+
response?: Record<string, unknown>;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The answer to one offline change set (one package of every change the device queued).
|
|
53
|
+
*
|
|
54
|
+
* Stored as an `OfflineChangeSet` node of the caller's company once the package has been
|
|
55
|
+
* opened, so a package the device sends again (same id) is answered with the same results
|
|
56
|
+
* and never applied twice. The node keeps the results as the JSON string `resultsJson`, which
|
|
57
|
+
* never goes on the wire; `results` is derived from it (or taken as given for a package just
|
|
58
|
+
* opened) and is what the answer carries in `attributes`.
|
|
59
|
+
*/
|
|
60
|
+
export type OfflineChangeSet = Entity & {
|
|
61
|
+
results?: OfflineChangeResult[];
|
|
62
|
+
resultsJson?: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const OfflineChangeSetDescriptor: import("../../../common").EntityDescriptor<OfflineChangeSet, {}>;
|
|
65
|
+
export type OfflineChangeSetDescriptorType = typeof OfflineChangeSetDescriptor;
|
|
66
|
+
//# sourceMappingURL=offline-change-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-change-set.d.ts","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/entities/offline-change-set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAG5D,6EAA6E;AAC7E,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAC;CACtC,CAAC;AAEF,iGAAiG;AACjG,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG;IACpC,qFAAqF;IACrF,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IACxB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC7C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAC/D,QAAQ,CAAC,EAAE,QAAQ,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;IAChE,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1C,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG;IACtC,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,0BAA0B,kEA0BrC,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,OAAO,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OfflineChangeSetDescriptor = void 0;
|
|
4
|
+
const common_1 = require("../../../common");
|
|
5
|
+
const offline_change_set_meta_1 = require("./offline-change-set.meta");
|
|
6
|
+
exports.OfflineChangeSetDescriptor = (0, common_1.defineEntity)()({
|
|
7
|
+
...offline_change_set_meta_1.offlineChangeSetMeta,
|
|
8
|
+
isCompanyScoped: true,
|
|
9
|
+
fields: {
|
|
10
|
+
resultsJson: { type: "string", excludeFromJsonApi: true, excludeFromSearch: true },
|
|
11
|
+
},
|
|
12
|
+
// Derived, output-only: a virtual field, because the serialiser emits a `computed` value only
|
|
13
|
+
// into meta (`computedDef.meta`) or nowhere, and the answer carries `results` in attributes.
|
|
14
|
+
virtualFields: {
|
|
15
|
+
results: {
|
|
16
|
+
compute: ({ data }) => {
|
|
17
|
+
if (Array.isArray(data?.results))
|
|
18
|
+
return data.results;
|
|
19
|
+
try {
|
|
20
|
+
const parsed = JSON.parse(data?.resultsJson ?? "[]");
|
|
21
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
relationships: {},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=offline-change-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-change-set.js","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/entities/offline-change-set.ts"],"names":[],"mappings":";;;AAAA,4CAA4D;AAC5D,uEAAiE;AAqEpD,QAAA,0BAA0B,GAAG,IAAA,qBAAY,GAAoB,CAAC;IACzE,GAAG,8CAAoB;IAEvB,eAAe,EAAE,IAAI;IAErB,MAAM,EAAE;QACN,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE;KACnF;IAED,8FAA8F;IAC9F,6FAA6F;IAC7F,aAAa,EAAE;QACb,OAAO,EAAE;YACP,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;gBACpB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;oBAAE,OAAO,IAAI,CAAC,OAAO,CAAC;gBACtD,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,IAAI,IAAI,CAAC,CAAC;oBACrD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7C,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC;SACF;KACF;IAED,aAAa,EAAE,EAAE;CAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-change-set.meta.d.ts","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/entities/offline-change-set.meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,eAAO,MAAM,oBAAoB,EAAE,QAKlC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.offlineChangeSetMeta = void 0;
|
|
4
|
+
exports.offlineChangeSetMeta = {
|
|
5
|
+
type: "offline-change-sets",
|
|
6
|
+
endpoint: "offline-change-sets",
|
|
7
|
+
nodeName: "offlineChangeSet",
|
|
8
|
+
labelName: "OfflineChangeSet",
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=offline-change-set.meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offline-change-set.meta.js","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/entities/offline-change-set.meta.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAa;IAC5C,IAAI,EAAE,qBAAqB;IAC3B,QAAQ,EAAE,qBAAqB;IAC/B,QAAQ,EAAE,kBAAkB;IAC5B,SAAS,EAAE,kBAAkB;CAC9B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./decorators/offline-replayable.decorator";
|
|
2
|
+
export * from "./dtos/offline-change-set.post.dto";
|
|
3
|
+
export * from "./entities/offline-change-set";
|
|
4
|
+
export * from "./entities/offline-change-set.meta";
|
|
5
|
+
export * from "./merge/merge-blocks";
|
|
6
|
+
export * from "./merge/three-way-merge";
|
|
7
|
+
export * from "./offline-change-set.module";
|
|
8
|
+
export * from "./repositories/offline-change-set.repository";
|
|
9
|
+
export * from "./services/offline-change-set.service";
|
|
10
|
+
export * from "./services/offline-route-runner.service";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundations/offline-change-set/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./decorators/offline-replayable.decorator"), exports);
|
|
18
|
+
__exportStar(require("./dtos/offline-change-set.post.dto"), exports);
|
|
19
|
+
__exportStar(require("./entities/offline-change-set"), exports);
|
|
20
|
+
__exportStar(require("./entities/offline-change-set.meta"), exports);
|
|
21
|
+
__exportStar(require("./merge/merge-blocks"), exports);
|
|
22
|
+
__exportStar(require("./merge/three-way-merge"), exports);
|
|
23
|
+
__exportStar(require("./offline-change-set.module"), exports);
|
|
24
|
+
__exportStar(require("./repositories/offline-change-set.repository"), exports);
|
|
25
|
+
__exportStar(require("./services/offline-change-set.service"), exports);
|
|
26
|
+
__exportStar(require("./services/offline-route-runner.service"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/foundations/offline-change-set/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4EAA0D;AAC1D,qEAAmD;AACnD,gEAA8C;AAC9C,qEAAmD;AACnD,uDAAqC;AACrC,0DAAwC;AACxC,8DAA4C;AAC5C,+EAA6D;AAC7D,wEAAsD;AACtD,0EAAwD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural equality for JSON values: key order does not matter, array order does.
|
|
3
|
+
* `undefined` and `null` are equal (a missing attribute and a null one mean the same on the wire).
|
|
4
|
+
*/
|
|
5
|
+
export declare function jsonEqual(a: unknown, b: unknown): boolean;
|
|
6
|
+
//# sourceMappingURL=deep-equal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-equal.d.ts","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/merge/deep-equal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAgBzD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonEqual = jsonEqual;
|
|
4
|
+
/**
|
|
5
|
+
* Structural equality for JSON values: key order does not matter, array order does.
|
|
6
|
+
* `undefined` and `null` are equal (a missing attribute and a null one mean the same on the wire).
|
|
7
|
+
*/
|
|
8
|
+
function jsonEqual(a, b) {
|
|
9
|
+
if (a === b)
|
|
10
|
+
return true;
|
|
11
|
+
if (a == null || b == null)
|
|
12
|
+
return a == null && b == null;
|
|
13
|
+
if (typeof a !== typeof b)
|
|
14
|
+
return false;
|
|
15
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
16
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length)
|
|
17
|
+
return false;
|
|
18
|
+
return a.every((item, index) => jsonEqual(item, b[index]));
|
|
19
|
+
}
|
|
20
|
+
if (typeof a === "object") {
|
|
21
|
+
const ao = a;
|
|
22
|
+
const bo = b;
|
|
23
|
+
const keys = new Set([...Object.keys(ao), ...Object.keys(bo)]);
|
|
24
|
+
for (const key of keys)
|
|
25
|
+
if (!jsonEqual(ao[key], bo[key]))
|
|
26
|
+
return false;
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=deep-equal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-equal.js","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/merge/deep-equal.ts"],"names":[],"mappings":";;AAIA,8BAgBC;AApBD;;;GAGG;AACH,SAAgB,SAAS,CAAC,CAAU,EAAE,CAAU;IAC9C,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI;QAAE,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC;IAC1D,IAAI,OAAO,CAAC,KAAK,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAClF,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC1B,MAAM,EAAE,GAAG,CAA4B,CAAC;QACxC,MAAM,EAAE,GAAG,CAA4B,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/D,KAAK,MAAM,GAAG,IAAI,IAAI;YAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;gBAAE,OAAO,KAAK,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** One top-level BlockNote block; its children are part of it. Only `id` is read. */
|
|
2
|
+
export type Block = {
|
|
3
|
+
id: string;
|
|
4
|
+
[key: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
/** Which side wins a conflicting block (and a conflicting order) once the GM has chosen. */
|
|
7
|
+
export type BlockPreference = "mine" | "theirs";
|
|
8
|
+
/**
|
|
9
|
+
* Block-by-block three-way merge of one rich-text field (BlockNote document).
|
|
10
|
+
*
|
|
11
|
+
* Blocks are compared by id as objects, never turned into text. Starting from the
|
|
12
|
+
* server's blocks (theirs):
|
|
13
|
+
* - a block changed only on the device takes the device's version;
|
|
14
|
+
* - a block removed on one side and untouched on the other is removed;
|
|
15
|
+
* - a block added on the device lands after the block that precedes it on the device;
|
|
16
|
+
* - a block changed on both sides (differently), or removed on one side and changed on
|
|
17
|
+
* the other, is a conflict: the merged document keeps the server's version and its
|
|
18
|
+
* id is listed in `conflictBlockIds`;
|
|
19
|
+
* - order: when only one side moved blocks, the merged document follows that side's order
|
|
20
|
+
* (the blocks' content still merges as above); when both sides moved blocks into different
|
|
21
|
+
* orders, `orderConflict` is true and the server's order is kept.
|
|
22
|
+
*
|
|
23
|
+
* With `prefer: "mine"` (the GM chose this device's version of the field) every conflict
|
|
24
|
+
* resolves to the device's side instead (its block, its removal, its order) and nothing is
|
|
25
|
+
* reported; `prefer: "theirs"` resolves them to the server's side.
|
|
26
|
+
*/
|
|
27
|
+
export declare function mergeBlocks(p: {
|
|
28
|
+
base: Block[];
|
|
29
|
+
mine: Block[];
|
|
30
|
+
theirs: Block[];
|
|
31
|
+
prefer?: BlockPreference;
|
|
32
|
+
}): {
|
|
33
|
+
merged: Block[];
|
|
34
|
+
conflictBlockIds: string[];
|
|
35
|
+
orderConflict: boolean;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=merge-blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-blocks.d.ts","sourceRoot":"","sources":["../../../../src/foundations/offline-change-set/merge/merge-blocks.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,MAAM,MAAM,KAAK,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAE3D,4FAA4F;AAC5F,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,GAAG;IAC3G,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;CACxB,CAoFA"}
|