@opencode/protocol 0.0.0-dev-20303 → 0.0.0-dev-20307

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.
@@ -1,6 +1,73 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
3
- export declare const CredentialGroup: HttpApiGroup.HttpApiGroup<"server.credential", HttpApiEndpoint.HttpApiEndpoint<"credential.update", "PATCH", "/api/credential/:credentialID", Schema.toCodecStringTree<Schema.Struct<{
3
+ import { ConflictError } from "../errors.js";
4
+ export declare const CredentialGroup: HttpApiGroup.HttpApiGroup<"server.credential", HttpApiEndpoint.HttpApiEndpoint<"credential.list", "GET", "/api/credential", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
5
+ readonly data: Schema.$Array<Schema.Struct<{
6
+ readonly id: Schema.brand<Schema.String, "Credential.ID"> & {
7
+ create: () => string & import("effect/Brand").Brand<"Credential.ID">;
8
+ };
9
+ readonly integrationID: Schema.brand<Schema.String, "Integration.ID">;
10
+ readonly label: Schema.String;
11
+ readonly active: Schema.Boolean;
12
+ readonly value: Schema.Union<readonly [Schema.Struct<{
13
+ readonly type: Schema.Literal<"oauth">;
14
+ readonly methodID: Schema.brand<Schema.String, "Integration.MethodID">;
15
+ readonly refresh: Schema.String;
16
+ readonly access: Schema.String;
17
+ readonly expires: Schema.Int;
18
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
19
+ }>, Schema.Struct<{
20
+ readonly type: Schema.Literal<"key">;
21
+ readonly key: Schema.String;
22
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
23
+ readonly configuration: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
24
+ }>]>;
25
+ }>>;
26
+ }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"credential.create", "POST", "/api/credential", never, never, Schema.toCodecJson<Schema.Struct<{
27
+ readonly id: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Credential.ID"> & {
28
+ create: () => string & import("effect/Brand").Brand<"Credential.ID">;
29
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Credential.ID"> & {
30
+ create: () => string & import("effect/Brand").Brand<"Credential.ID">;
31
+ }>, never, never>;
32
+ readonly integrationID: Schema.brand<Schema.String, "Integration.ID">;
33
+ readonly label: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
34
+ readonly value: Schema.Union<readonly [Schema.Struct<{
35
+ readonly type: Schema.Literal<"oauth">;
36
+ readonly methodID: Schema.brand<Schema.String, "Integration.MethodID">;
37
+ readonly refresh: Schema.String;
38
+ readonly access: Schema.String;
39
+ readonly expires: Schema.Int;
40
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
41
+ }>, Schema.Struct<{
42
+ readonly type: Schema.Literal<"key">;
43
+ readonly key: Schema.String;
44
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
45
+ readonly configuration: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
46
+ }>]>;
47
+ readonly activate: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
48
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
49
+ readonly data: Schema.Struct<{
50
+ readonly id: Schema.brand<Schema.String, "Credential.ID"> & {
51
+ create: () => string & import("effect/Brand").Brand<"Credential.ID">;
52
+ };
53
+ readonly integrationID: Schema.brand<Schema.String, "Integration.ID">;
54
+ readonly label: Schema.String;
55
+ readonly active: Schema.Boolean;
56
+ readonly value: Schema.Union<readonly [Schema.Struct<{
57
+ readonly type: Schema.Literal<"oauth">;
58
+ readonly methodID: Schema.brand<Schema.String, "Integration.MethodID">;
59
+ readonly refresh: Schema.String;
60
+ readonly access: Schema.String;
61
+ readonly expires: Schema.Int;
62
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
63
+ }>, Schema.Struct<{
64
+ readonly type: Schema.Literal<"key">;
65
+ readonly key: Schema.String;
66
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
67
+ readonly configuration: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Number, Schema.Boolean, Schema.$Array<Schema.String>]>>>, never, never>;
68
+ }>]>;
69
+ }>;
70
+ }>>, Schema.toCodecJson<typeof ConflictError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"credential.update", "PATCH", "/api/credential/:credentialID", Schema.toCodecStringTree<Schema.Struct<{
4
71
  credentialID: Schema.brand<Schema.String, "Credential.ID"> & {
5
72
  create: () => string & import("effect/Brand").Brand<"Credential.ID">;
6
73
  };
@@ -1,7 +1,24 @@
1
1
  import { Credential } from "@opencode/schema/credential";
2
2
  import { Schema } from "effect";
3
3
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
4
+ import { ConflictError } from "../errors.js";
4
5
  export const CredentialGroup = HttpApiGroup.make("server.credential")
6
+ .add(HttpApiEndpoint.get("credential.list", "/api/credential", {
7
+ success: Schema.Struct({ data: Schema.Array(Credential.Entry) }),
8
+ }).annotateMerge(OpenApi.annotations({
9
+ identifier: "credential.list",
10
+ summary: "List credentials",
11
+ description: "List every stored integration credential, including its secret value.",
12
+ })))
13
+ .add(HttpApiEndpoint.post("credential.create", "/api/credential", {
14
+ payload: Credential.CreateInput,
15
+ success: Schema.Struct({ data: Credential.Entry }),
16
+ error: ConflictError,
17
+ }).annotateMerge(OpenApi.annotations({
18
+ identifier: "credential.create",
19
+ summary: "Create credential",
20
+ description: "Store an integration credential. It becomes the integration's active credential unless activate is false and the integration already has one. Fails with a conflict when the requested ID already exists.",
21
+ })))
5
22
  .add(HttpApiEndpoint.patch("credential.update", "/api/credential/:credentialID", {
6
23
  params: { credentialID: Credential.ID },
7
24
  payload: Schema.Struct({ label: Schema.String }),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/protocol",
4
- "version": "0.0.0-dev-20303",
4
+ "version": "0.0.0-dev-20307",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "typecheck": "tsgo --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@opencode/schema": "0.0.0-dev-20303",
35
+ "@opencode/schema": "0.0.0-dev-20307",
36
36
  "effect": "4.0.0-rc.112"
37
37
  },
38
38
  "devDependencies": {