@owlmeans/planning 0.1.18-rc.21 → 0.1.18-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/planning/SKILL.md +51 -3
- package/build/aliases/types.d.ts +23 -0
- package/build/aliases/types.d.ts.map +1 -1
- package/build/aliases.d.ts.map +1 -1
- package/build/aliases.js +2 -1
- package/build/aliases.js.map +1 -1
- package/build/consts.d.ts +21 -1
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +23 -0
- package/build/consts.js.map +1 -1
- package/build/entrypoints/types.d.ts +7 -0
- package/build/entrypoints/types.d.ts.map +1 -1
- package/build/entrypoints.d.ts.map +1 -1
- package/build/entrypoints.js +7 -0
- package/build/entrypoints.js.map +1 -1
- package/build/helpers/apply.d.ts.map +1 -1
- package/build/helpers/apply.js +8 -3
- package/build/helpers/apply.js.map +1 -1
- package/build/helpers/changes/consts.local.d.ts.map +1 -1
- package/build/helpers/changes/consts.local.js +1 -1
- package/build/helpers/changes/consts.local.js.map +1 -1
- package/build/helpers/changes.d.ts.map +1 -1
- package/build/helpers/changes.js +3 -0
- package/build/helpers/changes.js.map +1 -1
- package/build/helpers/query.js +1 -1
- package/build/helpers/query.js.map +1 -1
- package/build/helpers/scoped/types.d.ts +4 -2
- package/build/helpers/scoped/types.d.ts.map +1 -1
- package/build/helpers/scoped.d.ts +3 -2
- package/build/helpers/scoped.d.ts.map +1 -1
- package/build/helpers/scoped.js +29 -8
- package/build/helpers/scoped.js.map +1 -1
- package/build/helpers/validate/types.d.ts +1 -0
- package/build/helpers/validate/types.d.ts.map +1 -1
- package/build/helpers/validate.d.ts.map +1 -1
- package/build/helpers/validate.js +6 -1
- package/build/helpers/validate.js.map +1 -1
- package/build/helpers/wire.d.ts.map +1 -1
- package/build/helpers/wire.js +2 -1
- package/build/helpers/wire.js.map +1 -1
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/registry.d.ts.map +1 -1
- package/build/registry.js +26 -0
- package/build/registry.js.map +1 -1
- package/build/resources/mentions.d.ts +4 -0
- package/build/resources/mentions.d.ts.map +1 -0
- package/build/resources/mentions.js +15 -0
- package/build/resources/mentions.js.map +1 -0
- package/build/resources/protocol/types.d.ts +29 -0
- package/build/resources/protocol/types.d.ts.map +1 -0
- package/build/resources/protocol/types.js +2 -0
- package/build/resources/protocol/types.js.map +1 -0
- package/build/resources/protocol.d.ts +6 -0
- package/build/resources/protocol.d.ts.map +1 -0
- package/build/resources/protocol.js +31 -0
- package/build/resources/protocol.js.map +1 -0
- package/build/resources/types.d.ts +146 -0
- package/build/resources/types.d.ts.map +1 -0
- package/build/resources/types.js +2 -0
- package/build/resources/types.js.map +1 -0
- package/build/resources/types.local.d.ts +6 -0
- package/build/resources/types.local.d.ts.map +1 -0
- package/build/resources/types.local.js +2 -0
- package/build/resources/types.local.js.map +1 -0
- package/build/schemas.d.ts +6 -0
- package/build/schemas.d.ts.map +1 -1
- package/build/schemas.js +59 -3
- package/build/schemas.js.map +1 -1
- package/build/types.d.ts +55 -3
- package/build/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/aliases/types.ts +3 -0
- package/src/aliases.ts +5 -2
- package/src/consts.ts +24 -0
- package/src/entrypoints/types.ts +7 -0
- package/src/entrypoints.ts +8 -0
- package/src/helpers/apply.ts +8 -3
- package/src/helpers/changes/consts.local.ts +1 -1
- package/src/helpers/changes.ts +3 -0
- package/src/helpers/query.ts +1 -1
- package/src/helpers/scoped/types.ts +4 -2
- package/src/helpers/scoped.ts +32 -13
- package/src/helpers/validate/types.ts +1 -0
- package/src/helpers/validate.ts +6 -1
- package/src/helpers/wire.ts +2 -1
- package/src/index.ts +4 -0
- package/src/registry.ts +26 -0
- package/src/resources/mentions.ts +11 -0
- package/src/resources/protocol/types.ts +20 -0
- package/src/resources/protocol.ts +35 -0
- package/src/resources/types.local.ts +5 -0
- package/src/resources/types.ts +148 -0
- package/src/schemas.ts +61 -3
- package/src/types.ts +50 -4
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AssigneeSchemaRegistry, AssigneeTypeSchema, PlanningResourceFacade, PlanningRecordStore, Assignee, Team, Comment, CommentMention } from './resources/types.js'
|
|
2
|
+
import type { PlanningResourceKind, ProjectMode } from './consts.js'
|
|
1
3
|
import type { BasicConfig, BasicContext } from '@owlmeans/context'
|
|
2
4
|
import type { Criteria, ListOptions, ListResult, ResourceRecord } from '@owlmeans/resource'
|
|
3
5
|
import type { AnySchema, ValidateFunction } from 'ajv'
|
|
@@ -26,6 +28,12 @@ export interface Workcard extends ResourceRecord {
|
|
|
26
28
|
description?: string
|
|
27
29
|
/** Primary parent id. Absent on a root project. */
|
|
28
30
|
parent?: string
|
|
31
|
+
/** Derived from the actual primary parent; never an independent reference. */
|
|
32
|
+
parentType?: string
|
|
33
|
+
reporter?: string
|
|
34
|
+
assignee?: string
|
|
35
|
+
/** Project visibility metadata, interpreted only by a host policy hook. */
|
|
36
|
+
mode?: ProjectMode
|
|
29
37
|
/** EVERY parent — many-to-many membership with no junction row. Always contains `parent`. */
|
|
30
38
|
parents: string[]
|
|
31
39
|
/** Status key of the PRIMARY flow. Mirror of `flows[primaryFlow]`. */
|
|
@@ -82,6 +90,8 @@ export interface Relationship extends ResourceRecord {
|
|
|
82
90
|
type: string
|
|
83
91
|
from: string
|
|
84
92
|
to: string
|
|
93
|
+
fromKind?: PlanningResourceKind
|
|
94
|
+
toKind?: PlanningResourceKind
|
|
85
95
|
project?: string
|
|
86
96
|
fields?: Record<string, unknown>
|
|
87
97
|
createdAt: string
|
|
@@ -94,6 +104,8 @@ export interface RelationshipDraft {
|
|
|
94
104
|
/** Defaults to the card the transition is about. */
|
|
95
105
|
from?: string
|
|
96
106
|
to: string
|
|
107
|
+
fromKind?: PlanningResourceKind
|
|
108
|
+
toKind?: PlanningResourceKind
|
|
97
109
|
fields?: Record<string, unknown>
|
|
98
110
|
}
|
|
99
111
|
|
|
@@ -223,6 +235,11 @@ export interface RelationshipType {
|
|
|
223
235
|
from?: string[]
|
|
224
236
|
/** Card types allowed at the `to` end. Any when omitted. */
|
|
225
237
|
to?: string[]
|
|
238
|
+
fromKind?: PlanningResourceKind
|
|
239
|
+
toKind?: PlanningResourceKind
|
|
240
|
+
/** A fields property whose references derive this relationship index. */
|
|
241
|
+
field?: string
|
|
242
|
+
multiple?: boolean
|
|
226
243
|
inverse?: string
|
|
227
244
|
/** At most one relationship of this type leaves a card. */
|
|
228
245
|
single?: boolean
|
|
@@ -241,6 +258,9 @@ export interface WorkcardTypeSchema {
|
|
|
241
258
|
/** Slots the type's cards carry as children. */
|
|
242
259
|
specifications: SpecificationSlot[]
|
|
243
260
|
relationships?: RelationshipType[]
|
|
261
|
+
/** Primary/direct hierarchy declarations. Missing means the legacy project-only rule. */
|
|
262
|
+
parents?: { types?: string[], required?: boolean }
|
|
263
|
+
children?: { types: string[] }
|
|
244
264
|
/** Allowed labels. Any when omitted. */
|
|
245
265
|
labels?: string[]
|
|
246
266
|
code?: CodePolicy
|
|
@@ -269,9 +289,10 @@ export interface PlanningSchemaBundle {
|
|
|
269
289
|
version: number
|
|
270
290
|
types: AnyTypeSchema[]
|
|
271
291
|
flows: StatusFlowSchema[]
|
|
292
|
+
assigneeTypes?: AssigneeTypeSchema[]
|
|
272
293
|
}
|
|
273
294
|
|
|
274
|
-
export interface PlanningSchemaRegistry {
|
|
295
|
+
export interface PlanningSchemaRegistry extends AssigneeSchemaRegistry {
|
|
275
296
|
registerType: (schema: AnyTypeSchema) => void
|
|
276
297
|
registerFlow: (flow: StatusFlowSchema) => void
|
|
277
298
|
types: () => AnyTypeSchema[]
|
|
@@ -315,7 +336,7 @@ export interface ScopedSchemaRecord extends ResourceRecord {
|
|
|
315
336
|
key: string
|
|
316
337
|
version: number
|
|
317
338
|
/** A `WorkcardTypeSchema` of kind `card`, or a `StatusFlowSchema`. */
|
|
318
|
-
definition: WorkcardTypeSchema | StatusFlowSchema
|
|
339
|
+
definition: WorkcardTypeSchema | StatusFlowSchema | AssigneeTypeSchema
|
|
319
340
|
/**
|
|
320
341
|
* Retired: offered for nothing new, still resolved for what already uses it. A retired record
|
|
321
342
|
* gives way to a live declaration of the same key in a lower layer.
|
|
@@ -367,11 +388,13 @@ export interface SchemaKey {
|
|
|
367
388
|
export interface ScopedSchemaOrigins {
|
|
368
389
|
types: Record<string, SchemaOrigin>
|
|
369
390
|
flows: Record<string, SchemaOrigin>
|
|
391
|
+
assigneeTypes?: Record<string, SchemaOrigin>
|
|
370
392
|
}
|
|
371
393
|
|
|
372
394
|
export interface ScopedSchemaRetired {
|
|
373
395
|
types: string[]
|
|
374
396
|
flows: string[]
|
|
397
|
+
assigneeTypes?: string[]
|
|
375
398
|
}
|
|
376
399
|
|
|
377
400
|
/**
|
|
@@ -401,6 +424,7 @@ export interface ScopedSchemaRegistry extends PlanningSchemaRegistry {
|
|
|
401
424
|
export interface SchemaDeclarations {
|
|
402
425
|
types?: WorkcardTypeSchema[]
|
|
403
426
|
flows?: StatusFlowSchema[]
|
|
427
|
+
assigneeTypes?: AssigneeTypeSchema[]
|
|
404
428
|
}
|
|
405
429
|
|
|
406
430
|
export interface SchemaWriteOptions {
|
|
@@ -426,6 +450,7 @@ export interface PlanningDefinitions {
|
|
|
426
450
|
*/
|
|
427
451
|
putType: (type: WorkcardTypeSchema, opts?: SchemaWriteOptions) => Promise<ScopedSchemaRecord>
|
|
428
452
|
/** Compare-and-set, as {@link putType}. */
|
|
453
|
+
putAssigneeType: (schema: AssigneeTypeSchema) => Promise<ScopedSchemaRecord>
|
|
429
454
|
putFlow: (flow: StatusFlowSchema, opts?: SchemaWriteOptions) => Promise<ScopedSchemaRecord>
|
|
430
455
|
/** Every declaration at its layer's next version — flows first, then types. */
|
|
431
456
|
define: (declarations: SchemaDeclarations, opts?: SchemaWriteOptions) => Promise<ScopedSchemaRecord[]>
|
|
@@ -446,6 +471,9 @@ export interface WorkcardDraft {
|
|
|
446
471
|
kind: WorkcardKind
|
|
447
472
|
type: string
|
|
448
473
|
parent?: string
|
|
474
|
+
reporter?: string
|
|
475
|
+
assignee?: string
|
|
476
|
+
mode?: ProjectMode
|
|
449
477
|
parents?: string[]
|
|
450
478
|
title: string
|
|
451
479
|
description?: string
|
|
@@ -619,6 +647,8 @@ export interface RelationshipWhere {
|
|
|
619
647
|
from?: string | string[]
|
|
620
648
|
to?: string | string[]
|
|
621
649
|
type?: string | string[]
|
|
650
|
+
fromKind?: PlanningResourceKind
|
|
651
|
+
toKind?: PlanningResourceKind
|
|
622
652
|
/** The project an edge is filed under. A store that ignores it is narrowed by the facade. */
|
|
623
653
|
project?: string | string[]
|
|
624
654
|
}
|
|
@@ -638,6 +668,8 @@ export interface PlanningStoreCapabilities {
|
|
|
638
668
|
|
|
639
669
|
/** Only `cards` is required — which is what keeps a foreign provider possible. */
|
|
640
670
|
export interface PlanningStore {
|
|
671
|
+
validateProjection?: (before: Workcard | null, after: Workcard | null, transition: Transition) => Promise<void>
|
|
672
|
+
projectReferences?: (after: Workcard, transition: Transition) => Promise<void>
|
|
641
673
|
alias?: string
|
|
642
674
|
capabilities?: PlanningStoreCapabilities
|
|
643
675
|
/** The id a new card gets. */
|
|
@@ -649,6 +681,12 @@ export interface PlanningStore {
|
|
|
649
681
|
commits?: CommitSource
|
|
650
682
|
/** Data-defined types and flows. Without it every type and flow resolves in code. */
|
|
651
683
|
schemas?: SchemaStore
|
|
684
|
+
assignees?: PlanningRecordStore<Assignee>
|
|
685
|
+
teams?: PlanningRecordStore<Team>
|
|
686
|
+
comments?: PlanningRecordStore<Comment>
|
|
687
|
+
mentions?: PlanningRecordStore<CommentMention>
|
|
688
|
+
/** Serialize dependent writes across processes in this organization. */
|
|
689
|
+
unit?: <R>(entityId: string, run: () => Promise<R>) => Promise<R>
|
|
652
690
|
}
|
|
653
691
|
|
|
654
692
|
// ─── Queries ─────────────────────────────────────────────────────────────────────────────────────
|
|
@@ -682,6 +720,8 @@ export interface SpecificationQuery extends ListOptions<Specification> {
|
|
|
682
720
|
}
|
|
683
721
|
|
|
684
722
|
export interface RelationshipQuery extends ListOptions<Relationship> {
|
|
723
|
+
fromKind?: PlanningResourceKind
|
|
724
|
+
toKind?: PlanningResourceKind
|
|
685
725
|
from?: string | string[]
|
|
686
726
|
to?: string | string[]
|
|
687
727
|
type?: string | string[]
|
|
@@ -739,6 +779,8 @@ export interface SpecificationQueryWire extends ListWire {
|
|
|
739
779
|
}
|
|
740
780
|
|
|
741
781
|
export interface RelationshipQueryWire extends ListWire {
|
|
782
|
+
fromKind?: PlanningResourceKind
|
|
783
|
+
toKind?: PlanningResourceKind
|
|
742
784
|
from?: string
|
|
743
785
|
to?: string
|
|
744
786
|
type?: string
|
|
@@ -793,6 +835,7 @@ export interface SchemaDefineRequest {
|
|
|
793
835
|
mode?: SchemaWriteMode
|
|
794
836
|
types?: WorkcardTypeSchema[]
|
|
795
837
|
flows?: StatusFlowSchema[]
|
|
838
|
+
assigneeTypes?: AssigneeTypeSchema[]
|
|
796
839
|
/** Keys retired at the layer after the declarations are written. */
|
|
797
840
|
retire?: SchemaKey[]
|
|
798
841
|
}
|
|
@@ -809,6 +852,9 @@ export interface PlanningScope {
|
|
|
809
852
|
entityId: string
|
|
810
853
|
profileId?: string
|
|
811
854
|
userId?: string
|
|
855
|
+
/** Trusted planning actor, resolved by a host auth plugin. */
|
|
856
|
+
assigneeId?: string
|
|
857
|
+
defaultAssigneeId?: string
|
|
812
858
|
service?: string
|
|
813
859
|
channel?: string
|
|
814
860
|
actor?: TransitionActor
|
|
@@ -820,7 +866,7 @@ export interface PlanningScope {
|
|
|
820
866
|
projects?: string[]
|
|
821
867
|
}
|
|
822
868
|
|
|
823
|
-
export interface PlanningFacade {
|
|
869
|
+
export interface PlanningFacade extends PlanningResourceFacade {
|
|
824
870
|
scope: PlanningScope
|
|
825
871
|
schemas: PlanningSchemaRegistry
|
|
826
872
|
cards: {
|
|
@@ -897,7 +943,7 @@ export interface PlanningPlugin {
|
|
|
897
943
|
name: string
|
|
898
944
|
/** Ascending; `DEFAULT_PLUGIN_ORDER` (50) when omitted. */
|
|
899
945
|
order?: number
|
|
900
|
-
schemas?: { types?: AnyTypeSchema[], flows?: StatusFlowSchema[] }
|
|
946
|
+
schemas?: { types?: AnyTypeSchema[], flows?: StatusFlowSchema[], assigneeTypes?: AssigneeTypeSchema[] }
|
|
901
947
|
owns?: (type: string) => boolean
|
|
902
948
|
store?: PlanningStore | ((ctx: BasicContext<BasicConfig>) => PlanningStore)
|
|
903
949
|
mintCode?: (draft: WorkcardDraft, taken: (code: string) => Promise<boolean>, ctx: PlanningExecContext) => Promise<string | undefined>
|