Skip to content

Commit f2f5ee7

Browse files
committed
eng-1983 initial stab at crossAppContracts
1 parent f14ab44 commit f2f5ee7

1 file changed

Lines changed: 56 additions & 3 deletions

File tree

packages/database/src/crossAppContracts.ts

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,27 +85,80 @@ export type CrossAppEmbedding = {
8585
embedding?: Enums<"EmbeddingName">;
8686
};
8787

88-
// A Content object. It can be put inline inside a concept.
89-
// Missing CrossAppBase attributes are inferred from enclosing object.
90-
export type InlineCrossAppContent = Partial<CrossAppBase> & {
88+
// An asset reference
89+
export type CrossAppAsset = {
90+
content: ArrayBuffer;
91+
mimetype: string;
92+
createdAt: Date;
93+
modifiedAt?: Date;
94+
filepath?: string;
95+
};
96+
97+
// Document fields
98+
type CrossAppDocumentExtras = {
99+
// MIME type
100+
contentType: string;
101+
};
102+
103+
// An inline document, to put inside Content or Concept.
104+
// Currently, we fully infer Documents (setting content_as_document=true)
105+
// since our nodes are pages; so this is not used yet.
106+
export type InlineCrossAppDocument = Partial<CrossAppBase> &
107+
CrossAppDocumentExtras;
108+
109+
// A standalone document, for `upsert_documents`. Not currently used.
110+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
111+
type StandaloneCrossAppDocument = LocalRef &
112+
CrossAppBase &
113+
CrossAppDocumentExtras;
114+
115+
// Content fields
116+
type CrossAppContentExtras = {
91117
value: string;
92118
embedding?: CrossAppEmbedding;
93119
scale?: Enums<"Scale">;
120+
partOf?: Ref;
121+
assets?: CrossAppAsset[];
122+
document?: InlineCrossAppDocument;
94123
contentType?: ContentType;
95124
};
96125

126+
// A Content object. It can be put inline inside a concept.
127+
// Missing CrossAppBase attributes are inferred from enclosing object.
128+
export type InlineCrossAppContent = Partial<CrossAppBase> &
129+
CrossAppContentExtras;
130+
131+
// A standalone content object, for `upsert_content`
132+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
133+
type StandaloneCrossAppContent = LocalRef &
134+
CrossAppBase &
135+
CrossAppContentExtras;
136+
97137
// An inline Content with obligatory typing
98138
type InlineCrossAppTypedContent = InlineCrossAppContent & {
99139
contentType: ContentType;
100140
};
101141

142+
// A platform account
143+
// either standalone for `upsert_account_in_space`,
144+
// or inline in Content or Concept
145+
export type CrossAppAccount = {
146+
accountLocalId: string;
147+
name?: string;
148+
email?: string;
149+
// agentType: Enums<"AgentType"> = 'person' // inferred
150+
// dgAccount?: string; // uuid
151+
};
152+
102153
// A node instance
103154
export type CrossAppNode = CrossAppBase & {
104155
nodeType: Ref;
105156
content: {
106157
direct: InlineCrossAppContent;
107158
full: InlineCrossAppTypedContent;
108159
};
160+
// This is a way to define document globally for all contents
161+
document?: InlineCrossAppDocument;
109162
};
110163

111164
// A relation instance

0 commit comments

Comments
 (0)