Skip to content

Commit

Permalink
moved to common
Browse files Browse the repository at this point in the history
  • Loading branch information
artembuslaev committed Apr 6, 2023
1 parent bf85254 commit 0b3596e
Show file tree
Hide file tree
Showing 175 changed files with 385 additions and 12,066 deletions.
1 change: 1 addition & 0 deletions common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"author": "Envision Blockchain Solutions <info@envisionblockchain.com>",
"dependencies": {
"@guardian/interfaces": "^2.11.0",
"@mattrglobal/jsonld-signatures-bbs": "^1.1.2",
"@mikro-orm/core": "~5.3.0",
"@mikro-orm/migrations-mongodb": "~5.3.0",
"@mikro-orm/mongodb": "~5.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import {
Topic as TopicCollection,
DryRun,
PolicyRoles as PolicyRolesCollection,
BaseEntity,
DataBaseHelper,
PolicyInvitations,
MultiDocuments,
Artifact as ArtifactCollection,
Expand All @@ -22,14 +20,16 @@ import {
MultiPolicy,
MultiPolicyTransaction,
PolicyModule,
} from '@guardian/common';
} from '../entity';
import { Binary } from 'bson';
import {
GenerateUUIDv4,
IVC,
SchemaEntity,
TopicType,
} from '@guardian/interfaces';
import { BaseEntity } from '../models';
import { DataBaseHelper } from '../helpers';

/**
* Database server
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {VcHelper} from '@helpers/vc-helper';
import {Users} from '../users';
import {Wallet} from '../wallet';
import { Users, VcHelper, Wallet } from '../helpers';

/**
* Service injector
Expand All @@ -9,8 +7,11 @@ export function Inject(): any {
return (target: any, key: string, value) => {
const _RegisteredInjections = [Wallet, Users, VcHelper];

const injClass = _RegisteredInjections.find(item => {
return new item() instanceof Reflect.getMetadata('design:type', target, key);
const injClass = _RegisteredInjections.find((item) => {
return (
new item() instanceof
Reflect.getMetadata('design:type', target, key)
);
});

if (delete target[key]) {
Expand All @@ -19,8 +20,8 @@ export function Inject(): any {
return new injClass();
},
enumerable: true,
configurable: true
configurable: true,
});
}
}
};
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DataBaseHelper, Schema } from '@guardian/common';
import { DataBaseHelper } from '../helpers';
import { ISchema } from '@guardian/interfaces';
import { DocumentLoader, IDocumentFormat } from '@hedera-modules';
import { Schema } from '../entity';
import { DocumentLoader, IDocumentFormat } from '../hedera-modules';

/**
* Schema Documents Loader.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DataBaseHelper, DidDocument } from '@guardian/common';
import { DidRootKey, DocumentLoader, IDocumentFormat } from '@hedera-modules';
import { DataBaseHelper } from '../helpers';
import { DidDocument } from '../entity';
import { DidRootKey, DocumentLoader, IDocumentFormat } from '../hedera-modules';

/**
* DID Documents Loader
Expand Down
5 changes: 5 additions & 0 deletions common/src/document-loader/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './context-loader';
export * from './did-document-loader';
export * from './schema-document-loader';
export * from './subject-schema-loader';
export * from './vc-schema-loader';
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DataBaseHelper, Schema } from '@guardian/common';
import { DocumentLoader, IDocumentFormat } from '@hedera-modules';
import { Schema } from '../entity';
import { DocumentLoader, IDocumentFormat } from '../hedera-modules';
import { DataBaseHelper } from '../helpers';

/**
* Schema Documents Loader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DataBaseHelper, Schema } from '@guardian/common';
import { ISchema } from '@guardian/interfaces';
import { SchemaLoader } from '@hedera-modules';
import { Schema } from '../entity';
import { SchemaLoader } from '../hedera-modules';
import { DataBaseHelper } from '../helpers';

/**
* Subject schema loader
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DataBaseHelper, Schema } from '@guardian/common';
import { ISchema } from '@guardian/interfaces';
import { SchemaLoader } from '@hedera-modules';
import { Schema } from '../entity';
import { SchemaLoader } from '../hedera-modules';
import { DataBaseHelper } from '../helpers';

/**
* VC schema loader
Expand Down
51 changes: 0 additions & 51 deletions common/src/entity/index.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
import { AggregateVC } from './aggregate-documents';
import { ApprovalDocument } from './approval-document';
import { Artifact } from './artifact';
import { ArtifactChunk } from './artifact-chunk';
import { BlockState } from './block-state';
import { Contract } from './contract';
import { DidDocument } from './did-document';
import { DocumentState } from './document-state';
import { DryRun } from './dry-run';
import { PolicyModule } from './module';
import { MultiDocuments } from './multi-documents';
import { MultiPolicy } from './multi-policy';
import { MultiPolicyTransaction } from './multi-policy-transaction';
import { Policy } from './policy';
import { PolicyInvitations } from './policy-invitations';
import { PolicyRoles } from './policy-roles';
import { RetireRequest } from './retire-request';
import { Schema } from './schema';
import { Settings } from './settings';
import { SplitDocuments } from './split-documents';
import { Token } from './token';
import { Topic } from './topic';
import { VcDocument } from './vc-document';
import { VpDocument } from './vp-document';

export * from './aggregate-documents';
export * from './approval-document';
export * from './artifact-chunk';
Expand All @@ -47,29 +22,3 @@ export * from './token';
export * from './topic';
export * from './vc-document';
export * from './vp-document';
export const entities = [
AggregateVC,
ApprovalDocument,
ArtifactChunk,
Artifact,
BlockState,
Contract,
DidDocument,
DocumentState,
DryRun,
PolicyModule,
MultiDocuments,
MultiPolicyTransaction,
MultiPolicy,
PolicyInvitations,
PolicyRoles,
Policy,
RetireRequest,
Schema,
Settings,
SplitDocuments,
Token,
Topic,
VcDocument,
VpDocument,
];
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export { timeout } from './utils';
export { Message, MessageStatus } from './message/message';
export { VcDocument } from './vcjs/vc-document';
export { VcDocument as VcDocumentDefinition } from './vcjs/vc-document';
export { VcSubject } from './vcjs/vc-subject';
export { VpDocument } from './vcjs/vp-document';
export { VpDocument as VpDocumentDefinition } from './vcjs/vp-document';
export { VCJS } from './vcjs/vcjs';
export { DIDMessage } from './message/did-message';
export { SchemaMessage } from './message/schema-message';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { IURL } from './url.interface';
import { MessageAction } from './message-action';
import { MessageType } from './message-type';
import { DidMessageBody } from './message-body.interface';
import { IPFS } from '@helpers/ipfs';
import { Hashing } from '../hashing';
import { IPFS } from '../../helpers';

/**
* DID message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export interface DidMessageBody extends MessageBody {
* URI
*/
uri: string;
/**
* Relationships
*/
relationships?: string[];
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@ import {
PrivateKey,
TopicId,
} from '@hashgraph/sdk';
import { IPFS } from '@helpers/ipfs';
import { Message } from './message';
import { MessageType } from './message-type';
import { VCMessage } from './vc-message';
import { DIDMessage } from './did-message';
import { Logger } from '@guardian/common';
import { IPFS, Logger, Workers } from '../../helpers';
import { PolicyMessage } from './policy-message';
import { SchemaMessage } from './schema-message';
import { MessageAction } from './message-action';
import { VPMessage } from './vp-message';
import { TransactionLogger } from '../transaction-logger';
import { GenerateUUIDv4, WorkerTaskType } from '@guardian/interfaces';
import { DatabaseServer } from '@database-modules';
import { Workers } from '@helpers/workers';
import { Environment } from '../environment';
import { MessageMemo } from '../memo-mappings/message-memo';
import { RegistrationMessage } from './registration-message';
import { TopicMessage } from './topic-message';
import { TopicConfig } from 'hedera-modules/topic';
import { TopicConfig } from '../../hedera-modules';
import { TokenMessage } from './token-message';
import { ModuleMessage } from './module-message';
import { DatabaseServer } from '../../database-modules';

/**
* Message server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Message } from './message';
import { IURL, UrlType } from './url.interface';
import { MessageAction } from './message-action';
import { MessageType } from './message-type';
import { IPFS } from '@helpers/ipfs';
import { PolicyModule } from '@guardian/common';
import { PolicyModule } from '../../entity';
import { ModuleMessageBody } from './message-body.interface';
import { IPFS } from '../../helpers';

/**
* Module message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Policy } from '@guardian/common';
import { Policy } from '../../entity';
import { Message } from './message';
import { IURL, UrlType } from './url.interface';
import { MessageAction } from './message-action';
import { MessageType } from './message-type';
import { PolicyMessageBody } from './message-body.interface';
import { IPFS } from '@helpers/ipfs';
import { IPFS } from '../../helpers';

/**
* Policy message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Schema } from '@guardian/common';
import { Schema } from '../../entity';
import { Message } from './message';
import { IURL, UrlType } from './url.interface';
import { MessageAction } from './message-action';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { IURL } from './url.interface';
import { MessageAction } from './message-action';
import { MessageType } from './message-type';
import { SynchronizationMessageBody } from './message-body.interface';
import { MultiPolicy } from '@guardian/common';
import { MultiPolicy } from '../../entity';

/**
* Synchronization message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { IURL, UrlType } from './url.interface';
import { MessageAction } from './message-action';
import { MessageType } from './message-type';
import { VcMessageBody } from './message-body.interface';
import { IPFS } from '@helpers/ipfs';
import { Hashing } from '../hashing';
import { SignatureType } from '@guardian/interfaces';
import {
Expand All @@ -15,6 +14,7 @@ import {
utf8ToBytes,
} from '@meeco/cryppo';
import { SerializationFormat } from '@meeco/cryppo/dist/src/serialization-versions';
import { IPFS } from '../../helpers';

/**
* VC message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { IURL, UrlType } from './url.interface';
import { MessageAction } from './message-action';
import { MessageType } from './message-type';
import { VpMessageBody } from './message-body.interface';
import { IPFS } from '@helpers/ipfs';
import { Hashing } from '../hashing';
import { IPFS } from '../../helpers';

/**
* VP message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TopicType, WorkerTaskType } from '@guardian/interfaces';
import { TopicConfig, MessageAction, MessageServer, TopicMessage } from '@hedera-modules';
import { TopicConfig, MessageAction, MessageServer, TopicMessage } from '.';
import { TopicMemo } from './memo-mappings/topic-memo';
import { Workers } from '@helpers/workers';
import { Workers } from '../helpers';

/**
* Topic Helper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Topic } from '@guardian/common';
import { Topic } from '../entity';
import { TopicType } from '@guardian/interfaces';
import { KeyType, Wallet } from '@helpers/wallet';
import { KeyType, Wallet } from '../helpers';

/**
* Topic Config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { WorkerTaskType } from '@guardian/interfaces';
import { Workers } from '@helpers/workers';
import { Logger, MessageResponse, RunFunctionAsync, SettingsContainer } from '@guardian/common';
import { DatabaseServer } from '@database-modules';
import { DatabaseServer } from '../database-modules';
import { Logger, RunFunctionAsync, SettingsContainer, Workers } from '../helpers';
import { MessageResponse } from '../models';

/**
* Transaction log level
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ export class DIDDocument {
* From
* @param did
* @param didRootKey
* @deprecated only for old DID versions
*/
public static from(did: string, didRootKey: PublicKey | string): DIDDocument {
try {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { SchemaLoader, SchemaLoaderFunction } from '../document-loader/schema-lo
import { BBSDidRootKey, DidRootKey } from './did-document';
import { Issuer } from './issuer';
import axios from 'axios';
import { IPFS } from '@helpers/ipfs';
import {
BbsBlsSignature2020, BbsBlsSignatureProof2020, Bls12381G2KeyPair
} from '@mattrglobal/jsonld-signatures-bbs';
import { IPFS } from '../../helpers';

/**
* Suite interface
Expand Down
17 changes: 12 additions & 5 deletions common/src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
export * from './application-state';
export * from './logger';
export * from './db-helper';
export * from './db-naming-strategy';
export * from './do-nothing';
export * from './ipfs';
export * from './logger';
export * from './migration';
export * from './settings-container';
export * from './service-requests-base';
export * from './run-function-async';
export * from './do-nothing';
export * from './schema-converter-utils';
export * from './schemas-to-context';
export * from './service-requests-base';
export * from './settings-container';
export * from './users';
export * from './utils';
export * from './validate-configuration';
export * from './schema-converter-utils';
export * from './vc-helper';
export * from './wallet';
export * from './workers';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MessageBrokerChannel } from '@guardian/common';
import { MessageAPI, WorkerTaskType } from '@guardian/interfaces';
import { Workers } from '@helpers/workers';
import { Workers } from './workers';
import { MessageBrokerChannel } from '../mq';

/**
* IPFS service
Expand Down
Loading

0 comments on commit 0b3596e

Please sign in to comment.