@herd-labs/sdk 0.3.1 → 0.4.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.
Files changed (97) hide show
  1. package/dist/src/config.d.ts +8 -8
  2. package/dist/src/config.js +8 -11
  3. package/dist/src/errors.d.ts +29 -44
  4. package/dist/src/errors.js +13 -16
  5. package/dist/src/live/ActionsServiceLive.d.ts +2 -2
  6. package/dist/src/live/ActionsServiceLive.js +9 -9
  7. package/dist/src/live/AdaptersServiceLive.d.ts +2 -2
  8. package/dist/src/live/AdaptersServiceLive.js +6 -6
  9. package/dist/src/live/AgentSafesServiceLive.d.ts +2 -2
  10. package/dist/src/live/AgentSafesServiceLive.js +3 -3
  11. package/dist/src/live/AgentWalletsServiceLive.d.ts +2 -2
  12. package/dist/src/live/AgentWalletsServiceLive.js +3 -3
  13. package/dist/src/live/AgentWorkflowsServiceLive.d.ts +2 -2
  14. package/dist/src/live/AgentWorkflowsServiceLive.js +10 -10
  15. package/dist/src/live/AuthServiceLive.d.ts +2 -2
  16. package/dist/src/live/AuthServiceLive.js +5 -5
  17. package/dist/src/live/BookmarksServiceLive.d.ts +2 -2
  18. package/dist/src/live/BookmarksServiceLive.js +16 -16
  19. package/dist/src/live/CodeBlocksServiceLive.d.ts +2 -2
  20. package/dist/src/live/CodeBlocksServiceLive.js +8 -8
  21. package/dist/src/live/CollectionsServiceLive.d.ts +2 -2
  22. package/dist/src/live/CollectionsServiceLive.js +3 -3
  23. package/dist/src/live/ContractsServiceLive.d.ts +2 -2
  24. package/dist/src/live/ContractsServiceLive.js +6 -6
  25. package/dist/src/live/DocsServiceLive.d.ts +2 -2
  26. package/dist/src/live/DocsServiceLive.js +2 -2
  27. package/dist/src/live/GroupsServiceLive.d.ts +2 -2
  28. package/dist/src/live/GroupsServiceLive.js +5 -5
  29. package/dist/src/live/HalServiceLive.d.ts +2 -2
  30. package/dist/src/live/HalServiceLive.js +9 -9
  31. package/dist/src/live/TransactionsServiceLive.d.ts +2 -2
  32. package/dist/src/live/TransactionsServiceLive.js +17 -17
  33. package/dist/src/live/WalletsServiceLive.d.ts +2 -2
  34. package/dist/src/live/WalletsServiceLive.js +14 -14
  35. package/dist/src/live/http.d.ts +4 -4
  36. package/dist/src/live/http.js +13 -13
  37. package/dist/src/schemas/actions.d.ts +95 -323
  38. package/dist/src/schemas/actions.js +41 -37
  39. package/dist/src/schemas/adapters.d.ts +5 -15
  40. package/dist/src/schemas/adapters.js +2 -2
  41. package/dist/src/schemas/agent-wallets.d.ts +66 -210
  42. package/dist/src/schemas/agent-wallets.js +25 -25
  43. package/dist/src/schemas/agent-workflows.d.ts +62 -62
  44. package/dist/src/schemas/agent-workflows.js +35 -31
  45. package/dist/src/schemas/auth.d.ts +22 -51
  46. package/dist/src/schemas/auth.js +6 -6
  47. package/dist/src/schemas/bookmarks.d.ts +64 -204
  48. package/dist/src/schemas/bookmarks.js +27 -23
  49. package/dist/src/schemas/codeblocks.d.ts +98 -294
  50. package/dist/src/schemas/codeblocks.js +41 -36
  51. package/dist/src/schemas/collections.d.ts +68 -224
  52. package/dist/src/schemas/collections.js +28 -24
  53. package/dist/src/schemas/common.d.ts +9 -25
  54. package/dist/src/schemas/common.js +5 -5
  55. package/dist/src/schemas/contracts.d.ts +125 -431
  56. package/dist/src/schemas/contracts.js +52 -63
  57. package/dist/src/schemas/docs.d.ts +9 -26
  58. package/dist/src/schemas/docs.js +4 -4
  59. package/dist/src/schemas/groups.d.ts +47 -47
  60. package/dist/src/schemas/groups.js +18 -18
  61. package/dist/src/schemas/hal.d.ts +57 -211
  62. package/dist/src/schemas/hal.js +32 -30
  63. package/dist/src/schemas/transactions.d.ts +404 -890
  64. package/dist/src/schemas/transactions.js +128 -132
  65. package/dist/src/schemas/wallets.d.ts +205 -709
  66. package/dist/src/schemas/wallets.js +112 -96
  67. package/dist/src/services/ActionsService.d.ts +1 -1
  68. package/dist/src/services/ActionsService.js +2 -2
  69. package/dist/src/services/AdaptersService.d.ts +1 -1
  70. package/dist/src/services/AdaptersService.js +2 -2
  71. package/dist/src/services/AgentSafesService.d.ts +1 -1
  72. package/dist/src/services/AgentSafesService.js +2 -2
  73. package/dist/src/services/AgentWalletsService.d.ts +1 -1
  74. package/dist/src/services/AgentWalletsService.js +2 -2
  75. package/dist/src/services/AgentWorkflowsService.d.ts +3 -3
  76. package/dist/src/services/AgentWorkflowsService.js +6 -2
  77. package/dist/src/services/AuthService.d.ts +3 -3
  78. package/dist/src/services/AuthService.js +2 -2
  79. package/dist/src/services/BookmarksService.d.ts +2 -2
  80. package/dist/src/services/BookmarksService.js +2 -2
  81. package/dist/src/services/CodeBlocksService.d.ts +1 -1
  82. package/dist/src/services/CodeBlocksService.js +2 -2
  83. package/dist/src/services/CollectionsService.d.ts +1 -1
  84. package/dist/src/services/CollectionsService.js +2 -2
  85. package/dist/src/services/ContractsService.d.ts +1 -1
  86. package/dist/src/services/ContractsService.js +2 -2
  87. package/dist/src/services/DocsService.d.ts +2 -2
  88. package/dist/src/services/DocsService.js +2 -2
  89. package/dist/src/services/GroupsService.d.ts +3 -3
  90. package/dist/src/services/GroupsService.js +4 -2
  91. package/dist/src/services/HalService.d.ts +1 -1
  92. package/dist/src/services/HalService.js +2 -2
  93. package/dist/src/services/TransactionsService.d.ts +1 -1
  94. package/dist/src/services/TransactionsService.js +2 -2
  95. package/dist/src/services/WalletsService.d.ts +1 -1
  96. package/dist/src/services/WalletsService.js +2 -2
  97. package/package.json +13 -18
@@ -1,18 +1,18 @@
1
1
  import { Context, Schema } from "effect";
2
- import * as effect_Either0 from "effect/Either";
2
+ import * as effect_Result0 from "effect/Result";
3
3
 
4
4
  //#region src/config.d.ts
5
- declare const HerdConfigSchema: Schema.EitherFromUnion<Schema.Struct<{
6
- baseUrl: typeof Schema.String;
7
- apiKey: typeof Schema.String;
5
+ declare const HerdConfigSchema: Schema.Result<Schema.Struct<{
6
+ readonly apiKey: Schema.String;
7
+ readonly baseUrl: Schema.String;
8
8
  }>, Schema.Struct<{
9
- baseUrl: typeof Schema.String;
10
- oauthAccessToken: typeof Schema.String;
9
+ readonly baseUrl: Schema.String;
10
+ readonly oauthAccessToken: Schema.String;
11
11
  }>>;
12
12
  type HerdConfigType = typeof HerdConfigSchema.Type;
13
- declare const HerdConfig_base: Context.TagClass<HerdConfig, "HerdConfig", effect_Either0.Either<{
14
- readonly baseUrl: string;
13
+ declare const HerdConfig_base: Context.ServiceClass<HerdConfig, "HerdConfig", effect_Result0.Result<{
15
14
  readonly apiKey: string;
15
+ readonly baseUrl: string;
16
16
  }, {
17
17
  readonly baseUrl: string;
18
18
  readonly oauthAccessToken: string;
@@ -1,17 +1,14 @@
1
1
  import { Context, Schema } from "effect";
2
2
 
3
3
  //#region src/config.ts
4
- const HerdConfigSchema = Schema.EitherFromUnion({
5
- left: Schema.Struct({
6
- baseUrl: Schema.String,
7
- oauthAccessToken: Schema.String
8
- }),
9
- right: Schema.Struct({
10
- baseUrl: Schema.String,
11
- apiKey: Schema.String
12
- })
13
- });
14
- var HerdConfig = class extends Context.Tag("HerdConfig")() {};
4
+ const HerdConfigSchema = Schema.Result(Schema.Struct({
5
+ apiKey: Schema.String,
6
+ baseUrl: Schema.String
7
+ }), Schema.Struct({
8
+ baseUrl: Schema.String,
9
+ oauthAccessToken: Schema.String
10
+ }));
11
+ var HerdConfig = class extends Context.Service()("HerdConfig") {};
15
12
 
16
13
  //#endregion
17
14
  export { HerdConfig, HerdConfigSchema };
@@ -1,57 +1,42 @@
1
1
  import { Schema } from "effect";
2
+ import * as effect_Cause0 from "effect/Cause";
2
3
 
3
4
  //#region src/errors.d.ts
4
- declare const ServiceError_base: Schema.TaggedErrorClass<ServiceError, "ServiceError", {
5
- readonly _tag: Schema.tag<"ServiceError">;
6
- } & {
7
- message: typeof Schema.String;
8
- metadata: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
9
- }>;
5
+ declare const ServiceError_base: Schema.Class<ServiceError, Schema.TaggedStruct<"ServiceError", {
6
+ readonly message: Schema.String;
7
+ readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
8
+ }>, effect_Cause0.YieldableError>;
10
9
  declare class ServiceError extends ServiceError_base {}
11
- declare const ActionNotFoundError_base: Schema.TaggedErrorClass<ActionNotFoundError, "ActionNotFoundError", {
12
- readonly _tag: Schema.tag<"ActionNotFoundError">;
13
- } & {
14
- id: typeof Schema.String;
15
- }>;
10
+ declare const ActionNotFoundError_base: Schema.Class<ActionNotFoundError, Schema.TaggedStruct<"ActionNotFoundError", {
11
+ readonly id: Schema.String;
12
+ }>, effect_Cause0.YieldableError>;
16
13
  declare class ActionNotFoundError extends ActionNotFoundError_base {}
17
- declare const CodeBlockNotFoundError_base: Schema.TaggedErrorClass<CodeBlockNotFoundError, "CodeBlockNotFoundError", {
18
- readonly _tag: Schema.tag<"CodeBlockNotFoundError">;
19
- } & {
20
- id: typeof Schema.String;
21
- }>;
14
+ declare const CodeBlockNotFoundError_base: Schema.Class<CodeBlockNotFoundError, Schema.TaggedStruct<"CodeBlockNotFoundError", {
15
+ readonly id: Schema.String;
16
+ }>, effect_Cause0.YieldableError>;
22
17
  declare class CodeBlockNotFoundError extends CodeBlockNotFoundError_base {}
23
- declare const CollectionNotFoundError_base: Schema.TaggedErrorClass<CollectionNotFoundError, "CollectionNotFoundError", {
24
- readonly _tag: Schema.tag<"CollectionNotFoundError">;
25
- } & {
26
- id: typeof Schema.String;
27
- }>;
18
+ declare const CollectionNotFoundError_base: Schema.Class<CollectionNotFoundError, Schema.TaggedStruct<"CollectionNotFoundError", {
19
+ readonly id: Schema.String;
20
+ }>, effect_Cause0.YieldableError>;
28
21
  declare class CollectionNotFoundError extends CollectionNotFoundError_base {}
29
- declare const TransactionNotFoundError_base: Schema.TaggedErrorClass<TransactionNotFoundError, "TransactionNotFoundError", {
30
- readonly _tag: Schema.tag<"TransactionNotFoundError">;
31
- } & {
32
- txHash: typeof Schema.String;
33
- blockchain: typeof Schema.String;
34
- }>;
22
+ declare const TransactionNotFoundError_base: Schema.Class<TransactionNotFoundError, Schema.TaggedStruct<"TransactionNotFoundError", {
23
+ readonly blockchain: Schema.String;
24
+ readonly txHash: Schema.String;
25
+ }>, effect_Cause0.YieldableError>;
35
26
  declare class TransactionNotFoundError extends TransactionNotFoundError_base {}
36
- declare const DocNotFoundError_base: Schema.TaggedErrorClass<DocNotFoundError, "DocNotFoundError", {
37
- readonly _tag: Schema.tag<"DocNotFoundError">;
38
- } & {
39
- docId: typeof Schema.String;
40
- }>;
27
+ declare const DocNotFoundError_base: Schema.Class<DocNotFoundError, Schema.TaggedStruct<"DocNotFoundError", {
28
+ readonly docId: Schema.String;
29
+ }>, effect_Cause0.YieldableError>;
41
30
  declare class DocNotFoundError extends DocNotFoundError_base {}
42
- declare const AuthError_base: Schema.TaggedErrorClass<AuthError, "AuthError", {
43
- readonly _tag: Schema.tag<"AuthError">;
44
- } & {
45
- message: typeof Schema.String;
46
- }>;
31
+ declare const AuthError_base: Schema.Class<AuthError, Schema.TaggedStruct<"AuthError", {
32
+ readonly message: Schema.String;
33
+ }>, effect_Cause0.YieldableError>;
47
34
  declare class AuthError extends AuthError_base {}
48
- declare const SimulationError_base: Schema.TaggedErrorClass<SimulationError, "SimulationError", {
49
- readonly _tag: Schema.tag<"SimulationError">;
50
- } & {
51
- name: typeof Schema.String;
52
- message: typeof Schema.String;
53
- hint: Schema.optional<typeof Schema.String>;
54
- }>;
35
+ declare const SimulationError_base: Schema.Class<SimulationError, Schema.TaggedStruct<"SimulationError", {
36
+ readonly hint: Schema.optional<Schema.String>;
37
+ readonly message: Schema.String;
38
+ readonly name: Schema.String;
39
+ }>, effect_Cause0.YieldableError>;
55
40
  declare class SimulationError extends SimulationError_base {}
56
41
  declare const ensureServiceError: (fallbackMessage: string) => (error: unknown) => ServiceError;
57
42
  //#endregion
@@ -1,26 +1,23 @@
1
1
  import { Schema } from "effect";
2
2
 
3
3
  //#region src/errors.ts
4
- var ServiceError = class extends Schema.TaggedError()("ServiceError", {
4
+ var ServiceError = class extends Schema.TaggedErrorClass()("ServiceError", {
5
5
  message: Schema.String,
6
- metadata: Schema.Record({
7
- key: Schema.String,
8
- value: Schema.Unknown
9
- })
6
+ metadata: Schema.Record(Schema.String, Schema.Unknown)
10
7
  }) {};
11
- var ActionNotFoundError = class extends Schema.TaggedError()("ActionNotFoundError", { id: Schema.String }) {};
12
- var CodeBlockNotFoundError = class extends Schema.TaggedError()("CodeBlockNotFoundError", { id: Schema.String }) {};
13
- var CollectionNotFoundError = class extends Schema.TaggedError()("CollectionNotFoundError", { id: Schema.String }) {};
14
- var TransactionNotFoundError = class extends Schema.TaggedError()("TransactionNotFoundError", {
15
- txHash: Schema.String,
16
- blockchain: Schema.String
8
+ var ActionNotFoundError = class extends Schema.TaggedErrorClass()("ActionNotFoundError", { id: Schema.String }) {};
9
+ var CodeBlockNotFoundError = class extends Schema.TaggedErrorClass()("CodeBlockNotFoundError", { id: Schema.String }) {};
10
+ var CollectionNotFoundError = class extends Schema.TaggedErrorClass()("CollectionNotFoundError", { id: Schema.String }) {};
11
+ var TransactionNotFoundError = class extends Schema.TaggedErrorClass()("TransactionNotFoundError", {
12
+ blockchain: Schema.String,
13
+ txHash: Schema.String
17
14
  }) {};
18
- var DocNotFoundError = class extends Schema.TaggedError()("DocNotFoundError", { docId: Schema.String }) {};
19
- var AuthError = class extends Schema.TaggedError()("AuthError", { message: Schema.String }) {};
20
- var SimulationError = class extends Schema.TaggedError()("SimulationError", {
21
- name: Schema.String,
15
+ var DocNotFoundError = class extends Schema.TaggedErrorClass()("DocNotFoundError", { docId: Schema.String }) {};
16
+ var AuthError = class extends Schema.TaggedErrorClass()("AuthError", { message: Schema.String }) {};
17
+ var SimulationError = class extends Schema.TaggedErrorClass()("SimulationError", {
18
+ hint: Schema.optional(Schema.String),
22
19
  message: Schema.String,
23
- hint: Schema.optional(Schema.String)
20
+ name: Schema.String
24
21
  }) {};
25
22
  const ensureServiceError = (fallbackMessage) => (error) => {
26
23
  if (error instanceof ServiceError) return error;
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { ActionsService } from "../services/ActionsService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient0 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient0 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/ActionsServiceLive.d.ts
7
- declare const ActionsServiceLive: Layer.Layer<ActionsService, never, HerdConfig | _effect_platform_HttpClient0.HttpClient>;
7
+ declare const ActionsServiceLive: Layer.Layer<ActionsService, never, HerdConfig | effect_unstable_http_HttpClient0.HttpClient>;
8
8
  //#endregion
9
9
  export { ActionsServiceLive };
@@ -3,31 +3,31 @@ import { Action, ActionVersionsResponse, ActionsSearchResponse, CreateActionResp
3
3
  import { ActionsService } from "../services/ActionsService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/ActionsServiceLive.ts
9
- const mapNotFound = (id) => Effect.catchAll((error) => {
9
+ const mapNotFound = (id) => Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new ActionNotFoundError({ id }));
11
11
  return Effect.fail(error);
12
12
  });
13
13
  const ActionsServiceLive = Layer.effect(ActionsService, Effect.gen(function* () {
14
14
  const { baseUrl, client } = yield* authorizedClient;
15
15
  return {
16
+ create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions"), { body: jsonBody({
17
+ ...params,
18
+ expressionType: "action"
19
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateActionResponse)), Effect.mapError(ensureServiceError("Failed to create action"))),
20
+ delete: (id) => pipe(client.del(makeUrl(baseUrl, `/v1/actions/${id}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete action")), mapNotFound(id)),
16
21
  get: (id, options) => pipe(client.get(makeUrl(baseUrl, `/v1/actions/${id}`, options?.includeReferences === true ? { includeReferences: "true" } : void 0)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(Action)), Effect.mapError(ensureServiceError("Failed to get action")), mapNotFound(id)),
17
22
  getVersions: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/versions"), { body: jsonBody({
18
23
  actionIds: params.actionIds,
19
24
  latest: params.latest
20
25
  }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ActionVersionsResponse)), Effect.mapError(ensureServiceError("Failed to get action versions"))),
26
+ publishExpression: (id, expressionId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/${id}/expressions/${expressionId}/publish`), { body: jsonBody(params ?? {}) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PublishExpressionResponse)), Effect.mapError(ensureServiceError("Failed to publish expression")), mapNotFound(id)),
21
27
  search: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/query"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ActionsSearchResponse)), Effect.mapError(ensureServiceError("Failed to search actions"))),
22
28
  searchRelatedAdapters: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions/related-adapters/query"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(RelatedAdaptersResponse)), Effect.mapError(ensureServiceError("Failed to search related adapters"))),
23
- create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions"), { body: jsonBody({
24
- ...params,
25
- expressionType: "action"
26
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateActionResponse)), Effect.mapError(ensureServiceError("Failed to create action"))),
27
- updateMetadata: (id, params) => pipe(client.patch(makeUrl(baseUrl, `/v1/actions/${id}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update action metadata")), mapNotFound(id)),
28
29
  updateExpression: (id, expressionId, params) => pipe(client.put(makeUrl(baseUrl, `/v1/actions/${id}/expressions/${expressionId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update expression")), mapNotFound(id)),
29
- publishExpression: (id, expressionId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/${id}/expressions/${expressionId}/publish`), { body: jsonBody(params ?? {}) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PublishExpressionResponse)), Effect.mapError(ensureServiceError("Failed to publish expression")), mapNotFound(id)),
30
- delete: (id) => pipe(client.del(makeUrl(baseUrl, `/v1/actions/${id}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete action")), mapNotFound(id))
30
+ updateMetadata: (id, params) => pipe(client.patch(makeUrl(baseUrl, `/v1/actions/${id}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update action metadata")), mapNotFound(id))
31
31
  };
32
32
  }));
33
33
 
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { AdaptersService } from "../services/AdaptersService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient0 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient1 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/AdaptersServiceLive.d.ts
7
- declare const AdaptersServiceLive: Layer.Layer<AdaptersService, never, HerdConfig | _effect_platform_HttpClient0.HttpClient>;
7
+ declare const AdaptersServiceLive: Layer.Layer<AdaptersService, never, HerdConfig | effect_unstable_http_HttpClient1.HttpClient>;
8
8
  //#endregion
9
9
  export { AdaptersServiceLive };
@@ -3,25 +3,25 @@ import { Action, CreateActionResponse, PublishExpressionResponse } from "../sche
3
3
  import { AdaptersService } from "../services/AdaptersService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AdaptersServiceLive.ts
9
- const mapNotFound = (id) => Effect.catchAll((error) => {
9
+ const mapNotFound = (id) => Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new ActionNotFoundError({ id }));
11
11
  return Effect.fail(error);
12
12
  });
13
13
  const AdaptersServiceLive = Layer.effect(AdaptersService, Effect.gen(function* () {
14
14
  const { baseUrl, client } = yield* authorizedClient;
15
15
  return {
16
- get: (id) => pipe(client.get(makeUrl(baseUrl, `/v1/actions/${id}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(Action)), Effect.mapError(ensureServiceError("Failed to get adapter")), mapNotFound(id)),
17
16
  create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/actions"), { body: jsonBody({
18
17
  ...params,
19
18
  expressionType: "adapter"
20
19
  }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateActionResponse)), Effect.mapError(ensureServiceError("Failed to create adapter"))),
21
- updateMetadata: (id, params) => pipe(client.patch(makeUrl(baseUrl, `/v1/actions/${id}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update adapter metadata")), mapNotFound(id)),
22
- updateExpression: (id, expressionId, params) => pipe(client.put(makeUrl(baseUrl, `/v1/actions/${id}/expressions/${expressionId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update adapter expression")), mapNotFound(id)),
20
+ delete: (id) => pipe(client.del(makeUrl(baseUrl, `/v1/actions/${id}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete adapter")), mapNotFound(id)),
21
+ get: (id) => pipe(client.get(makeUrl(baseUrl, `/v1/actions/${id}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(Action)), Effect.mapError(ensureServiceError("Failed to get adapter")), mapNotFound(id)),
23
22
  publishExpression: (id, expressionId, params) => pipe(client.post(makeUrl(baseUrl, `/v1/actions/${id}/expressions/${expressionId}/publish`), { body: jsonBody(params ?? {}) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PublishExpressionResponse)), Effect.mapError(ensureServiceError("Failed to publish adapter expression")), mapNotFound(id)),
24
- delete: (id) => pipe(client.del(makeUrl(baseUrl, `/v1/actions/${id}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete adapter")), mapNotFound(id))
23
+ updateExpression: (id, expressionId, params) => pipe(client.put(makeUrl(baseUrl, `/v1/actions/${id}/expressions/${expressionId}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update adapter expression")), mapNotFound(id)),
24
+ updateMetadata: (id, params) => pipe(client.patch(makeUrl(baseUrl, `/v1/actions/${id}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to update adapter metadata")), mapNotFound(id))
25
25
  };
26
26
  }));
27
27
 
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { AgentSafesService } from "../services/AgentSafesService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient1 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient2 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/AgentSafesServiceLive.d.ts
7
- declare const AgentSafesServiceLive: Layer.Layer<AgentSafesService, never, HerdConfig | _effect_platform_HttpClient1.HttpClient>;
7
+ declare const AgentSafesServiceLive: Layer.Layer<AgentSafesService, never, HerdConfig | effect_unstable_http_HttpClient2.HttpClient>;
8
8
  //#endregion
9
9
  export { AgentSafesServiceLive };
@@ -3,15 +3,15 @@ import { AgentSafe, AgentSafeMetadata, SetSafeProposerResponse } from "../schema
3
3
  import { AgentSafesService } from "../services/AgentSafesService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AgentSafesServiceLive.ts
9
9
  const AgentSafesServiceLive = Layer.effect(AgentSafesService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
+ editAgentSafeMetadata: (blockchain, safeAddress, params) => pipe(client.patch(makeUrl(baseUrl, `/v1/agent-safes/${blockchain}/${safeAddress}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentSafeMetadata)), Effect.mapError(ensureServiceError("Failed to edit agent Safe metadata"))),
12
13
  getAgentSafe: (blockchain, safeAddress) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-safes/${blockchain}/${safeAddress}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentSafe)), Effect.mapError(ensureServiceError("Failed to get agent Safe"))),
13
- setSafeProposer: (blockchain, safeAddress, params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-safes/${blockchain}/${safeAddress}/proposers`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(SetSafeProposerResponse)), Effect.mapError(ensureServiceError("Failed to set agent Safe proposer"))),
14
- editAgentSafeMetadata: (blockchain, safeAddress, params) => pipe(client.patch(makeUrl(baseUrl, `/v1/agent-safes/${blockchain}/${safeAddress}`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentSafeMetadata)), Effect.mapError(ensureServiceError("Failed to edit agent Safe metadata")))
14
+ setSafeProposer: (blockchain, safeAddress, params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-safes/${blockchain}/${safeAddress}/proposers`), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(SetSafeProposerResponse)), Effect.mapError(ensureServiceError("Failed to set agent Safe proposer")))
15
15
  };
16
16
  }));
17
17
 
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { AgentWalletsService } from "../services/AgentWalletsService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient11 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient0 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/AgentWalletsServiceLive.d.ts
7
- declare const AgentWalletsServiceLive: Layer.Layer<AgentWalletsService, never, HerdConfig | _effect_platform_HttpClient11.HttpClient>;
7
+ declare const AgentWalletsServiceLive: Layer.Layer<AgentWalletsService, never, HerdConfig | effect_unstable_http_HttpClient0.HttpClient>;
8
8
  //#endregion
9
9
  export { AgentWalletsServiceLive };
@@ -3,14 +3,14 @@ import { AgentWalletSafesList, AgentWalletsList } from "../schemas/agent-wallets
3
3
  import { AgentWalletsService } from "../services/AgentWalletsService.js";
4
4
  import { authorizedClient, checkStatus, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AgentWalletsServiceLive.ts
9
9
  const AgentWalletsServiceLive = Layer.effect(AgentWalletsService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
- listAgentWallets: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-wallets", { groupId: params?.groupId })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletsList)), Effect.mapError(ensureServiceError("Failed to list agent wallets"))),
13
- listAgentWalletSafes: (agentWalletAddress) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-wallets/${agentWalletAddress}/safes`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletSafesList)), Effect.mapError(ensureServiceError("Failed to list agent wallet Safes")))
12
+ listAgentWalletSafes: (agentWalletAddress) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-wallets/${agentWalletAddress}/safes`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletSafesList)), Effect.mapError(ensureServiceError("Failed to list agent wallet Safes"))),
13
+ listAgentWallets: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-wallets", { groupId: params?.groupId })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWalletsList)), Effect.mapError(ensureServiceError("Failed to list agent wallets")))
14
14
  };
15
15
  }));
16
16
 
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { AgentWorkflowsService } from "../services/AgentWorkflowsService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient12 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient3 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/AgentWorkflowsServiceLive.d.ts
7
- declare const AgentWorkflowsServiceLive: Layer.Layer<AgentWorkflowsService, never, HerdConfig | _effect_platform_HttpClient12.HttpClient>;
7
+ declare const AgentWorkflowsServiceLive: Layer.Layer<AgentWorkflowsService, never, HerdConfig | effect_unstable_http_HttpClient3.HttpClient>;
8
8
  //#endregion
9
9
  export { AgentWorkflowsServiceLive };
@@ -3,14 +3,14 @@ import { AgentWorkflowWithRuns, CreateAgentWorkflowResponse, CreateAgentWorkflow
3
3
  import { AgentWorkflowNotFoundError, AgentWorkflowRunNotFoundError, AgentWorkflowsService } from "../services/AgentWorkflowsService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AgentWorkflowsServiceLive.ts
9
- const mapWorkflowNotFound = (workflowId) => Effect.catchAll((error) => {
9
+ const mapWorkflowNotFound = (workflowId) => Effect.catch((error) => {
10
10
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new AgentWorkflowNotFoundError(workflowId));
11
11
  return Effect.fail(error);
12
12
  });
13
- const mapRunNotFound = (runId) => Effect.catchAll((error) => {
13
+ const mapRunNotFound = (runId) => Effect.catch((error) => {
14
14
  if (error instanceof ServiceError && error.metadata["status"] === 404) return Effect.fail(new AgentWorkflowRunNotFoundError(runId));
15
15
  return Effect.fail(error);
16
16
  });
@@ -18,18 +18,18 @@ const AgentWorkflowsServiceLive = Layer.effect(AgentWorkflowsService, Effect.gen
18
18
  const { baseUrl, client } = yield* authorizedClient;
19
19
  return {
20
20
  create: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/agent-workflows"), { body: jsonBody(params) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateAgentWorkflowResponse)), Effect.mapError(ensureServiceError("Failed to create agent workflow"))),
21
- list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-workflows", {
22
- groupId: params.groupId,
23
- type: params.type
24
- })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ListAgentWorkflowsResponse)), Effect.mapError(ensureServiceError("Failed to list agent workflows"))),
25
- get: (agentWorkflowId) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-workflows/${agentWorkflowId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWorkflowWithRuns)), Effect.mapError(ensureServiceError("Failed to get agent workflow")), mapWorkflowNotFound(agentWorkflowId)),
26
21
  createRun: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/${params.agentWorkflowId}/runs`), { body: jsonBody({
27
22
  outputs: params.outputs,
28
23
  changelog: params.changelog
29
24
  }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreateAgentWorkflowRunResponse)), Effect.mapError(ensureServiceError("Failed to create agent workflow run")), mapWorkflowNotFound(params.agentWorkflowId)),
30
- submitDecision: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/decisions`), { body: jsonBody({ decision: params.decision }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(SubmitAgentWorkflowDecisionResponse)), Effect.mapError(ensureServiceError("Failed to submit agent workflow decision")), mapRunNotFound(params.agentWorkflowRunId)),
25
+ executeSafeTx: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/push/execute`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ExecuteSafeTxResponse)), Effect.mapError(ensureServiceError("Failed to execute safe transaction")), mapRunNotFound(params.agentWorkflowRunId)),
26
+ get: (agentWorkflowId) => pipe(client.get(makeUrl(baseUrl, `/v1/agent-workflows/${agentWorkflowId}`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(AgentWorkflowWithRuns)), Effect.mapError(ensureServiceError("Failed to get agent workflow")), mapWorkflowNotFound(agentWorkflowId)),
27
+ list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/agent-workflows", {
28
+ groupId: params.groupId,
29
+ type: params.type
30
+ })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ListAgentWorkflowsResponse)), Effect.mapError(ensureServiceError("Failed to list agent workflows"))),
31
31
  push: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/push`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(PushAgentWorkflowResponse)), Effect.mapError(ensureServiceError("Failed to push agent workflow")), mapRunNotFound(params.agentWorkflowRunId)),
32
- executeSafeTx: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/push/execute`)), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ExecuteSafeTxResponse)), Effect.mapError(ensureServiceError("Failed to execute safe transaction")), mapRunNotFound(params.agentWorkflowRunId))
32
+ submitDecision: (params) => pipe(client.post(makeUrl(baseUrl, `/v1/agent-workflows/runs/${params.agentWorkflowRunId}/decisions`), { body: jsonBody({ decision: params.decision }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(SubmitAgentWorkflowDecisionResponse)), Effect.mapError(ensureServiceError("Failed to submit agent workflow decision")), mapRunNotFound(params.agentWorkflowRunId))
33
33
  };
34
34
  }));
35
35
 
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { AuthService } from "../services/AuthService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient13 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient10 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/AuthServiceLive.d.ts
7
- declare const AuthServiceLive: Layer.Layer<AuthService, never, HerdConfig | _effect_platform_HttpClient13.HttpClient>;
7
+ declare const AuthServiceLive: Layer.Layer<AuthService, never, HerdConfig | effect_unstable_http_HttpClient10.HttpClient>;
8
8
  //#endregion
9
9
  export { AuthServiceLive };
@@ -3,22 +3,22 @@ import { ApiKeyListResponse, CreatedApiKey, TokenResponse, WhoamiResponse } from
3
3
  import { AuthService } from "../services/AuthService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl, urlEncodedBody } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/AuthServiceLive.ts
9
9
  const AuthServiceLive = Layer.effect(AuthService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
- whoami: () => pipe(client.get(makeUrl(baseUrl, "/v1/users/me")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(WhoamiResponse)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
12
+ listApiKeys: pipe(client.get(makeUrl(baseUrl, "/v1/api-keys")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ApiKeyListResponse)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
13
+ provisionApiKey: (name) => pipe(client.post(makeUrl(baseUrl, "/v1/api-keys"), { body: jsonBody({ name }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreatedApiKey)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
13
14
  refreshToken: (refreshToken, clientId) => pipe(client.post(makeUrl(baseUrl, "/api/auth/oauth2/token"), { body: urlEncodedBody({
14
15
  grant_type: "refresh_token",
15
16
  refresh_token: refreshToken,
16
17
  client_id: clientId,
17
18
  resource: baseUrl
18
19
  }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(TokenResponse)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
19
- provisionApiKey: (name) => pipe(client.post(makeUrl(baseUrl, "/v1/api-keys"), { body: jsonBody({ name }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(CreatedApiKey)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
20
- listApiKeys: () => pipe(client.get(makeUrl(baseUrl, "/v1/api-keys")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(ApiKeyListResponse)), Effect.mapError((error) => new AuthError({ message: String(error) }))),
21
- revokeApiKey: (keyId) => pipe(client.del(makeUrl(baseUrl, `/v1/api-keys/${keyId}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError((error) => new AuthError({ message: String(error) })))
20
+ revokeApiKey: (keyId) => pipe(client.del(makeUrl(baseUrl, `/v1/api-keys/${keyId}`)), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError((error) => new AuthError({ message: String(error) }))),
21
+ whoami: pipe(client.get(makeUrl(baseUrl, "/v1/users/me")), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(WhoamiResponse)), Effect.mapError((error) => new AuthError({ message: String(error) })))
22
22
  };
23
23
  }));
24
24
 
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { BookmarksService } from "../services/BookmarksService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient2 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient6 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/BookmarksServiceLive.d.ts
7
- declare const BookmarksServiceLive: Layer.Layer<BookmarksService, never, HerdConfig | _effect_platform_HttpClient2.HttpClient>;
7
+ declare const BookmarksServiceLive: Layer.Layer<BookmarksService, never, HerdConfig | effect_unstable_http_HttpClient6.HttpClient>;
8
8
  //#endregion
9
9
  export { BookmarksServiceLive };
@@ -3,13 +3,12 @@ import { BookmarkResponse, BookmarksList } from "../schemas/bookmarks.js";
3
3
  import { BookmarksService } from "../services/BookmarksService.js";
4
4
  import { authorizedClient, checkStatus, jsonBody, makeUrl } from "./http.js";
5
5
  import { Effect, Layer, pipe } from "effect";
6
- import { HttpClientResponse } from "@effect/platform";
6
+ import { HttpClientResponse } from "effect/unstable/http";
7
7
 
8
8
  //#region src/live/BookmarksServiceLive.ts
9
9
  const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function* () {
10
10
  const { baseUrl, client } = yield* authorizedClient;
11
11
  return {
12
- list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/bookmarks", { objectTypes: params?.objectTypes?.join(",") })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarksList)), Effect.mapError(ensureServiceError("Failed to list bookmarks"))),
13
12
  addContract: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
14
13
  objectType: "contract",
15
14
  contractAddress: params.address,
@@ -18,7 +17,7 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
18
17
  savedFunctions: [],
19
18
  savedEvents: []
20
19
  },
21
- ...params.label !== void 0 ? { userLabel: params.label } : {}
20
+ ...params.label === void 0 ? {} : { userLabel: params.label }
22
21
  }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add contract bookmark"))),
23
22
  addTransaction: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
24
23
  objectType: "transaction",
@@ -28,29 +27,30 @@ const BookmarksServiceLive = Layer.effect(BookmarksService, Effect.gen(function*
28
27
  savedFunctions: [],
29
28
  savedEvents: []
30
29
  },
31
- ...params.label !== void 0 ? { userLabel: params.label } : {}
30
+ ...params.label === void 0 ? {} : { userLabel: params.label }
32
31
  }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add transaction bookmark"))),
33
32
  addWallet: (params) => pipe(client.post(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
34
33
  objectType: "wallet",
35
34
  walletAddress: params.address,
36
35
  details: {},
37
- ...params.label !== void 0 ? { userLabel: params.label } : {}
36
+ ...params.label === void 0 ? {} : { userLabel: params.label }
38
37
  }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to add wallet bookmark"))),
39
- updateLabel: (params) => pipe(client.patch(makeUrl(baseUrl, "/v1/bookmarks/label"), { body: jsonBody({
38
+ delete: (params) => pipe(client.del(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
40
39
  objectType: params.objectType,
41
- ...params.address !== void 0 ? { contractAddress: params.address } : {},
40
+ ...params.address === void 0 ? {} : { contractAddress: params.address },
42
41
  ...params.address !== void 0 && params.objectType === "wallet" ? { walletAddress: params.address } : {},
43
- ...params.txHash !== void 0 ? { transactionHash: params.txHash } : {},
44
- ...params.blockchain !== void 0 ? { blockchain: params.blockchain } : {},
45
- userLabel: params.label
46
- }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to update bookmark label"))),
47
- delete: (params) => pipe(client.del(makeUrl(baseUrl, "/v1/bookmarks"), { body: jsonBody({
42
+ ...params.txHash === void 0 ? {} : { transactionHash: params.txHash },
43
+ ...params.blockchain === void 0 ? {} : { blockchain: params.blockchain }
44
+ }) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete bookmark"))),
45
+ list: (params) => pipe(client.get(makeUrl(baseUrl, "/v1/bookmarks", { objectTypes: params?.objectTypes?.join(",") })), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarksList)), Effect.mapError(ensureServiceError("Failed to list bookmarks"))),
46
+ updateLabel: (params) => pipe(client.patch(makeUrl(baseUrl, "/v1/bookmarks/label"), { body: jsonBody({
48
47
  objectType: params.objectType,
49
- ...params.address !== void 0 ? { contractAddress: params.address } : {},
48
+ ...params.address === void 0 ? {} : { contractAddress: params.address },
50
49
  ...params.address !== void 0 && params.objectType === "wallet" ? { walletAddress: params.address } : {},
51
- ...params.txHash !== void 0 ? { transactionHash: params.txHash } : {},
52
- ...params.blockchain !== void 0 ? { blockchain: params.blockchain } : {}
53
- }) }), Effect.flatMap(checkStatus), Effect.asVoid, Effect.mapError(ensureServiceError("Failed to delete bookmark")))
50
+ ...params.txHash === void 0 ? {} : { transactionHash: params.txHash },
51
+ ...params.blockchain === void 0 ? {} : { blockchain: params.blockchain },
52
+ userLabel: params.label
53
+ }) }), Effect.flatMap(checkStatus), Effect.flatMap(HttpClientResponse.schemaBodyJson(BookmarkResponse)), Effect.mapError(ensureServiceError("Failed to update bookmark label")))
54
54
  };
55
55
  }));
56
56
 
@@ -1,9 +1,9 @@
1
1
  import { HerdConfig } from "../config.js";
2
2
  import { CodeBlocksService } from "../services/CodeBlocksService.js";
3
3
  import { Layer } from "effect";
4
- import * as _effect_platform_HttpClient9 from "@effect/platform/HttpClient";
4
+ import * as effect_unstable_http_HttpClient8 from "effect/unstable/http/HttpClient";
5
5
 
6
6
  //#region src/live/CodeBlocksServiceLive.d.ts
7
- declare const CodeBlocksServiceLive: Layer.Layer<CodeBlocksService, never, HerdConfig | _effect_platform_HttpClient9.HttpClient>;
7
+ declare const CodeBlocksServiceLive: Layer.Layer<CodeBlocksService, never, HerdConfig | effect_unstable_http_HttpClient8.HttpClient>;
8
8
  //#endregion
9
9
  export { CodeBlocksServiceLive };