Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tools): issue when converting a valid model to Protobuf #618

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ProtobufVisitor {
* @public
*/
getNamesOfSubclassesOfClassRecursively(classDeclaration) {
return typeof classDeclaration.getAssignableClassDeclarations === 'function'
return typeof classDeclaration?.getAssignableClassDeclarations === 'function'
? classDeclaration.getAssignableClassDeclarations()
?.filter(
assignableClass => assignableClass.getName() !== classDeclaration.getName()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
@description("Accord Project Agreement Protocol")
namespace [email protected]

import [email protected].{Property,ConceptDeclaration,Model} from https://models.accordproject.org/concerto/[email protected]
import [email protected] from https://models.accordproject.org/markdown/[email protected]
import [email protected].{Party} from https://models.accordproject.org/accordproject/[email protected]

scalar JSON extends String
scalar FullyQualifiedTypeName extends String

@description("Bytes and mime type for a blob of data, such as images, files, etc.")
concept Blob {
o String base64
o String mimeType // e.g. "image/jpeg", "application/pdf", "audio/mpeg", "video/mp4", etc...
}

@description("The text for a template")
concept Text {
o Document templateMark
}

@description("The concept declaration associated with a template")
concept TemplateModel {
o FullyQualifiedTypeName typeName // name of the type for this template
--> SharedModel sharedModel optional // reference to a shared model
o Model model optional // an inline model
}

@description("A shared data model")
@resource
concept SharedModel identified by modelId {
o String modelId
o Model model
}

@description("The type (language) of code")
enum CodeType {
o ES2015
o WASM_BYTES
}

@description("Code encoding scheme")
enum CodeEncodingType {
o PLAIN_TEXT
o BASE64
}

@description("Executable code")
concept Code {
o CodeType type
o CodeEncodingType encoding
o String value
}

@description("A function for a template")
concept Function identified by name {
o String name
o FullyQualifiedTypeName requestType
o FullyQualifiedTypeName responseType optional
o FullyQualifiedTypeName[] emittedTypes optional
o Code code
}

@description("The functions for a template")
concept Logic {
o FullyQualifiedTypeName stateType optional
o Function[] functions
}

@resource
@description("An Accord Project template")
concept Template identified by name {
o String name
o String author
o String displayName optional
o String version
o String description optional
o String license
o String[] keywords optional
o Blob logo optional
o TemplateModel templateModel
o Text text
o Logic logic optional
}

@description("A key/value pair")
concept KeyValue {
o String key
o String value
}

@description("Generic metadata comprised of key/value pairs")
concept Metadata {
o KeyValue[] values
}

@resource
@description("An Accord Project Agreement, an instance of a template")
concept Agreement identified by agreementId {
o String agreementId
o JSON data // Data for the agreement (an instance of the data for its template)
o JSON state optional // Runtime state of the agreement
--> Template template // Template for the the agreement
o AgreementParty[] agreementParties // Parties to the agreement
o Signature[] signatures // Signatures of the parties to the agreement
o AgreementStatusType agreementStatus // Current status of agreement
o HistoryEntry[] historyEntries // History of document state and details.
o Blob[] attachments // Pdfs, images, multimedia, etc. that form part of the agreement
o String[] references // uri/urls to external references relevant to agreement
o Metadata metadata // Additional data that may be relevant to the agreement
}

@description("A Party to an Agreement")
participant AgreementParty extends Party {
o String name
o Boolean signatory // Sometimes a party named on an agreement are not required to sign (e.g. beneficiary)
o String role optional // Role of AgreementParty (e.g. "Owner", "Company Director", etc..)
o String email optional
o String phone optional
o String company optional
o String network optional
o Address address optional
}

@description("An Address of an Agreement Party")
concept Address {
o String[] streetRoad
o String suburbTownCity optional
o String stateTerritoryRegion optional
o String postalCode optional
o String country optional
}

@description("A history entry for an Agreement")
transaction HistoryEntry {
o AgreementStatusType agreementStatus // Status at time of change
o JSON data // Data at time of change
o Metadata metadata // Additional data that may be relevant to the agreement at time of change
}

@description("A signature of an Agreement Party")
concept Signature {
o AgreementParty signatory // The Agreement Party signing the Agreement
o DateTime signedAt optional // When the signing occurred
o Metadata metadata // Geolocation data, IP address, etc.
o Blob[] signatureImage // Selfie, proof-of-id, sign-on-glass image
}

@description("Abstract conversion options")
abstract concept ConversionOptions {
}

@description("PDF conversion options")
concept PdfConversionOptions extends ConversionOptions {
o JSON styles optional
}

@description("Server feature identifiers")
enum FeatureType {
// note: crud operations on templates is required
o TEMPLATE_VERIFY_SIGNATURES // verify a signed template
o TEMPLATE_LOGIC // templates with logic
o TEMPLATE_STATEFUL // stateful templates

o AGREEMENT_MANAGE // crud operations on agreements
o AGREEMENT_TRIGGER // trigger agreements
o AGREEMENT_STATE // get the state of an agreement
o AGREEMENT_CONVERT_PDF // convert agreement to PDF

// o AGREEMENT_SIGNING

o SHARED_MODEL_MANAGE // manage shared models
}

@description("Server capabilities")
concept Capabilities {
o FeatureType[] features
}

@description("Trigger a function with a JSON payload")
concept TriggerRequest {
o String functionName
o JSON payload
}

@description("Response of triggering a function")
concept TriggerResponse {
o JSON result optional
o Boolean isError
o String errorMessage optional
o String errorDetails optional
}

@description("Runtime status of an agreement")
enum AgreementStatusType {
o DRAFT // No signatories have signed yet
o SIGNNG // Signed by some but not all signatories
o COMPLETED // Signing by all signatories completed
o SUPERSEDED // Superseded by subsequent agreement
}
Loading