UNPKG

@mapeo/mock-data

Version:

Module and CLI to generate mock data for Mapeo

1,089 lines 65.5 kB
export type ValidSchema = typeof import("@comapeo/schema").docSchemas[import("@comapeo/schema/dist/types.js").SchemaName]; /** * Derives a union of all keys of an object, including nested objects. Each level of nesting is separated with a period (`.`). * https://alexop.dev/posts/typescript-extract-all-keys-nested-objects/ */ export type ExtractKeys<T> = T extends object ? { [K in keyof T & string]: K | (T[K] extends object ? `${K}.${ExtractKeys<T[K]>}` : never); }[keyof T & string] : never; /** * Derives valid Faker IDs that can be used with `json-schema-faker`. */ export type FakerId<T> = Extract<ExtractKeys<T>, `${string}.${string}`>; import { JSONSchemaFaker } from 'json-schema-faker'; /** * @param {ValidSchema} schema */ export function createFakerSchema(schema: ValidSchema): { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/translation/v1.json"; readonly description: "A translation is a translated message in a single language for a string property/field of any Mapeo record type"; readonly title: "translation"; readonly type: "object"; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly type: "string"; readonly const: "translation"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly links: { readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; }; }; readonly deleted: { readonly description: "Indicates whether the document has been deleted"; readonly type: "boolean"; }; readonly docRef: { readonly type: "object"; readonly properties: { readonly docId: { readonly description: "hex-encoded id of the element that this observation references"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; }; readonly required: readonly ["docId", "versionId"]; }; readonly docRefType: { readonly description: "type of the element that this translation references"; readonly type: "string"; readonly enum: readonly ["type_unspecified", "deviceInfo", "preset", "field", "observation", "projectSettings", "role", "track", "UNRECOGNIZED"]; }; readonly propertyRef: { readonly type: "string"; readonly description: "identifier for translated field/property in dot-prop notation"; readonly minLength: 1; }; readonly languageCode: { readonly type: "string"; readonly description: "three-letter ISO 169-3 language code"; readonly minLength: 1; readonly maxLength: 3; }; readonly regionCode: { readonly type: "string"; readonly description: "two-letter country code from ISO 3166-1 alpha-2 or a three-digit code from UN M.49 for geographical regions"; readonly minLength: 2; readonly maxLength: 3; }; readonly message: { readonly type: "string"; readonly description: "the translated string"; }; }; readonly required: readonly ["schemaName", "docRef", "docRefType", "propertyRef", "languageCode", "message", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"]; readonly additionalProperties: false; } | { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/track/v1.json"; readonly title: "Track"; readonly description: "A track is a recording of positions over time, with associated tags, similar to an observation"; readonly definitions: { readonly position: { readonly description: "Position details"; readonly type: "object"; readonly required: readonly ["timestamp", "mocked", "coords"]; readonly properties: { readonly timestamp: { readonly description: "Timestamp (ISO date string) of when the current position was obtained"; readonly type: "string"; readonly format: "date-time"; }; readonly mocked: { readonly description: "`true` if the position was mocked"; readonly type: "boolean"; readonly default: false; }; readonly coords: { readonly description: "Position details, should be self explanatory. Units in meters"; readonly type: "object"; readonly required: readonly ["latitude", "longitude"]; readonly properties: { readonly latitude: { readonly type: "number"; }; readonly longitude: { readonly type: "number"; }; readonly altitude: { readonly type: "number"; }; readonly heading: { readonly type: "number"; }; readonly speed: { readonly type: "number"; }; readonly accuracy: { readonly type: "number"; }; }; }; }; }; }; readonly type: "object"; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly description: "Must be `track`"; readonly type: "string"; readonly const: "track"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly links: { readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; }; }; readonly deleted: { readonly description: "Indicates whether the document has been deleted"; readonly type: "boolean"; }; readonly locations: { readonly type: "array"; readonly description: "Array of positions along the track"; readonly items: { readonly $ref: "#/definitions/position"; }; }; readonly observationRefs: { readonly type: "array"; readonly description: "References to any observations that this track is related to."; readonly items: { readonly type: "object"; readonly properties: { readonly docId: { readonly description: "hex-encoded id of the element that this track references"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; }; readonly required: readonly ["docId", "versionId"]; }; }; readonly tags: { readonly type: "object"; readonly description: "User-defined key-value pairs relevant to this track"; readonly properties: {}; readonly additionalProperties: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }, { readonly type: "array"; readonly items: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }]; }; }]; }; }; readonly presetRef: { readonly type: "object"; readonly description: "References to the preset that this track is related to."; readonly properties: { readonly docId: { readonly description: "hex-encoded id of the element that this track references"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; }; readonly required: readonly ["docId", "versionId"]; }; }; readonly required: readonly ["schemaName", "locations", "tags", "observationRefs", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"]; readonly additionalProperties: false; } | { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/role/v1.json"; readonly title: "Role"; readonly type: "object"; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly type: "string"; readonly const: "role"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly links: { readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; }; }; readonly deleted: { readonly description: "Indicates whether the document has been deleted"; readonly type: "boolean"; }; readonly roleId: { readonly type: "string"; readonly description: "Unique identifier for role assigned to device with auth core ID equal to `docId` of this record"; readonly minLength: 1; }; readonly fromIndex: { readonly type: "integer"; readonly minimum: 0; readonly description: "This is the index of the auth core that this role applies to (identified by the `docId`) to apply this role from. E.g. documents in the auth core assigned this role from this index will be evaluated according to this role."; }; }; readonly required: readonly ["schemaName", "roleId", "fromIndex", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"]; readonly additionalProperties: false; } | { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/remoteDetectionAlert/v1.json"; readonly title: "RemoteDetectionAlert"; readonly description: "A remote detection alert is a type of element in the map that relates to an alert (regarding an urgent event that happened on the territory)"; readonly type: "object"; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly description: "Must be `remoteDetectionAlert`"; readonly type: "string"; readonly const: "remoteDetectionAlert"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly links: { readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; }; }; readonly deleted: { readonly description: "Indicates whether the document has been deleted"; readonly type: "boolean"; }; readonly detectionDateStart: { readonly type: "string"; readonly format: "date-time"; readonly description: "Timestamp of when the detected alert started"; }; readonly detectionDateEnd: { readonly type: "string"; readonly format: "date-time"; readonly description: "Timestamp of when the detected alert ended"; }; readonly sourceId: { readonly type: "string"; readonly description: "unique string identifiying this alert, different from the `docId`"; }; readonly metadata: { readonly type: "object"; readonly description: "Additional metadata related to this alert. It is a map from a string to any element (including lists)"; readonly properties: {}; readonly additionalProperties: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }, { readonly type: "array"; readonly items: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }]; }; }]; }; }; readonly geometry: { readonly $ref: "http://comapeo.app/schemas/shared/geometry.json"; }; }; readonly required: readonly ["schemaName", "detectionDateStart", "detectionDateEnd", "sourceId", "metadata", "geometry", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"]; readonly additionalProperties: false; } | { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/project/v1.json"; readonly title: "ProjectSettings"; readonly type: "object"; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly description: "Must be `project`"; readonly type: "string"; readonly const: "projectSettings"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly links: { readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; }; }; readonly deleted: { readonly description: "Indicates whether the document has been deleted"; readonly type: "boolean"; }; readonly name: { readonly description: "name of the project"; readonly type: "string"; }; readonly projectDescription: { readonly description: "description of the project"; readonly type: "string"; }; readonly projectColor: { readonly description: "color associated with a project represented in 24 bit (#rrggbb)"; readonly type: "string"; readonly pattern: "^#[a-fA-F0-9]{6}$"; }; readonly defaultPresets: { readonly type: "object"; readonly properties: { readonly point: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly area: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly vertex: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly line: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly relation: { readonly type: "array"; readonly items: { readonly type: "string"; }; }; }; readonly required: readonly ["point", "area", "vertex", "line", "relation"]; readonly additionalProperties: false; }; readonly configMetadata: { readonly type: "object"; readonly properties: { readonly name: { readonly type: "string"; readonly description: "Name of the configuration"; }; readonly buildDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "RFC3339-formatted datetime of when the configuration was built"; }; readonly importDate: { readonly type: "string"; readonly format: "date-time"; readonly description: "RFC3339-formatted datetime of when the configuration was imported to the project"; }; readonly fileVersion: { readonly type: "string"; readonly description: "version of the configuration file format as comver (MAJOR.MINOR)"; }; }; readonly additionalProperties: false; readonly required: readonly ["name", "buildDate", "importDate", "fileVersion"]; }; }; readonly required: readonly ["schemaName", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"]; readonly additionalProperties: false; } | { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/preset/v1.json"; readonly title: "Preset"; readonly description: "Presets define how map entities are displayed to the user. They define the icon used on the map, and the fields / questions shown to the user when they create or edit the entity on the map. The `tags` property of a preset is used to match the preset with observations, nodes, ways and relations. If multiple presets match, the one that matches the most tags is used."; readonly definitions: { readonly tags: { readonly type: "object"; readonly properties: {}; readonly additionalProperties: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }, { readonly type: "array"; readonly items: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }]; }; }]; }; }; }; readonly type: "object"; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly description: "Must be `preset`"; readonly type: "string"; readonly const: "preset"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly links: { readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; }; }; readonly deleted: { readonly description: "Indicates whether the document has been deleted"; readonly type: "boolean"; }; readonly name: { readonly description: "Name for the feature in default language."; readonly type: "string"; }; readonly geometry: { readonly description: "Valid geometry types for the feature - this preset will only match features of this geometry type `\"point\", \"vertex\", \"line\", \"area\", \"relation\"`"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; readonly enum: readonly ["point", "vertex", "line", "area", "relation"]; }; }; readonly tags: { readonly description: "The tags are used to match the preset to existing map entities. You can match based on multiple tags E.g. if you have existing points with the tags `nature:tree` and `species:oak` then you can add both these tags here in order to match only oak trees."; readonly $ref: "#/definitions/tags"; }; readonly addTags: { readonly description: "Tags that are added when changing to the preset (default is the same value as 'tags')"; readonly $ref: "#/definitions/tags"; }; readonly removeTags: { readonly description: "Tags that are removed when changing to another preset (default is the same value as 'addTags' which in turn defaults to 'tags')"; readonly $ref: "#/definitions/tags"; }; readonly fieldRefs: { readonly type: "array"; readonly description: "References to any fields that this preset is related to."; readonly items: { readonly type: "object"; readonly properties: { readonly docId: { readonly description: "hex-encoded id of the element that this observation references"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; }; readonly required: readonly ["docId", "versionId"]; }; }; readonly iconRef: { readonly type: "object"; readonly description: "References to the icon that this preset is related to."; readonly properties: { readonly docId: { readonly description: "hex-encoded id of the element that this observation references"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; }; readonly required: readonly ["docId", "versionId"]; }; readonly terms: { readonly description: "Synonyms or related terms (used for search)"; readonly type: "array"; readonly items: { readonly type: "string"; }; }; readonly color: { readonly description: "string representation of a color in 24 bit (#rrggbb)"; readonly type: "string"; readonly pattern: "^#[a-fA-F0-9]{6}$"; }; }; readonly required: readonly ["name", "geometry", "tags", "addTags", "removeTags", "fieldRefs", "schemaName", "terms", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"]; readonly additionalProperties: false; } | { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/observation/v1.json"; readonly title: "Observation"; readonly description: "An observation is something that has been observed at a particular time and place. It is a subjective statement of 'I saw/heard this, here'"; readonly definitions: { readonly attachment: { readonly oneOf: readonly [{ readonly type: "object"; readonly properties: { readonly driveDiscoveryId: { readonly type: "string"; readonly description: "core discovery id for the drive that the attachment belongs to"; readonly minLength: 1; }; readonly name: { readonly type: "string"; readonly description: "name of the attachment"; readonly minLength: 1; }; readonly type: { readonly type: "string"; readonly description: "string that describes the type of the attachment"; readonly const: "photo"; }; readonly hash: { readonly type: "string"; readonly description: "SHA256 hash of the attachment"; readonly minLength: 1; }; readonly photoExif: { readonly type: "object"; readonly description: "EXIF data from an image. https://exiftool.org/TagNames/EXIF.html"; readonly properties: { readonly ApertureValue: { readonly type: "number"; }; readonly ExposureTime: { readonly type: "number"; }; readonly Flash: { readonly type: "number"; }; readonly FNumber: { readonly type: "number"; }; readonly FocalLength: { readonly type: "number"; }; readonly ISOSpeedRatings: { readonly type: "number"; }; readonly ImageLength: { readonly type: "number"; }; readonly ImageWidth: { readonly type: "number"; }; readonly Make: { readonly type: "string"; }; readonly Model: { readonly type: "string"; }; readonly Orientation: { readonly type: "number"; }; readonly ShutterSpeedValue: { readonly type: "number"; }; }; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the attachment was created"; readonly type: "string"; readonly format: "date-time"; }; readonly position: { readonly $ref: "#/definitions/position"; }; readonly external: { readonly description: "Indicates whether the associated media was created from a source outside of CoMapeo"; readonly type: "boolean"; }; }; readonly required: readonly ["driveDiscoveryId", "name", "type", "hash", "external"]; }, { readonly type: "object"; readonly properties: { readonly driveDiscoveryId: { readonly type: "string"; readonly description: "core discovery id for the drive that the attachment belongs to"; readonly minLength: 1; }; readonly name: { readonly type: "string"; readonly description: "name of the attachment"; readonly minLength: 1; }; readonly type: { readonly type: "string"; readonly description: "string that describes the type of the attachment"; readonly "meta:enum": { readonly UNRECOGNIZED: "future attachment type"; }; readonly enum: readonly ["attachment_type_unspecified", "video", "audio", "UNRECOGNIZED"]; }; readonly hash: { readonly type: "string"; readonly description: "SHA256 hash of the attachment"; readonly minLength: 1; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the attachment was created"; readonly type: "string"; readonly format: "date-time"; }; readonly position: { readonly $ref: "#/definitions/position"; }; readonly external: { readonly description: "Indicates whether the associated media was created from a source outside of CoMapeo"; readonly type: "boolean"; }; }; readonly required: readonly ["driveDiscoveryId", "name", "type", "hash", "external"]; }]; }; readonly position: { readonly description: "Position details"; readonly type: "object"; readonly required: readonly ["timestamp", "coords"]; readonly properties: { readonly timestamp: { readonly description: "Timestamp of when the current position was obtained"; readonly type: "string"; readonly format: "date-time"; }; readonly mocked: { readonly description: "`true` if the position was mocked"; readonly type: "boolean"; readonly default: false; }; readonly coords: { readonly description: "Position details, should be self explanatory. Units in meters"; readonly type: "object"; readonly required: readonly ["latitude", "longitude"]; readonly properties: { readonly latitude: { readonly type: "number"; }; readonly longitude: { readonly type: "number"; }; readonly altitude: { readonly type: "number"; }; readonly altitudeAccuracy: { readonly type: "number"; }; readonly heading: { readonly type: "number"; }; readonly speed: { readonly type: "number"; }; readonly accuracy: { readonly type: "number"; }; }; }; }; }; }; readonly type: "object"; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly description: "Must be `observation`"; readonly type: "string"; readonly const: "observation"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly links: { readonly description: "Version ids of the previous document versions this one is replacing. Each link is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "array"; readonly uniqueItems: true; readonly items: { readonly type: "string"; }; }; readonly deleted: { readonly description: "Indicates whether the document has been deleted"; readonly type: "boolean"; }; readonly lat: { readonly description: "latitude of the observation"; readonly type: "number"; readonly minimum: -90; readonly maximum: 90; }; readonly lon: { readonly description: "longitude of the observation"; readonly type: "number"; readonly minimum: -180; readonly maximum: 180; }; readonly attachments: { readonly type: "array"; readonly description: "media or other data that are attached to this observation"; readonly items: { readonly $ref: "#/definitions/attachment"; }; }; readonly tags: { readonly type: "object"; readonly description: "User-defined key-value pairs relevant to this observation"; readonly properties: {}; readonly additionalProperties: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }, { readonly type: "array"; readonly items: { readonly anyOf: readonly [{ readonly type: "boolean"; }, { readonly type: "number"; }, { readonly type: "string"; }, { readonly type: "null"; }]; }; }]; }; }; readonly metadata: { readonly description: "Additional metadata associated with the observation (e.g. location precision, altitude, heading)"; readonly type: "object"; readonly properties: { readonly manualLocation: { readonly description: "Whether location has been set manually"; readonly type: "boolean"; readonly default: false; }; readonly position: { readonly $ref: "#/definitions/position"; }; readonly lastSavedPosition: { readonly $ref: "#/definitions/position"; }; readonly positionProvider: { readonly description: "Details of the location providers that were available on the device when the observation was recorded"; readonly type: "object"; readonly required: readonly ["locationServicesEnabled"]; readonly properties: { readonly gpsAvailable: { readonly description: "Whether the user has enabled GPS for device location (this is not the same as whether location is turned on or off, this is a device setting whether to use just wifi and bluetooth or use GPS for location)"; readonly type: "boolean"; }; readonly passiveAvailable: { readonly description: "Whether the device is configured to lookup location based on wifi and bluetooth networks"; readonly type: "boolean"; }; readonly locationServicesEnabled: { readonly description: "Has the user enabled location services on the device (this is often turned off when the device is in airplane mode)"; readonly type: "boolean"; }; readonly networkAvailable: { readonly description: "Whether the device can lookup location based on cell phone towers"; readonly type: "boolean"; }; }; }; }; readonly additionalProperties: false; }; readonly presetRef: { readonly type: "object"; readonly description: "References to the preset that this observation is related to."; readonly properties: { readonly docId: { readonly description: "hex-encoded id of the element that this observation references"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; }; readonly required: readonly ["docId", "versionId"]; }; }; readonly required: readonly ["schemaName", "tags", "attachments", "docId", "createdAt", "updatedAt", "links", "versionId", "originalVersionId", "deleted"]; readonly additionalProperties: false; } | { readonly $schema: "http://json-schema.org/draft-07/schema#"; readonly $id: "http://mapeo.world/schemas/icon/v1.json"; readonly title: "Icon"; readonly description: "An Icon represents metadata to retrieve an Icon blob"; readonly type: "object"; readonly definitions: { readonly size: { readonly type: "string"; readonly enum: readonly ["size_unspecified", "small", "medium", "large"]; }; readonly blobVersionId: { readonly description: "Version id of the icon blob. Each id is id (hex-encoded 32 byte buffer) and index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; }; readonly properties: { readonly docId: { readonly description: "Hex-encoded 32-byte buffer"; readonly type: "string"; readonly minLength: 1; }; readonly versionId: { readonly description: "core discovery id (hex-encoded 32-byte buffer) and core index number, separated by '/'"; readonly type: "string"; readonly minLength: 1; }; readonly originalVersionId: { readonly description: "Version ID of the original version of this document. For the original version, matches `versionId`."; readonly type: "string"; readonly minLength: 1; }; readonly schemaName: { readonly description: "Must be `icon`"; readonly type: "string"; readonly const: "icon"; }; readonly createdAt: { readonly description: "RFC3339-formatted datetime of when the first version of the element was created"; readonly type: "string"; readonly format: "date-time"; }; readonly updatedAt: { readonly description: "RFC3339-formatted datetime of when this version of the element was created"; readonly type: "strin