Comparing version 3.1.4-beta.2 to 3.1.5-beta.11
@@ -12,2 +12,1 @@ import { Action } from '../types'; | ||
} | ||
//# sourceMappingURL=action-handler.d.ts.map |
@@ -11,3 +11,3 @@ /// <reference types="node" /> | ||
import { Action } from './types'; | ||
import { Message } from './entities/message'; | ||
import { Message } from './message/message'; | ||
export declare const EventTypes: { | ||
@@ -23,4 +23,4 @@ validatedMessage: string; | ||
identityProviders: AbstractIdentityProvider[]; | ||
serviceControllers?: ServiceControllerDerived[]; | ||
messageValidator?: MessageValidator; | ||
serviceControllers: ServiceControllerDerived[]; | ||
messageValidator: MessageValidator; | ||
actionHandler?: ActionHandler; | ||
@@ -32,3 +32,3 @@ } | ||
private serviceManager; | ||
private messageValidator?; | ||
private messageValidator; | ||
private actionHandler?; | ||
@@ -41,10 +41,4 @@ constructor(config: Config); | ||
validateMessage(message: Message): Promise<Message>; | ||
saveNewMessage(input: { | ||
raw: string; | ||
metaDataType?: string; | ||
metaDataValue?: string; | ||
}): Promise<Message>; | ||
handleAction(action: Action): Promise<any>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=core.d.ts.map |
@@ -70,3 +70,2 @@ "use strict"; | ||
var abstract_message_validator_1 = require("./message/abstract-message-validator"); | ||
var message_1 = require("./entities/message"); | ||
var debug_1 = __importDefault(require("debug")); | ||
@@ -87,3 +86,3 @@ var debug = debug_1.default('daf:core'); | ||
_this.serviceManager = new service_manager_1.ServiceManager({ | ||
controllers: config.serviceControllers || [], | ||
controllers: config.serviceControllers, | ||
didResolver: _this.didResolver, | ||
@@ -186,5 +185,3 @@ }); | ||
case 0: | ||
if (!this.messageValidator) { | ||
return [2 /*return*/, Promise.reject('Message validator not provided')]; | ||
} | ||
debug('Raw message %O', message); | ||
_a.label = 1; | ||
@@ -197,3 +194,2 @@ case 1: | ||
if (validatedMessage.isValid()) { | ||
debug('Emitting event', exports.EventTypes.validatedMessage); | ||
this.emit(exports.EventTypes.validatedMessage, validatedMessage); | ||
@@ -205,3 +201,2 @@ return [2 /*return*/, validatedMessage]; | ||
error_1 = _a.sent(); | ||
debug('Emitting event', exports.EventTypes.error); | ||
this.emit(exports.EventTypes.error, error_1, message); | ||
@@ -214,38 +209,12 @@ return [2 /*return*/, Promise.reject(error_1)]; | ||
}; | ||
Core.prototype.saveNewMessage = function (input) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var message, error_2; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 3, , 4]); | ||
return [4 /*yield*/, this.validateMessage(new message_1.Message({ | ||
raw: input.raw, | ||
meta: { | ||
type: input.metaDataType, | ||
value: input.metaDataValue | ||
} | ||
}))]; | ||
case 1: | ||
message = _a.sent(); | ||
return [4 /*yield*/, message.save()]; | ||
case 2: | ||
_a.sent(); | ||
return [2 /*return*/, message]; | ||
case 3: | ||
error_2 = _a.sent(); | ||
this.emit(exports.EventTypes.error, error_2); | ||
return [2 /*return*/, Promise.reject(error_2)]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Core.prototype.handleAction = function (action) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (!this.actionHandler) { | ||
return [2 /*return*/, Promise.reject('Action handler not provided')]; | ||
if (this.actionHandler) { | ||
return [2 /*return*/, this.actionHandler.handleAction(action, this)]; | ||
} | ||
return [2 /*return*/, this.actionHandler.handleAction(action, this)]; | ||
else { | ||
return [2 /*return*/, Promise.reject('No action handler')]; | ||
} | ||
return [2 /*return*/]; | ||
}); | ||
@@ -252,0 +221,0 @@ }); |
@@ -1,2 +0,1 @@ | ||
export declare const baseTypeDefs = "\n type Query \n\n type Mutation \n\n type Identity {\n did: ID!\n provider: String\n }\n\n"; | ||
//# sourceMappingURL=graphql-base-type-defs.d.ts.map | ||
export declare const baseTypeDefs = "\n type Query \n\n type Mutation \n \n type Identity {\n did: ID!\n }\n \n type Message {\n id: ID!\n threadId: String\n rowId: String!\n type: String!\n sender: Identity\n receiver: Identity\n raw: String!\n data: String\n timestamp: Int\n metaData: [MessageMetaData]\n thread: [Message]\n }\n\n type MessageMetaData {\n type: String!\n id: String\n data: String\n }\n \n"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.baseTypeDefs = "\n type Query \n\n type Mutation \n\n type Identity {\n did: ID!\n provider: String\n }\n\n"; | ||
exports.baseTypeDefs = "\n type Query \n\n type Mutation \n \n type Identity {\n did: ID!\n }\n \n type Message {\n id: ID!\n threadId: String\n rowId: String!\n type: String!\n sender: Identity\n receiver: Identity\n raw: String!\n data: String\n timestamp: Int\n metaData: [MessageMetaData]\n thread: [Message]\n }\n\n type MessageMetaData {\n type: String!\n id: String\n data: String\n }\n \n"; | ||
//# sourceMappingURL=graphql-base-type-defs.js.map |
import { Core } from '../core'; | ||
import { Message } from '../entities/message'; | ||
import { Presentation } from '../entities/presentation'; | ||
import { Credential } from '../entities/credential'; | ||
import { Claim } from '../entities/claim'; | ||
import { Identity } from '../entities/identity'; | ||
export interface Context { | ||
import { LastMessageTimestampForInstance } from '../service/service-manager'; | ||
import { Message } from '../message/message'; | ||
interface Context { | ||
core: Core; | ||
} | ||
export interface FindOptions { | ||
take?: number; | ||
skip?: number; | ||
} | ||
export declare const resolvers: { | ||
Query: { | ||
serviceMessagesSince: (_: any, args: { | ||
ts: LastMessageTimestampForInstance[]; | ||
}, ctx: Context) => Promise<{ | ||
id: any; | ||
data: string; | ||
raw: string; | ||
metaData: import("../message/message").MetaData[]; | ||
type: string | null; | ||
threadId: string | null; | ||
sender: string | null; | ||
receiver: string | null; | ||
timestamp: number | null; | ||
vc?: any; | ||
}[]>; | ||
}; | ||
Mutation: { | ||
saveNewMessage: (_: any, args: { | ||
newMessage: (_: any, args: { | ||
raw: string; | ||
metaDataType?: string; | ||
metaDataValue?: string; | ||
sourceType: string; | ||
sourceId?: string | undefined; | ||
}, ctx: Context) => Promise<Message>; | ||
}; | ||
Query: { | ||
identity: (_: any, { did }: { | ||
did: any; | ||
}) => Promise<Identity>; | ||
identities: (_: any, { input }: { | ||
input: any; | ||
}) => Promise<Identity[]>; | ||
message: (_: any, { id }: { | ||
id: any; | ||
}) => Promise<Message>; | ||
messages: (_: any, { input }: { | ||
input?: { | ||
options?: FindOptions; | ||
from?: string[]; | ||
to?: string[]; | ||
type?: string[]; | ||
threadId?: string[]; | ||
}; | ||
}) => Promise<Message[]>; | ||
presentation: (_: any, { hash }: { | ||
hash: any; | ||
}) => Promise<Presentation>; | ||
presentations: (_: any, { input }: { | ||
input?: { | ||
options?: FindOptions; | ||
issuer?: string[]; | ||
audience?: string[]; | ||
type?: string[]; | ||
context?: string[]; | ||
}; | ||
}) => Promise<Presentation[]>; | ||
credential: (_: any, { hash }: { | ||
hash: any; | ||
}) => Promise<Credential>; | ||
credentials: (_: any, { input }: { | ||
input?: { | ||
options?: FindOptions; | ||
issuer?: string[]; | ||
subject?: string[]; | ||
type?: string[]; | ||
context?: string[]; | ||
}; | ||
}) => Promise<Credential[]>; | ||
claim: (_: any, { hash }: { | ||
hash: any; | ||
}) => Promise<Claim>; | ||
claims: (_: any, { input }: { | ||
input?: { | ||
options?: FindOptions; | ||
issuer?: string[]; | ||
subject?: string[]; | ||
type?: string[]; | ||
value?: string[]; | ||
}; | ||
}) => Promise<Claim[]>; | ||
}; | ||
Identity: { | ||
sentMessages: (identity: Identity) => Promise<Message[]>; | ||
receivedMessages: (identity: Identity) => Promise<Message[]>; | ||
issuedPresentations: (identity: Identity) => Promise<Presentation[]>; | ||
receivedPresentations: (identity: Identity) => Promise<Presentation[]>; | ||
issuedCredentials: (identity: Identity) => Promise<Credential[]>; | ||
receivedCredentials: (identity: Identity) => Promise<Credential[]>; | ||
issuedClaims: (identity: Identity) => Promise<Claim[]>; | ||
receivedClaims: (identity: Identity) => Promise<Claim[]>; | ||
}; | ||
Credential: { | ||
claims: (credential: Credential) => Promise<Claim[]>; | ||
messages: (credential: Credential) => Promise<Message[]>; | ||
presentations: (credential: Credential) => Promise<Presentation[]>; | ||
}; | ||
Presentation: { | ||
credentials: (presentation: Presentation) => Promise<Credential[]>; | ||
messages: (presentation: Presentation) => Promise<Message[]>; | ||
}; | ||
Message: { | ||
presentations: (message: Message) => Promise<Presentation[]>; | ||
credentials: (message: Message) => Promise<Credential[]>; | ||
}; | ||
}; | ||
export declare const typeDefs = "\n\n input FindOptions {\n take: Int\n skip: Int\n }\n\n input IdentitiesInput {\n options: FindOptions\n }\n\n input MessagesInput {\n from: [String]\n to: [String]\n type: [String]\n threadId: [String]\n options: FindOptions\n }\n\n input PresentationsInput {\n issuer: [String]\n audience: [String]\n type: [String]\n context: [String]\n options: FindOptions\n }\n\n input CredentialsInput {\n issuer: [String]\n subject: [String]\n type: [String]\n context: [String]\n options: FindOptions\n }\n\n input ClaimsInput {\n issuer: [ID]\n subject: [ID]\n type: [String]\n value: [String]\n options: FindOptions\n }\n\n extend type Query {\n identity(did: ID!): Identity\n identities(input: IdentitiesInput): [Identity]\n message(id: ID!): Message\n messages(input: MessagesInput): [Message]\n presentation(hash: ID!): Presentation\n presentations(input: PresentationsInput): [Presentation]\n credential(hash: ID!): Credential\n credentials(input: CredentialsInput): [Credential]\n claim(hash: ID!): Claim\n claims(input: ClaimsInput): [Claim]\n }\n\n extend type Mutation {\n saveNewMessage(raw: String!, metaDataType: String, metaDataValue: String): Message\n }\n\n\n extend type Identity {\n sentMessages: [Message]\n receivedMessages: [Message]\n issuedPresentations: [Presentation]\n receivedPresentations: [Presentation]\n issuedCredentials: [Credential]\n receivedCredentials: [Credential]\n issuedClaims: [Claim]\n receivedClaims: [Claim]\n }\n\n scalar Object\n scalar Date\n \n type Message {\n id: ID!\n saveDate: Date!\n updateDate: Date!\n createdAt: Date\n expiresAt: Date\n threadId: String\n type: String!\n raw: String\n data: Object\n replyTo: [String]\n replyUrl: [String]\n from: Identity\n to: Identity\n metaData: [MetaData]\n presentations: [Presentation]\n credentials: [Credential]\n }\n\n type MetaData {\n type: String!\n value: String\n }\n\n type Presentation {\n hash: ID!\n raw: String!\n issuer: Identity!\n audience: Identity!\n issuanceDate: Date!\n expirationDate: Date\n context: [String]\n type: [String]\n credentials: [Credential]\n messages: [Message]\n }\n \n type Credential {\n hash: ID!\n raw: String!\n issuer: Identity!\n subject: Identity!\n issuanceDate: Date!\n expirationDate: Date\n context: [String]\n type: [String]\n credentialSubject: Object\n claims: [Claim]\n presentations: [Presentation]\n messages: [Message]\n }\n\n type Claim {\n hash: ID!\n issuer: Identity!\n subject: Identity!\n credential: Credential!\n type: String!\n value: String!\n isObj: Boolean\n } \n"; | ||
//# sourceMappingURL=graphql-core.d.ts.map | ||
export declare const typeDefs = "\n input LastMessageTimestampForInstance {\n timestamp: Int!\n did: String!\n type: String!\n id: String!\n }\n\n type ServiceMessage {\n id: String!\n threadId: String,\n timestamp: Int,\n sender: String,\n receiver: String,\n type: String,\n raw: String,\n data: String,\n metaData: [MessageMetaData]\n }\n\n extend type Query {\n serviceMessagesSince(ts: [LastMessageTimestampForInstance]!): [ServiceMessage]\n }\n\n extend type Mutation {\n newMessage(raw: String!, sourceType: String!, sourceId: String): Message\n }\n"; | ||
export {}; |
@@ -50,257 +50,37 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var typeorm_1 = require("typeorm"); | ||
var message_1 = require("../entities/message"); | ||
var presentation_1 = require("../entities/presentation"); | ||
var credential_1 = require("../entities/credential"); | ||
var claim_1 = require("../entities/claim"); | ||
var identity_1 = require("../entities/identity"); | ||
var messages = function (_, _a) { | ||
var input = _a.input; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var options; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
options = { | ||
where: {} | ||
}; | ||
if (input === null || input === void 0 ? void 0 : input.from) | ||
options.where['from'] = typeorm_1.In(input.from); | ||
if (input === null || input === void 0 ? void 0 : input.to) | ||
options.where['to'] = typeorm_1.In(input.to); | ||
if (input === null || input === void 0 ? void 0 : input.type) | ||
options.where['type'] = typeorm_1.In(input.type); | ||
if (input === null || input === void 0 ? void 0 : input.threadId) | ||
options.where['threadId'] = typeorm_1.In(input.threadId); | ||
if ((_b = input === null || input === void 0 ? void 0 : input.options) === null || _b === void 0 ? void 0 : _b.skip) | ||
options['skip'] = input.options.skip; | ||
if ((_c = input === null || input === void 0 ? void 0 : input.options) === null || _c === void 0 ? void 0 : _c.take) | ||
options['take'] = input.options.take; | ||
return [2 /*return*/, message_1.Message.find(options)]; | ||
}); | ||
var message_1 = require("../message/message"); | ||
var newMessage = function (_, args, ctx) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, ctx.core.validateMessage(new message_1.Message({ | ||
raw: args.raw, | ||
meta: { | ||
type: args.sourceType, | ||
id: args.sourceId, | ||
}, | ||
}))]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}; | ||
var presentations = function (_, _a) { | ||
var input = _a.input; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var options; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
options = { | ||
where: {} | ||
}; | ||
if (input === null || input === void 0 ? void 0 : input.issuer) | ||
options.where['issuer'] = typeorm_1.In(input.issuer); | ||
if (input === null || input === void 0 ? void 0 : input.audience) | ||
options.where['audience'] = typeorm_1.In(input.audience); | ||
if (input === null || input === void 0 ? void 0 : input.type) | ||
options.where['type'] = typeorm_1.In(input.type); | ||
if (input === null || input === void 0 ? void 0 : input.context) | ||
options.where['context'] = typeorm_1.In(input.context); | ||
if ((_b = input === null || input === void 0 ? void 0 : input.options) === null || _b === void 0 ? void 0 : _b.skip) | ||
options['skip'] = input.options.skip; | ||
if ((_c = input === null || input === void 0 ? void 0 : input.options) === null || _c === void 0 ? void 0 : _c.take) | ||
options['take'] = input.options.take; | ||
return [2 /*return*/, presentation_1.Presentation.find(options)]; | ||
}); | ||
}); }; | ||
var serviceMessagesSince = function (_, args, ctx) { return __awaiter(void 0, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, ctx.core.getMessagesSince(args.ts)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res.map(function (msg) { return (__assign(__assign({}, msg), { id: msg.id, data: JSON.stringify(msg.data), raw: msg.raw, metaData: msg.allMeta })); })]; | ||
} | ||
}); | ||
}; | ||
var credentials = function (_, _a) { | ||
var input = _a.input; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var options; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
options = { | ||
where: {} | ||
}; | ||
if (input === null || input === void 0 ? void 0 : input.issuer) | ||
options.where['issuer'] = typeorm_1.In(input.issuer); | ||
if (input === null || input === void 0 ? void 0 : input.subject) | ||
options.where['audience'] = typeorm_1.In(input.subject); | ||
if (input === null || input === void 0 ? void 0 : input.type) | ||
options.where['type'] = typeorm_1.In(input.type); | ||
if (input === null || input === void 0 ? void 0 : input.context) | ||
options.where['context'] = typeorm_1.In(input.context); | ||
if ((_b = input === null || input === void 0 ? void 0 : input.options) === null || _b === void 0 ? void 0 : _b.skip) | ||
options['skip'] = input.options.skip; | ||
if ((_c = input === null || input === void 0 ? void 0 : input.options) === null || _c === void 0 ? void 0 : _c.take) | ||
options['take'] = input.options.take; | ||
return [2 /*return*/, credential_1.Credential.find(options)]; | ||
}); | ||
}); | ||
}; | ||
var claims = function (_, _a) { | ||
var input = _a.input; | ||
return __awaiter(void 0, void 0, void 0, function () { | ||
var options; | ||
var _b, _c; | ||
return __generator(this, function (_d) { | ||
options = { | ||
relations: ['credential'], | ||
where: {} | ||
}; | ||
if (input === null || input === void 0 ? void 0 : input.issuer) | ||
options.where['issuer'] = typeorm_1.In(input.issuer); | ||
if (input === null || input === void 0 ? void 0 : input.subject) | ||
options.where['subject'] = typeorm_1.In(input.subject); | ||
if (input === null || input === void 0 ? void 0 : input.type) | ||
options.where['type'] = typeorm_1.In(input.type); | ||
if (input === null || input === void 0 ? void 0 : input.value) | ||
options.where['value'] = typeorm_1.In(input.value); | ||
if ((_b = input === null || input === void 0 ? void 0 : input.options) === null || _b === void 0 ? void 0 : _b.skip) | ||
options['skip'] = input.options.skip; | ||
if ((_c = input === null || input === void 0 ? void 0 : input.options) === null || _c === void 0 ? void 0 : _c.take) | ||
options['take'] = input.options.take; | ||
return [2 /*return*/, claim_1.Claim.find(options)]; | ||
}); | ||
}); | ||
}; | ||
}); }; | ||
exports.resolvers = { | ||
Mutation: { | ||
saveNewMessage: function (_, args, ctx) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
return [2 /*return*/, ctx.core.saveNewMessage(args)]; | ||
}); }); }, | ||
}, | ||
Query: { | ||
identity: function (_, _a) { | ||
var did = _a.did; | ||
return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_b) { | ||
return [2 /*return*/, identity_1.Identity.findOne(did)]; | ||
}); }); | ||
}, | ||
identities: function (_, _a) { | ||
var input = _a.input; | ||
return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_b) { | ||
return [2 /*return*/, identity_1.Identity.find(__assign({}, input === null || input === void 0 ? void 0 : input.options))]; | ||
}); }); | ||
}, | ||
message: function (_, _a) { | ||
var id = _a.id; | ||
return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_b) { | ||
return [2 /*return*/, message_1.Message.findOne(id)]; | ||
}); }); | ||
}, | ||
messages: messages, | ||
presentation: function (_, _a) { | ||
var hash = _a.hash; | ||
return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_b) { | ||
return [2 /*return*/, presentation_1.Presentation.findOne(hash)]; | ||
}); }); | ||
}, | ||
presentations: presentations, | ||
credential: function (_, _a) { | ||
var hash = _a.hash; | ||
return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_b) { | ||
return [2 /*return*/, credential_1.Credential.findOne(hash)]; | ||
}); }); | ||
}, | ||
credentials: credentials, | ||
claim: function (_, _a) { | ||
var hash = _a.hash; | ||
return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_b) { | ||
return [2 /*return*/, claim_1.Claim.findOne(hash, { relations: ['credential'] })]; | ||
}); }); | ||
}, | ||
claims: claims, | ||
serviceMessagesSince: serviceMessagesSince, | ||
}, | ||
Identity: { | ||
sentMessages: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['sentMessages'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).sentMessages]; | ||
} | ||
}); }); }, | ||
receivedMessages: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['receivedMessages'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).receivedMessages]; | ||
} | ||
}); }); }, | ||
issuedPresentations: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['issuedPresentations'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).issuedPresentations]; | ||
} | ||
}); }); }, | ||
receivedPresentations: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['receivedPresentations'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).receivedPresentations]; | ||
} | ||
}); }); }, | ||
issuedCredentials: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['issuedCredentials'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).issuedCredentials]; | ||
} | ||
}); }); }, | ||
receivedCredentials: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['receivedCredentials'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).receivedCredentials]; | ||
} | ||
}); }); }, | ||
issuedClaims: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['issuedClaims'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).issuedClaims]; | ||
} | ||
}); }); }, | ||
receivedClaims: function (identity) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, identity_1.Identity.findOne(identity.did, { relations: ['receivedClaims'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).receivedClaims]; | ||
} | ||
}); }); }, | ||
Mutation: { | ||
newMessage: newMessage, | ||
}, | ||
Credential: { | ||
claims: function (credential) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, credential_1.Credential.findOne(credential.hash, { relations: ['claims'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).claims]; | ||
} | ||
}); }); }, | ||
messages: function (credential) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, credential_1.Credential.findOne(credential.hash, { relations: ['messages'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).messages]; | ||
} | ||
}); }); }, | ||
presentations: function (credential) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, credential_1.Credential.findOne(credential.hash, { relations: ['presentations'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).presentations]; | ||
} | ||
}); }); }, | ||
}, | ||
Presentation: { | ||
credentials: function (presentation) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, presentation_1.Presentation.findOne(presentation.hash, { relations: ['credentials'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).credentials]; | ||
} | ||
}); }); }, | ||
messages: function (presentation) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, presentation_1.Presentation.findOne(presentation.hash, { relations: ['messages'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).messages]; | ||
} | ||
}); }); } | ||
}, | ||
Message: { | ||
presentations: function (message) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, message_1.Message.findOne(message.id, { relations: ['presentations'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).presentations]; | ||
} | ||
}); }); }, | ||
credentials: function (message) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, message_1.Message.findOne(message.id, { relations: ['credentials'] })]; | ||
case 1: return [2 /*return*/, (_a.sent()).credentials]; | ||
} | ||
}); }); }, | ||
}, | ||
}; | ||
exports.typeDefs = "\n\n input FindOptions {\n take: Int\n skip: Int\n }\n\n input IdentitiesInput {\n options: FindOptions\n }\n\n input MessagesInput {\n from: [String]\n to: [String]\n type: [String]\n threadId: [String]\n options: FindOptions\n }\n\n input PresentationsInput {\n issuer: [String]\n audience: [String]\n type: [String]\n context: [String]\n options: FindOptions\n }\n\n input CredentialsInput {\n issuer: [String]\n subject: [String]\n type: [String]\n context: [String]\n options: FindOptions\n }\n\n input ClaimsInput {\n issuer: [ID]\n subject: [ID]\n type: [String]\n value: [String]\n options: FindOptions\n }\n\n extend type Query {\n identity(did: ID!): Identity\n identities(input: IdentitiesInput): [Identity]\n message(id: ID!): Message\n messages(input: MessagesInput): [Message]\n presentation(hash: ID!): Presentation\n presentations(input: PresentationsInput): [Presentation]\n credential(hash: ID!): Credential\n credentials(input: CredentialsInput): [Credential]\n claim(hash: ID!): Claim\n claims(input: ClaimsInput): [Claim]\n }\n\n extend type Mutation {\n saveNewMessage(raw: String!, metaDataType: String, metaDataValue: String): Message\n }\n\n\n extend type Identity {\n sentMessages: [Message]\n receivedMessages: [Message]\n issuedPresentations: [Presentation]\n receivedPresentations: [Presentation]\n issuedCredentials: [Credential]\n receivedCredentials: [Credential]\n issuedClaims: [Claim]\n receivedClaims: [Claim]\n }\n\n scalar Object\n scalar Date\n \n type Message {\n id: ID!\n saveDate: Date!\n updateDate: Date!\n createdAt: Date\n expiresAt: Date\n threadId: String\n type: String!\n raw: String\n data: Object\n replyTo: [String]\n replyUrl: [String]\n from: Identity\n to: Identity\n metaData: [MetaData]\n presentations: [Presentation]\n credentials: [Credential]\n }\n\n type MetaData {\n type: String!\n value: String\n }\n\n type Presentation {\n hash: ID!\n raw: String!\n issuer: Identity!\n audience: Identity!\n issuanceDate: Date!\n expirationDate: Date\n context: [String]\n type: [String]\n credentials: [Credential]\n messages: [Message]\n }\n \n type Credential {\n hash: ID!\n raw: String!\n issuer: Identity!\n subject: Identity!\n issuanceDate: Date!\n expirationDate: Date\n context: [String]\n type: [String]\n credentialSubject: Object\n claims: [Claim]\n presentations: [Presentation]\n messages: [Message]\n }\n\n type Claim {\n hash: ID!\n issuer: Identity!\n subject: Identity!\n credential: Credential!\n type: String!\n value: String!\n isObj: Boolean\n } \n"; | ||
exports.typeDefs = "\n input LastMessageTimestampForInstance {\n timestamp: Int!\n did: String!\n type: String!\n id: String!\n }\n\n type ServiceMessage {\n id: String!\n threadId: String,\n timestamp: Int,\n sender: String,\n receiver: String,\n type: String,\n raw: String,\n data: String,\n metaData: [MessageMetaData]\n }\n\n extend type Query {\n serviceMessagesSince(ts: [LastMessageTimestampForInstance]!): [ServiceMessage]\n }\n\n extend type Mutation {\n newMessage(raw: String!, sourceType: String!, sourceId: String): Message\n }\n"; | ||
//# sourceMappingURL=graphql-core.js.map |
@@ -47,2 +47,1 @@ import { Core } from '../core'; | ||
export declare const typeDefs = "\n type IdentityProvider {\n type: String!\n description: String\n }\n extend type Query {\n identityProviders: [IdentityProvider]\n managedIdentities: [Identity]\n managedIdentitySecret(type: String, did: String): String\n }\n\n extend type Mutation {\n createIdentity(type: String): Identity!\n deleteIdentity(type: String, did: String): Boolean!\n importIdentity(type: String, secret: String): Identity!\n }\n\n extend type Identity {\n type: String\n isManaged: Boolean!\n }\n \n"; | ||
//# sourceMappingURL=graphql-identity-manager.d.ts.map |
@@ -13,2 +13,1 @@ export interface ServiceEndpoint { | ||
} | ||
//# sourceMappingURL=abstract-identity-controller.d.ts.map |
@@ -18,2 +18,1 @@ /// <reference types="node" /> | ||
export {}; | ||
//# sourceMappingURL=abstract-identity-provider.d.ts.map |
@@ -13,2 +13,1 @@ import { SerializedKey } from './abstract-key-management-system'; | ||
} | ||
//# sourceMappingURL=abstract-identity-store.d.ts.map |
@@ -14,2 +14,1 @@ import { AbstractKey, KeyType } from './abstract-key-management-system'; | ||
export {}; | ||
//# sourceMappingURL=abstract-identity.d.ts.map |
@@ -28,2 +28,1 @@ export declare type KeyType = 'Ed25519' | 'Secp256k1'; | ||
export {}; | ||
//# sourceMappingURL=abstract-key-management-system.d.ts.map |
@@ -7,2 +7,1 @@ import { SerializedKey } from './abstract-key-management-system'; | ||
} | ||
//# sourceMappingURL=abstract-key-store.d.ts.map |
@@ -22,2 +22,1 @@ import { AbstractIdentity } from './abstract-identity'; | ||
export {}; | ||
//# sourceMappingURL=identity-manager.d.ts.map |
@@ -7,20 +7,17 @@ export { Core, EventTypes, Resolver } from './core'; | ||
export { AbstractIdentityProvider, IdentityProviderDerived } from './identity/abstract-identity-provider'; | ||
export { AbstractKeyManagementSystem, AbstractKey, SerializedKey, } from './identity/abstract-key-management-system'; | ||
export { AbstractKeyManagementSystem, AbstractKey, KeyType, SerializedKey, } from './identity/abstract-key-management-system'; | ||
export { AbstractIdentityStore, SerializedIdentity } from './identity/abstract-identity-store'; | ||
export { AbstractKeyStore } from './identity/abstract-key-store'; | ||
export { AbstractMessageValidator } from './message/abstract-message-validator'; | ||
export { Message } from './message/message'; | ||
export { ServiceManager, LastMessageTimestampForInstance, ServiceEventTypes } from './service/service-manager'; | ||
export { AbstractServiceController } from './service/abstract-service-controller'; | ||
export { Gql } from './graphql/index'; | ||
export { Action } from './types'; | ||
export { IdentityStore } from './identity/identity-store'; | ||
export { KeyStore } from './identity/key-store'; | ||
import { Key, KeyType } from './entities/key'; | ||
import { Identity } from './entities/identity'; | ||
import { Claim } from './entities/claim'; | ||
import { Credential } from './entities/credential'; | ||
import { Presentation } from './entities/presentation'; | ||
import { Message } from './entities/message'; | ||
export declare const Entities: (typeof Key | typeof Identity | typeof Claim | typeof Credential | typeof Presentation | typeof Message)[]; | ||
export { KeyType, Key, Identity, Message, Claim, Credential, Presentation }; | ||
//# sourceMappingURL=index.d.ts.map | ||
import * as Types from './types'; | ||
import * as GqlCore from './graphql/graphql-core'; | ||
import * as GqlIdentityManager from './graphql/graphql-identity-manager'; | ||
declare const Gql: { | ||
baseTypeDefs: string; | ||
Core: typeof GqlCore; | ||
IdentityManager: typeof GqlIdentityManager; | ||
}; | ||
export { Types, Gql }; |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -25,2 +32,4 @@ var core_1 = require("./core"); | ||
exports.AbstractMessageValidator = abstract_message_validator_1.AbstractMessageValidator; | ||
var message_1 = require("./message/message"); | ||
exports.Message = message_1.Message; | ||
var service_manager_1 = require("./service/service-manager"); | ||
@@ -31,21 +40,13 @@ exports.ServiceManager = service_manager_1.ServiceManager; | ||
exports.AbstractServiceController = abstract_service_controller_1.AbstractServiceController; | ||
var index_1 = require("./graphql/index"); | ||
exports.Gql = index_1.Gql; | ||
var identity_store_1 = require("./identity/identity-store"); | ||
exports.IdentityStore = identity_store_1.IdentityStore; | ||
var key_store_1 = require("./identity/key-store"); | ||
exports.KeyStore = key_store_1.KeyStore; | ||
var key_1 = require("./entities/key"); | ||
exports.Key = key_1.Key; | ||
var identity_1 = require("./entities/identity"); | ||
exports.Identity = identity_1.Identity; | ||
var claim_1 = require("./entities/claim"); | ||
exports.Claim = claim_1.Claim; | ||
var credential_1 = require("./entities/credential"); | ||
exports.Credential = credential_1.Credential; | ||
var presentation_1 = require("./entities/presentation"); | ||
exports.Presentation = presentation_1.Presentation; | ||
var message_1 = require("./entities/message"); | ||
exports.Message = message_1.Message; | ||
exports.Entities = [key_1.Key, identity_1.Identity, message_1.Message, claim_1.Claim, credential_1.Credential, presentation_1.Presentation]; | ||
var Types = __importStar(require("./types")); | ||
exports.Types = Types; | ||
var graphql_base_type_defs_1 = require("./graphql/graphql-base-type-defs"); | ||
var GqlCore = __importStar(require("./graphql/graphql-core")); | ||
var GqlIdentityManager = __importStar(require("./graphql/graphql-identity-manager")); | ||
var Gql = { | ||
baseTypeDefs: graphql_base_type_defs_1.baseTypeDefs, | ||
Core: GqlCore, | ||
IdentityManager: GqlIdentityManager, | ||
}; | ||
exports.Gql = Gql; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { Message } from '../entities/message'; | ||
import { Message } from './message'; | ||
import { Core } from '../core'; | ||
@@ -13,2 +13,1 @@ export interface MessageValidator { | ||
} | ||
//# sourceMappingURL=abstract-message-validator.d.ts.map |
@@ -5,3 +5,3 @@ /// <reference types="node" /> | ||
import { Resolver } from '../core'; | ||
import { Message } from '../entities/message'; | ||
import { Message } from '../message/message'; | ||
export declare abstract class AbstractServiceController extends EventEmitter { | ||
@@ -24,2 +24,1 @@ readonly identity: AbstractIdentity; | ||
export {}; | ||
//# sourceMappingURL=abstract-service-controller.d.ts.map |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
import { AbstractIdentity } from '../identity/abstract-identity'; | ||
import { Message } from '../entities/message'; | ||
import { Message } from '../message/message'; | ||
export declare enum ServiceEventTypes { | ||
@@ -32,2 +32,1 @@ NewMessages = "NewMessages" | ||
export {}; | ||
//# sourceMappingURL=service-manager.d.ts.map |
@@ -5,2 +5,1 @@ export interface Action { | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -6,2 +6,35 @@ # Change Log | ||
# [3.4.0](https://github.com/uport-project/daf/compare/v3.3.0...v3.4.0) (2020-03-19) | ||
### Features | ||
* Ethr-did export/import ([0f8ab11](https://github.com/uport-project/daf/commit/0f8ab111a5e96d3a687b318605ab2ff607c7bf23)), closes [#105](https://github.com/uport-project/daf/issues/105) | ||
# [3.3.0](https://github.com/uport-project/daf/compare/v3.2.0...v3.3.0) (2020-03-19) | ||
### Features | ||
* Version bump ([5f8c0fe](https://github.com/uport-project/daf/commit/5f8c0fe551f9512401ff4f68baa171a8aaeec419)) | ||
# [3.2.0](https://github.com/uport-project/daf/compare/v3.1.4...v3.2.0) (2020-03-19) | ||
### Features | ||
* Version bump ([f482187](https://github.com/uport-project/daf/commit/f482187a776f05f1977d3c01caa8acc2e0e6c08f)) | ||
## [3.1.3](https://github.com/uport-project/daf/compare/v3.1.2...v3.1.3) (2020-03-18) | ||
@@ -8,0 +41,0 @@ |
{ | ||
"name": "daf-core", | ||
"description": "DID Agent Framework Core", | ||
"version": "3.1.4-beta.2+526ec35", | ||
"version": "3.1.5-beta.11+4557a99", | ||
"main": "build/index.js", | ||
@@ -31,3 +31,3 @@ "types": "build/index.d.ts", | ||
"keywords": [], | ||
"gitHead": "526ec35e925ab39ffc0fc8ea803e9af2fee2e785" | ||
"gitHead": "4557a991dd9a4c2c656bce0039b1041562ee0f25" | ||
} |
@@ -34,2 +34,5 @@ export type KeyType = 'Ed25519' | 'Secp256k1' | ||
abstract deleteKey(kid: string): Promise<boolean> | ||
importKey(key: SerializedKey): Promise<AbstractKey> { | ||
return Promise.reject('Method importKey not implemented') | ||
} | ||
} |
@@ -17,2 +17,6 @@ import { AbstractIdentityStore, SerializedIdentity } from '../identity/abstract-identity-store' | ||
/** | ||
* | ||
* @param did DID address. String | ||
*/ | ||
async get(did: string) { | ||
@@ -24,2 +28,6 @@ const identity = await Identity.findOne(did, { relations: ['keys'] }) | ||
/** | ||
* | ||
* @param did DID address. String | ||
*/ | ||
async delete(did: string) { | ||
@@ -26,0 +34,0 @@ const identity = await Identity.findOne(did) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1
229418
118
4283