From 90eb012270b6868291094ebc618a2e244cdd34e6 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Sat, 14 Feb 2026 06:24:42 +0530 Subject: [PATCH 1/2] feat(playground): improve default agreement sample to better reflect legal use case Signed-off-by: Vaishnavi --- src/samples/playground.ts | 143 +++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 79 deletions(-) diff --git a/src/samples/playground.ts b/src/samples/playground.ts index 219c9ce9..446e9d12 100644 --- a/src/samples/playground.ts +++ b/src/samples/playground.ts @@ -1,99 +1,84 @@ -const MODEL = `namespace hello@1.0.0 -import org.accordproject.money@0.3.0.{MonetaryAmount} from https://models.accordproject.org/money@0.3.0.cto - -concept Address { - o String line1 - o String city - o String state - o String country -} +const MODEL = `namespace org.accordproject.service@1.0.0 -concept OrderLine { - o String sku +concept ServiceItem { + o String description + o Double rate o Integer quantity - o Double price -} - -concept Order { - o DateTime createdAt - o OrderLine[] orderLines } @template -concept TemplateData { - o String name - o Address address - o Integer age optional - o MonetaryAmount salary - o String[] favoriteColors - o Order order +concept ServiceAgreement { + o String clientName + o String clientAddress + o String providerName + o String providerAddress + o DateTime effectiveDate + o ServiceItem[] services + o Integer paymentTerms }`; -const TEMPLATE = `> A general sample that uses a range of features -### Welcome {{name}}! - -![AP Logo](https://avatars.githubusercontent.com/u/29445438?s=64) +const TEMPLATE = `# SERVICE AGREEMENT -{{#clause address}} -#### Address -> {{line1}}, - {{city}}, {{state}}, - {{country}} - {{/clause}} +This Service Agreement is made and entered into as of {{effectiveDate as "D MMMM YYYY"}} by and between {{clientName}}, located at {{clientAddress}} (Client), and {{providerName}}, located at {{providerAddress}} (SProvider). -- You are *{{age}}* years old -- Your monthly salary is {{salary as "0,0.00 CCC"}} -- Your favorite colours are {{#join favoriteColors}} +## 1. Services -{{#clause order}} -## Orders -Your last order was placed {{createdAt as "D MMMM YYYY"}} ({{% return now.diff(order.createdAt, 'day')%}} days ago). +Provider shall perform the following services for Client: -{{#ulist orderLines}} -- {{quantity}}x _{{sku}}_ @ £{{price as "0,0.00"}} +{{#ulist services}} +- {{description}} at {{rate as "0.00"}} per unit × {{quantity}} {{/ulist}} -Order total: {{% return '£' + order.orderLines.map(ol => ol.price * ol.quantity).reduce((sum, cur) => sum + cur).toFixed(2);%}} -{{/clause}} -Thank you. +## 2. Compensation + +In consideration for the services provided, Client shall pay Provider the total amount calculated below: + +**Total Service Value:** {{% +return '$' + services + .map(s => s.rate * s.quantity) + .reduce((sum, cur) => sum + cur, 0) + .toFixed(2); +%}} + +Payment is due within {{paymentTerms}} days of invoice. + +## 3. Execution + +IN WITNESS WHEREOF, the parties hereto have executed this Agreement as of the date first written above. + +--- + +### Client: +{{clientName}} + +### Provider: +{{providerName}} `; const DATA = { - "$class" : "hello@1.0.0.TemplateData", - "name": "John Doe", - "address" : { - "line1" : "1 Main Street", - "city" : "Boson", - "state" : "MA", - "country" : "USA" - }, - "age" : 42, - "salary": { - "$class": "org.accordproject.money@0.3.0.MonetaryAmount", - "doubleValue": 1500, - "currencyCode": "EUR" + "$class": "org.accordproject.service@1.0.0.ServiceAgreement", + "effectiveDate": "2026-02-01T00:00:00Z", + "paymentTerms": 30, + "clientName": "Acme Corp", + "clientAddress": "123 Business Road, London, UK", + "providerName": "DevConsult Ltd", + "providerAddress": "456 Tech Street, Berlin, Germany", + "services": [ + { + "$class": "org.accordproject.service@1.0.0.ServiceItem", + "description": "Backend Development", + "rate": 80, + "quantity": 40 }, - "favoriteColors" : ['red', 'green', 'blue'], - "order" : { - "createdAt" : "2023-05-01", - "$class" : "hello@1.0.0.Order", - "orderLines": - [ - { - "$class" : "hello@1.0.0.OrderLine", - "sku" : "ABC-123", - "quantity" : 3, - "price" : 29.99 - }, - { - "$class" : "hello@1.0.0.OrderLine", - "sku" : "DEF-456", - "quantity" : 5, - "price" : 19.99 - } - ] + { + "$class": "org.accordproject.service@1.0.0.ServiceItem", + "description": "Code Review", + "rate": 60, + "quantity": 10 } + ] }; -const NAME = 'Customer Order'; -export {NAME, MODEL,DATA,TEMPLATE}; \ No newline at end of file +const NAME = 'Service Agreement'; + +export { NAME, MODEL, DATA, TEMPLATE }; From 0803afb28e9ecd6fcb21c6e6f1c80e4e51a01010 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Mon, 23 Feb 2026 09:34:26 +0530 Subject: [PATCH 2/2] Update Service Agreement template Signed-off-by: Vaishnavi --- src/samples/playground.ts | 77 +++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/src/samples/playground.ts b/src/samples/playground.ts index 446e9d12..4e84e65a 100644 --- a/src/samples/playground.ts +++ b/src/samples/playground.ts @@ -6,6 +6,11 @@ concept ServiceItem { o Integer quantity } +concept Compensation { + o ServiceItem[] services + o Integer paymentTerms +} + @template concept ServiceAgreement { o String clientName @@ -13,72 +18,88 @@ concept ServiceAgreement { o String providerName o String providerAddress o DateTime effectiveDate - o ServiceItem[] services - o Integer paymentTerms + o Compensation compensation }`; const TEMPLATE = `# SERVICE AGREEMENT -This Service Agreement is made and entered into as of {{effectiveDate as "D MMMM YYYY"}} by and between {{clientName}}, located at {{clientAddress}} (Client), and {{providerName}}, located at {{providerAddress}} (SProvider). +This Service Agreement is made and entered into as of +{{effectiveDate as "D MMMM YYYY"}} +by and between {{clientName}}, located at {{clientAddress}} (Client), +and {{providerName}}, located at {{providerAddress}} (Provider). + +--- ## 1. Services -Provider shall perform the following services for Client: +{{#clause compensation}} +### Services Provided {{#ulist services}} - {{description}} at {{rate as "0.00"}} per unit × {{quantity}} {{/ulist}} -## 2. Compensation +### Payment Terms +Payment is due within {{paymentTerms}} days of invoice. +{{/clause}} + +--- -In consideration for the services provided, Client shall pay Provider the total amount calculated below: +## 2. Total Compensation **Total Service Value:** {{% -return '$' + services +return '$' + compensation.services .map(s => s.rate * s.quantity) .reduce((sum, cur) => sum + cur, 0) .toFixed(2); %}} -Payment is due within {{paymentTerms}} days of invoice. +--- ## 3. Execution -IN WITNESS WHEREOF, the parties hereto have executed this Agreement as of the date first written above. +IN WITNESS WHEREOF, the parties hereto have executed this Agreement. ---- +### Client: +![Client Logo](https://ui-avatars.com/api/?name=AcmeCorp&size=40) -### Client: {{clientName}} -### Provider: +### Provider: + +![provider logo](https://ui-avatars.com/api/?name=DevConsult+Ltd&size=40) + {{providerName}} + `; const DATA = { "$class": "org.accordproject.service@1.0.0.ServiceAgreement", "effectiveDate": "2026-02-01T00:00:00Z", - "paymentTerms": 30, "clientName": "Acme Corp", "clientAddress": "123 Business Road, London, UK", "providerName": "DevConsult Ltd", "providerAddress": "456 Tech Street, Berlin, Germany", - "services": [ - { - "$class": "org.accordproject.service@1.0.0.ServiceItem", - "description": "Backend Development", - "rate": 80, - "quantity": 40 - }, - { - "$class": "org.accordproject.service@1.0.0.ServiceItem", - "description": "Code Review", - "rate": 60, - "quantity": 10 - } - ] + "compensation": { + "$class": "org.accordproject.service@1.0.0.Compensation", + "paymentTerms": 30, + "services": [ + { + "$class": "org.accordproject.service@1.0.0.ServiceItem", + "description": "Backend Development", + "rate": 80, + "quantity": 40 + }, + { + "$class": "org.accordproject.service@1.0.0.ServiceItem", + "description": "Code Review", + "rate": 60, + "quantity": 10 + } + ] + } }; const NAME = 'Service Agreement'; -export { NAME, MODEL, DATA, TEMPLATE }; +export { NAME, MODEL, DATA, TEMPLATE }; \ No newline at end of file