@effect/platform 0.69.18 → 0.69.19

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,10 +2,9 @@
2
2
  * @since 1.0.0
3
3
  */
4
4
  import * as Context from "effect/Context"
5
- import * as HashMap from "effect/HashMap"
6
- import * as HashSet from "effect/HashSet"
7
5
  import { type Pipeable, pipeArguments } from "effect/Pipeable"
8
6
  import * as Predicate from "effect/Predicate"
7
+ import * as Record from "effect/Record"
9
8
  import * as Schema from "effect/Schema"
10
9
  import type * as HttpApiEndpoint from "./HttpApiEndpoint.js"
11
10
  import type { HttpApiDecodeError } from "./HttpApiError.js"
@@ -51,10 +50,10 @@ export interface HttpApiGroup<
51
50
  readonly [TypeId]: TypeId
52
51
  readonly identifier: Id
53
52
  readonly topLevel: TopLevel
54
- readonly endpoints: HashMap.HashMap<string, Endpoints>
53
+ readonly endpoints: Record.ReadonlyRecord<string, Endpoints>
55
54
  readonly errorSchema: Schema.Schema<Error, unknown, R>
56
55
  readonly annotations: Context.Context<never>
57
- readonly middlewares: HashSet.HashSet<HttpApiMiddleware.TagClassAny>
56
+ readonly middlewares: ReadonlySet<HttpApiMiddleware.TagClassAny>
58
57
 
59
58
  /**
60
59
  * Add an `HttpApiEndpoint` to an `HttpApiGroup`.
@@ -272,7 +271,10 @@ const Proto = {
272
271
  return makeProto({
273
272
  identifier: this.identifier,
274
273
  topLevel: this.topLevel,
275
- endpoints: HashMap.set(this.endpoints, endpoint.name, endpoint),
274
+ endpoints: {
275
+ ...this.endpoints,
276
+ [endpoint.name]: endpoint
277
+ },
276
278
  errorSchema: this.errorSchema,
277
279
  annotations: this.annotations,
278
280
  middlewares: this.middlewares
@@ -301,7 +303,7 @@ const Proto = {
301
303
  return makeProto({
302
304
  identifier: this.identifier,
303
305
  topLevel: this.topLevel,
304
- endpoints: HashMap.map(this.endpoints, (endpoint) => endpoint.prefix(prefix)),
306
+ endpoints: Record.map(this.endpoints, (endpoint) => endpoint.prefix(prefix)),
305
307
  errorSchema: this.errorSchema,
306
308
  annotations: this.annotations,
307
309
  middlewares: this.middlewares
@@ -319,14 +321,14 @@ const Proto = {
319
321
  }) as any)
320
322
  ),
321
323
  annotations: this.annotations,
322
- middlewares: HashSet.add(this.middlewares, middleware)
324
+ middlewares: new Set([...this.middlewares, middleware])
323
325
  })
324
326
  },
325
327
  middlewareEndpoints(this: HttpApiGroup.AnyWithProps, middleware: HttpApiMiddleware.TagClassAny) {
326
328
  return makeProto({
327
329
  identifier: this.identifier,
328
330
  topLevel: this.topLevel,
329
- endpoints: HashMap.map(this.endpoints, (endpoint) => endpoint.middleware(middleware)),
331
+ endpoints: Record.map(this.endpoints, (endpoint) => endpoint.middleware(middleware)),
330
332
  errorSchema: this.errorSchema,
331
333
  annotations: this.annotations,
332
334
  middlewares: this.middlewares
@@ -356,7 +358,7 @@ const Proto = {
356
358
  return makeProto({
357
359
  identifier: this.identifier,
358
360
  topLevel: this.topLevel,
359
- endpoints: HashMap.map(this.endpoints, (endpoint) => endpoint.annotateContext(context)),
361
+ endpoints: Record.map(this.endpoints, (endpoint) => endpoint.annotateContext(context)),
360
362
  errorSchema: this.errorSchema,
361
363
  annotations: this.annotations,
362
364
  middlewares: this.middlewares
@@ -366,7 +368,7 @@ const Proto = {
366
368
  return makeProto({
367
369
  identifier: this.identifier,
368
370
  topLevel: this.topLevel,
369
- endpoints: HashMap.map(this.endpoints, (endpoint) => endpoint.annotate(tag, value)),
371
+ endpoints: Record.map(this.endpoints, (endpoint) => endpoint.annotate(tag, value)),
370
372
  errorSchema: this.errorSchema,
371
373
  annotations: this.annotations,
372
374
  middlewares: this.middlewares
@@ -386,10 +388,10 @@ const makeProto = <
386
388
  >(options: {
387
389
  readonly identifier: Id
388
390
  readonly topLevel: TopLevel
389
- readonly endpoints: HashMap.HashMap<string, Endpoints>
391
+ readonly endpoints: Record.ReadonlyRecord<string, Endpoints>
390
392
  readonly errorSchema: Schema.Schema<Error, unknown, R>
391
393
  readonly annotations: Context.Context<never>
392
- readonly middlewares: HashSet.HashSet<HttpApiMiddleware.TagClassAny>
394
+ readonly middlewares: ReadonlySet<HttpApiMiddleware.TagClassAny>
393
395
  }): HttpApiGroup<Id, Endpoints, Error, R, TopLevel> => {
394
396
  function HttpApiGroup() {}
395
397
  Object.setPrototypeOf(HttpApiGroup, Proto)
@@ -411,8 +413,8 @@ export const make = <const Id extends string, const TopLevel extends (true | fal
411
413
  makeProto({
412
414
  identifier,
413
415
  topLevel: options?.topLevel ?? false as any,
414
- endpoints: HashMap.empty(),
416
+ endpoints: Record.empty(),
415
417
  errorSchema: Schema.Never as any,
416
418
  annotations: Context.empty(),
417
- middlewares: HashSet.empty()
419
+ middlewares: new Set()
418
420
  })
package/src/OpenApi.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import * as Context from "effect/Context"
5
5
  import { globalValue } from "effect/GlobalValue"
6
- import * as HashSet from "effect/HashSet"
7
6
  import * as Option from "effect/Option"
8
7
  import type { ReadonlyRecord } from "effect/Record"
9
8
  import * as Schema from "effect/Schema"
@@ -173,7 +172,7 @@ export const fromApi = <A extends HttpApi.HttpApi.Any>(self: A): OpenAPISpec =>
173
172
  Option.map(Context.getOption(api.annotations, Override), (override) => {
174
173
  Object.assign(spec, override)
175
174
  })
176
- HashSet.forEach(api.middlewares, (middleware) => {
175
+ api.middlewares.forEach((middleware) => {
177
176
  if (!HttpApiMiddleware.isSecurity(middleware)) {
178
177
  return
179
178
  }
@@ -218,7 +217,7 @@ export const fromApi = <A extends HttpApi.HttpApi.Any>(self: A): OpenAPISpec =>
218
217
  Option.map(Context.getOption(endpoint.annotations, ExternalDocs), (externalDocs) => {
219
218
  op.externalDocs = externalDocs
220
219
  })
221
- HashSet.forEach(middleware, (middleware) => {
220
+ middleware.forEach((middleware) => {
222
221
  if (!HttpApiMiddleware.isSecurity(middleware)) {
223
222
  return
224
223
  }