core: migrated code to new api surface

This commit is contained in:
𝑷𝒉𝒊𝒍𝒐𝒄𝒂𝒍𝒚𝒔𝒕
2026-05-11 20:40:52 -04:00
parent d2f8717555
commit 53870ac1f2
2 changed files with 8 additions and 9 deletions
+2 -2
View File
@@ -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[]
}
+6 -7
View File
@@ -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 = {