Skip to content

Commit

Permalink
fix: export const plugin schemas instead of defaults (#1327)
Browse files Browse the repository at this point in the history
* remove references to the JSON build output for plugin schemas
* export the schemas from each package

relates to #1318 / #1317 / #1315
  • Loading branch information
mirceanis authored Jan 25, 2024
1 parent 71e313f commit 7896cea
Show file tree
Hide file tree
Showing 41 changed files with 94 additions and 168 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@jest/globals": "29.7.0",
"@metamask/eth-sig-util": "7.0.0",
"@microsoft/api-documenter": "7.23.0",
"@microsoft/api-extractor": "7.38.0",
"@microsoft/api-extractor": "7.39.4",
"@microsoft/api-extractor-model": "7.28.0",
"@microsoft/tsdoc": "0.14.2",
"@noble/hashes": "1.3.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"update-veramo-latest": "pnpm add @veramo/core@latest @veramo/discovery@latest @veramo/remote-client@latest @veramo/remote-server@latest @veramo/did-provider-key@latest @veramo/did-resolver@latest @veramo/did-jwt@latest @veramo/credential-w3c@latest @veramo/did-provider-ethr@latest @veramo/did-provider-web@latest @veramo/did-comm@latest @veramo/kms-local@latest @veramo/selective-disclosure@latest @veramo/data-store@latest @veramo/key-manager@latest @veramo/message-handler@latest @veramo/did-manager@latest @veramo/url-handler@latest @veramo/credential-eip712@latest @veramo/utils@latest"
},
"dependencies": {
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/api-extractor-model": "^7.27.5",
"@microsoft/api-extractor": "^7.39.4",
"@microsoft/api-extractor-model": "^7.28.7",
"@transmute/credentials-context": "^0.7.0-unstable.81",
"@types/blessed": "^0.1.22",
"@types/swagger-ui-express": "^4.1.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ dev
interfaces[pluginInterfaceName] = api
}

writeFileSync(resolve(outPutPath), `export default ${JSON.stringify(interfaces, null, 2)}`)
writeFileSync(resolve(outPutPath), `export const schema = ${JSON.stringify(interfaces, null, 2)}`)
})

dev
Expand Down
3 changes: 1 addition & 2 deletions packages/core-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.js"
},
"./build/plugin.schema": "./build/plugin.schema.js"
}
},
"types": "build/index.d.ts",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions packages/core-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*
* @packageDocumentation
*/

export { CoreEvents } from './coreEvents.js'
export * from './agent.js'
export * from './types/IAgent.js'
Expand All @@ -25,3 +26,4 @@ export * from './types/IResolver.js'
export * from './types/IError.js'
export * from './types/IVerifyResult.js'
export * from './types/vc-data-model.js'
export { schema } from './plugin.schema.js'
2 changes: 1 addition & 1 deletion packages/core-types/src/plugin.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
export const schema = {
"IResolver": {
"components": {
"schemas": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"rootDir": "src",
"outDir": "build"
},
"include": ["./**/*.ts", "./src/plugin.schema.json"]
"include": ["./**/*.ts"]
}
2 changes: 1 addition & 1 deletion packages/credential-eip712/src/agent/CredentialEIP712.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
removeDIDParameters,
resolveDidOrThrow,
} from '@veramo/utils'
import schema from '../plugin.schema'
import { schema } from '../plugin.schema.js'

import { recoverTypedSignature, SignTypedDataVersion } from '@metamask/eth-sig-util'
import {
Expand Down
1 change: 1 addition & 0 deletions packages/credential-eip712/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { CredentialIssuerEIP712 } from './agent/CredentialEIP712.js'
export * from './types/ICredentialEIP712.js'
export { schema } from './plugin.schema.js'
2 changes: 1 addition & 1 deletion packages/credential-eip712/src/plugin.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
export const schema = {
"ICredentialIssuerEIP712": {
"components": {
"schemas": {
Expand Down
2 changes: 1 addition & 1 deletion packages/credential-eip712/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
{ "path": "../core-types" },
{ "path": "../utils" }
],
"include": ["./**/*.ts", "./src/plugin.schema.json"]
"include": ["./**/*.ts"]
}
3 changes: 1 addition & 2 deletions packages/credential-ld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"version": "5.6.0",
"main": "build/index.js",
"exports": {
".": "./build/index.js",
"./build/plugin.schema.json": "./build/plugin.schema.json"
".": "./build/index.js"
},
"types": "build/index.d.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/credential-ld/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
VerifiablePresentation,
} from '@veramo/core-types'
import { VeramoLdSignature } from './index.js'
import schema from './plugin.schema.js'
import { schema } from './plugin.schema.js'
import Debug from 'debug'
import { LdContextLoader } from './ld-context-loader.js'
import {
Expand Down
3 changes: 2 additions & 1 deletion packages/credential-ld/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export { VeramoLdSignature } from './ld-suites.js'
export * from './suites/EcdsaSecp256k1RecoverySignature2020.js'
export * from './suites/Ed25519Signature2018.js'
export * from './suites/Ed25519Signature2020.js'
export * from './suites/JsonWebSignature2020.js'
export * from './suites/JsonWebSignature2020.js'
export { schema } from './plugin.schema.js'
2 changes: 1 addition & 1 deletion packages/credential-ld/src/plugin.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
export const schema = {
"ICredentialIssuerLD": {
"components": {
"schemas": {
Expand Down
3 changes: 1 addition & 2 deletions packages/credential-w3c/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"version": "5.6.0",
"main": "build/index.js",
"exports": {
".": "./build/index.js",
"./build/plugin.schema.json": "./build/plugin.schema.json"
".": "./build/index.js"
},
"types": "build/index.d.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/credential-w3c/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
W3CVerifiablePresentation,
} from '@veramo/core-types'

import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'

import {
createVerifiableCredentialJwt,
Expand Down
2 changes: 1 addition & 1 deletion packages/credential-w3c/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
{ "path": "../message-handler" },
{ "path": "../utils" }
],
"include": ["./**/*.ts", "./src/plugin.schema.json"]
"include": ["./**/*.ts"]
}
2 changes: 1 addition & 1 deletion packages/data-store-json/src/data-store-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
VerifiablePresentation,
W3CVerifiableCredential,
} from '@veramo/core-types'
import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'
import { asArray, computeEntryHash, extractIssuer } from '@veramo/utils'
import { deserialize, serialize } from '@ungap/structured-clone'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/data-store/src/data-store-orm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
UniqueVerifiablePresentation,
Where,
} from '@veramo/core-types'
import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'
import { createMessage, Message } from './entities/message.js'
import { Claim } from './entities/claim.js'
import { Credential } from './entities/credential.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/data-store/src/data-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
VerifiableCredential,
VerifiablePresentation,
} from '@veramo/core-types'
import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'
import { createMessage, createMessageEntity, Message } from './entities/message.js'
import { createCredentialEntity, Credential } from './entities/credential.js'
import { Claim } from './entities/claim.js'
Expand Down
3 changes: 1 addition & 2 deletions packages/did-comm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"version": "5.6.0",
"main": "build/index.js",
"exports": {
".": "./build/index.js",
"./build/plugin.schema.json": "./build/plugin.schema.json"
".": "./build/index.js"
},
"types": "build/index.d.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/did-comm/src/didcomm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import {
xc20pAuthEncrypterEcdh1PuV3x25519WithXC20PKW,
} from './encryption/xc20pkw-encrypters.js'

import schema from './plugin.schema.js'
import { schema } from './plugin.schema.js'

import { v4 as uuidv4 } from 'uuid'

Expand Down
2 changes: 1 addition & 1 deletion packages/did-comm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export * from './types/IDIDComm.js'
export { DIDCommMessageHandler } from './message-handler.js'
export * from './protocols/index.js'
export * from './transports/transports.js'

export { schema } from './plugin.schema.js'
2 changes: 1 addition & 1 deletion packages/did-comm/src/plugin.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
export const schema = {
"IDIDComm": {
"components": {
"schemas": {
Expand Down
2 changes: 1 addition & 1 deletion packages/did-comm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"path": "../utils"
}
],
"include": ["./**/*.ts", "./src/plugin.schema.json"]
"include": ["./**/*.ts"]
}
3 changes: 1 addition & 2 deletions packages/did-discovery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"version": "5.6.0",
"main": "build/index.js",
"exports": {
".": "./build/index.js",
"./build/plugin.schema.json": "./build/plugin.schema.json"
".": "./build/index.js"
},
"types": "build/index.d.ts",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion packages/did-discovery/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {
IDIDDiscoveryDiscoverDidResult,
} from './types'
import { AbstractDidDiscoveryProvider } from './abstract-did-discovery-provider.js'
import schema from './plugin.schema.js'
import { schema } from './plugin.schema.js'
import Debug from 'debug'

const debug = Debug('veramo:did-discovery')

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/did-discovery/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
*/
export { DIDDiscovery } from './action-handler.js'
export { AbstractDidDiscoveryProvider } from './abstract-did-discovery-provider.js'
export * from './types.js'
export * from './types.js'
export { schema } from './plugin.schema.js'
2 changes: 1 addition & 1 deletion packages/did-discovery/src/plugin.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
export const schema = {
"IDIDDiscovery": {
"components": {
"schemas": {
Expand Down
2 changes: 1 addition & 1 deletion packages/did-discovery/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"declarationDir": "build",
},
"references": [{ "path": "../core-types" }],
"include": ["./**/*.ts", "./src/plugin.schema.json"]
"include": ["./**/*.ts"]
}
2 changes: 1 addition & 1 deletion packages/did-manager/src/id-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
IKey,
IService,
} from '@veramo/core-types'
import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'
import { AbstractDIDStore } from './abstract-identifier-store.js'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/did-resolver/src/resolver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DIDDocumentSection, IAgentPlugin, IResolver } from '@veramo/core-types'
import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'
import { isDefined } from '@veramo/utils'
import {
DIDDocument,
Expand Down
2 changes: 1 addition & 1 deletion packages/key-manager/src/key-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
MinimalImportableKey,
TKeyType,
} from '@veramo/core-types'
import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'
import * as u8a from 'uint8arrays'
import { createAnonDecrypter, createAnonEncrypter, createJWE, decryptJWE, type ECDH, type JWE } from 'did-jwt'
import { convertEd25519PublicKeyToX25519 } from '@veramo/utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/message-handler/src/message-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
CoreEvents,
IMessage,
} from '@veramo/core-types'
import schema from '@veramo/core-types/build/plugin.schema'
import { schema } from '@veramo/core-types'
import { Message } from './message.js'
import { AbstractMessageHandler } from './abstract-message-handler.js'

Expand Down
3 changes: 1 addition & 2 deletions packages/selective-disclosure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"version": "5.6.0",
"main": "build/index.js",
"exports": {
".": "./build/index.js",
"./build/plugin.schema.json": "./build/plugin.schema.json"
".": "./build/index.js"
},
"types": "build/index.d.ts",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/selective-disclosure/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
ISelectiveDisclosureRequest,
IValidatePresentationAgainstSdrArgs,
} from './types.js'
import schema from './plugin.schema.js'
import { schema } from './plugin.schema.js'
import { createJWT } from 'did-jwt'
import Debug from 'debug'
import {
Expand Down
3 changes: 2 additions & 1 deletion packages/selective-disclosure/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
*/
export { SdrMessageHandler, MessageTypes } from './message-handler.js'
export { SelectiveDisclosure } from './action-handler.js'
export * from './types.js'
export * from './types.js'
export { schema } from './plugin.schema.js'
2 changes: 1 addition & 1 deletion packages/selective-disclosure/src/plugin.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
export const schema = {
"ISelectiveDisclosure": {
"components": {
"schemas": {
Expand Down
2 changes: 1 addition & 1 deletion packages/selective-disclosure/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"path": "../utils"
}
],
"include": ["./**/*.ts", "./src/plugin.schema.json"]
"include": ["./**/*.ts"]
}
Loading

0 comments on commit 7896cea

Please sign in to comment.