Skip to content

Commit

Permalink
Merge pull request #1 from 2060-io/feat/update-to-credo
Browse files Browse the repository at this point in the history
feat: update to credo-ts
  • Loading branch information
genaris authored Feb 3, 2024
2 parents eefb68e + 7413de5 commit 7df453e
Show file tree
Hide file tree
Showing 19 changed files with 1,189 additions and 183 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ on:
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case:
# "When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other."
concurrency:
group: aries-javascript-receipts${{ github.ref }}-${{ github.repository }}-{{ github.event_name }}
group: credo-ts-receipts${{ github.ref }}-${{ github.repository }}-{{ github.event_name }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-latest
name: Validate
steps:
- name: Checkout aries-javascript-receipts
- name: Checkout credo-ts-receipts
uses: actions/checkout@v3

- name: Get yarn cache directory path
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
name: Release
needs: [validate]
steps:
- name: Checkout aries-javascript-receipts
- name: Checkout credo-ts-receipts
uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ on:
# Ideally we only add this to the 'release' job so it doesn't limit PR runs, but github can't guarantee the job order in that case:
# "When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other."
concurrency:
group: aries-javascript-receipts${{ github.ref }}-${{ github.repository }}-{{ github.event_name }}
group: credo-ts-receipts${{ github.ref }}-${{ github.repository }}-{{ github.event_name }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-latest
name: Validate
steps:
- name: Checkout aries-javascript-receipts
- name: Checkout credo-ts-receipts
uses: actions/checkout@v3

- name: Get yarn cache directory path
Expand Down Expand Up @@ -56,9 +56,9 @@ jobs:
name: Release
needs: [validate]
# Only run on workflow dispatch to main branch
if: github.ref == 'refs/heads/main' && github.repository == '2060-io/aries-javascript-receipts' && github.event_name == 'workflow_dispatch'
if: github.ref == 'refs/heads/main' && github.repository == '2060-io/credo-ts-receipts' && github.event_name == 'workflow_dispatch'
steps:
- name: Checkout aries-javascript-receipts
- name: Checkout credo-ts-receipts
uses: actions/checkout@v2
with:
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This module is used to provide an Aries Agent built with Aries Framework JavaScr
It's conceived as an extension module for Aries Framework JavaScript which can be injected to an existing agent instance:

```ts
import { ReceiptsModule } from 'aries-javascript-receipts'
import { ReceiptsModule } from 'credo-ts-receipts'

const agent = new Agent({
config: {
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "aries-framework-receipts",
"version": "0.0.0",
"description": "Message Receipts protocol implementation for @aries-framework/core",
"description": "Message Receipts protocol implementation for @credo-ts/core",
"author": "2060.io",
"homepage": "https://github.com/2060-io/aries-javascript-receipts",
"homepage": "https://github.com/2060-io/credo-ts-receipts",
"license": "ISC",
"main": "build/index.js",
"types": "build/index.js",
Expand All @@ -23,21 +23,21 @@
},
"repository": {
"type": "git",
"url": "https://github.com/2060-io/aries-javascript-receipts"
"url": "https://github.com/2060-io/credo-ts-receipts"
},
"bugs": {
"url": "https://github.com/2060-io/aries-javascript-receipts/issues"
"url": "https://github.com/2060-io/credo-ts-receipts/issues"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
"@aries-framework/askar": "^0.4.0",
"@aries-framework/node": "^0.4.0",
"@hyperledger/aries-askar-nodejs": "^0.1.0",
"@credo-ts/askar": "^0.5.0-alpha.116",
"@credo-ts/node": "^0.5.0-alpha.116",
"@hyperledger/aries-askar-nodejs": "^0.2.0-dev.6",
"@types/jest": "^26.0.23",
"@types/node": "^16.11.7",
"@types/node": "^20.11.16",
"@types/node-fetch": "^2.6.4",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.48.1",
Expand All @@ -51,17 +51,14 @@
"typescript": "~4.9.4"
},
"dependencies": {
"@aries-framework/core": "^0.4.0",
"@credo-ts/core": "^0.5.0-alpha.116",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"class-validator": "^0.14.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.2.0",
"tsyringe": "^4.7.0",
"tsyringe": "^4.8.0",
"uuid": "^9.0.0"
},
"resolutions": {
"ref-napi": "npm:@2060.io/ref-napi"
},
"release-it": {
"github": {
"release": true
Expand All @@ -78,5 +75,8 @@
"tagAnnotation": "${version}",
"requireBranch": "main"
}
},
"resolutions": {
"@hyperledger/aries-askar-nodejs": "0.2.0-dev.6"
}
}
8 changes: 4 additions & 4 deletions src/ReceiptsApi.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
AriesFrameworkError,
CredoError,
ConnectionService,
injectable,
MessageSender,
AgentContext,
OutboundMessageContext,
} from '@aries-framework/core'
} from '@credo-ts/core'
import { MessageReceiptsHandler, RequestReceiptsHandler } from './handlers'
import { MessageReceipt, MessageReceiptOptions, RequestedReceipt, RequestedReceiptOptions } from './messages'
import { ReceiptsService } from './services'
Expand Down Expand Up @@ -37,7 +37,7 @@ export class ReceiptsApi {
const connection = await this.connectionService.findById(this.agentContext, options.connectionId)

if (!connection) {
throw new AriesFrameworkError(`Connection not found with id ${options.connectionId}`)
throw new CredoError(`Connection not found with id ${options.connectionId}`)
}

const message = await this.receiptsService.createReceiptsMessage({
Expand All @@ -53,7 +53,7 @@ export class ReceiptsApi {
const connection = await this.connectionService.findById(this.agentContext, options.connectionId)

if (!connection) {
throw new AriesFrameworkError(`Connection not found with id ${options.connectionId}`)
throw new CredoError(`Connection not found with id ${options.connectionId}`)
}

const message = await this.receiptsService.createRequestReceiptsMessage({
Expand Down
4 changes: 2 additions & 2 deletions src/ReceiptsModule.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DependencyManager, FeatureRegistry, Module } from '@aries-framework/core'
import type { DependencyManager, FeatureRegistry, Module } from '@credo-ts/core'

import { Protocol } from '@aries-framework/core'
import { Protocol } from '@credo-ts/core'

import { ReceiptsApi } from './ReceiptsApi'
import { ReceiptsService } from './services'
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/MessageReceiptsHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MessageHandler, MessageHandlerInboundMessage } from '@aries-framework/core'
import { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core'
import { MessageReceiptsMessage } from '../messages'
import { ReceiptsService } from '../services'

Expand Down
2 changes: 1 addition & 1 deletion src/handlers/RequestReceiptsHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MessageHandler, MessageHandlerInboundMessage } from '@aries-framework/core'
import { MessageHandler, MessageHandlerInboundMessage } from '@credo-ts/core'
import { RequestReceiptsMessage } from '../messages'
import { ReceiptsService } from '../services'

Expand Down
2 changes: 1 addition & 1 deletion src/messages/MessageReceiptsMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AgentMessage, IsValidMessageType, parseMessageType } from '@aries-framework/core'
import { AgentMessage, IsValidMessageType, parseMessageType } from '@credo-ts/core'
import { IsArray, IsInstance, IsString, IsDate, IsEnum, ValidateNested } from 'class-validator'
import { Expose, Transform, TransformationType, Type } from 'class-transformer'
import { MessageState } from './MessageState'
Expand Down
2 changes: 1 addition & 1 deletion src/messages/RequestReceiptsMessage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AgentMessage, IsValidMessageType, parseMessageType } from '@aries-framework/core'
import { AgentMessage, IsValidMessageType, parseMessageType } from '@credo-ts/core'
import { IsArray, IsInstance, IsString, IsEnum, ValidateNested } from 'class-validator'
import { Expose, Type } from 'class-transformer'
import { MessageState } from './MessageState'
Expand Down
2 changes: 1 addition & 1 deletion src/services/ReceiptsEvents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseEvent } from '@aries-framework/core'
import { BaseEvent } from '@credo-ts/core'
import { MessageReceipt, RequestedReceipt } from '../messages'

export enum ReceiptsEventTypes {
Expand Down
2 changes: 1 addition & 1 deletion src/services/ReceiptsService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Lifecycle, scoped } from 'tsyringe'

import { EventEmitter, MessageHandlerInboundMessage } from '@aries-framework/core'
import { EventEmitter, MessageHandlerInboundMessage } from '@credo-ts/core'
import { MessageReceiptsReceivedEvent, ReceiptsEventTypes, RequestReceiptsReceivedEvent } from './ReceiptsEvents'
import { MessageReceiptsHandler, RequestReceiptsHandler } from '../handlers'
import {
Expand Down
6 changes: 3 additions & 3 deletions test/receipts.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { agentDependencies } from '@aries-framework/node'
import { AskarModule } from '@aries-framework/askar'
import { agentDependencies } from '@credo-ts/node'
import { AskarModule } from '@credo-ts/askar'
import { ariesAskar } from '@hyperledger/aries-askar-nodejs'

import {
Expand All @@ -9,7 +9,7 @@ import {
DidExchangeState,
EncryptedMessage,
LogLevel,
} from '@aries-framework/core'
} from '@credo-ts/core'
import { v4 as uuid } from 'uuid'
import { filter, firstValueFrom, map, Subject, timeout } from 'rxjs'
import { ReceiptsModule } from '../src/ReceiptsModule'
Expand Down
6 changes: 3 additions & 3 deletions test/recordUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import type {
RecordUpdatedEvent,
Agent,
BaseEvent,
} from '@aries-framework/core'
import type { Constructor } from '@aries-framework/core/build/utils/mixins'
} from '@credo-ts/core'
import type { Constructor } from '@credo-ts/core/build/utils/mixins'

import { RepositoryEventTypes } from '@aries-framework/core'
import { RepositoryEventTypes } from '@credo-ts/core'
import { map, filter, pipe } from 'rxjs'

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
2 changes: 1 addition & 1 deletion test/transport/SubjectInboundTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
TransportService,
TransportSession,
utils,
} from '@aries-framework/core'
} from '@credo-ts/core'
import type { Subscription } from 'rxjs'

import { Subject } from 'rxjs'
Expand Down
8 changes: 4 additions & 4 deletions test/transport/SubjectOutboundTransport.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { SubjectMessage } from './SubjectInboundTransport'
import type { OutboundPackage, OutboundTransport, Agent, Logger } from '@aries-framework/core'
import type { OutboundPackage, OutboundTransport, Agent, Logger } from '@credo-ts/core'

import { takeUntil, Subject, take } from 'rxjs'

import { MessageReceiver, InjectionSymbols, AriesFrameworkError } from '@aries-framework/core'
import { MessageReceiver, InjectionSymbols, CredoError } from '@credo-ts/core'

export class SubjectOutboundTransport implements OutboundTransport {
private logger!: Logger
Expand Down Expand Up @@ -36,13 +36,13 @@ export class SubjectOutboundTransport implements OutboundTransport {
const { payload, endpoint } = outboundPackage

if (!endpoint) {
throw new AriesFrameworkError('Cannot send message to subject without endpoint')
throw new CredoError('Cannot send message to subject without endpoint')
}

const subject = this.subjectMap[endpoint]

if (!subject) {
throw new AriesFrameworkError(`No subject found for endpoint ${endpoint}`)
throw new CredoError(`No subject found for endpoint ${endpoint}`)
}

// Create a replySubject just for this session. Both ends will be able to close it,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"aries-javascript-media-sharing/*": ["src"]
"credo-ts-media-sharing/*": ["src"]
}
},
"include": ["packages", "./.eslintrc.js", "./jest.config.ts", "./jest.config.base.ts", "types", "test", "samples"],
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"aries-javascript-receipts/*": ["src"]
"credo-ts-receipts/*": ["src"]
},
"types": ["jest", "node"],
"watch": true
Expand Down
Loading

0 comments on commit 7df453e

Please sign in to comment.