@mapeo/mock-data
Version:
Module and CLI to generate mock data for Mapeo
251 lines (250 loc) • 7.26 kB
TypeScript
/** @typedef {import('@comapeo/schema/dist/types.js').SchemaName} SchemaName */
export function listSchemas(): {
[name: string]: string[];
};
/**
* @template {SchemaName} TSchemaName
* @param {TSchemaName} schemaName
* @param {{version?: string, count?: number}} [options]
* @returns {Array<Extract<import('@comapeo/schema').MapeoDoc, { schemaName: TSchemaName }>>}
*/
export function generate<TSchemaName extends import("@comapeo/schema/dist/types.js").SchemaName>(schemaName: TSchemaName, { count }?: {
version?: string | undefined;
count?: number | undefined;
} | undefined): (Extract<{
schemaName: "translation";
docRef: {
docId: string;
versionId: string;
};
docRefType: "track" | "role" | "projectSettings" | "preset" | "observation" | "field" | "deviceInfo" | "type_unspecified" | "UNRECOGNIZED";
propertyRef: string;
languageCode: string;
regionCode?: string | undefined;
message: string;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "track";
locations: import("@comapeo/schema/dist/schema/track.js").Position[];
observationRefs: {
docId: string;
versionId: string;
}[];
tags: {
[k: string]: string | number | boolean | (string | number | boolean | null)[] | null;
};
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "role";
roleId: string;
fromIndex: number;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "remoteDetectionAlert";
detectionDateStart: string;
detectionDateEnd: string;
sourceId: string;
metadata: {
[k: string]: string | number | boolean | (string | number | boolean | null)[] | null;
};
geometry: import("@comapeo/schema/dist/schema/remoteDetectionAlert.js").Geometry;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "projectSettings";
name?: string | undefined;
defaultPresets?: {
point: string[];
area: string[];
vertex: string[];
line: string[];
relation: string[];
} | undefined;
configMetadata?: {
name: string;
buildDate: string;
importDate: string;
fileVersion: string;
} | undefined;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "preset";
name: string;
geometry: ("point" | "area" | "vertex" | "line" | "relation")[];
tags: import("@comapeo/schema/dist/schema/preset.js").Tags;
addTags: import("@comapeo/schema/dist/schema/preset.js").Tags1;
removeTags: import("@comapeo/schema/dist/schema/preset.js").Tags2;
fieldRefs: {
docId: string;
versionId: string;
}[];
iconRef?: {
docId: string;
versionId: string;
} | undefined;
terms: string[];
color?: string | undefined;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "observation";
lat?: number | undefined;
lon?: number | undefined;
attachments: {
driveDiscoveryId: string;
name: string;
type: "UNRECOGNIZED" | "attachment_type_unspecified" | "photo" | "video" | "audio";
hash: string;
}[];
tags: {
[k: string]: string | number | boolean | (string | number | boolean | null)[] | null;
};
metadata?: {
manualLocation?: boolean | undefined;
position?: import("@comapeo/schema/dist/schema/observation.js").Position | undefined;
lastSavedPosition?: import("@comapeo/schema/dist/schema/observation.js").Position | undefined;
positionProvider?: {
gpsAvailable?: boolean | undefined;
passiveAvailable?: boolean | undefined;
locationServicesEnabled: boolean;
networkAvailable?: boolean | undefined;
} | undefined;
} | undefined;
presetRef?: {
docId: string;
versionId: string;
} | undefined;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "icon";
name: string;
variants: ({
mimeType: "image/png";
size: import("@comapeo/schema/dist/schema/icon.js").Size;
pixelDensity: 2 | 1 | 3;
blobVersionId: string;
} | {
size: import("@comapeo/schema/dist/schema/icon.js").Size;
mimeType: "image/svg+xml";
blobVersionId: string;
})[];
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "field";
tagKey: string;
type: "number" | "type_unspecified" | "UNRECOGNIZED" | "text" | "selectOne" | "selectMultiple";
label: string;
appearance?: "UNRECOGNIZED" | "appearance_unspecified" | "singleline" | "multiline" | undefined;
snakeCase?: boolean | undefined;
options?: {
label: string;
value: string | number | boolean | null;
}[] | undefined;
universal?: boolean | undefined;
placeholder?: string | undefined;
helperText?: string | undefined;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "deviceInfo";
name: string;
deviceType: "UNRECOGNIZED" | "device_type_unspecified" | "mobile" | "tablet" | "desktop" | "selfHostedServer";
selfHostedServerDetails?: {
baseUrl: string;
} | undefined;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}> | Extract<{
schemaName: "coreOwnership";
authCoreId: string;
configCoreId: string;
dataCoreId: string;
blobCoreId: string;
blobIndexCoreId: string;
docId: string;
versionId: string;
originalVersionId: string;
createdAt: string;
updatedAt: string;
links: string[];
deleted: boolean;
}, {
schemaName: TSchemaName;
}>)[];
export type SchemaName = import('@comapeo/schema/dist/types.js').SchemaName;