2023-10-03 12:16:33 +00:00
|
|
|
export type FileMeta = {
|
|
|
|
name: string;
|
2023-11-03 08:38:04 +00:00
|
|
|
created: number;
|
2023-10-03 12:16:33 +00:00
|
|
|
lastModified: number;
|
|
|
|
contentType: string;
|
|
|
|
size: number;
|
|
|
|
perm: "ro" | "rw";
|
|
|
|
noSync?: boolean;
|
|
|
|
};
|
|
|
|
|
2023-11-06 08:14:16 +00:00
|
|
|
export type PageMeta = ObjectValue<
|
|
|
|
{
|
|
|
|
name: string;
|
|
|
|
created: string; // indexing it as a string
|
|
|
|
lastModified: string; // indexing it as a string
|
|
|
|
lastOpened?: number;
|
|
|
|
perm: "ro" | "rw";
|
|
|
|
} & Record<string, any>
|
|
|
|
>;
|
2023-10-03 12:16:33 +00:00
|
|
|
|
|
|
|
export type AttachmentMeta = {
|
|
|
|
name: string;
|
|
|
|
contentType: string;
|
2023-11-03 08:38:04 +00:00
|
|
|
created: number;
|
2023-10-03 12:16:33 +00:00
|
|
|
lastModified: number;
|
|
|
|
size: number;
|
|
|
|
perm: "ro" | "rw";
|
|
|
|
};
|
|
|
|
|
|
|
|
// Message Queue related types
|
2023-08-28 15:12:15 +00:00
|
|
|
export type MQMessage = {
|
2023-08-10 16:32:41 +00:00
|
|
|
id: string;
|
|
|
|
queue: string;
|
|
|
|
body: any;
|
|
|
|
retries?: number;
|
|
|
|
};
|
2023-08-11 18:37:13 +00:00
|
|
|
|
2023-08-28 15:12:15 +00:00
|
|
|
export type MQStats = {
|
2023-08-11 18:37:13 +00:00
|
|
|
queued: number;
|
|
|
|
processing: number;
|
|
|
|
dlq: number;
|
|
|
|
};
|
2023-08-20 15:51:00 +00:00
|
|
|
|
2023-08-28 15:12:15 +00:00
|
|
|
export type MQSubscribeOptions = {
|
|
|
|
batchSize?: number;
|
|
|
|
pollInterval?: number;
|
|
|
|
};
|
|
|
|
|
2023-10-03 12:16:33 +00:00
|
|
|
// Key-Value Store related types
|
|
|
|
export type KvKey = string[];
|
|
|
|
|
|
|
|
export type KV<T = any> = {
|
|
|
|
key: KvKey;
|
|
|
|
value: T;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type OrderBy = {
|
|
|
|
expr: QueryExpression;
|
|
|
|
desc: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type Select = {
|
2023-08-20 15:51:00 +00:00
|
|
|
name: string;
|
2023-10-03 12:16:33 +00:00
|
|
|
expr?: QueryExpression;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type Query = {
|
|
|
|
querySource?: string;
|
|
|
|
filter?: QueryExpression;
|
|
|
|
orderBy?: OrderBy[];
|
|
|
|
select?: Select[];
|
|
|
|
limit?: QueryExpression;
|
|
|
|
render?: string;
|
2023-10-30 13:15:12 +00:00
|
|
|
renderAll?: boolean;
|
2023-10-03 13:24:07 +00:00
|
|
|
distinct?: boolean;
|
2024-01-13 16:30:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* When set, the DS implementation _may_ cache the result for the given number of seconds.
|
|
|
|
*/
|
|
|
|
cacheSecs?: number;
|
2023-10-03 12:16:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export type KvQuery = Omit<Query, "querySource"> & {
|
|
|
|
prefix?: KvKey;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type QueryExpression =
|
|
|
|
| ["and", QueryExpression, QueryExpression]
|
|
|
|
| ["or", QueryExpression, QueryExpression]
|
|
|
|
| ["=", QueryExpression, QueryExpression]
|
|
|
|
| ["!=", QueryExpression, QueryExpression]
|
|
|
|
| ["=~", QueryExpression, QueryExpression]
|
|
|
|
| ["!=~", QueryExpression, QueryExpression]
|
|
|
|
| ["<", QueryExpression, QueryExpression]
|
|
|
|
| ["<=", QueryExpression, QueryExpression]
|
|
|
|
| [">", QueryExpression, QueryExpression]
|
|
|
|
| [">=", QueryExpression, QueryExpression]
|
|
|
|
| ["in", QueryExpression, QueryExpression]
|
|
|
|
| ["attr", QueryExpression, string]
|
|
|
|
| ["attr", string]
|
|
|
|
| ["number", number]
|
|
|
|
| ["string", string]
|
|
|
|
| ["boolean", boolean]
|
|
|
|
| ["null"]
|
2023-12-21 17:21:00 +00:00
|
|
|
| ["not", QueryExpression]
|
2023-10-03 12:16:33 +00:00
|
|
|
| ["array", QueryExpression[]]
|
|
|
|
| ["object", Record<string, any>]
|
|
|
|
| ["regexp", string, string] // regex, modifier
|
|
|
|
| ["+", QueryExpression, QueryExpression]
|
|
|
|
| ["-", QueryExpression, QueryExpression]
|
|
|
|
| ["*", QueryExpression, QueryExpression]
|
|
|
|
| ["%", QueryExpression, QueryExpression]
|
|
|
|
| ["/", QueryExpression, QueryExpression]
|
|
|
|
| ["call", string, QueryExpression[]];
|
|
|
|
|
|
|
|
export type FunctionMap = Record<string, (...args: any[]) => any>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An ObjectValue that can be indexed by the `index` plug, needs to have a minimum of
|
|
|
|
* of two fields:
|
|
|
|
* - ref: a unique reference (id) for the object, ideally a page reference
|
|
|
|
* - tags: a list of tags that the object belongs to
|
|
|
|
*/
|
|
|
|
export type ObjectValue<T> = {
|
|
|
|
ref: string;
|
2024-01-11 12:20:50 +00:00
|
|
|
tag: string; // main tag
|
|
|
|
tags?: string[];
|
|
|
|
itags?: string[]; // implicit or inherited tags (inherited from the page for instance)
|
2023-10-03 12:16:33 +00:00
|
|
|
} & T;
|
|
|
|
|
|
|
|
export type ObjectQuery = Omit<Query, "prefix">;
|
2023-10-29 09:02:50 +00:00
|
|
|
|
|
|
|
// Code widget stuff
|
|
|
|
export type CodeWidgetCallback = (
|
|
|
|
bodyText: string,
|
2023-10-31 09:33:38 +00:00
|
|
|
pageName: string,
|
2024-01-08 16:08:26 +00:00
|
|
|
) => Promise<CodeWidgetContent | null>;
|
2023-10-29 09:02:50 +00:00
|
|
|
|
|
|
|
export type CodeWidgetContent = {
|
|
|
|
html?: string;
|
|
|
|
markdown?: string;
|
|
|
|
script?: string;
|
2023-12-28 15:14:30 +00:00
|
|
|
buttons?: CodeWidgetButton[];
|
|
|
|
};
|
|
|
|
|
|
|
|
export type CodeWidgetButton = {
|
2024-01-04 19:08:12 +00:00
|
|
|
widgetTarget?: boolean;
|
2023-12-28 15:14:30 +00:00
|
|
|
description: string;
|
|
|
|
svg: string;
|
|
|
|
invokeFunction: string;
|
2023-10-29 09:02:50 +00:00
|
|
|
};
|
2023-11-21 15:24:20 +00:00
|
|
|
|
|
|
|
export type LintDiagnostic = {
|
|
|
|
from: number;
|
|
|
|
to: number;
|
|
|
|
severity: "error" | "warning" | "info" | "hint";
|
|
|
|
message: string;
|
|
|
|
};
|
2023-11-22 14:33:25 +00:00
|
|
|
|
|
|
|
export type UploadFile = {
|
|
|
|
name: string;
|
2023-11-23 11:09:48 +00:00
|
|
|
contentType: string;
|
2023-11-22 14:33:25 +00:00
|
|
|
content: Uint8Array;
|
2023-12-21 17:21:00 +00:00
|
|
|
};
|