From 53870ac1f26b6fd498352598de0507e9aa5967d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9D=91=B7=F0=9D=92=89=F0=9D=92=8A=F0=9D=92=8D?= =?UTF-8?q?=F0=9D=92=90=F0=9D=92=84=F0=9D=92=82=F0=9D=92=8D=F0=9D=92=9A?= =?UTF-8?q?=F0=9D=92=94=F0=9D=92=95?= Date: Mon, 11 May 2026 20:40:52 -0400 Subject: [PATCH] core: migrated code to new api surface --- src/core/Atomic.ts | 4 ++-- src/core/DataUtils.ts | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/core/Atomic.ts b/src/core/Atomic.ts index ca129b02..f2fd7f90 100644 --- a/src/core/Atomic.ts +++ b/src/core/Atomic.ts @@ -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[] } diff --git a/src/core/DataUtils.ts b/src/core/DataUtils.ts index 64c4049d..663a02b4 100644 --- a/src/core/DataUtils.ts +++ b/src/core/DataUtils.ts @@ -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 = (a: T, b: IJsonDelta): T => { - return applyDelta(clone(a), b); +export const patchObject = (a: T, b: Changeset): T => { + return applyChangeset(clone(a), b); } // const jestDiffOptions: DiffOptions = { -- 2.51.2