@anchrd/intel-contract 0.4.0 → 0.4.2

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.
@@ -73,6 +73,7 @@ export type KnowledgeVersion = z.infer<typeof KnowledgeVersion>;
73
73
  export declare const ListKnowledgeNodesInput: z.ZodObject<{
74
74
  parentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
75
75
  includeArchived: z.ZodDefault<z.ZodBoolean>;
76
+ archivedOnly: z.ZodOptional<z.ZodBoolean>;
76
77
  }, z.core.$strict>;
77
78
  export type ListKnowledgeNodesInput = z.infer<typeof ListKnowledgeNodesInput>;
78
79
  export declare const GetKnowledgeNodeInput: z.ZodObject<{
@@ -1320,8 +1321,17 @@ export declare const UpdateFlowInput: z.ZodObject<{
1320
1321
  idempotencyKey: z.ZodString;
1321
1322
  }, z.core.$strict>;
1322
1323
  export type UpdateFlowInput = z.infer<typeof UpdateFlowInput>;
1324
+ export declare const ArchiveFlowInput: z.ZodObject<{
1325
+ flowId: z.ZodString;
1326
+ baseUpdatedAt: z.ZodISODateTime;
1327
+ archived: z.ZodBoolean;
1328
+ idempotencyKey: z.ZodString;
1329
+ }, z.core.$strict>;
1330
+ export type ArchiveFlowInput = z.infer<typeof ArchiveFlowInput>;
1323
1331
  export declare const ListFlowsInput: z.ZodObject<{
1324
1332
  parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1333
+ includeArchived: z.ZodOptional<z.ZodBoolean>;
1334
+ archivedOnly: z.ZodOptional<z.ZodBoolean>;
1325
1335
  }, z.core.$strict>;
1326
1336
  export type ListFlowsInput = z.infer<typeof ListFlowsInput>;
1327
1337
  export declare const GetFlowInput: z.ZodObject<{
@@ -60,6 +60,14 @@ export const KnowledgeVersion = z.strictObject({
60
60
  export const ListKnowledgeNodesInput = z.strictObject({
61
61
  parentId: IntelId.nullable().default(null),
62
62
  includeArchived: z.boolean().default(false),
63
+ // ⚠️ Overrides `parentId` rather than narrowing beside it: what is archived is asked for across
64
+ // the whole tree, because that is the only useful question. Somebody looking for what they threw
65
+ // away does not know which folder it was in — if they did, they would not be looking (#113).
66
+ // A separate flag rather than a third state on `includeArchived`, so no existing caller changes
67
+ // meaning — and `.optional()` rather than `.default(false)` for the same reason `ListFlowsInput`
68
+ // carries it that way: a default makes the field required in the PARSED type, and every existing
69
+ // caller would have to answer a question it is not asking.
70
+ archivedOnly: z.boolean().optional(),
63
71
  });
64
72
  export const GetKnowledgeNodeInput = z.strictObject({ nodeId: IntelId });
65
73
  export const ListKnowledgeGrantsInput = z.strictObject({ resourceId: IntelId });
@@ -604,11 +612,31 @@ export const UpdateFlowInput = z
604
612
  idempotencyKey: z.string().min(8).max(200),
605
613
  })
606
614
  .refine((input) => input.title !== undefined || input.description !== undefined || input.parentId !== undefined, { error: "At least one change is required" });
615
+ // Archiving a flow is the same shape as archiving a document, deliberately: `archived` is a boolean
616
+ // rather than a one-way verb, because an archive nothing returns from is a delete under a friendlier
617
+ // name. Restoring is the same call with `false`.
618
+ export const ArchiveFlowInput = z.strictObject({
619
+ flowId: IntelId,
620
+ baseUpdatedAt: IsoDateTime,
621
+ archived: z.boolean(),
622
+ idempotencyKey: z.string().min(8).max(200),
623
+ });
607
624
  // Three answers, not two: an absent `parentId` lists every visible flow (the search dialog asks
608
625
  // that), `null` lists the root of the shared tree and an ID lists one folder (the sidebar tree asks
609
626
  // per level, which is what keeps the tree off the N+1 it used to load with).
610
627
  export const ListFlowsInput = z.strictObject({
611
628
  parentId: IntelId.nullable().optional(),
629
+ // The only way back to an archived flow, and the only place that asks for one: the bounded read
630
+ // behind the relation graph has no such flag on purpose (#30). A drawing that includes what was
631
+ // archived says the tidying up never happened.
632
+ //
633
+ // ⚠️ `.optional()` rather than `.default(false)`, unlike `ListKnowledgeNodesInput`. This schema is
634
+ // the argument type of `listFlows` on three layers, and a default makes the field required in the
635
+ // *parsed* type — every existing caller that lists a folder would have to spell out the answer to
636
+ // a question it is not asking. Absent means "without the archive" everywhere it is read.
637
+ includeArchived: z.boolean().optional(),
638
+ // The same question for flows, and the same override of `parentId` — see `ListKnowledgeNodesInput`.
639
+ archivedOnly: z.boolean().optional(),
612
640
  });
613
641
  export const GetFlowInput = z.strictObject({ flowId: IntelId });
614
642
  export const SaveFlowVersionInput = z.strictObject({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anchrd/intel-contract",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {