Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Deprecated Worker, eventHandler, and action APIs #1237

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions workflow-core/api/workflow-core.api

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ public abstract class StatefulWorkflow<
public inner class RenderContext internal constructor(
baseContext: BaseRenderContext<PropsT, StateT, OutputT>
) : BaseRenderContext<@UnsafeVariance PropsT, StateT, @UnsafeVariance OutputT> by baseContext {
@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <reified CurrentStateT : StateT & Any> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
// Type variance issue: https://github.com/square/workflow-kotlin/issues/891
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(currentState: CurrentStateT) -> Unit
): () -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)

/**
* Like [eventHandler], but no-ops if [state][WorkflowAction.Updater.state] has
* changed to a different type than [CurrentStateT] by the time [update] fires.
Expand Down Expand Up @@ -144,23 +129,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <reified CurrentStateT : StateT & Any, EventT> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
event: EventT
) -> Unit
): (EventT) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <reified CurrentStateT : StateT & Any, EventT> safeEventHandler(
name: String,
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
Expand All @@ -181,24 +149,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <reified CurrentStateT : StateT & Any, E1, E2> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2
) -> Unit
): (E1, E2) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <reified CurrentStateT : StateT & Any, E1, E2> safeEventHandler(
name: String,
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
Expand All @@ -220,25 +170,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3
) -> Unit
): (E1, E2, E3) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3> safeEventHandler(
name: String,
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
Expand All @@ -261,26 +192,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3,
e4: E4
) -> Unit
): (E1, E2, E3, E4) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4> safeEventHandler(
name: String,
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
Expand All @@ -304,27 +215,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4, E5> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3,
e4: E4,
e5: E5
) -> Unit
): (E1, E2, E3, E4, E5) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <reified CurrentStateT : StateT & Any, E1, E2, E3, E4, E5> safeEventHandler(
name: String,
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
Expand All @@ -349,36 +239,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <
reified CurrentStateT : StateT & Any,
E1,
E2,
E3,
E4,
E5,
E6
> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3,
e4: E4,
e5: E5,
e6: E6
) -> Unit
): (E1, E2, E3, E4, E5, E6) -> Unit = safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <
reified CurrentStateT : StateT & Any,
E1,
Expand Down Expand Up @@ -412,39 +272,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <
reified CurrentStateT : StateT & Any,
E1,
E2,
E3,
E4,
E5,
E6,
E7
> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3,
e4: E4,
e5: E5,
e6: E6,
e7: E7
) -> Unit
): (E1, E2, E3, E4, E5, E6, E7) -> Unit =
safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <
reified CurrentStateT : StateT & Any,
E1,
Expand Down Expand Up @@ -480,41 +307,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <
reified CurrentStateT : StateT & Any,
E1,
E2,
E3,
E4,
E5,
E6,
E7,
E8
> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3,
e4: E4,
e5: E5,
e6: E6,
e7: E7,
e8: E8
) -> Unit
): (E1, E2, E3, E4, E5, E6, E7, E8) -> Unit =
safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <
reified CurrentStateT : StateT & Any,
E1,
Expand Down Expand Up @@ -552,43 +344,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <
reified CurrentStateT : StateT & Any,
E1,
E2,
E3,
E4,
E5,
E6,
E7,
E8,
E9
> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3,
e4: E4,
e5: E5,
e6: E6,
e7: E7,
e8: E8,
e9: E9
) -> Unit
): (E1, E2, E3, E4, E5, E6, E7, E8, E9) -> Unit =
safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <
reified CurrentStateT : StateT & Any,
E1,
Expand Down Expand Up @@ -630,45 +385,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name",
ReplaceWith("safeEventHandler(\"TODO: debugging name\", onFailedCast, update)")
)
public inline fun <
reified CurrentStateT : StateT & Any,
E1,
E2,
E3,
E4,
E5,
E6,
E7,
E8,
E9,
E10
> safeEventHandler(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
crossinline update: WorkflowAction<
@UnsafeVariance PropsT,
StateT,
@UnsafeVariance OutputT
>.Updater.(
currentState: CurrentStateT,
e1: E1,
e2: E2,
e3: E3,
e4: E4,
e5: E5,
e6: E6,
e7: E7,
e8: E8,
e9: E9,
e10: E10
) -> Unit
): (E1, E2, E3, E4, E5, E6, E7, E8, E9, E10) -> Unit =
safeEventHandler("safeEventHandler", onFailedCast, update)

public inline fun <
reified CurrentStateT : StateT & Any,
E1,
Expand Down Expand Up @@ -715,18 +431,6 @@ public abstract class StatefulWorkflow<
}
}

@Deprecated(
"Always provide a debugging name.",
ReplaceWith("safeAction(\"TODO: name\", onFailedCast, update)")
)
public inline fun <reified CurrentStateT : StateT & Any> safeAction(
crossinline onFailedCast: (name: String, type: KClass<*>, state: StateT) -> Unit =
::defaultOnFailedCast,
noinline update: WorkflowAction<PropsT, StateT, OutputT>.Updater.(
currentState: CurrentStateT
) -> Unit
): WorkflowAction<PropsT, StateT, OutputT> = safeAction("safeAction", onFailedCast, update)

/**
* Like [action], but no-ops if [state][WorkflowAction.Updater.state] has
* changed to a different type than [CurrentStateT] by the time [update] fires.
Expand Down Expand Up @@ -970,15 +674,6 @@ public inline fun <StateT, OutputT, RenderingT> Workflow.Companion.stateful(
{ _, state -> render(state) }
)

@Deprecated(
"Always provide a debugging name",
ReplaceWith("action(\"TODO: debugging name\", update)")
)
public fun <PropsT, StateT, OutputT, RenderingT>
StatefulWorkflow<PropsT, StateT, OutputT, RenderingT>.action(
update: WorkflowAction<PropsT, StateT, OutputT>.Updater.() -> Unit
): WorkflowAction<PropsT, StateT, OutputT> = action("", update)

/**
* Convenience to create a [WorkflowAction] with parameter types matching those
* of the receiving [StatefulWorkflow]. The action will invoke the given [lambda][update]
Expand Down
Loading
Loading