import { dispatcher } from "../events/schedule/schedule.js";
import { isLike, ok } from "../is.js";
import { dispatchSyncEvent } from "../sync/dispatch.js";
import { getPeriodicSyncTagRegistrationState, setPeriodicSyncTagRegistrationState } from "./manager.js";
export function isPeriodicSyncDurableEventData(event) {
    return !!(isLike(event) &&
        event.type === "periodicsync" &&
        typeof event.tag === "string");
}
export const removePeriodicSyncDispatcherFunction = dispatcher("periodicsync", async (event, dispatch) => {
    ok(isPeriodicSyncDurableEventData(event), "Expected periodicsync event with tag");
    await dispatchSyncEvent({
        event,
        dispatch,
        getRegistrationState: getPeriodicSyncTagRegistrationState,
        setRegistrationState: setPeriodicSyncTagRegistrationState,
        deregister: false
    });
});
//# sourceMappingURL=dispatch.js.map