@sealant/api-contracts-next 0.40.0-next.768 → 0.40.0-next.770

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.
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import { Schema } from "effect";
11
11
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
12
+ import { PersonId } from "./person-id.js";
12
13
  const NonEmptyString = Schema.String.check(Schema.isNonEmpty(), Schema.isTrimmed());
13
14
  export const accessTokenScopeSchema = Schema.Literals([
14
15
  "session:read",
@@ -16,7 +17,7 @@ export const accessTokenScopeSchema = Schema.Literals([
16
17
  "workspace:exec",
17
18
  ]);
18
19
  export const createAccessTokenRequestSchema = Schema.Struct({
19
- ownerUserId: NonEmptyString,
20
+ ownerUserId: PersonId,
20
21
  scopes: Schema.Array(accessTokenScopeSchema).check(Schema.isNonEmpty()),
21
22
  name: Schema.optional(NonEmptyString),
22
23
  /** When set, the token is valid only for this workspace. */
@@ -26,7 +27,7 @@ export const createAccessTokenRequestSchema = Schema.Struct({
26
27
  });
27
28
  export const accessTokenSchema = Schema.Struct({
28
29
  tokenId: NonEmptyString,
29
- ownerUserId: NonEmptyString,
30
+ ownerUserId: PersonId,
30
31
  name: Schema.optional(NonEmptyString),
31
32
  scopes: Schema.Array(accessTokenScopeSchema),
32
33
  workspaceId: Schema.optional(NonEmptyString),
@@ -40,7 +41,7 @@ export const createAccessTokenResponseSchema = Schema.Struct({
40
41
  token: NonEmptyString,
41
42
  });
42
43
  export const listAccessTokensQuerySchema = Schema.Struct({
43
- ownerUserId: NonEmptyString,
44
+ ownerUserId: PersonId,
44
45
  });
45
46
  export const listAccessTokensResponseSchema = Schema.Struct({
46
47
  items: Schema.Array(accessTokenSchema),
@@ -65,7 +66,7 @@ export const AccessTokensGroup = HttpApiGroup.make("accessTokens")
65
66
  }))
66
67
  .add(HttpApiEndpoint.post("revokeAccessToken", "/:tokenId/revoke", {
67
68
  params: tokenIdParams,
68
- payload: Schema.Struct({ ownerUserId: NonEmptyString }),
69
+ payload: Schema.Struct({ ownerUserId: PersonId }),
69
70
  success: accessTokenSchema,
70
71
  error: [AccessTokenBadRequestError, AccessTokenNotFoundError, AccessTokenInternalServerError],
71
72
  }))
@@ -1,5 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
3
+ import { PersonId } from "./person-id.js";
3
4
  const NonEmptyString = Schema.String.check(Schema.isNonEmpty(), Schema.isTrimmed());
4
5
  /*
5
6
  Connected provider accounts (Claude / Codex / GitHub credentials). Same trust model as ssh-keys:
@@ -45,7 +46,7 @@ export const connectedAccountLoginSchema = Schema.Union([
45
46
  ]);
46
47
  export const connectedAccountSummarySchema = Schema.Struct({
47
48
  connectedAccountId: NonEmptyString,
48
- ownerUserId: NonEmptyString,
49
+ ownerUserId: PersonId,
49
50
  provider: connectedAccountProviderSchema,
50
51
  name: NonEmptyString,
51
52
  // "oauth-token" | "credentials-json" (claude) | "auth-json" (codex) | "gh-cli-token" (github) |
@@ -71,7 +72,7 @@ export const connectedAccountSummarySchema = Schema.Struct({
71
72
  login: Schema.optional(connectedAccountLoginSchema),
72
73
  });
73
74
  export const createConnectedAccountRequestSchema = Schema.Struct({
74
- ownerUserId: NonEmptyString,
75
+ ownerUserId: PersonId,
75
76
  provider: connectedAccountProviderSchema,
76
77
  /**
77
78
  * The account to connect or replace by name; a new name is a new account, and `default` names
@@ -99,7 +100,7 @@ export const createConnectedAccountRequestSchema = Schema.Struct({
99
100
  secret: Schema.String.check(Schema.isNonEmpty()),
100
101
  });
101
102
  export const listConnectedAccountsQuerySchema = Schema.Struct({
102
- ownerUserId: NonEmptyString,
103
+ ownerUserId: PersonId,
103
104
  });
104
105
  export const listConnectedAccountsResponseSchema = Schema.Struct({
105
106
  items: Schema.Array(connectedAccountSummarySchema),
@@ -110,7 +111,7 @@ export const listConnectedAccountsResponseSchema = Schema.Struct({
110
111
  hasApiKeyHistory: Schema.optional(Schema.Boolean),
111
112
  });
112
113
  export const markConnectedAccountInvalidRequestSchema = Schema.Struct({
113
- ownerUserId: NonEmptyString,
114
+ ownerUserId: PersonId,
114
115
  /**
115
116
  * The `credentialRevision` the refusal was observed on. When the stored credential has moved on
116
117
  * since, nothing is marked and the answer's `outcome` is `superseded`.
@@ -123,7 +124,7 @@ export const markConnectedAccountInvalidResponseSchema = Schema.Struct({
123
124
  outcome: Schema.optional(Schema.Literals(["marked", "superseded"])),
124
125
  });
125
126
  export const setConnectedAccountDefaultRequestSchema = Schema.Struct({
126
- ownerUserId: NonEmptyString,
127
+ ownerUserId: PersonId,
127
128
  connectedAccountId: NonEmptyString,
128
129
  });
129
130
  export class ConnectedAccountBadRequestError extends Schema.TaggedError()("ConnectedAccountBadRequestError", {