Skip to content

Commit

Permalink
Bump the effect group with 3 updates (#147)
Browse files Browse the repository at this point in the history
* Bump the effect group with 3 updates

Bumps the effect group with 3 updates: [@effect/platform](https://github.com/effect-ts/effect/tree/HEAD/packages/platform), [@effect/schema](https://github.com/effect-ts/effect/tree/HEAD/packages/schema) and [effect](https://github.com/effect-ts/effect/tree/HEAD/packages/effect).


Updates `@effect/platform` from 0.48.21 to 0.48.29
- [Release notes](https://github.com/effect-ts/effect/releases)
- [Changelog](https://github.com/Effect-TS/effect/blob/main/packages/platform/CHANGELOG.md)
- [Commits](https://github.com/effect-ts/effect/commits/@effect/[email protected]/packages/platform)

Updates `@effect/schema` from 0.64.15 to 0.65.0
- [Release notes](https://github.com/effect-ts/effect/releases)
- [Changelog](https://github.com/Effect-TS/effect/blob/main/packages/schema/CHANGELOG.md)
- [Commits](https://github.com/effect-ts/effect/commits/@effect/[email protected]/packages/schema)

Updates `effect` from 2.4.15 to 2.4.19
- [Release notes](https://github.com/effect-ts/effect/releases)
- [Changelog](https://github.com/Effect-TS/effect/blob/main/packages/effect/CHANGELOG.md)
- [Commits](https://github.com/effect-ts/effect/commits/[email protected]/packages/effect)

---
updated-dependencies:
- dependency-name: "@effect/platform"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: effect
- dependency-name: "@effect/schema"
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: effect
- dependency-name: effect
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: effect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Match changes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Wilkinson <[email protected]>
  • Loading branch information
dependabot[bot] and thewilkybarkid authored Apr 16, 2024
1 parent 35f688e commit 91f86ed
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 101 deletions.
46 changes: 26 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
"vitest": "^1.5.0"
},
"dependencies": {
"@effect/platform": "^0.48.21",
"@effect/schema": "^0.64.5",
"@effect/platform": "^0.48.29",
"@effect/schema": "^0.65.0",
"@js-temporal/polyfill": "^0.4.4",
"chalk": "^5.3.0",
"doi-regex": "^0.1.13",
"effect": "2.4.15",
"effect": "2.4.19",
"ioredis": "^5.3.2",
"orcid-utils": "^1.2.2"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Doi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const isDoi: Predicate.Refinement<unknown, Doi> = (u): u is Doi =>

export const Doi = Brand.refined<Doi>(isDoi, s => Brand.error(`Expected ${s} to be a DOI`))

export const DoiSchema = Schema.string.pipe(Schema.fromBrand(Doi))
export const DoiSchema = Schema.String.pipe(Schema.fromBrand(Doi))

export const toUrl: (doi: Doi) => URL = doi => {
const url = new URL('https://doi.org')
Expand Down
90 changes: 46 additions & 44 deletions src/Orcid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,28 @@ export const deletePeerReview = ({
yield* _(HttpClient.request.del(`${orcid}/peer-review/${id}`), client, Effect.scoped)
})

const PrereviewGroupSchema = Schema.struct({
'external-ids': Schema.struct({
'external-id': Schema.tuple(
Schema.struct({
'external-id-type': Schema.literal('peer-review'),
'external-id-value': Schema.literal('orcid-generated:prereview'),
const PrereviewGroupSchema = Schema.Struct({
'external-ids': Schema.Struct({
'external-id': Schema.Tuple(
Schema.Struct({
'external-id-type': Schema.Literal('peer-review'),
'external-id-value': Schema.Literal('orcid-generated:prereview'),
}),
),
}),
'peer-review-group': Schema.array(
Schema.struct({
'external-ids': Schema.struct({
'external-id': Schema.tuple(
Schema.struct({
'external-id-type': Schema.literal('doi'),
'peer-review-group': Schema.Array(
Schema.Struct({
'external-ids': Schema.Struct({
'external-id': Schema.Tuple(
Schema.Struct({
'external-id-type': Schema.Literal('doi'),
'external-id-value': DoiSchema,
}),
),
}),
'peer-review-summary': Schema.tuple(
Schema.struct({
'put-code': Schema.number,
'peer-review-summary': Schema.Tuple(
Schema.Struct({
'put-code': Schema.Number,
}),
),
}),
Expand All @@ -110,56 +110,58 @@ const PrereviewGroupSchema = Schema.struct({

export type PrereviewGroupSchema = Schema.Schema.Type<typeof PrereviewGroupSchema>

const OtherPeerReviewGroupSchema = Schema.struct({
'external-ids': Schema.struct({
'external-id': Schema.tuple(
Schema.struct({
'external-id-value': Schema.string,
const OtherPeerReviewGroupSchema = Schema.Struct({
'external-ids': Schema.Struct({
'external-id': Schema.Tuple(
Schema.Struct({
'external-id-value': Schema.String,
}),
),
}),
})

const PeerReviewsSchema = Schema.struct({
group: Schema.array(Schema.union(PrereviewGroupSchema, OtherPeerReviewGroupSchema)),
const PeerReviewsSchema = Schema.Struct({
group: Schema.Array(Schema.Union(PrereviewGroupSchema, OtherPeerReviewGroupSchema)),
})

const NewPeerReviewSchema = Schema.struct({
'reviewer-role': Schema.literal('reviewer'),
'review-identifiers': Schema.struct({
'external-id': Schema.struct({
'external-id-type': Schema.literal('doi'),
const NewPeerReviewSchema = Schema.Struct({
'reviewer-role': Schema.Literal('reviewer'),
'review-identifiers': Schema.Struct({
'external-id': Schema.Struct({
'external-id-type': Schema.Literal('doi'),
'external-id-value': DoiSchema,
'external-id-relationship': Schema.literal('self'),
'external-id-relationship': Schema.Literal('self'),
}),
}),
'review-url': Url.UrlSchema,
'review-type': Schema.literal('review'),
'review-type': Schema.Literal('review'),
'review-completion-date': Schema.transform(
Schema.struct({
Schema.Struct({
year: Schema.NumberFromString,
month: Schema.NumberFromString,
day: Schema.NumberFromString,
}),
Temporal.PlainDateFromSelfSchema,
({ year, month, day }) => Temporal.PlainDate.from({ year, month, day }),
date => ({ year: date.year, month: date.month, day: date.day }),
{
decode: ({ year, month, day }) => Temporal.PlainDate.from({ year, month, day }),
encode: date => ({ year: date.year, month: date.month, day: date.day }),
},
),
'review-group-id': Schema.literal('orcid-generated:prereview'),
'subject-external-identifier': Schema.struct({
'external-id-type': Schema.literal('doi'),
'review-group-id': Schema.Literal('orcid-generated:prereview'),
'subject-external-identifier': Schema.Struct({
'external-id-type': Schema.Literal('doi'),
'external-id-value': DoiSchema,
'external-id-relationship': Schema.literal('self'),
'external-id-relationship': Schema.Literal('self'),
}),
'subject-container-name': Schema.optional(Schema.string),
'subject-type': Schema.optional(Schema.literal('preprint')),
'subject-name': Schema.optional(Schema.struct({ title: Schema.string })),
'subject-container-name': Schema.optional(Schema.String),
'subject-type': Schema.optional(Schema.Literal('preprint')),
'subject-name': Schema.optional(Schema.Struct({ title: Schema.String })),
'subject-url': Url.UrlSchema,
'convening-organization': Schema.struct({
name: Schema.string,
address: Schema.struct({
city: Schema.string,
country: Schema.string,
'convening-organization': Schema.Struct({
name: Schema.String,
address: Schema.Struct({
city: Schema.String,
country: Schema.String,
}),
}),
})
Expand Down
2 changes: 1 addition & 1 deletion src/OrcidId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const isOrcid: Predicate.Refinement<unknown, OrcidId> = (u): u is OrcidId => {

export const OrcidId = Brand.refined<OrcidId>(isOrcid, s => Brand.error(`Expected ${s} to be an ORCID iD`))

export const OrcidIdSchema = Schema.string.pipe(Schema.fromBrand(OrcidId))
export const OrcidIdSchema = Schema.String.pipe(Schema.fromBrand(OrcidId))
2 changes: 1 addition & 1 deletion src/Redis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const scanStream = (

return Stream.fromAsyncIterable(redis.scanStream(options), error => new RedisError({ error }))
}),
).pipe(Stream.map(Schema.decodeSync(Schema.array(Schema.string))), Stream.map(Chunk.fromIterable))
).pipe(Stream.map(Schema.decodeSync(Schema.Array(Schema.String))), Stream.map(Chunk.fromIterable))

export const get = (key: IoRedis.RedisKey): Effect.Effect<Option.Option<string>, RedisError, Redis> =>
Effect.gen(function* (_) {
Expand Down
14 changes: 6 additions & 8 deletions src/Temporal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ export const PlainDateFromSelfSchema = Schema.instanceOf(Temporal.PlainDate)
export const PlainDateFromStringSchema = <A extends string, I, R>(
self: Schema.Schema<A, I, R>,
): Schema.Schema<Temporal.PlainDate, I, R> =>
Schema.transformOrFail(
self,
PlainDateFromSelfSchema,
(s, _, ast) =>
Schema.transformOrFail(self, PlainDateFromSelfSchema, {
decode: (s, _, ast) =>
ParseResult.try({
try: () => Temporal.PlainDate.from(s),
catch: () => new ParseResult.Type(ast, s),
}),
plainDate => ParseResult.succeed(plainDate.toString()),
{ strict: false },
)
encode: plainDate => ParseResult.succeed(plainDate.toString()),
strict: false,
})

export const PlainDateSchema = PlainDateFromStringSchema(Schema.string)
export const PlainDateSchema = PlainDateFromStringSchema(Schema.String)
14 changes: 6 additions & 8 deletions src/Url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import { ParseResult, Schema } from '@effect/schema'
export const UrlFromSelfSchema: Schema.Schema<URL> = Schema.instanceOf(URL)

export const UrlFromStringSchema = <A extends string, I, R>(self: Schema.Schema<A, I, R>): Schema.Schema<URL, I, R> =>
Schema.transformOrFail(
self,
UrlFromSelfSchema,
(s, _, ast) =>
Schema.transformOrFail(self, UrlFromSelfSchema, {
decode: (s, _, ast) =>
ParseResult.try({
try: () => new URL(s),
catch: () => new ParseResult.Type(ast, s),
}),
url => ParseResult.succeed(url.href),
{ strict: false },
)
encode: url => ParseResult.succeed(url.href),
strict: false,
})

export const UrlSchema = UrlFromStringSchema(Schema.string)
export const UrlSchema = UrlFromStringSchema(Schema.String)
2 changes: 1 addition & 1 deletion src/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const getUsers: Stream.Stream<
Stream.map(User),
)

const OrcidTokenSchema = Schema.struct({ value: Schema.struct({ accessToken: Schema.string }) })
const OrcidTokenSchema = Schema.Struct({ value: Schema.Struct({ accessToken: Schema.String }) })

const getAccessToken = flow(
(orcidId: OrcidId.OrcidId) => Effect.flatten(Redis.get(`orcid-token:${orcidId}`)),
Expand Down
28 changes: 14 additions & 14 deletions src/Zenodo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,31 @@ const getRecords = (
return response.hits
})

const RecordsSchema = Schema.struct({
hits: Schema.struct({
hits: Schema.array(
Schema.struct({
const RecordsSchema = Schema.Struct({
hits: Schema.Struct({
hits: Schema.Array(
Schema.Struct({
doi: DoiSchema,
metadata: Schema.struct({
metadata: Schema.Struct({
publication_date: Temporal.PlainDateSchema,
related_identifiers: Schema.array(
Schema.union(
Schema.struct({
related_identifiers: Schema.Array(
Schema.Union(
Schema.Struct({
identifier: DoiSchema,
relation: Schema.string,
scheme: Schema.literal('doi'),
relation: Schema.String,
scheme: Schema.Literal('doi'),
}),
Schema.struct({
Schema.Struct({
identifier: Url.UrlSchema,
relation: Schema.string,
scheme: Schema.literal('url'),
relation: Schema.String,
scheme: Schema.Literal('url'),
}),
),
),
}),
}),
),
total: Schema.nonNegative()(Schema.number),
total: Schema.nonNegative()(Schema.Number),
}),
})

Expand Down

0 comments on commit 91f86ed

Please sign in to comment.