Skip to content

Commit 0b40e6c

Browse files
committed
eng-1983 initial stab at crossAppContracts
1 parent 562c561 commit 0b40e6c

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

packages/database/src/crossAppContracts.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,20 @@ type CrossAppBase = LocalRef & {
2121
author: Ref;
2222
};
2323

24+
type SpaceRef = DbRef | { url: string; sourceApp: Enums<"Platform"> };
25+
26+
export type LocalOrRemoteRef =
27+
| LocalRef
28+
| {
29+
localId: string;
30+
// infer space from context if absent.
31+
space?: SpaceRef;
32+
}
33+
| {
34+
// A string that contains combined space and localId
35+
rid: string;
36+
};
37+
2438
// A node schema
2539
export type CrossAppNodeSchema = CrossAppBase & {
2640
label: string;
@@ -72,3 +86,10 @@ export type CrossAppNode = CrossAppBase & {
7286
full: InlineCrossAppTypedContent;
7387
};
7488
};
89+
90+
// A relation instance
91+
export type CrossAppRelation = CrossAppBase & {
92+
relationType: Ref;
93+
source: LocalOrRemoteRef;
94+
destination: LocalOrRemoteRef;
95+
};

0 commit comments

Comments
 (0)