@marlowe.io/language-core-v1
Advanced tools
Comparing version 0.2.0-alpha-20 to 0.2.0-alpha-21
@@ -1,31 +0,6 @@ | ||
import { V as ValueIdGuard } from './inputs-e33903eb.js'; | ||
export { A as Action, u as AddValue, G as AndObs, b as Assert, q as AvailableMoney, B as BuiltinByteString, f as Case, C as Choice, x as ChoiceValue, K as ChoseSomething, a as Close, F as Cond, r as Constant, e as Contract, D as Deposit, w as DivValue, E as Environment, k as IChoice, j as IDeposit, l as INotify, I as If, h as Input, n as InputContent, L as Let, M as MerkleizedInput, v as MulValue, s as NegValue, o as NormalInput, J as NotObs, N as Notify, O as Observation, H as OrObs, P as Pay, S as SubValue, g as TimeInterval, z as TimeIntervalEnd, y as TimeIntervalStart, T as Timeout, U as UseValue, p as Value, Q as ValueEQ, X as ValueGE, R as ValueGT, Z as ValueLE, Y as ValueLT, W as When } from './inputs-e33903eb.js'; | ||
import { A as AccountIdGuard, T as TokenGuard, C as ChoiceIdGuard } from './token-3e6f9764.js'; | ||
export { e as Address, B as Bound, c as ChoiceName, d as Party, f as Payee, g as PayeeAccount, h as PayeeParty, R as Role, i as TokenName } from './token-3e6f9764.js'; | ||
import { l as lib } from './index-c69c741e.js'; | ||
export { A as Action, z as AddValue, R as AndObs, q as Assert, w as AvailableMoney, B as BuiltinByteString, r as Case, g as Choice, H as ChoiceValue, Z as ChoseSomething, C as Close, O as Cond, x as Constant, o as Contract, D as Deposit, G as DivValue, E as Environment, f as IChoice, I as IDeposit, h as INotify, p as If, n as Input, u as InputContent, L as Let, l as MerkleizedCase, M as MerkleizedInput, F as MulValue, y as NegValue, k as NormalCase, j as NormalInput, Y as NotObs, N as Notify, Q as Observation, X as OrObs, P as Pay, S as SubValue, T as TimeInterval, K as TimeIntervalEnd, J as TimeIntervalStart, s as Timeout, U as UseValue, v as Value, _ as ValueEQ, a0 as ValueGE, $ as ValueGT, V as ValueId, a2 as ValueLE, a1 as ValueLT, W as When } from './inputs-1fc1b8e2.js'; | ||
export { A as AccountId, j as Address, B as Bound, C as ChoiceId, h as ChoiceName, d as Party, e as Payee, k as PayeeAccount, n as PayeeParty, R as Role, T as Token, o as TokenName } from './token-a492074d.js'; | ||
export { A as Accounts, i as AmbiguousTimeIntervalError, j as ApplyNoMatchError, e as AssertionFailed, I as IntervalError, h as IntervalInPast, g as InvalidInterval, M as MarloweState, c as NonPositiveDeposit, N as NonPositivePay, d as PartialPay, P as Payment, S as Shadowing, k as TEIntervalError, b as Transaction, l as TransactionError, m as TransactionOutput, T as TransactionSuccess, f as TransactionWarning, U as UselessTransaction } from './guards-09c16877.js'; | ||
import './index-c69c741e.js'; | ||
import '@marlowe.io/adapter/time'; | ||
const Account = lib.tuple([ | ||
lib.tuple([AccountIdGuard, TokenGuard]), | ||
lib.bigint, | ||
]); | ||
// DISCUSSION: Instead of having a custom guard for this we could have | ||
// an associative Map guard. | ||
/** | ||
* TODO: Comment | ||
* @category State | ||
*/ | ||
const AccountsGuard = lib.array(Account); | ||
/** | ||
* TODO: Comment | ||
* @see Section 2.1.8 and appendix E.14 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} | ||
* @category State | ||
*/ | ||
const MarloweStateGuard = lib.type({ | ||
accounts: AccountsGuard, | ||
boundValues: lib.array(lib.tuple([ValueIdGuard, lib.bigint])), | ||
choices: lib.array(lib.tuple([ChoiceIdGuard, lib.bigint])), | ||
minTime: lib.bigint, | ||
}); | ||
export { AccountIdGuard as AccountId, AccountsGuard as Accounts, ChoiceIdGuard as ChoiceId, MarloweStateGuard as MarloweState, TokenGuard as Token }; | ||
import '@marlowe.io/adapter/assoc-map'; |
@@ -1,6 +0,7 @@ | ||
export { c as close, d as datetoTimeout, i as inputNotify, m as mkEnvironment, t as timeoutToDate } from './inputs-e33903eb.js'; | ||
import { T as TokenGuard, a as adaToken } from './token-3e6f9764.js'; | ||
export { P as PolicyId, r as role, b as token, t as tokenToString } from './token-3e6f9764.js'; | ||
export { c as close, d as datetoTimeout, i as inputNotify, m as mkEnvironment, t as timeoutToDate } from './inputs-1fc1b8e2.js'; | ||
import { T as TokenGuard, a as adaToken } from './token-a492074d.js'; | ||
export { P as PolicyId, l as lovelace, r as role, b as token, t as tokenToString } from './token-a492074d.js'; | ||
import { l as lib } from './index-c69c741e.js'; | ||
import '@marlowe.io/adapter/time'; | ||
import '@marlowe.io/adapter/assoc-map'; | ||
@@ -7,0 +8,0 @@ /** |
@@ -0,5 +1,6 @@ | ||
import { Sort } from "@marlowe.io/adapter/assoc-map"; | ||
import * as t from "io-ts/lib/index.js"; | ||
import { Party } from "./participants.js"; | ||
/** | ||
* TODO: Comment | ||
* Represents a choice topic. | ||
* @category Choice | ||
@@ -9,3 +10,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.ChoiceName | choice name type}. | ||
* @category Choice | ||
@@ -15,3 +16,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Identifier for a {@link @marlowe.io/language-core-v1!index.Choice | choice}. | ||
* @category Choice | ||
@@ -24,3 +25,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.ChoiceId | choice id type}. | ||
* @category Choice | ||
@@ -30,3 +31,9 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Sorting function for ChoiceId as defined in the Marlowe Specification (SemanticsGuarantees.thy) | ||
* @hidden | ||
*/ | ||
export declare function choiceIdCmp(a: ChoiceId, b: ChoiceId): Sort; | ||
/** | ||
* Marlowe {@link @marlowe.io/language-core-v1!index.Choice | choices} are numeric values that | ||
* are bounded with the inclusive interval `[from , to]`. | ||
* @category Choice | ||
@@ -39,3 +46,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Bound | bound type}. | ||
* @category Choice | ||
@@ -45,3 +52,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents a value that was chosen by a party in a {@link @marlowe.io/language-core-v1!index.IChoice | choice input} | ||
* @category Choice | ||
@@ -51,6 +58,16 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.ChosenNum | chosen num type}. | ||
* @category Choice | ||
*/ | ||
export declare const ChosenNumGuard: t.Type<ChosenNum>; | ||
/** | ||
* Checks if a chosen number is between a given bound | ||
* @category Choice | ||
*/ | ||
export declare function inBound(num: bigint, bound: Bound): boolean; | ||
/** | ||
* Checks if a chosen number is within any of the given bounds | ||
* @category Choice | ||
*/ | ||
export declare function inBounds(num: bigint, bounds: Bound[]): boolean; | ||
//# sourceMappingURL=choices.d.ts.map |
@@ -0,5 +1,6 @@ | ||
import { strCmp } from "@marlowe.io/adapter/assoc-map"; | ||
import * as t from "io-ts/lib/index.js"; | ||
import { PartyGuard } from "./participants.js"; | ||
import { partyCmp, PartyGuard } from "./participants.js"; | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.ChoiceName | choice name type}. | ||
* @category Choice | ||
@@ -9,3 +10,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.ChoiceId | choice id type}. | ||
* @category Choice | ||
@@ -17,5 +18,16 @@ */ | ||
}); | ||
/** | ||
* Sorting function for ChoiceId as defined in the Marlowe Specification (SemanticsGuarantees.thy) | ||
* @hidden | ||
*/ | ||
export function choiceIdCmp(a, b) { | ||
const nameCmp = strCmp(a.choice_name, b.choice_name); | ||
if (nameCmp !== "EqualTo") { | ||
return nameCmp; | ||
} | ||
return partyCmp(a.choice_owner, b.choice_owner); | ||
} | ||
// TODO: Try to remove recursion | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Bound | bound type}. | ||
* @category Choice | ||
@@ -25,5 +37,19 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.ChosenNum | chosen num type}. | ||
* @category Choice | ||
*/ | ||
export const ChosenNumGuard = t.bigint; | ||
/** | ||
* Checks if a chosen number is between a given bound | ||
* @category Choice | ||
*/ | ||
export function inBound(num, bound) { | ||
return num >= bound.from && num <= bound.to; | ||
} | ||
/** | ||
* Checks if a chosen number is within any of the given bounds | ||
* @category Choice | ||
*/ | ||
export function inBounds(num, bounds) { | ||
return bounds.some((bound) => inBound(num, bound)); | ||
} |
@@ -6,2 +6,3 @@ import * as t from "io-ts/lib/index.js"; | ||
import { Action } from "./actions.js"; | ||
import { BuiltinByteString } from "./inputs.js"; | ||
/** | ||
@@ -72,21 +73,19 @@ * Search [[lower-name-builders]] | ||
/** | ||
* TODO: Comment | ||
* The `Let` constructor allows a contract to record a value using an identifier `let`. The | ||
* expression `be` is evaluated, and the result is stored in the `boundValues` of the {@link MarloweState} | ||
* with the `let` identifier. The contract then continues with `then`. | ||
* | ||
* As well as allowing us to use abbreviations, this mechanism also means that we can capture and save | ||
* volatile values that might be changing with time, e.g. the current price of oil, or the current time, | ||
* at a particular point in the execution of the contract, to be used later on in contract execution. | ||
* @see Section 2.1.7 and appendix E.10 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} | ||
* @category Contract | ||
*/ | ||
export interface Let { | ||
/** | ||
* TODO: Comment | ||
*/ | ||
let: ValueId; | ||
/** | ||
* TODO: Comment | ||
*/ | ||
be: Value; | ||
/** | ||
* TODO: Comment | ||
*/ | ||
then: Contract; | ||
} | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Let | let type}. | ||
* @category Contract | ||
@@ -138,6 +137,7 @@ */ | ||
/** | ||
* TODO: Comment | ||
* A pattern match between an Action and a Contract. | ||
* To be used inside of a {@link When} statement. | ||
* @category Contract | ||
*/ | ||
export interface Case { | ||
export interface NormalCase { | ||
/** | ||
@@ -153,5 +153,33 @@ * TODO: Comment | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link NormalCase | normal case type}. | ||
* @category Contract | ||
*/ | ||
export declare const NormalCaseGuard: t.Type<NormalCase>; | ||
/** | ||
* A pattern match between an Action and a Merkleized Contract. | ||
* To be used inside of a {@link When} statement. | ||
* @see {@link https://docs.marlowe.iohk.io/docs/platform-and-architecture/large-contracts} | ||
* @category Contract | ||
*/ | ||
export interface MerkleizedCase { | ||
case: Action; | ||
/** | ||
* A hash of the contract that will be executed if the case is matched. | ||
* Never construct this value yourself, the runtime should calculate hashing. | ||
*/ | ||
merkleized_then: BuiltinByteString; | ||
} | ||
/** | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link MerkleizedCase | merkleized case type}. | ||
* @category Contract | ||
*/ | ||
export declare const MerkleizedCaseGuard: t.Type<MerkleizedCase>; | ||
/** | ||
* @category Contract | ||
*/ | ||
export type Case = NormalCase | MerkleizedCase; | ||
/** | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Case | case type}. | ||
* @category Contract | ||
*/ | ||
export declare const CaseGuard: t.Type<Case>; | ||
@@ -169,7 +197,7 @@ /** | ||
/** | ||
* @hidden | ||
* @experimental | ||
*/ | ||
export declare const datetoTimeout: (date: Date) => Timeout; | ||
/** | ||
* @hidden | ||
* @experimental | ||
*/ | ||
@@ -187,2 +215,22 @@ export declare const timeoutToDate: (timeout: Timeout) => Date; | ||
export declare const ContractGuard: t.Type<Contract>; | ||
/** | ||
* Pattern match object on the Contract type | ||
* @category Contract | ||
* @hidden | ||
*/ | ||
export type ContractMatcher<T> = { | ||
close: () => T; | ||
pay: (pay: Pay) => T; | ||
if: (contract: If) => T; | ||
when: (contract: When) => T; | ||
let: (contract: Let) => T; | ||
assert: (contract: Assert) => T; | ||
}; | ||
/** | ||
* Pattern matching on the Contract type | ||
* @hidden | ||
* @category Contract | ||
*/ | ||
export declare function matchContract<T>(matcher: ContractMatcher<T>): (contract: Contract) => T; | ||
export declare function matchContract<T>(matcher: Partial<ContractMatcher<T>>): (contract: Contract) => T | undefined; | ||
//# sourceMappingURL=contract.d.ts.map |
@@ -51,3 +51,3 @@ import * as t from "io-ts/lib/index.js"; | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Let | let type}. | ||
* @category Contract | ||
@@ -71,7 +71,20 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link NormalCase | normal case type}. | ||
* @category Contract | ||
*/ | ||
export const CaseGuard = t.recursion("Case", () => t.type({ case: ActionGuard, then: ContractGuard })); | ||
export const NormalCaseGuard = t.recursion("Case", () => t.type({ case: ActionGuard, then: ContractGuard })); | ||
/** | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link MerkleizedCase | merkleized case type}. | ||
* @category Contract | ||
*/ | ||
export const MerkleizedCaseGuard = t.type({ | ||
case: ActionGuard, | ||
merkleized_then: t.string, | ||
}); | ||
/** | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Case | case type}. | ||
* @category Contract | ||
*/ | ||
export const CaseGuard = t.recursion("Case", () => t.union([NormalCaseGuard, MerkleizedCaseGuard])); | ||
/** | ||
* TODO: Comment | ||
@@ -82,8 +95,10 @@ * @category Contract | ||
/** | ||
* @hidden | ||
* @experimental | ||
*/ | ||
// DISCUSSION: I think this should be renamed dateToPOSIX and moved to the time module in the adapter package | ||
export const datetoTimeout = (date) => pipe(date, getUnixTime, (a) => a * 1000, BigInt, (a) => a.valueOf()); | ||
/** | ||
* @hidden | ||
* @experimental | ||
*/ | ||
// DISCUSSION: I think this should be renamed POSIXtoDate and moved to the time module in the adapter package | ||
export const timeoutToDate = (timeout) => new Date(Number(timeout)); | ||
@@ -95,1 +110,23 @@ /** | ||
export const ContractGuard = t.recursion("Contract", () => t.union([CloseGuard, PayGuard, IfGuard, WhenGuard, LetGuard, AssertGuard])); | ||
export function matchContract(matcher) { | ||
return (contract) => { | ||
if (CloseGuard.is(contract) && matcher.close) { | ||
return matcher.close(); | ||
} | ||
else if (PayGuard.is(contract) && matcher.pay) { | ||
return matcher.pay(contract); | ||
} | ||
else if (IfGuard.is(contract) && matcher.if) { | ||
return matcher.if(contract); | ||
} | ||
else if (WhenGuard.is(contract) && matcher.when) { | ||
return matcher.when(contract); | ||
} | ||
else if (LetGuard.is(contract) && matcher.let) { | ||
return matcher.let(contract); | ||
} | ||
else if (AssertGuard.is(contract) && matcher.assert) { | ||
return matcher.assert(contract); | ||
} | ||
}; | ||
} |
@@ -8,3 +8,3 @@ import * as t from "io-ts/lib/index.js"; | ||
export const mkEnvironment = (start) => (end) => ({ | ||
timeInterval: { from: start.getTime(), to: end.getTime() }, | ||
timeInterval: { from: BigInt(start.getTime()), to: BigInt(end.getTime()) }, | ||
}); | ||
@@ -11,0 +11,0 @@ /** |
@@ -17,3 +17,3 @@ /** | ||
export { ChoiceNameGuard as ChoiceName, ChoiceIdGuard as ChoiceId, BoundGuard as Bound, } from "./choices.js"; | ||
export { CloseGuard as Close, PayGuard as Pay, IfGuard as If, LetGuard as Let, AssertGuard as Assert, ContractGuard as Contract, WhenGuard as When, CaseGuard as Case, TimeoutGuard as Timeout, } from "./contract.js"; | ||
export { CloseGuard as Close, PayGuard as Pay, IfGuard as If, LetGuard as Let, AssertGuard as Assert, ContractGuard as Contract, WhenGuard as When, CaseGuard as Case, NormalCaseGuard as NormalCase, MerkleizedCaseGuard as MerkleizedCase, TimeoutGuard as Timeout, } from "./contract.js"; | ||
export { EnvironmentGuard as Environment, TimeIntervalGuard as TimeInterval, } from "./environment.js"; | ||
@@ -25,3 +25,4 @@ export { InputGuard as Input, IDepositGuard as IDeposit, IChoiceGuard as IChoice, INotifyGuard as INotify, BuiltinByteStringGuard as BuiltinByteString, InputContentGuard as InputContent, NormalInputGuard as NormalInput, MerkleizedInputGuard as MerkleizedInput, } from "./inputs.js"; | ||
export { TokenGuard as Token, TokenNameGuard as TokenName } from "./token.js"; | ||
export { ValueGuard as Value, AvailableMoneyGuard as AvailableMoney, ConstantGuard as Constant, NegValueGuard as NegValue, AddValueGuard as AddValue, SubValueGuard as SubValue, MulValueGuard as MulValue, DivValueGuard as DivValue, ChoiceValueGuard as ChoiceValue, TimeIntervalStartGuard as TimeIntervalStart, TimeIntervalEndGuard as TimeIntervalEnd, UseValueGuard as UseValue, CondGuard as Cond, ObservationGuard as Observation, AndObsGuard as AndObs, OrObsGuard as OrObs, NotObsGuard as NotObs, ChoseSomethingGuard as ChoseSomething, ValueEQGuard as ValueEQ, ValueGTGuard as ValueGT, ValueGEGuard as ValueGE, ValueLTGuard as ValueLT, ValueLEGuard as ValueLE, } from "./value-and-observation.js"; | ||
export { ValueGuard as Value, ValueIdGuard as ValueId, AvailableMoneyGuard as AvailableMoney, ConstantGuard as Constant, NegValueGuard as NegValue, AddValueGuard as AddValue, SubValueGuard as SubValue, MulValueGuard as MulValue, DivValueGuard as DivValue, ChoiceValueGuard as ChoiceValue, TimeIntervalStartGuard as TimeIntervalStart, TimeIntervalEndGuard as TimeIntervalEnd, UseValueGuard as UseValue, CondGuard as Cond, ObservationGuard as Observation, AndObsGuard as AndObs, OrObsGuard as OrObs, NotObsGuard as NotObs, ChoseSomethingGuard as ChoseSomething, ValueEQGuard as ValueEQ, ValueGTGuard as ValueGT, ValueGEGuard as ValueGE, ValueLTGuard as ValueLT, ValueLEGuard as ValueLE, } from "./value-and-observation.js"; | ||
export { TransactionGuard as Transaction, PaymentGuard as Payment, NonPositivePayGuard as NonPositivePay, NonPositiveDepositGuard as NonPositiveDeposit, PartialPayGuard as PartialPay, ShadowingGuard as Shadowing, AssertionFailedGuard as AssertionFailed, TransactionWarningGuard as TransactionWarning, InvalidIntervalGuard as InvalidInterval, IntervalInPastGuard as IntervalInPast, IntervalErrorGuard as IntervalError, AmbiguousTimeIntervalErrorGuard as AmbiguousTimeIntervalError, ApplyNoMatchErrorGuard as ApplyNoMatchError, UselessTransactionGuard as UselessTransaction, TEIntervalErrorGuard as TEIntervalError, TransactionErrorGuard as TransactionError, TransactionSuccessGuard as TransactionSuccess, TransactionOutputGuard as TransactionOutput, } from "./transaction.js"; | ||
//# sourceMappingURL=guards.d.ts.map |
@@ -17,3 +17,3 @@ /** | ||
export { ChoiceNameGuard as ChoiceName, ChoiceIdGuard as ChoiceId, BoundGuard as Bound, } from "./choices.js"; | ||
export { CloseGuard as Close, PayGuard as Pay, IfGuard as If, LetGuard as Let, AssertGuard as Assert, ContractGuard as Contract, WhenGuard as When, CaseGuard as Case, TimeoutGuard as Timeout, } from "./contract.js"; | ||
export { CloseGuard as Close, PayGuard as Pay, IfGuard as If, LetGuard as Let, AssertGuard as Assert, ContractGuard as Contract, WhenGuard as When, CaseGuard as Case, NormalCaseGuard as NormalCase, MerkleizedCaseGuard as MerkleizedCase, TimeoutGuard as Timeout, } from "./contract.js"; | ||
export { EnvironmentGuard as Environment, TimeIntervalGuard as TimeInterval, } from "./environment.js"; | ||
@@ -25,2 +25,3 @@ export { InputGuard as Input, IDepositGuard as IDeposit, IChoiceGuard as IChoice, INotifyGuard as INotify, BuiltinByteStringGuard as BuiltinByteString, InputContentGuard as InputContent, NormalInputGuard as NormalInput, MerkleizedInputGuard as MerkleizedInput, } from "./inputs.js"; | ||
export { TokenGuard as Token, TokenNameGuard as TokenName } from "./token.js"; | ||
export { ValueGuard as Value, AvailableMoneyGuard as AvailableMoney, ConstantGuard as Constant, NegValueGuard as NegValue, AddValueGuard as AddValue, SubValueGuard as SubValue, MulValueGuard as MulValue, DivValueGuard as DivValue, ChoiceValueGuard as ChoiceValue, TimeIntervalStartGuard as TimeIntervalStart, TimeIntervalEndGuard as TimeIntervalEnd, UseValueGuard as UseValue, CondGuard as Cond, ObservationGuard as Observation, AndObsGuard as AndObs, OrObsGuard as OrObs, NotObsGuard as NotObs, ChoseSomethingGuard as ChoseSomething, ValueEQGuard as ValueEQ, ValueGTGuard as ValueGT, ValueGEGuard as ValueGE, ValueLTGuard as ValueLT, ValueLEGuard as ValueLE, } from "./value-and-observation.js"; | ||
export { ValueGuard as Value, ValueIdGuard as ValueId, AvailableMoneyGuard as AvailableMoney, ConstantGuard as Constant, NegValueGuard as NegValue, AddValueGuard as AddValue, SubValueGuard as SubValue, MulValueGuard as MulValue, DivValueGuard as DivValue, ChoiceValueGuard as ChoiceValue, TimeIntervalStartGuard as TimeIntervalStart, TimeIntervalEndGuard as TimeIntervalEnd, UseValueGuard as UseValue, CondGuard as Cond, ObservationGuard as Observation, AndObsGuard as AndObs, OrObsGuard as OrObs, NotObsGuard as NotObs, ChoseSomethingGuard as ChoseSomething, ValueEQGuard as ValueEQ, ValueGTGuard as ValueGT, ValueGEGuard as ValueGE, ValueLTGuard as ValueLT, ValueLEGuard as ValueLE, } from "./value-and-observation.js"; | ||
export { TransactionGuard as Transaction, PaymentGuard as Payment, NonPositivePayGuard as NonPositivePay, NonPositiveDepositGuard as NonPositiveDeposit, PartialPayGuard as PartialPay, ShadowingGuard as Shadowing, AssertionFailedGuard as AssertionFailed, TransactionWarningGuard as TransactionWarning, InvalidIntervalGuard as InvalidInterval, IntervalInPastGuard as IntervalInPast, IntervalErrorGuard as IntervalError, AmbiguousTimeIntervalErrorGuard as AmbiguousTimeIntervalError, ApplyNoMatchErrorGuard as ApplyNoMatchError, UselessTransactionGuard as UselessTransaction, TEIntervalErrorGuard as TEIntervalError, TransactionErrorGuard as TransactionError, TransactionSuccessGuard as TransactionSuccess, TransactionOutputGuard as TransactionOutput, } from "./transaction.js"; |
/** | ||
* This module exports static types (only useful in TypeScript) for the JSON schema as specified in the Appendix E of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe specification} | ||
``` | ||
@@ -25,4 +26,4 @@ import {Value, Contract} from "@marlowe/language-core-v1" | ||
export { Action, Deposit, Notify, Choice } from "./actions.js"; | ||
export { ChoiceName, ChoiceId, Bound } from "./choices.js"; | ||
export { Close, Pay, If, Let, Assert, Contract, When, Case, close, datetoTimeout, timeoutToDate, Timeout, } from "./contract.js"; | ||
export { ChoiceName, ChoiceId, Bound, ChosenNum } from "./choices.js"; | ||
export { Close, Pay, If, Let, Assert, Contract, When, Case, NormalCase, MerkleizedCase, close, datetoTimeout, timeoutToDate, Timeout, } from "./contract.js"; | ||
export { Environment, mkEnvironment, TimeInterval } from "./environment.js"; | ||
@@ -32,7 +33,7 @@ export { Input, IDeposit, IChoice, INotify, BuiltinByteString, inputNotify, InputContent, NormalInput, MerkleizedInput, } from "./inputs.js"; | ||
export { Payee, PayeeAccount, PayeeParty, AccountId } from "./payee.js"; | ||
export { Token, TokenName, tokenToString, token, adaToken } from "./token.js"; | ||
export { MarloweState } from "./state.js"; | ||
export { Value, AvailableMoney, Constant, NegValue, AddValue, SubValue, MulValue, DivValue, ChoiceValue, TimeIntervalStart, TimeIntervalEnd, UseValue, Cond, Observation, AndObs, OrObs, NotObs, ChoseSomething, ValueEQ, ValueGT, ValueGE, ValueLT, ValueLE, } from "./value-and-observation.js"; | ||
export { Token, TokenName, tokenToString, token, adaToken, lovelace, } from "./token.js"; | ||
export { Accounts, MarloweState } from "./state.js"; | ||
export { Value, ValueId, AvailableMoney, Constant, NegValue, AddValue, SubValue, MulValue, DivValue, ChoiceValue, TimeIntervalStart, TimeIntervalEnd, UseValue, Cond, Observation, AndObs, OrObs, NotObs, ChoseSomething, ValueEQ, ValueGT, ValueGE, ValueLT, ValueLE, } from "./value-and-observation.js"; | ||
export { TokenValue, tokenValue, adaValue } from "./tokenValue.js"; | ||
export { PolicyId } from "./policyId.js"; | ||
//# sourceMappingURL=index.d.ts.map |
/** | ||
* This module exports static types (only useful in TypeScript) for the JSON schema as specified in the Appendix E of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe specification} | ||
``` | ||
@@ -28,4 +29,4 @@ import {Value, Contract} from "@marlowe/language-core-v1" | ||
export { role } from "./participants.js"; | ||
export { tokenToString, token, adaToken } from "./token.js"; | ||
export { tokenToString, token, adaToken, lovelace, } from "./token.js"; | ||
export { TokenValue, tokenValue, adaValue } from "./tokenValue.js"; | ||
export { PolicyId } from "./policyId.js"; |
@@ -99,3 +99,3 @@ import * as t from "io-ts/lib/index.js"; | ||
*/ | ||
export declare const MerkleizedInputGuard: t.IntersectionC<[t.Type<InputContent, InputContent, unknown>, t.PartialC<{ | ||
export declare const MerkleizedInputGuard: t.IntersectionC<[t.Type<InputContent, InputContent, unknown>, t.TypeC<{ | ||
continuation_hash: t.Type<string, string, unknown>; | ||
@@ -102,0 +102,0 @@ merkleized_continuation: t.Type<import("./contract.js").Contract, import("./contract.js").Contract, unknown>; |
@@ -63,3 +63,3 @@ import * as t from "io-ts/lib/index.js"; | ||
InputContentGuard, | ||
t.partial({ | ||
t.type({ | ||
continuation_hash: BuiltinByteStringGuard, | ||
@@ -74,4 +74,4 @@ merkleized_continuation: ContractGuard, | ||
export const InputGuard = t.union([ | ||
MerkleizedInputGuard, | ||
NormalInputGuard, | ||
MerkleizedInputGuard, | ||
]); |
@@ -8,7 +8,9 @@ /** | ||
import { AddressBech32 } from "./address.js"; | ||
import { Sort } from "@marlowe.io/adapter/assoc-map"; | ||
/** | ||
* | ||
* An address party is defined by a blockchain specific Address and it cannot be traded | ||
* (it is fixed for the lifetime of a contract). | ||
``` | ||
const addressExample: Address = {"address" : "example address"} | ||
const addressExample: Address = {"address" : "addr_test1qpcucug827nlrmsv7n66hwdfpemwqtv8nxnjc4azacuu807w6l6hgelwsph7clqmauq7h3y9qhhgs0rwu3mu8uf7m4kqckxkry"} | ||
``` | ||
@@ -22,3 +24,3 @@ * @see Section 2.1.1 and appendix E.1 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe specification} | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Address | address type}. | ||
* @category Party | ||
@@ -36,3 +38,9 @@ */ | ||
/** | ||
* TODO: Comment | ||
* A Role, allows the participation of the contract to be dynamic. Any user that can prove to have permission to act as `RoleName` is able to carry out the | ||
* {@link @marlowe.io/language-core-v1!index.Action | actions} assigned, and redeem the {@link @marlowe.io/language-core-v1!semantics.Payment | payments} issued to that role. | ||
* The roles are implemented as tokens that can be traded, this allows for more complex use cases. | ||
* | ||
``` | ||
const roleExample: Role = {"role_token" : "Buyer"} | ||
``` | ||
* @category Party | ||
@@ -44,3 +52,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Role | role type}. | ||
* @category Party | ||
@@ -55,3 +63,4 @@ */ | ||
/** | ||
* TODO: Comment | ||
* A participant (or `Party`) in the contract can be represented by either a fixed {@link Address} | ||
* or a {@link Role} | ||
* @category Party | ||
@@ -61,3 +70,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Party | party type}. | ||
* @category Party | ||
@@ -74,3 +83,8 @@ */ | ||
export declare const partyToString: (party: Party) => string; | ||
/** | ||
* Sorting function for Parties as defined in the Marlowe Specification (SemanticsGuarantees.thy) | ||
* @hidden | ||
*/ | ||
export declare function partyCmp(a: Party, b: Party): Sort; | ||
export {}; | ||
//# sourceMappingURL=participants.d.ts.map |
@@ -10,4 +10,5 @@ /** | ||
import { AddressBech32 } from "./address.js"; | ||
import { strCmp } from "@marlowe.io/adapter/assoc-map"; | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Address | address type}. | ||
* @category Party | ||
@@ -23,3 +24,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Role | role type}. | ||
* @category Party | ||
@@ -34,3 +35,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Party | party type}. | ||
* @category Party | ||
@@ -47,1 +48,20 @@ */ | ||
export const partyToString = (party) => RoleGuard.is(party) ? party.role_token : party.address; | ||
/** | ||
* Sorting function for Parties as defined in the Marlowe Specification (SemanticsGuarantees.thy) | ||
* @hidden | ||
*/ | ||
export function partyCmp(a, b) { | ||
if (AddressGuard.is(a) && RoleGuard.is(b)) { | ||
return "LowerThan"; | ||
} | ||
if (RoleGuard.is(a) && AddressGuard.is(b)) { | ||
return "GreaterThan"; | ||
} | ||
if (AddressGuard.is(a) && AddressGuard.is(b)) { | ||
return strCmp(a.address, b.address); | ||
} | ||
if (RoleGuard.is(a) && RoleGuard.is(b)) { | ||
return strCmp(a.role_token, b.role_token); | ||
} | ||
throw new Error("Unreachable"); | ||
} |
import * as t from "io-ts/lib/index.js"; | ||
import { Party } from "./participants.js"; | ||
/** | ||
* TODO: Comment | ||
* The Marlowe model allows for a contract to store assets. All participants of the contract | ||
* implicitly own an account identified with an AccountId. Which is just a type alias for | ||
* a Party. | ||
* @category Payee | ||
@@ -9,3 +11,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link AccountId | accountId type}. | ||
* @category Payee | ||
@@ -15,3 +17,4 @@ */ | ||
/** | ||
* TODO: Comment | ||
* One of the {@link @marlowe.io/language-core-v1!index.Payee} options. A payment made to | ||
* an Account payee is an internal transfer of the funds (it doesn't leave the contract). | ||
* @category Payee | ||
@@ -23,3 +26,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.PayeeAccount | account payee type}. | ||
* @category Payee | ||
@@ -31,3 +34,4 @@ */ | ||
/** | ||
* TODO: Comment | ||
* One of the {@link @marlowe.io/language-core-v1!index.Payee} options. A payment made to | ||
* a Party payee takes the money out of the contract and gives it to the party. | ||
* @category Payee | ||
@@ -39,3 +43,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.PayeeParty | party payee type}. | ||
* @category Payee | ||
@@ -47,3 +51,5 @@ */ | ||
/** | ||
* TODO: Comment | ||
* When you use the {@link @marlowe.io/language-core-v1!index.Pay | Pay} construct to make a | ||
* {@link @marlowe.io/language-core-v1!semantics.Payment | payment} you need to specify the destination | ||
* of the payment using a `Payee`. | ||
* @category Payee | ||
@@ -53,3 +59,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Payee | payee type}. | ||
* @category Payee | ||
@@ -62,2 +68,18 @@ */ | ||
}>]>; | ||
/** | ||
* Pattern match object on the Payee type | ||
* @category Payee | ||
* @hidden | ||
*/ | ||
export type PayeeMatcher<T> = { | ||
party: (party: Party) => T; | ||
account: (account: AccountId) => T; | ||
}; | ||
/** | ||
* Pattern matching on the Payee type | ||
* @hidden | ||
* @category Payee | ||
*/ | ||
export declare function matchPayee<T>(matcher: PayeeMatcher<T>): (payee: Payee) => T; | ||
export declare function matchPayee<T>(matcher: Partial<PayeeMatcher<T>>): (payee: Payee) => T | undefined; | ||
//# sourceMappingURL=payee.d.ts.map |
import * as t from "io-ts/lib/index.js"; | ||
import { PartyGuard } from "./participants.js"; | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link AccountId | accountId type}. | ||
* @category Payee | ||
@@ -9,3 +9,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.PayeeAccount | account payee type}. | ||
* @category Payee | ||
@@ -18,3 +18,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.PayeeParty | party payee type}. | ||
* @category Payee | ||
@@ -27,3 +27,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Payee | payee type}. | ||
* @category Payee | ||
@@ -33,1 +33,11 @@ */ | ||
export const PayeeGuard = t.union([PayeeAccountGuard, PayeePartyGuard]); | ||
export function matchPayee(matcher) { | ||
return (payee) => { | ||
if (PayeePartyGuard.is(payee) && matcher.party) { | ||
return matcher.party(payee.party); | ||
} | ||
else if (PayeeAccountGuard.is(payee) && matcher.account) { | ||
return matcher.account(payee.account); | ||
} | ||
}; | ||
} |
import * as t from "io-ts/lib/index.js"; | ||
import { AssocMap, Sort } from "@marlowe.io/adapter/assoc-map"; | ||
import { AccountId } from "./payee.js"; | ||
import { ValueId } from "./value-and-observation.js"; | ||
import { Token } from "./token.js"; | ||
import { ChoiceId } from "./choices.js"; | ||
export type Account = t.TypeOf<typeof Account>; | ||
export declare const Account: t.TupleC<[t.TupleC<[t.UnionC<[t.Type<import("./participants.js").Address, import("./participants.js").Address, unknown>, t.Type<import("./participants.js").Role, import("./participants.js").Role, unknown>]>, t.Type<import("./token.js").Token, import("./token.js").Token, unknown>]>, t.BigIntC]>; | ||
export declare const Account: t.TupleC<[t.TupleC<[t.UnionC<[t.Type<import("./participants.js").Address, import("./participants.js").Address, unknown>, t.Type<import("./participants.js").Role, import("./participants.js").Role, unknown>]>, t.Type<Token, Token, unknown>]>, t.BigIntC]>; | ||
/** | ||
* TODO: Comment | ||
* The Marlowe model allows for a contract to store assets. All participants of the contract implicitly | ||
* own an account identified with an AccountId. | ||
* | ||
* All assets stored in the contract must be in an internal account for one of the parties; this way, | ||
* when the contract is closed, all remaining assets can be redeemed by their respective owners. | ||
* These accounts are local: they only exist (and are accessible) within the contract. | ||
* @category State | ||
* @see Section 2.1.3 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} | ||
*/ | ||
export type Accounts = t.TypeOf<typeof AccountsGuard>; | ||
export type Accounts = AssocMap<[AccountId, Token], bigint>; | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Accounts | accounts type}. | ||
* @category State | ||
*/ | ||
export declare const AccountsGuard: t.ArrayC<t.TupleC<[t.TupleC<[t.UnionC<[t.Type<import("./participants.js").Address, import("./participants.js").Address, unknown>, t.Type<import("./participants.js").Role, import("./participants.js").Role, unknown>]>, t.Type<import("./token.js").Token, import("./token.js").Token, unknown>]>, t.BigIntC]>>; | ||
export declare const AccountsGuard: t.Type<Accounts>; | ||
/** | ||
* TODO: Comment | ||
* Sorting function for Accounts | ||
* @hidden | ||
*/ | ||
export declare function accountsCmp(a: [AccountId, Token], b: [AccountId, Token]): Sort; | ||
/** | ||
* The state of a Marlowe Contract is stored in the blockchain and contains the information required to move the contract | ||
* forward via computeTransaction | ||
* @see Section 2.1.8 and appendix E.14 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} | ||
@@ -22,17 +37,24 @@ * @category State | ||
export interface MarloweState { | ||
/** | ||
* @inheritdoc Accounts | ||
*/ | ||
accounts: Accounts; | ||
/** | ||
* TODO: Comment | ||
* Serialized as associative map | ||
* This is a Map of the values that were bound to the contract using the {@link Let} construct. | ||
*/ | ||
boundValues: Array<[ValueId, bigint]>; | ||
boundValues: AssocMap<ValueId, bigint>; | ||
/** | ||
* TODO: Comment | ||
* Serialized as associative map | ||
* This is a Map of the choices that were made by the participants of the contract using the {@link Choice} action. | ||
*/ | ||
choices: Array<[ChoiceId, bigint]>; | ||
choices: AssocMap<ChoiceId, bigint>; | ||
/** | ||
* Transactions have a validity time interval `(startTime, endTime)` which gives us a proxy for real time. | ||
* It is up to the blockchain implementation to make sure that `startTime <= now <= endTime`. The variable | ||
* `minTime` is the biggest known `startTime`. That allow us to trim a time interval and ensure that | ||
* `startTime` does not decrease between transactions. | ||
*/ | ||
minTime: bigint; | ||
} | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link MarloweState | state type}. | ||
* @see Section 2.1.8 and appendix E.14 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} | ||
@@ -39,0 +61,0 @@ * @category State |
import * as t from "io-ts/lib/index.js"; | ||
import { AssocMapGuard } from "@marlowe.io/adapter/assoc-map"; | ||
import { AccountIdGuard } from "./payee.js"; | ||
import { ValueIdGuard } from "./value-and-observation.js"; | ||
import { TokenGuard } from "./token.js"; | ||
import { tokenCmp, TokenGuard } from "./token.js"; | ||
import { ChoiceIdGuard } from "./choices.js"; | ||
import { partyCmp } from "./participants.js"; | ||
export const Account = t.tuple([ | ||
@@ -10,11 +12,20 @@ t.tuple([AccountIdGuard, TokenGuard]), | ||
]); | ||
// DISCUSSION: Instead of having a custom guard for this we could have | ||
// an associative Map guard. | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Accounts | accounts type}. | ||
* @category State | ||
*/ | ||
export const AccountsGuard = t.array(Account); | ||
export const AccountsGuard = AssocMapGuard(t.tuple([AccountIdGuard, TokenGuard]), t.bigint); | ||
/** | ||
* TODO: Comment | ||
* Sorting function for Accounts | ||
* @hidden | ||
*/ | ||
export function accountsCmp(a, b) { | ||
const accIdCmp = partyCmp(a[0], b[0]); | ||
if (accIdCmp !== "EqualTo") { | ||
return accIdCmp; | ||
} | ||
return tokenCmp(a[1], b[1]); | ||
} | ||
/** | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link MarloweState | state type}. | ||
* @see Section 2.1.8 and appendix E.14 of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe spec} | ||
@@ -25,5 +36,5 @@ * @category State | ||
accounts: AccountsGuard, | ||
boundValues: t.array(t.tuple([ValueIdGuard, t.bigint])), | ||
choices: t.array(t.tuple([ChoiceIdGuard, t.bigint])), | ||
boundValues: AssocMapGuard(ValueIdGuard, t.bigint), | ||
choices: AssocMapGuard(ChoiceIdGuard, t.bigint), | ||
minTime: t.bigint, | ||
}); |
@@ -0,5 +1,6 @@ | ||
import { Sort } from "@marlowe.io/adapter/assoc-map"; | ||
import * as t from "io-ts/lib/index.js"; | ||
import { PolicyId } from "./policyId.js"; | ||
/** | ||
* TODO: Comment | ||
* @see {@link @marlowe.io/language-core-v1!index.Token}. | ||
* @category Token | ||
@@ -9,3 +10,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.TokenName | token name type}. | ||
* @category Token | ||
@@ -15,17 +16,12 @@ */ | ||
/** | ||
* TODO: Comment | ||
* A Token consists of a `CurrencySymbol` that represents the monetary policy of the | ||
* `Token` and a `TokenName` which allows to have multiple tokens with the same monetary policy. | ||
* @category Token | ||
*/ | ||
export interface Token { | ||
/** | ||
* TODO: Comment | ||
*/ | ||
currency_symbol: PolicyId; | ||
/** | ||
* TODO: Comment | ||
*/ | ||
token_name: TokenName; | ||
} | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Token | token type}. | ||
* @category Token | ||
@@ -47,12 +43,16 @@ */ | ||
/** | ||
* The native {@link Token} of the Cardano blockchain. 1 Million lovelaces is one ADA. | ||
* @category Token | ||
*/ | ||
export declare const lovelace: Token; | ||
/** | ||
* @deprecated Use `lovelace` instead | ||
* @hidden | ||
*/ | ||
export declare const lovelaceToken: Token; | ||
export declare const adaToken: Token; | ||
/** | ||
* DISCUSSION: In different places (like the playground) | ||
* we use the name `ada` for the lovelace token, I think we | ||
* should only use lovelace as it can be missleading. | ||
* Sorting function for Parties as defined in the Marlowe Specification (SemanticsGuarantees.thy) | ||
* @hidden | ||
*/ | ||
export declare const adaToken: Token; | ||
export declare function tokenCmp(a: Token, b: Token): Sort; | ||
//# sourceMappingURL=token.d.ts.map |
@@ -0,5 +1,6 @@ | ||
import { strCmp } from "@marlowe.io/adapter/assoc-map"; | ||
import * as t from "io-ts/lib/index.js"; | ||
import { PolicyId } from "./policyId.js"; | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.TokenName | token name type}. | ||
* @category Token | ||
@@ -9,3 +10,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Token | token type}. | ||
* @category Token | ||
@@ -30,11 +31,21 @@ */ | ||
/** | ||
* The native {@link Token} of the Cardano blockchain. 1 Million lovelaces is one ADA. | ||
* @category Token | ||
*/ | ||
export const lovelace = token("", ""); | ||
/** | ||
* @deprecated Use `lovelace` instead | ||
* @hidden | ||
*/ | ||
export const lovelaceToken = token("", ""); | ||
export const adaToken = lovelace; | ||
/** | ||
* DISCUSSION: In different places (like the playground) | ||
* we use the name `ada` for the lovelace token, I think we | ||
* should only use lovelace as it can be missleading. | ||
* Sorting function for Parties as defined in the Marlowe Specification (SemanticsGuarantees.thy) | ||
* @hidden | ||
*/ | ||
export const adaToken = lovelaceToken; | ||
export function tokenCmp(a, b) { | ||
const currencyCmp = strCmp(a.currency_symbol, b.currency_symbol); | ||
if (currencyCmp !== "EqualTo") { | ||
return currencyCmp; | ||
} | ||
return strCmp(a.token_name, b.token_name); | ||
} |
@@ -11,3 +11,3 @@ /** | ||
/** | ||
* TODO: Comment | ||
* Represents the amount of money available in a participants internal account | ||
* @category Value | ||
@@ -20,3 +20,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.AvailableMoney | available money type}. | ||
* @category Value | ||
@@ -31,3 +31,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* A constant value | ||
* @category Value | ||
@@ -37,3 +37,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Constant | constant value type}. | ||
* @category Value | ||
@@ -43,3 +43,4 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents the start time as a POSIXTime of the {@link @marlowe.io/language-core-v1!semantics.Transaction} this value is | ||
* evaluated in. | ||
* @category Value | ||
@@ -49,3 +50,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.TimeIntervalStart | time interval start type}. | ||
* @category Value | ||
@@ -55,3 +56,4 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents the end time as a POSIXTime of the {@link @marlowe.io/language-core-v1!semantics.Transaction} this value is | ||
* evaluated in. | ||
* @category Value | ||
@@ -61,3 +63,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.TimeIntervalEnd | time interval end type}. | ||
* @category Value | ||
@@ -67,3 +69,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents `- negate` | ||
* @category Value | ||
@@ -75,3 +77,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.NegValue | neg value type}. | ||
* @category Value | ||
@@ -81,3 +83,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents `add + and` | ||
* @category Value | ||
@@ -90,3 +92,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.AddValue | add value type}. | ||
* @category Value | ||
@@ -96,3 +98,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents `value - minus` | ||
* @category Value | ||
@@ -105,3 +107,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.SubValue | sub value type}. | ||
* @category Value | ||
@@ -119,3 +121,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents `multiply * times` | ||
* @category Value | ||
@@ -128,3 +130,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.MulValue | mul value type}. | ||
* @category Value | ||
@@ -134,3 +136,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents `divide / by` | ||
* @category Value | ||
@@ -143,3 +145,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.DivValue | div value type}. | ||
* @category Value | ||
@@ -149,3 +151,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Represents the {@link @marlowe.io/language-core-v1!index.ChosenNum} for a {@link @marlowe.io/language-core-v1!index.ChoiceId}. | ||
* @category Value | ||
@@ -157,10 +159,18 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ChoiceValue | choice value type}. | ||
* @category Value | ||
*/ | ||
export declare const ChoiceValueGuard: t.Type<ChoiceValue>; | ||
/** | ||
* Is an identifier for a {@link @marlowe.io/language-core-v1!index.Let} binding | ||
* @category Value | ||
*/ | ||
export type ValueId = string; | ||
/** | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueId | value id type}. | ||
* @category Value | ||
*/ | ||
export declare const ValueIdGuard: t.Type<ValueId>; | ||
/** | ||
* TODO: Comment | ||
* Represents the bound value of a {@link @marlowe.io/language-core-v1!index.Let} expression. | ||
* @category Value | ||
@@ -172,3 +182,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link UseValue | use value type}. | ||
* @category Value | ||
@@ -178,3 +188,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Ternary conditional expression | ||
* @category Value | ||
@@ -188,3 +198,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Cond | cond type}. | ||
* @category Value | ||
@@ -194,3 +204,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Marlowe allows the representation of numeric `Values` using the following constructs | ||
* @category Value | ||
@@ -200,3 +210,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Value | value type}. | ||
* @category Value | ||
@@ -206,3 +216,29 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Pattern match object on the Value type | ||
* @category Value | ||
* @hidden | ||
*/ | ||
export type ValueMatcher<T> = { | ||
availableMoney: (value: AvailableMoney) => T; | ||
constant: (value: Constant) => T; | ||
negValue: (value: NegValue) => T; | ||
addValue: (value: AddValue) => T; | ||
subValue: (value: SubValue) => T; | ||
mulValue: (value: MulValue) => T; | ||
divValue: (value: DivValue) => T; | ||
choiceValue: (value: ChoiceValue) => T; | ||
timeIntervalStart: (value: TimeIntervalStart) => T; | ||
timeIntervalEnd: (value: TimeIntervalEnd) => T; | ||
useValue: (value: UseValue) => T; | ||
cond: (value: Cond) => T; | ||
}; | ||
/** | ||
* Pattern matching on the Value type | ||
* @hidden | ||
* @category Value | ||
*/ | ||
export declare function matchValue<T>(matcher: ValueMatcher<T>): (value: Value) => T; | ||
export declare function matchValue<T>(matcher: Partial<ValueMatcher<T>>): (value: Value) => T | undefined; | ||
/** | ||
* Observes `both && and` | ||
* @category Observation | ||
@@ -215,3 +251,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link AndObs | and type}. | ||
* @category Observation | ||
@@ -221,3 +257,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Observes `either || or` | ||
* @category Observation | ||
@@ -230,3 +266,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link OrObs | or type}. | ||
* @category Observation | ||
@@ -236,3 +272,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Negates the `not` observation | ||
* @category Observation | ||
@@ -244,3 +280,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link NotObs | not type}. | ||
* @category Observation | ||
@@ -250,3 +286,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Observes if the `chose_something_for` choice was made | ||
* @category Observation | ||
@@ -258,3 +294,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ChoseSomething | choose something type}. | ||
* @category Observation | ||
@@ -264,3 +300,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Observes if `value == equal_to` | ||
* @category Observation | ||
@@ -273,3 +309,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueEQ | value eq type}. | ||
* @category Observation | ||
@@ -279,3 +315,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Observes if `value > gt` | ||
* @category Observation | ||
@@ -288,3 +324,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueGT | value greater than type}. | ||
* @category Observation | ||
@@ -294,3 +330,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Observes if `value >= ge_than` | ||
* @category Observation | ||
@@ -303,3 +339,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueGE | value greater or equal type}. | ||
* @category Observation | ||
@@ -309,3 +345,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Observes if `value < lt` | ||
* @category Observation | ||
@@ -318,3 +354,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueLT | value lower than type}. | ||
* @category Observation | ||
@@ -324,3 +360,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Observes if `value <= le_than` | ||
* @category Observation | ||
@@ -333,3 +369,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueLE | value lower or equal type}. | ||
* @category Observation | ||
@@ -339,3 +375,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* Marlowe allows the representation of boolean `Observation`s using the following constructs | ||
* @category Observation | ||
@@ -345,6 +381,31 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Observation | observation type}. | ||
* @category Observation | ||
*/ | ||
export declare const ObservationGuard: t.Type<Observation>; | ||
/** | ||
* Pattern match object on the Observation type | ||
* @category Observation | ||
* @hidden | ||
*/ | ||
export type ObservationMatcher<T> = { | ||
andObs: (observation: AndObs) => T; | ||
orObs: (observation: OrObs) => T; | ||
notObs: (observation: NotObs) => T; | ||
choseSomething: (observation: ChoseSomething) => T; | ||
valueEQ: (observation: ValueEQ) => T; | ||
valueGT: (observation: ValueGT) => T; | ||
valueGE: (observation: ValueGE) => T; | ||
valueLT: (observation: ValueLT) => T; | ||
valueLE: (observation: ValueLE) => T; | ||
trueObs: (observation: true) => T; | ||
falseObs: (observation: false) => T; | ||
}; | ||
/** | ||
* Pattern matching on the Observation type | ||
* @hidden | ||
* @category Observation | ||
*/ | ||
export declare function matchObservation<T>(matcher: ObservationMatcher<T>): (observation: Observation) => T; | ||
export declare function matchObservation<T>(matcher: Partial<ObservationMatcher<T>>): (observation: Observation) => T | undefined; | ||
//# sourceMappingURL=value-and-observation.d.ts.map |
@@ -11,3 +11,3 @@ /** | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.AvailableMoney | available money type}. | ||
* @category Value | ||
@@ -25,3 +25,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Constant | constant value type}. | ||
* @category Value | ||
@@ -31,3 +31,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.TimeIntervalStart | time interval start type}. | ||
* @category Value | ||
@@ -37,3 +37,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.TimeIntervalEnd | time interval end type}. | ||
* @category Value | ||
@@ -43,3 +43,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.NegValue | neg value type}. | ||
* @category Value | ||
@@ -49,3 +49,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.AddValue | add value type}. | ||
* @category Value | ||
@@ -55,3 +55,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.SubValue | sub value type}. | ||
* @category Value | ||
@@ -69,3 +69,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.MulValue | mul value type}. | ||
* @category Value | ||
@@ -75,3 +75,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.DivValue | div value type}. | ||
* @category Value | ||
@@ -81,9 +81,13 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ChoiceValue | choice value type}. | ||
* @category Value | ||
*/ | ||
export const ChoiceValueGuard = t.recursion("ChoiceValue", () => t.type({ value_of_choice: ChoiceIdGuard })); | ||
/** | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueId | value id type}. | ||
* @category Value | ||
*/ | ||
export const ValueIdGuard = t.string; | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link UseValue | use value type}. | ||
* @category Value | ||
@@ -93,3 +97,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Cond | cond type}. | ||
* @category Value | ||
@@ -99,3 +103,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link Value | value type}. | ||
* @category Value | ||
@@ -117,4 +121,44 @@ */ | ||
])); | ||
export function matchValue(matcher) { | ||
return (value) => { | ||
if (AvailableMoneyGuard.is(value) && matcher.availableMoney) { | ||
return matcher.availableMoney(value); | ||
} | ||
else if (ConstantGuard.is(value) && matcher.constant) { | ||
return matcher.constant(value); | ||
} | ||
else if (NegValueGuard.is(value) && matcher.negValue) { | ||
return matcher.negValue(value); | ||
} | ||
else if (AddValueGuard.is(value) && matcher.addValue) { | ||
return matcher.addValue(value); | ||
} | ||
else if (SubValueGuard.is(value) && matcher.subValue) { | ||
return matcher.subValue(value); | ||
} | ||
else if (MulValueGuard.is(value) && matcher.mulValue) { | ||
return matcher.mulValue(value); | ||
} | ||
else if (DivValueGuard.is(value) && matcher.divValue) { | ||
return matcher.divValue(value); | ||
} | ||
else if (ChoiceValueGuard.is(value) && matcher.choiceValue) { | ||
return matcher.choiceValue(value); | ||
} | ||
else if (TimeIntervalStartGuard.is(value) && matcher.timeIntervalStart) { | ||
return matcher.timeIntervalStart(value); | ||
} | ||
else if (TimeIntervalEndGuard.is(value) && matcher.timeIntervalEnd) { | ||
return matcher.timeIntervalEnd(value); | ||
} | ||
else if (UseValueGuard.is(value) && matcher.useValue) { | ||
return matcher.useValue(value); | ||
} | ||
else if (CondGuard.is(value) && matcher.cond) { | ||
return matcher.cond(value); | ||
} | ||
}; | ||
} | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link AndObs | and type}. | ||
* @category Observation | ||
@@ -124,3 +168,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link OrObs | or type}. | ||
* @category Observation | ||
@@ -130,3 +174,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link NotObs | not type}. | ||
* @category Observation | ||
@@ -136,3 +180,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ChoseSomething | choose something type}. | ||
* @category Observation | ||
@@ -143,3 +187,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueEQ | value eq type}. | ||
* @category Observation | ||
@@ -149,3 +193,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueGT | value greater than type}. | ||
* @category Observation | ||
@@ -155,3 +199,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueGE | value greater or equal type}. | ||
* @category Observation | ||
@@ -161,3 +205,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueLT | value lower than type}. | ||
* @category Observation | ||
@@ -167,3 +211,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link ValueLE | value lower or equal type}. | ||
* @category Observation | ||
@@ -173,3 +217,3 @@ */ | ||
/** | ||
* TODO: Comment | ||
* {@link !io-ts-usage | Dynamic type guard} for the {@link @marlowe.io/language-core-v1!index.Observation | observation type}. | ||
* @category Observation | ||
@@ -189,1 +233,38 @@ */ | ||
])); | ||
export function matchObservation(matcher) { | ||
return (observation) => { | ||
if (AndObsGuard.is(observation) && matcher.andObs) { | ||
return matcher.andObs(observation); | ||
} | ||
else if (OrObsGuard.is(observation) && matcher.orObs) { | ||
return matcher.orObs(observation); | ||
} | ||
else if (NotObsGuard.is(observation) && matcher.notObs) { | ||
return matcher.notObs(observation); | ||
} | ||
else if (ChoseSomethingGuard.is(observation) && matcher.choseSomething) { | ||
return matcher.choseSomething(observation); | ||
} | ||
else if (ValueEQGuard.is(observation) && matcher.valueEQ) { | ||
return matcher.valueEQ(observation); | ||
} | ||
else if (ValueGTGuard.is(observation) && matcher.valueGT) { | ||
return matcher.valueGT(observation); | ||
} | ||
else if (ValueGEGuard.is(observation) && matcher.valueGE) { | ||
return matcher.valueGE(observation); | ||
} | ||
else if (ValueLTGuard.is(observation) && matcher.valueLT) { | ||
return matcher.valueLT(observation); | ||
} | ||
else if (ValueLEGuard.is(observation) && matcher.valueLE) { | ||
return matcher.valueLE(observation); | ||
} | ||
else if (observation == true && matcher.trueObs) { | ||
return matcher.trueObs(observation); | ||
} | ||
else if (observation == false && matcher.falseObs) { | ||
return matcher.falseObs(observation); | ||
} | ||
}; | ||
} |
{ | ||
"name": "@marlowe.io/language-core-v1", | ||
"version": "0.2.0-alpha-20", | ||
"version": "0.2.0-alpha-21", | ||
"description": "Library to manipulate Marlowe Core contracts", | ||
@@ -52,2 +52,7 @@ "repository": "https://github.com/input-output-hk/marlowe-ts-sdk", | ||
"types": "./dist/esm/version.d.ts" | ||
}, | ||
"./semantics": { | ||
"import": "./dist/esm/semantics.js", | ||
"require": "./dist/bundled/cjs/semantics.cjs", | ||
"types": "./dist/esm/semantics.d.ts" | ||
} | ||
@@ -54,0 +59,0 @@ }, |
# Description | ||
This package contains code to work with the version 1 of Marlowe Core. It exports four modules: | ||
This package contains code to work with the version 1 of Marlowe Core. It exports 5 modules: | ||
@@ -9,2 +9,3 @@ - @{@link index | marlowe.io/language-core-v1} - Exports static types (TypeScript only) for the JSON schema as specified in the Appendix E of the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe specification} | ||
- @{@link playground-v1 | marlowe.io/language-core-v1/playground-v1} - Exports constructors compatible with the Playground's `marlowe-js` internal library. | ||
- @{@link semantics | marlowe.io/language-core-v1/semantics} - Exports the semantics of the Core language as specified in the {@link https://github.com/input-output-hk/marlowe/releases/download/v3/Marlowe.pdf | Marlowe specification}. This can be used to simulate or unit test a contract. | ||
@@ -11,0 +12,0 @@ ## Getting started |
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 too big to display
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1761109
181
51798
34