Skip to content

Commit 14af0a6

Browse files
author
Nil20
committed
chore: allow configurable scope for draft
1 parent db3f46a commit 14af0a6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/client/src/v2-events/utils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import {
2323
SystemVariables,
2424
Scope,
2525
ActionScopes,
26+
ConfigurableActionScopes,
27+
parseConfigurableScope,
2628
WorkqueueConfigWithoutQuery,
2729
joinValues,
2830
UUID,
@@ -232,7 +234,14 @@ export enum CoreWorkqueues {
232234
}
233235

234236
export function hasOutboxWorkqueue(scopes: Scope[]) {
235-
return scopes.some((scope) => ActionScopes.safeParse(scope).success)
237+
const hasLiteralActionScopes = scopes.some(
238+
(scope) => ActionScopes.safeParse(scope).success
239+
)
240+
const parsedScopes = scopes.map(parseConfigurableScope)
241+
const hasConfigurableActionScopes = parsedScopes.some(
242+
(scope) => ConfigurableActionScopes.safeParse(scope).success
243+
)
244+
return hasLiteralActionScopes || hasConfigurableActionScopes
236245
}
237246

238247
export function hasDraftWorkqueue(scopes: Scope[]) {

packages/commons/src/scopes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@ const ConfigurableRawScopes = z.discriminatedUnion('type', [
327327
CustomActionScope
328328
])
329329

330+
export const ConfigurableActionScopes = z.discriminatedUnion('type', [
331+
// @TODO - Configure actual action scopes
332+
RecordScope,
333+
CustomActionScope
334+
])
335+
330336
type ConfigurableRawScopes = z.infer<typeof ConfigurableRawScopes>
331337
export type ConfigurableScopeType = ConfigurableRawScopes['type']
332338

0 commit comments

Comments
 (0)