mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-09-03 05:10:00 +03:00
core: migrated code to new api surface
This commit is contained in:
+2
-2
@@ -7,7 +7,7 @@ import { MarkOptional } from "ts-essentials";
|
||||
import { ErrorObject } from "serialize-error";
|
||||
import { PlayPlatformIdStr } from "../backend/common/infrastructure/Atomic.js";
|
||||
import { FlowControlTerm } from "../backend/common/infrastructure/Transform.js";
|
||||
import { IJsonDelta } from "json-diff-ts";
|
||||
import { Changeset } from "json-diff-ts";
|
||||
|
||||
export interface SourceStatusData {
|
||||
status: string;
|
||||
@@ -327,7 +327,7 @@ export interface LifecycleStep {
|
||||
flowReason?: string
|
||||
flowKnownState?: 'skip' | 'prereq'
|
||||
error?: ErrorLike
|
||||
patch?: IJsonDelta
|
||||
patch?: Changeset
|
||||
inputs?: LifecycleInput[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { create as diffCreate } from "jsondiffpatch";
|
||||
import { numberFormatOptions } from './Atomic.js';
|
||||
import { diffDelta, applyDelta, IJsonDelta, DeltaOptions } from 'json-diff-ts';
|
||||
import { diff, applyChangeset, Changeset, Options } from 'json-diff-ts';
|
||||
// may want to return to this one day
|
||||
// but currently the jsondiffpatch formatter is the best console/ansi diff output for humans :(
|
||||
//import {DiffOptions, DiffOptionsColor, diff as jestDiff} from 'jest-diff';
|
||||
@@ -19,18 +19,17 @@ export const jdiff = diffCreate({
|
||||
//omitRemovedValues: true
|
||||
});
|
||||
|
||||
const diffOptions: DeltaOptions = {
|
||||
/*arrayIdentityKeys: {artists: '$value'},*/
|
||||
reversible: false,
|
||||
const diffOptions: Options = {
|
||||
/*arrayIdentityKeys: {artists: '$value'},*/
|
||||
keysToSkip: ['playDate','playDateCompleted','listenRanges']
|
||||
};
|
||||
|
||||
export const diffObjects = (a: object, b: object) => {
|
||||
return diffDelta(a, b, diffOptions);
|
||||
return diff(a, b, diffOptions);
|
||||
}
|
||||
|
||||
export const patchObject = <T>(a: T, b: IJsonDelta): T => {
|
||||
return applyDelta(clone(a), b);
|
||||
export const patchObject = <T>(a: T, b: Changeset): T => {
|
||||
return applyChangeset(clone(a), b);
|
||||
}
|
||||
|
||||
// const jestDiffOptions: DiffOptions = {
|
||||
|
||||
Reference in New Issue
Block a user