@heynixie/contract 0.54.0 → 0.55.0

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.
@@ -60,6 +60,11 @@ export declare function buildQueryUtils(client: ContractClient): {
60
60
  }[];
61
61
  } | undefined;
62
62
  recordedAt: Date;
63
+ route?: {
64
+ isMove: boolean;
65
+ messages: number[];
66
+ taskID: string;
67
+ } | undefined;
63
68
  sequence: number;
64
69
  summary?: {
65
70
  contextSize?: number | undefined;
@@ -136,6 +141,11 @@ export declare function buildQueryUtils(client: ContractClient): {
136
141
  }[];
137
142
  } | undefined;
138
143
  recordedAt: Date;
144
+ route?: {
145
+ isMove: boolean;
146
+ messages: number[];
147
+ taskID: string;
148
+ } | undefined;
139
149
  sequence: number;
140
150
  summary?: {
141
151
  contextSize?: number | undefined;
@@ -275,6 +285,78 @@ export declare function buildQueryUtils(client: ContractClient): {
275
285
  sequence: number;
276
286
  thread: string;
277
287
  }>;
288
+ move: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, {
289
+ clientActionID: string;
290
+ sequence: number;
291
+ thread: string;
292
+ to: {
293
+ kind: "new";
294
+ name: string;
295
+ brief: string;
296
+ } | {
297
+ kind: "task";
298
+ taskID: string;
299
+ };
300
+ }, {
301
+ movedAt: Date;
302
+ taskID: string;
303
+ }, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
304
+ UNAUTHORIZED: {
305
+ message: string;
306
+ status: number;
307
+ };
308
+ }>, {
309
+ CLIENT_ACTION_ID_REUSED: {
310
+ message: string;
311
+ status: number;
312
+ };
313
+ }>, {
314
+ RECORD_NOT_FOUND: {
315
+ message: string;
316
+ status: number;
317
+ };
318
+ TASK_NOT_FOUND: {
319
+ message: string;
320
+ status: number;
321
+ };
322
+ TASK_TAKES_NO_MESSAGES: {
323
+ message: string;
324
+ status: number;
325
+ };
326
+ ALREADY_THERE: {
327
+ message: string;
328
+ status: number;
329
+ };
330
+ }>>> & import("@orpc/tanstack-query").GeneralUtils<{
331
+ clientActionID: string;
332
+ sequence: number;
333
+ thread: string;
334
+ to: {
335
+ kind: "new";
336
+ name: string;
337
+ brief: string;
338
+ } | {
339
+ kind: "task";
340
+ taskID: string;
341
+ };
342
+ }>;
343
+ } & import("@orpc/tanstack-query").GeneralUtils<unknown>;
344
+ tasks: {
345
+ list: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, unknown, {
346
+ tasks: {
347
+ brief: string;
348
+ isTakingMessages: boolean;
349
+ lastActivityAt: Date;
350
+ name: string;
351
+ state: "done" | "failed" | "ready" | "running" | "waiting";
352
+ taskID: string;
353
+ }[];
354
+ }, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
355
+ UNAUTHORIZED: {
356
+ message: string;
357
+ status: number;
358
+ };
359
+ }>>> & import("@orpc/tanstack-query").GeneralUtils<unknown>;
278
360
  } & import("@orpc/tanstack-query").GeneralUtils<unknown>;
279
361
  memory: {
280
362
  export: import("@orpc/tanstack-query").ProcedureUtils<Record<never, never>, {
@@ -1645,6 +1727,11 @@ export declare function buildQueryUtils(client: ContractClient): {
1645
1727
  }[];
1646
1728
  } | undefined;
1647
1729
  recordedAt: Date;
1730
+ route?: {
1731
+ isMove: boolean;
1732
+ messages: number[];
1733
+ taskID: string;
1734
+ } | undefined;
1648
1735
  sequence: number;
1649
1736
  summary?: {
1650
1737
  contextSize?: number | undefined;
@@ -1736,6 +1823,11 @@ export declare function buildQueryUtils(client: ContractClient): {
1736
1823
  }[];
1737
1824
  } | undefined;
1738
1825
  recordedAt: Date;
1826
+ route?: {
1827
+ isMove: boolean;
1828
+ messages: number[];
1829
+ taskID: string;
1830
+ } | undefined;
1739
1831
  sequence: number;
1740
1832
  summary?: {
1741
1833
  contextSize?: number | undefined;
@@ -77,6 +77,11 @@ export declare const contract: {
77
77
  }, z.core.$strip>>;
78
78
  }, z.core.$strip>>;
79
79
  recordedAt: z.ZodDate;
80
+ route: z.ZodOptional<z.ZodObject<{
81
+ isMove: z.ZodBoolean;
82
+ messages: z.ZodArray<z.ZodInt>;
83
+ taskID: z.ZodString;
84
+ }, z.core.$strip>>;
80
85
  sequence: z.ZodInt;
81
86
  summary: z.ZodOptional<z.ZodObject<{
82
87
  contextSize: z.ZodOptional<z.ZodInt>;
@@ -173,6 +178,11 @@ export declare const contract: {
173
178
  }, z.core.$strip>>;
174
179
  }, z.core.$strip>>;
175
180
  recordedAt: z.ZodDate;
181
+ route: z.ZodOptional<z.ZodObject<{
182
+ isMove: z.ZodBoolean;
183
+ messages: z.ZodArray<z.ZodInt>;
184
+ taskID: z.ZodString;
185
+ }, z.core.$strip>>;
176
186
  sequence: z.ZodInt;
177
187
  summary: z.ZodOptional<z.ZodObject<{
178
188
  contextSize: z.ZodOptional<z.ZodInt>;
@@ -296,6 +306,72 @@ export declare const contract: {
296
306
  status: number;
297
307
  };
298
308
  }>, Record<never, never>>;
309
+ move: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
310
+ clientActionID: z.ZodUUID;
311
+ sequence: z.ZodInt;
312
+ thread: z.ZodString;
313
+ to: z.ZodDiscriminatedUnion<[z.ZodObject<{
314
+ kind: z.ZodLiteral<"task">;
315
+ taskID: z.ZodString;
316
+ }, z.core.$strip>, z.ZodObject<{
317
+ kind: z.ZodLiteral<"new">;
318
+ name: z.ZodString;
319
+ brief: z.ZodString;
320
+ }, z.core.$strip>], "kind">;
321
+ }, z.core.$strip>, z.ZodObject<{
322
+ movedAt: z.ZodDate;
323
+ taskID: z.ZodString;
324
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
325
+ UNAUTHORIZED: {
326
+ message: string;
327
+ status: number;
328
+ };
329
+ }>, {
330
+ CLIENT_ACTION_ID_REUSED: {
331
+ message: string;
332
+ status: number;
333
+ };
334
+ }>, {
335
+ RECORD_NOT_FOUND: {
336
+ message: string;
337
+ status: number;
338
+ };
339
+ TASK_NOT_FOUND: {
340
+ message: string;
341
+ status: number;
342
+ };
343
+ TASK_TAKES_NO_MESSAGES: {
344
+ message: string;
345
+ status: number;
346
+ };
347
+ ALREADY_THERE: {
348
+ message: string;
349
+ status: number;
350
+ };
351
+ }>, Record<never, never>>;
352
+ };
353
+ tasks: {
354
+ list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
355
+ tasks: z.ZodArray<z.ZodObject<{
356
+ brief: z.ZodString;
357
+ isTakingMessages: z.ZodBoolean;
358
+ lastActivityAt: z.ZodDate;
359
+ name: z.ZodString;
360
+ state: z.ZodEnum<{
361
+ done: "done";
362
+ failed: "failed";
363
+ ready: "ready";
364
+ running: "running";
365
+ waiting: "waiting";
366
+ }>;
367
+ taskID: z.ZodString;
368
+ }, z.core.$strip>>;
369
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
370
+ UNAUTHORIZED: {
371
+ message: string;
372
+ status: number;
373
+ };
374
+ }>, Record<never, never>>;
299
375
  };
300
376
  memory: {
301
377
  export: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
@@ -1912,6 +1988,11 @@ export declare const contract: {
1912
1988
  }[];
1913
1989
  } | undefined;
1914
1990
  recordedAt: Date;
1991
+ route?: {
1992
+ isMove: boolean;
1993
+ messages: number[];
1994
+ taskID: string;
1995
+ } | undefined;
1915
1996
  sequence: number;
1916
1997
  summary?: {
1917
1998
  contextSize?: number | undefined;
@@ -1989,6 +2070,11 @@ export declare const contract: {
1989
2070
  }[];
1990
2071
  } | undefined;
1991
2072
  recordedAt: Date;
2073
+ route?: {
2074
+ isMove: boolean;
2075
+ messages: number[];
2076
+ taskID: string;
2077
+ } | undefined;
1992
2078
  sequence: number;
1993
2079
  summary?: {
1994
2080
  contextSize?: number | undefined;
@@ -2077,6 +2163,11 @@ export declare const contract: {
2077
2163
  }[];
2078
2164
  } | undefined;
2079
2165
  recordedAt: Date;
2166
+ route?: {
2167
+ isMove: boolean;
2168
+ messages: number[];
2169
+ taskID: string;
2170
+ } | undefined;
2080
2171
  sequence: number;
2081
2172
  summary?: {
2082
2173
  contextSize?: number | undefined;
@@ -2154,6 +2245,11 @@ export declare const contract: {
2154
2245
  }[];
2155
2246
  } | undefined;
2156
2247
  recordedAt: Date;
2248
+ route?: {
2249
+ isMove: boolean;
2250
+ messages: number[];
2251
+ taskID: string;
2252
+ } | undefined;
2157
2253
  sequence: number;
2158
2254
  summary?: {
2159
2255
  contextSize?: number | undefined;
package/dist/index.js CHANGED
@@ -670,6 +670,11 @@ var versionTextSchema = versionRefSchema.extend({
670
670
  status: z9.enum(["readable", "shredded", "unreadable", "missing"]),
671
671
  text: z9.string().optional()
672
672
  });
673
+ var routeSchema = z9.object({
674
+ isMove: z9.boolean(),
675
+ messages: z9.array(sequenceSchema),
676
+ taskID: threadSchema
677
+ });
673
678
  var recordSchema = z9.object({
674
679
  compaction: compactionSchema.optional(),
675
680
  compactionFailure: compactionFailureSchema.optional(),
@@ -686,6 +691,7 @@ var recordSchema = z9.object({
686
691
  rating: ratingSchema.optional(),
687
692
  recall: recallSchema.optional(),
688
693
  recordedAt: z9.date(),
694
+ route: routeSchema.optional(),
689
695
  sequence: sequenceSchema,
690
696
  summary: summarySchema.optional(),
691
697
  thread: threadSchema,
@@ -701,6 +707,25 @@ var sessionSchema = z9.object({
701
707
  sessionID: z9.uuid()
702
708
  });
703
709
  var checkedAction = signedIn.errors(reusedIDErrors);
710
+ var taskNameSchema = z9.string().trim().min(1).max(80);
711
+ var taskBriefSchema = z9.string().trim().min(1).max(8000);
712
+ var newTaskTargetSchema = z9.object({
713
+ kind: z9.literal("new"),
714
+ name: taskNameSchema,
715
+ brief: taskBriefSchema
716
+ });
717
+ var moveTargetSchema = z9.discriminatedUnion("kind", [
718
+ z9.object({ kind: z9.literal("task"), taskID: threadSchema }),
719
+ newTaskTargetSchema
720
+ ]);
721
+ var listedTaskSchema = z9.object({
722
+ brief: z9.string(),
723
+ isTakingMessages: z9.boolean(),
724
+ lastActivityAt: z9.date(),
725
+ name: z9.string(),
726
+ state: z9.enum(["ready", "running", "waiting", "done", "failed"]),
727
+ taskID: threadSchema
728
+ });
704
729
  var followRecords = signedIn.input(z9.object({ afterSequence: sequenceSchema, thread: threadSchema.optional() })).output(eventIterator2(z9.object({ record: recordSchema })));
705
730
  var contract = {
706
731
  conversation: {
@@ -736,7 +761,27 @@ var contract = {
736
761
  clientActionID: clientActionIDSchema,
737
762
  sequence: sequenceSchema,
738
763
  thread: threadSchema
739
- })).output(z9.object({ forgottenAt: z9.date() }))
764
+ })).output(z9.object({ forgottenAt: z9.date() })),
765
+ move: checkedAction.errors({
766
+ RECORD_NOT_FOUND: {
767
+ message: "No message of yours on this thread has this sequence",
768
+ status: 404
769
+ },
770
+ TASK_NOT_FOUND: { message: "No open task has this ID", status: 404 },
771
+ TASK_TAKES_NO_MESSAGES: {
772
+ message: "This task runs on its own schedule and takes no message of yours",
773
+ status: 409
774
+ },
775
+ ALREADY_THERE: { message: "The message already went to this task", status: 409 }
776
+ }).input(z9.object({
777
+ clientActionID: clientActionIDSchema,
778
+ sequence: sequenceSchema,
779
+ thread: threadSchema,
780
+ to: moveTargetSchema
781
+ })).output(z9.object({ movedAt: z9.date(), taskID: threadSchema }))
782
+ },
783
+ tasks: {
784
+ list: signedIn.output(z9.object({ tasks: z9.array(listedTaskSchema) }))
740
785
  },
741
786
  memory: {
742
787
  readVersions: signedIn.input(z9.object({ versions: z9.array(versionRefSchema).min(1).max(100) })).output(z9.object({ versions: z9.array(versionTextSchema) })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heynixie/contract",
3
- "version": "0.54.0",
3
+ "version": "0.55.0",
4
4
  "description": "The oRPC contract of the nixie API, with the types a client needs",
5
5
  "license": "MIT",
6
6
  "repository": {