Skip to content
Open
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
21 changes: 21 additions & 0 deletions packages/database/src/crossAppContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ type CrossAppBase = LocalRef & {
author: Ref;
};

type SpaceRef = DbRef | { url: string; sourceApp: Enums<"Platform"> };

export type LocalOrRemoteRef =
| LocalRef
| {
localId: string;
// infer space from context if absent.
space?: SpaceRef;
}
| {
// A string that contains combined space and localId
rid: string;
};

// A node schema
export type CrossAppNodeSchema = CrossAppBase & {
label: string;
Expand Down Expand Up @@ -72,3 +86,10 @@ export type CrossAppNode = CrossAppBase & {
full: InlineCrossAppTypedContent;
};
};

// A relation instance
export type CrossAppRelation = CrossAppBase & {
relationType: Ref;
source: LocalOrRemoteRef;
destination: LocalOrRemoteRef;
};