Skip to content
Open
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
8 changes: 4 additions & 4 deletions e2e/tests/cicero-core.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let p12B64: string;

test.beforeAll(async () => {
p12B64 = fs.readFileSync(KEYSTORE, { encoding: 'base64' });
const template = await (Template as any).fromDirectory(TEMPLATE_DIR);
const template = await (Template as any).fromDirectory(TEMPLATE_DIR, { offline: true });
const buf = await template.toArchive('es6', {
keystore: { p12File: p12B64, passphrase: 'password' },
});
Expand Down Expand Up @@ -58,7 +58,7 @@ test.describe('@accordproject/cicero-core UMD', () => {
const id = await page.evaluate(async (b64: string) => {
const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0));
const { Template } = (window as any)['cicero-core'];
const t = await Template.fromArchive(bytes.buffer);
const t = await Template.fromArchive(bytes.buffer, { offline: true });
return t.getIdentifier();
}, signedArchiveB64);
expect(id).toBe('helloworldstate@0.15.0');
Expand All @@ -69,7 +69,7 @@ test.describe('@accordproject/cicero-core UMD', () => {
const hasSig = await page.evaluate(async (b64: string) => {
const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0));
const { Template } = (window as any)['cicero-core'];
const t = await Template.fromArchive(bytes.buffer);
const t = await Template.fromArchive(bytes.buffer, { offline: true });
return !!t.authorSignature?.templateSignature?.signature;
}, signedArchiveB64);
expect(hasSig).toBe(true);
Expand All @@ -80,7 +80,7 @@ test.describe('@accordproject/cicero-core UMD', () => {
const err = await page.evaluate(async ({ b64, p12 }: { b64: string; p12: string }) => {
const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0));
const { Template } = (window as any)['cicero-core'];
const t = await Template.fromArchive(bytes.buffer);
const t = await Template.fromArchive(bytes.buffer, { offline: true });
try {
await t.toArchive('es6', { keystore: { p12File: p12, passphrase: 'wrong' } });
return null;
Expand Down
4 changes: 2 additions & 2 deletions packages/cicero-cli/src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ describe('#compile', () => {

it('should compile a template archive to a Typescript model', async () => {
const dir = await tmp.dir({ unsafeCleanup: true });
const template = await Template.fromDirectory(path.resolve(dataDir, 'helloworldstate'));
const template = await Template.fromDirectory(path.resolve(dataDir, 'helloworldstate'), { offline: true });
const buffer = await template.toArchive('es6');
fs.writeFileSync(path.resolve(dir.path, 'helloworldstate.cta'), buffer);
await Commands.compile(path.resolve(dir.path, 'helloworldstate.cta'), 'Typescript', dir.path, true);
await Commands.compile(path.resolve(dir.path, 'helloworldstate.cta'), 'Typescript', dir.path, { offline: true });
expect(fs.readdirSync(dir.path).length).toBeGreaterThan(0);
dir.cleanup();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// A reduced copy of org.accordproject.runtime@1.0.0, carrying only the base
// types cicero-core resolves by name. The published namespace also defines the
// agreement state envelope and its clause-state map; cicero-core looks up
// neither, and the map requires a Concerto version this package does not pin.
// Kept local because the namespace is not published yet.

concerto version "^3.0.0"

namespace org.accordproject.runtime@1.0.0

/**
* Base request for invoking contract logic with no custom request properties.
*/
transaction Request {
}

/**
* Base response for contract logic with no custom response properties.
*/
transaction Response {
}
2 changes: 1 addition & 1 deletion packages/cicero-cli/test/data/helloemit/model/model.cto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace org.accordproject.helloemit@1.0.0

import org.accordproject.contract@0.2.0.{Clause, Contract} from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, State, Obligation} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto
import org.accordproject.runtime@1.0.0.{Request, Response} from https://models.accordproject.org/accordproject/runtime@1.0.0.cto

/**
* The template model
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// A reduced copy of org.accordproject.runtime@1.0.0, carrying only the base
// types cicero-core resolves by name. The published namespace also defines the
// agreement state envelope and its clause-state map; cicero-core looks up
// neither, and the map requires a Concerto version this package does not pin.
// Kept local because the namespace is not published yet.

concerto version "^3.0.0"

namespace org.accordproject.runtime@1.0.0

/**
* Base request for invoking contract logic with no custom request properties.
*/
transaction Request {
}

/**
* Base response for contract logic with no custom response properties.
*/
transaction Response {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// A reduced copy of org.accordproject.templatedata@1.0.0, carrying only the
// two extension points cicero-core resolves by name. The published namespace
// defines nothing else and imports nothing. Kept local because the namespace
// is not published yet.

concerto version "^3.0.0"

namespace org.accordproject.templatedata@1.0.0

/**
* The extension point for a template's own data model.
*
* A template's model declares exactly one concrete subtype, and that
* subtype is the template model: extending TemplateData is the
* declaration, so no `@template` decorator is required to identify it.
*/
abstract concept TemplateData {}

/**
* The extension point for template-specific runtime state.
*
* A template declares one concrete subtype and it is carried in the runtime
* state envelope: state is composed into the envelope rather than subclassing
* it, which is why this is an abstract concept and not an asset.
*/
abstract concept StateData {}
5 changes: 3 additions & 2 deletions packages/cicero-cli/test/data/helloworldstate/model/model.cto
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace org.accordproject.helloworldstate@1.0.0

import org.accordproject.contract@0.2.0.{Clause, Contract} from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, State} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto
import org.accordproject.runtime@1.0.0.{Request, Response} from https://models.accordproject.org/accordproject/runtime@1.0.0.cto
import org.accordproject.templatedata@1.0.0.StateData from https://models.accordproject.org/accordproject/templatedata@1.0.0.cto

transaction MyRequest extends Request {
o String input
Expand All @@ -11,7 +12,7 @@ transaction MyResponse extends Response {
o String output
}

asset HelloWorldState extends State {
concept HelloWorldState extends StateData {
o Double counter
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace org.accordproject.installmentsale@1.0.0

import org.accordproject.contract@0.2.0.Contract from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, Obligation, State} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto
import org.accordproject.runtime@1.0.0.{Request, Response} from https://models.accordproject.org/accordproject/runtime@1.0.0.cto
import org.accordproject.templatedata@1.0.0.StateData from https://models.accordproject.org/accordproject/templatedata@1.0.0.cto
import org.accordproject.money@0.3.0.MonetaryAmount from https://models.accordproject.org/money@0.3.0.cto


Expand Down Expand Up @@ -38,7 +39,7 @@ concept MyPaymentObligation extends MyObligation {
o Double amount
}

asset InstallmentSaleState extends State {
concept InstallmentSaleState extends StateData {
o ContractStatus status
o Double balance_remaining
o Integer next_payment_month
Expand Down
3 changes: 0 additions & 3 deletions packages/cicero-cli/test/data/ip-payment/state.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace org.accordproject.latedeliveryandpenalty@1.0.0

import org.accordproject.contract@0.2.0.Clause from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, Obligation, State} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto
import org.accordproject.runtime@1.0.0.{Request, Response} from https://models.accordproject.org/accordproject/runtime@1.0.0.cto
import org.accordproject.time@0.3.0.{TemporalUnit, Duration} from https://models.accordproject.org/time@0.3.0.cto

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// A reduced copy of org.accordproject.runtime@1.0.0, carrying only the base
// types cicero-core resolves by name. The published namespace also defines the
// agreement state envelope and its clause-state map; cicero-core looks up
// neither, and the map requires a Concerto version this package does not pin.
// Kept local because the namespace is not published yet.

concerto version "^3.0.0"

namespace org.accordproject.runtime@1.0.0

/**
* Base request for invoking contract logic with no custom request properties.
*/
transaction Request {
}

/**
* Base response for contract logic with no custom response properties.
*/
transaction Response {
}
Loading
Loading