@ottochain/sdk 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,8 @@
1
1
  /**
2
- * Corporate Governance State Machines
3
- *
4
- * TypeScript definitions using defineFiberApp() pattern.
5
- * Converted from JSON state machine definitions.
2
+ * Corporate state machine definitions.
3
+ * Re-exports from TypeScript definition files.
6
4
  */
7
- // Core corporate state machines
8
- export { corpEntityDef, } from "./corp-entity.js";
9
- export { corpBoardDef, } from "./corp-board.js";
10
- export { corpShareholdersDef, } from "./corp-shareholders.js";
11
- export { corpSecuritiesDef, } from "./corp-securities.js";
12
- // Re-export all definitions as a collection
13
- export const corporateStateMachines = {
14
- corpEntity: () => import("./corp-entity.js").then((m) => m.corpEntityDef),
15
- corpBoard: () => import("./corp-board.js").then((m) => m.corpBoardDef),
16
- corpShareholders: () => import("./corp-shareholders.js").then((m) => m.corpShareholdersDef),
17
- corpSecurities: () => import("./corp-securities.js").then((m) => m.corpSecuritiesDef),
18
- };
5
+ export { corpBoardDef } from './corp-board.js';
6
+ export { corpEntityDef } from './corp-entity.js';
7
+ export { corpSecuritiesDef } from './corp-securities.js';
8
+ export { corpShareholdersDef } from './corp-shareholders.js';
@@ -1,11 +1,10 @@
1
1
  /**
2
- * Governance State Machine Definitions
3
- *
4
- * TypeScript-first definitions using defineFiberApp() - no JSON, no code generation.
2
+ * Governance state machine definitions.
3
+ * Re-exports from TypeScript definition files.
5
4
  */
6
- export { govUniversalDef } from "./governance-universal.js";
7
- export { govSimpleDef } from "./governance-simple.js";
8
- export { daoSingleDef } from "./dao-single.js";
9
- export { daoMultisigDef } from "./dao-multisig.js";
10
- export { daoTokenDef } from "./dao-token.js";
11
- export { daoReputationDef } from "./dao-reputation.js";
5
+ export { daoMultisigDef } from './dao-multisig.js';
6
+ export { daoReputationDef } from './dao-reputation.js';
7
+ export { daoSingleDef } from './dao-single.js';
8
+ export { daoTokenDef } from './dao-token.js';
9
+ export { govSimpleDef } from './governance-simple.js';
10
+ export { govUniversalDef } from './governance-universal.js';
@@ -1,14 +1,7 @@
1
1
  /**
2
- * Identity State Machine Definitions
3
- *
4
- * TypeScript-first definitions - no JSON, no code generation.
2
+ * Identity state machine definitions.
3
+ * Re-exports from TypeScript definition files.
5
4
  */
6
- export { identityAgentDef, } from "./identity-agent.js";
7
- export { identityOracleDef, } from "./identity-oracle.js";
8
- export { identityUniversalDef, } from "./identity-universal.js";
9
- // Re-export all definitions as a record for iteration
10
- export const IDENTITY_DEFINITIONS = {
11
- agent: () => import("./identity-agent.js").then((m) => m.identityAgentDef),
12
- oracle: () => import("./identity-oracle.js").then((m) => m.identityOracleDef),
13
- universal: () => import("./identity-universal.js").then((m) => m.identityUniversalDef),
14
- };
5
+ export { identityAgentDef } from './identity-agent.js';
6
+ export { identityOracleDef } from './identity-oracle.js';
7
+ export { identityUniversalDef } from './identity-universal.js';
@@ -1,10 +1,9 @@
1
1
  /**
2
- * Markets State Machine Definitions
3
- *
4
- * TypeScript-first definitions using defineFiberApp() - no JSON, no code generation.
2
+ * Markets state machine definitions.
3
+ * Re-exports from TypeScript definition files.
5
4
  */
6
- export { marketUniversalDef } from "./market-universal.js";
7
- export { marketPredictionDef } from "./market-prediction.js";
8
- export { marketAuctionDef } from "./market-auction.js";
9
- export { marketCrowdfundDef } from "./market-crowdfund.js";
10
- export { marketGroupBuyDef } from "./market-group-buy.js";
5
+ export { marketAuctionDef } from './market-auction.js';
6
+ export { marketCrowdfundDef } from './market-crowdfund.js';
7
+ export { marketGroupBuyDef } from './market-group-buy.js';
8
+ export { marketPredictionDef } from './market-prediction.js';
9
+ export { marketUniversalDef } from './market-universal.js';
package/dist/esm/index.js CHANGED
@@ -42,3 +42,5 @@ DagAddressSchema, PrivateKeySchema, PublicKeySchema, KeyPairSchema, SignaturePro
42
42
  validate, validatePrivateKey, validatePublicKey, validateAddress, validateKeyPair, safeParse, assert, } from './validation.js';
43
43
  // ─── OttoChain metagraph client ───────────────────────────────────────────────
44
44
  export { MetagraphClient as OttoMetagraphClient } from './ottochain/metagraph-client.js';
45
+ // Proto definition helper
46
+ export { toProtoDefinition, defineFiberApp, } from './schema/fiber-app.js';
@@ -58,6 +58,7 @@ export function toJSON(def) {
58
58
  */
59
59
  export function toProtoDefinition(def) {
60
60
  // Extract only the proto-compatible fields
61
+ // NOTE: guard and effect are REQUIRED by the Scala Transition case class (no defaults)
61
62
  const protoDef = {
62
63
  states: {},
63
64
  initialState: def.initialState,
@@ -65,10 +66,10 @@ export function toProtoDefinition(def) {
65
66
  from: t.from,
66
67
  to: t.to,
67
68
  eventName: t.eventName,
68
- ...(t.guard && { guard: t.guard }),
69
- ...(t.effect && { effect: t.effect }),
69
+ guard: t.guard, // Required - Scala has no default
70
+ effect: t.effect, // Required - Scala has no default
71
+ // dependencies has default Set.empty in Scala, so omit if empty
70
72
  ...(t.dependencies?.length && { dependencies: [...t.dependencies] }),
71
- ...(t.emits?.length && { emits: [...t.emits] }),
72
73
  })),
73
74
  };
74
75
  // Copy states (only id and isFinal)