@anchrd/colab-sdk 0.1.43 → 0.1.45

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.
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { idSchema } from "../ids/ids.js";
3
3
  import { Limit as PageSize } from "../list-input.js";
4
4
  import { NodeId } from "../nodes/nodes.js";
5
+ import { TeamId } from "../teams/teams.js";
5
6
  // Sharing a node (#37, Funktionen › Freigeben und Versionen, D138): the inputs of
6
7
  // `intelligence_node_grant_list`, `intelligence_node_share` and `intelligence_node_grant_revoke`,
7
8
  // and their answers. Like Google Drive: three rights, a grant on a folder reaches everything in it,
@@ -18,15 +19,20 @@ export const NodeGrantListInput = z.strictObject({
18
19
  .describe("The nextCursor of the previous page, unchanged. Leaving it out starts at the top."),
19
20
  limit: PageSize.optional().describe("How many people one page holds, 1 to 100. Leaving it out gives 100."),
20
21
  });
21
- // One person who reaches the node, with the strongest right they hold and where it comes from.
22
+ // One person, or one team (#1121, E243), who reaches the node, with the strongest right they hold
23
+ // and where it comes from. A team stands as itself, never as its members.
22
24
  export const NodeGrant = z.object({
23
25
  // The grant to revoke: on this node, or on the folder `inheritedFrom`. Null for the creator of the
24
26
  // node or of a folder above it, whose right is no grant.
25
27
  grantId: GrantId.nullable(),
26
- userId: z.string(),
27
- // As `access` names them today; null for an account that is gone.
28
+ // The holder, exactly one of the two (#1121): a person or machine, or a team.
29
+ userId: idSchema("user").nullable(),
30
+ teamId: TeamId.nullable(),
31
+ // As `access` names them today; null for an account or a team that is gone.
28
32
  name: z.string().nullable(),
29
- kind: z.enum(["human", "machine"]).nullable(),
33
+ kind: z.enum(["human", "machine", "team"]).nullable(),
34
+ // A team's members today; null for a person or machine.
35
+ members: z.number().int().nullable(),
30
36
  // The person's address, shown under the name (#150); null for a machine and for an account that
31
37
  // is gone.
32
38
  email: z.string().nullable(),
@@ -40,15 +46,24 @@ export const NodeGrantList = z.object({
40
46
  items: z.array(NodeGrant),
41
47
  nextCursor: z.string().nullable(),
42
48
  });
43
- export const NodeShareInput = z.strictObject({
49
+ export const NodeShareInput = z
50
+ .strictObject({
44
51
  nodeId: NodeId,
45
- userId: idSchema("user").describe("The person or machine to share with, `user_…`, as intelligence_user_list finds them. A locked account cannot be given a right."),
46
- right: GrantRight.describe("read sees the node, write also changes it, share also shares it further. Sharing again with someone who holds a grant sets their right to this one. A node in its creator's own area moves to the top level of Shared."),
52
+ userId: idSchema("user")
53
+ .optional()
54
+ .describe("The person or machine to share with, `user_…`, as intelligence_user_list finds them. A locked account cannot be given a right. Give userId or teamId."),
55
+ teamId: TeamId.optional().describe("The team to share with, `team_…`, as access_team_list finds it: every member reaches the node, and loses it on leaving the team (#1121). Only read or write. The node stays where it is. Give userId or teamId."),
56
+ right: GrantRight.describe("read sees the node, write also changes it, share also shares it further (not for a team). Sharing again with someone who holds a grant sets their right to this one. A node in its creator's own area moves to the top level of Shared, unless it goes to a machine or a team."),
57
+ })
58
+ .refine((input) => (input.userId === undefined) !== (input.teamId === undefined), {
59
+ message: "Give exactly one of userId and teamId.",
47
60
  });
48
61
  export const NodeShared = z.object({
49
62
  nodeId: NodeId,
50
63
  grantId: GrantId,
51
- userId: z.string(),
64
+ // The holder, exactly one of the two (#1121): a person or machine, or a team.
65
+ userId: idSchema("user").nullable(),
66
+ teamId: TeamId.nullable(),
52
67
  right: GrantRight,
53
68
  // Where the node stands now: null is the top level of Shared.
54
69
  parentId: NodeId.nullable(),
@@ -3,12 +3,12 @@ export declare const homeSetupSteps: readonly ["profile", "ai", "operator", "goa
3
3
  export declare const HomeSetupStep: z.ZodEnum<{
4
4
  operator: "operator";
5
5
  goal: "goal";
6
+ team: "team";
6
7
  connector: "connector";
7
8
  credential: "credential";
8
9
  signin: "signin";
9
10
  profile: "profile";
10
11
  ai: "ai";
11
- team: "team";
12
12
  }>;
13
13
  export type HomeSetupStep = z.infer<typeof HomeSetupStep>;
14
14
  export declare const homePersonSteps: ReadonlySet<HomeSetupStep>;
@@ -32,12 +32,12 @@ export declare const HomeSetupState: z.ZodObject<{
32
32
  step: z.ZodEnum<{
33
33
  operator: "operator";
34
34
  goal: "goal";
35
+ team: "team";
35
36
  connector: "connector";
36
37
  credential: "credential";
37
38
  signin: "signin";
38
39
  profile: "profile";
39
40
  ai: "ai";
40
- team: "team";
41
41
  }>;
42
42
  scope: z.ZodEnum<{
43
43
  organisation: "organisation";
@@ -52,12 +52,12 @@ export declare const Home: z.ZodObject<{
52
52
  step: z.ZodEnum<{
53
53
  operator: "operator";
54
54
  goal: "goal";
55
+ team: "team";
55
56
  connector: "connector";
56
57
  credential: "credential";
57
58
  signin: "signin";
58
59
  profile: "profile";
59
60
  ai: "ai";
60
- team: "team";
61
61
  }>;
62
62
  scope: z.ZodEnum<{
63
63
  organisation: "organisation";
@@ -13,6 +13,7 @@ export type Delivery = z.infer<typeof Delivery>;
13
13
  export declare const InvitationCreateInput: z.ZodObject<{
14
14
  email: z.ZodEmail;
15
15
  roleIds: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`role_${string}`>>>;
16
+ teamIds: z.ZodOptional<z.ZodArray<z.ZodTemplateLiteral<`team_${string}`>>>;
16
17
  }, z.core.$strict>;
17
18
  export type InvitationCreateInput = z.infer<typeof InvitationCreateInput>;
18
19
  export declare const InvitationResendInput: z.ZodObject<{
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { idSchema } from "../ids/ids.js";
3
3
  import { Name } from "../profile/profile.js";
4
4
  import { RoleId } from "../roles/roles.js";
5
+ import { TeamId } from "../teams/teams.js";
5
6
  // Invitations (Einstellungen › Nutzer, #25): the inputs of the `access_invitation_*` tools, the
6
7
  // doors under `/auth/invitation` the invited person uses, and the answers. An invitation lives seven
7
8
  // days, carries one valid token at a time, and its roles become the person's on acceptance.
@@ -15,6 +16,13 @@ const RoleIds = z.array(RoleId).max(50);
15
16
  export const InvitationCreateInput = z.strictObject({
16
17
  email: z.email(),
17
18
  roleIds: RoleIds.optional(),
19
+ // The teams the account joins on acceptance (#1121, E243), besides "Gesamte Firma", which every
20
+ // new person joins; without the field none besides it.
21
+ teamIds: z
22
+ .array(TeamId)
23
+ .max(50)
24
+ .optional()
25
+ .describe('The teams the new account joins on acceptance. Every new person joins "Gesamte Firma" anyway. Without the field no other.'),
18
26
  });
19
27
  export const InvitationResendInput = z.strictObject({ invitationId: InvitationId });
20
28
  export const InvitationRevokeInput = z.strictObject({ invitationId: InvitationId });
@@ -0,0 +1,67 @@
1
+ import { z } from "zod";
2
+ export declare const JobId: z.ZodTemplateLiteral<`job_${string}`>;
3
+ export type JobId = z.infer<typeof JobId>;
4
+ export declare const JobKind: z.ZodEnum<{
5
+ restore: "restore";
6
+ purge: "purge";
7
+ }>;
8
+ export type JobKind = z.infer<typeof JobKind>;
9
+ export declare const maxJobEntries = 2000;
10
+ export declare const maxJobRefusedNamed = 100;
11
+ export declare const JobCreateInput: z.ZodObject<{
12
+ kind: z.ZodEnum<{
13
+ restore: "restore";
14
+ purge: "purge";
15
+ }>;
16
+ nodeIds: z.ZodArray<z.ZodTemplateLiteral<`node_${string}`>>;
17
+ idempotencyKey: z.ZodString;
18
+ }, z.core.$strict>;
19
+ export type JobCreateInput = z.infer<typeof JobCreateInput>;
20
+ export declare const JobGetInput: z.ZodObject<{
21
+ jobId: z.ZodTemplateLiteral<`job_${string}`>;
22
+ }, z.core.$strict>;
23
+ export type JobGetInput = z.infer<typeof JobGetInput>;
24
+ export declare const JobListInput: z.ZodObject<{}, z.core.$strict>;
25
+ export type JobListInput = z.infer<typeof JobListInput>;
26
+ export declare const JobRefused: z.ZodObject<{
27
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
28
+ name: z.ZodNullable<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ export type JobRefused = z.infer<typeof JobRefused>;
31
+ export declare const Job: z.ZodObject<{
32
+ jobId: z.ZodTemplateLiteral<`job_${string}`>;
33
+ kind: z.ZodEnum<{
34
+ restore: "restore";
35
+ purge: "purge";
36
+ }>;
37
+ total: z.ZodNumber;
38
+ done: z.ZodNumber;
39
+ refused: z.ZodNumber;
40
+ refusedEntries: z.ZodArray<z.ZodObject<{
41
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
42
+ name: z.ZodNullable<z.ZodString>;
43
+ }, z.core.$strip>>;
44
+ createdAt: z.ZodString;
45
+ completedAt: z.ZodNullable<z.ZodString>;
46
+ }, z.core.$strip>;
47
+ export type Job = z.infer<typeof Job>;
48
+ export declare const JobList: z.ZodObject<{
49
+ items: z.ZodArray<z.ZodObject<{
50
+ jobId: z.ZodTemplateLiteral<`job_${string}`>;
51
+ kind: z.ZodEnum<{
52
+ restore: "restore";
53
+ purge: "purge";
54
+ }>;
55
+ total: z.ZodNumber;
56
+ done: z.ZodNumber;
57
+ refused: z.ZodNumber;
58
+ refusedEntries: z.ZodArray<z.ZodObject<{
59
+ nodeId: z.ZodTemplateLiteral<`node_${string}`>;
60
+ name: z.ZodNullable<z.ZodString>;
61
+ }, z.core.$strip>>;
62
+ createdAt: z.ZodString;
63
+ completedAt: z.ZodNullable<z.ZodString>;
64
+ }, z.core.$strip>>;
65
+ nextCursor: z.ZodNull;
66
+ }, z.core.$strip>;
67
+ export type JobList = z.infer<typeof JobList>;
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+ import { idSchema } from "../ids/ids.js";
3
+ import { NodeId } from "../nodes/nodes.js";
4
+ import { IdempotencyKey } from "../primitives/primitives.js";
5
+ // Jobs (#1129, E236, Seiten › Archiv): deleting for good or restoring many archive entries runs on
6
+ // the server. One request names the entries and answers the job at once; the queue works them off
7
+ // one after the other, each through the door of a single entry, under the rights of the person who
8
+ // started it. Only a person in the browser starts or reads a job (D124): there is no tool over `/mcp`.
9
+ export const JobId = idSchema("job").describe("The job's id, `job_…`.");
10
+ export const JobKind = z.enum(["purge", "restore"]);
11
+ // The most entries one job takes: the archive draws at most 2000 entries per section.
12
+ export const maxJobEntries = 2000;
13
+ // The most refused entries an answer names; the rest is counted.
14
+ export const maxJobRefusedNamed = 100;
15
+ export const JobCreateInput = z.strictObject({
16
+ kind: JobKind.describe("purge deletes the entries for good, restore brings them back."),
17
+ nodeIds: z
18
+ .array(NodeId)
19
+ .min(1)
20
+ .max(maxJobEntries)
21
+ .describe("The archived entries, the topmost of a selection: an entry inside another one goes with it."),
22
+ idempotencyKey: IdempotencyKey,
23
+ });
24
+ export const JobGetInput = z.strictObject({ jobId: JobId });
25
+ // The jobs of the caller that have not ended: few at any time, so one page.
26
+ export const JobListInput = z.strictObject({});
27
+ export const JobRefused = z.object({
28
+ nodeId: NodeId,
29
+ // The name it had when the job reached it; null for an entry the person could not read.
30
+ name: z.string().nullable(),
31
+ });
32
+ export const Job = z.object({
33
+ jobId: JobId,
34
+ kind: JobKind,
35
+ // Every entry the job took, the ones done, and the ones the server refused.
36
+ total: z.number().int(),
37
+ done: z.number().int(),
38
+ refused: z.number().int(),
39
+ // The first `maxJobRefusedNamed` refused entries, in the order given.
40
+ refusedEntries: z.array(JobRefused),
41
+ createdAt: z.string(),
42
+ // Null while entries are still open.
43
+ completedAt: z.string().nullable(),
44
+ });
45
+ export const JobList = z.object({ items: z.array(Job), nextCursor: z.null() });
@@ -159,6 +159,7 @@ export declare const NodeListItem: z.ZodObject<{
159
159
  }, z.core.$strip>>;
160
160
  count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
161
161
  secret: z.ZodOptional<z.ZodLiteral<true>>;
162
+ preview: z.ZodOptional<z.ZodTemplateLiteral<`version_${string}`>>;
162
163
  rootArchived: z.ZodOptional<z.ZodLiteral<true>>;
163
164
  }, z.core.$strip>;
164
165
  export type NodeListItem = z.infer<typeof NodeListItem>;
@@ -219,6 +220,7 @@ export declare const NodeList: z.ZodObject<{
219
220
  }, z.core.$strip>>;
220
221
  count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
221
222
  secret: z.ZodOptional<z.ZodLiteral<true>>;
223
+ preview: z.ZodOptional<z.ZodTemplateLiteral<`version_${string}`>>;
222
224
  rootArchived: z.ZodOptional<z.ZodLiteral<true>>;
223
225
  }, z.core.$strip>>;
224
226
  nextCursor: z.ZodNullable<z.ZodString>;
@@ -144,6 +144,10 @@ export const NodeListItem = z.object({
144
144
  count: z.number().int().nullable().optional(),
145
145
  // Only on a secret document or table (#357): the tree draws the lock.
146
146
  secret: secretFlag,
147
+ // Only over `/api`, on a file whose current version is an image the installation can show smaller
148
+ // (#1135): that version, so the folder's preview address changes with a new version. `/mcp` leaves
149
+ // it out; an AI reads the file itself.
150
+ preview: idSchema("version").optional(),
147
151
  // Only in section users (E97, #447): the root of an archived account, listed only while it still
148
152
  // holds something, after all others.
149
153
  rootArchived: z