Skip to content

Commit

Permalink
package use tsconfig moduleResolution=NodeNext
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo committed Dec 12, 2023
1 parent af9d463 commit 8677f2f
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 33 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion packages/core/src/client/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link, URI, UnknownLink, Block } from '@ucanto/client'
import * as Assert from '../capability/assert'
import * as Assert from '../capability/assert.js'

/** A verifiable claim about data. */
export interface ContentClaim<T extends string> {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const serviceURL = new URL('https://claims.web3.storage')
/** @type {import('@ucanto/interface').Principal} */
export const servicePrincipal = { did: () => 'did:web:claims.web3.storage' }

/** @type {import('@ucanto/interface').ConnectionView<import('../server/service/api').Service>} */
/** @type {import('@ucanto/interface').ConnectionView<import('../server/service/api.js').Service>} */
export const connection = connect({
id: servicePrincipal,
codec: CAR.outbound,
Expand All @@ -23,7 +23,7 @@ export { connect, invoke, delegate, CAR, HTTP }

/**
* @param {Uint8Array} bytes
* @returns {Promise<import('./api').Claim>}
* @returns {Promise<import('./api.js').Claim>}
*/
export const decode = async bytes => {
const delegation = await extractDelegation(bytes)
Expand Down Expand Up @@ -79,14 +79,14 @@ export const fetch = async (content, options) => {
*
* @param {import('@ucanto/client').UnknownLink} content
* @param {FetchOptions} [options]
* @returns {Promise<import('./api').Claim[]>}
* @returns {Promise<import('./api.js').Claim[]>}
*/
export const read = async (content, options) => {
const res = await fetch(content, options)
if (!res.ok) throw new Error(`unexpected service status: ${res.status}`, { cause: await res.text() })
if (!res.body) throw new Error('missing response body')

/** @type {import('./api').Claim[]} */
/** @type {import('./api.js').Claim[]} */
const claims = []
try {
await res.body
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/server/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as Server from '@ucanto/server'
import { createService } from './service/index.js'

/** @typedef {import('@ucanto/interface').ServerView<import('./service/api').Service>} Server */
/** @typedef {import('@ucanto/interface').ServerView<import('./service/api.js').Service>} Server */

/**
* @param {import('./service/api').ServiceContext & {
* @param {import('./service/api.js').ServiceContext & {
* id: import('@ucanto/server').Signer
* codec: import('@ucanto/server').InboundCodec
* validateAuthorization: import('@ucanto/interface').RevocationChecker['validateAuthorization']
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/server/service/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as Server from '@ucanto/server'
import * as Assert from '../../capability/assert.js'

/**
* @param {import('./api').AssertServiceContext} context
* @returns {import('./api').AssertService}
* @param {import('./api.js').AssertServiceContext} context
* @returns {import('./api.js').AssertService}
*/
export function createService (context) {
return {
Expand All @@ -17,9 +17,9 @@ export function createService (context) {

/**
* @param {object} config
* @param {import('./api').AnyAssertCap} config.capability
* @param {import('./api.js').AnyAssertCap} config.capability
* @param {import('@ucanto/interface').Invocation} config.invocation
* @param {import('./api').AssertServiceContext} context
* @param {import('./api.js').AssertServiceContext} context
* @returns {Promise<import('@ucanto/server').Result<{}, import('@ucanto/server').Failure>>}
*/
export const handler = async ({ capability, invocation }, { claimStore }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/server/service/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createService as createAssertService } from './assert.js'

/**
* @param {import('./api').ServiceContext} context
* @returns {import('./api').Service}
* @param {import('./api.js').ServiceContext} context
* @returns {import('./api.js').Service}
*/
export const createService = context => ({
assert: createAssertService(context)
Expand Down
4 changes: 2 additions & 2 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"checkJs": true,
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"skipLibCheck": true,
"resolveJsonModule": true,
"lib": ["ES2022", "DOM"],
"target": "ES2022",
"module": "ESNext"
}
}
3 changes: 2 additions & 1 deletion packages/lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"@ucanto/principal": "^9.0.0",
"@ucanto/server": "^9.0.1",
"@ucanto/transport": "^9.0.0",
"carstream": "^1.0.2",
"cardex": "^2.3.2",
"carstream": "^1.1.1",
"multiformats": "^12.0.1",
"p-retry": "^5.1.2",
"uint8arrays": "^4.0.4",
Expand Down
14 changes: 7 additions & 7 deletions packages/lambda/src/lib/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export { BlockIndexClaimFetcher } from './block-index.js'

/** @implements {ClaimStore} */
export class ClaimStorage {
/** @type {import('./dynamo-table').DynamoTable} */
/** @type {import('./dynamo-table.js').DynamoTable} */
#table
/** @type {import('./s3-bucket').S3Bucket} */
/** @type {import('./s3-bucket.js').S3Bucket} */
#bucket

/**
* @param {{
* table: import('./dynamo-table').DynamoTable
* bucket: import('./s3-bucket').S3Bucket
* table: import('./dynamo-table.js').DynamoTable
* bucket: import('./s3-bucket.js').S3Bucket
* }} config
*/
constructor ({ table, bucket }) {
Expand Down Expand Up @@ -85,7 +85,7 @@ export class ClaimStorage {

/**
* @param {import('@web3-storage/content-claims/server/api').Claim} claim
* @param {import('./s3-bucket').S3Bucket} s3
* @param {import('./s3-bucket.js').S3Bucket} s3
**/
async function storeClaimBytes ({ claim, bytes }, { bucketName, s3Client }) {
const cidstr = claim.toString(base32)
Expand All @@ -105,7 +105,7 @@ async function storeClaimBytes ({ claim, bytes }, { bucketName, s3Client }) {

/**
* @param {import('@web3-storage/content-claims/server/api').Claim} claim
* @param {import('./dynamo-table').DynamoTable} dynamo
* @param {import('./dynamo-table.js').DynamoTable} dynamo
*/
async function upsertClaim ({ claim, content, expiration }, { tableName, dynamoClient }) {
const hasExpiration = expiration && isFinite(expiration)
Expand All @@ -129,7 +129,7 @@ async function upsertClaim ({ claim, content, expiration }, { tableName, dynamoC

/**
* @param {import('@web3-storage/content-claims/server/api').Claim} claim
* @param {import('./dynamo-table').DynamoTable} dynamo
* @param {import('./dynamo-table.js').DynamoTable} dynamo
*/
async function maybeUpsertEquivalentClaim (claim, dynamo) {
const { content, value } = claim
Expand Down
4 changes: 2 additions & 2 deletions packages/lambda/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"checkJs": true,
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"skipLibCheck": true,
"resolveJsonModule": true,
"lib": ["ES2022", "DOM"],
"target": "ES2022",
"module": "es2022",
"baseUrl": ".",
"paths": {
"@web3-storage/content-claims/*": ["../core/src/*"]
Expand Down

0 comments on commit 8677f2f

Please sign in to comment.