export const APP_SETTINGS = "app"; export const LINKS_SETTINGS = "links"; const utilitySoftwareSchema = { title: "utilitySoftware", version: 0, description: "describes an utility software", type: "object", primaryKey: "id", properties: { id: { type: "number" }, name: { type: "string" }, label: { type: "string" }, description: { type: "string" }, executable_path: { type: "string" }, fallback_path: { type: ["string", "null"] }, parameters: { type: "string" }, icon: { type: ["string", "null"] }, order: { type: "number" }, }, }; const SiteSchema = { title: "site", version: 0, description: "describes a web site", type: "object", primaryKey: "id", properties: { id: { type: "number" }, name: { type: "string" }, label: { type: "string" }, description: { type: "string" }, url: { type: "string" }, icon: { type: ["string", "null"] }, is_program: { type: "boolean" }, is_frameless: { type: "boolean" }, open_with_default_browser: { type: "boolean" }, order: { type: "number" }, }, }; const programSchema = { title: "program", version: 0, description: "describes an program", type: "object", primaryKey: "id", properties: { id: { type: "number" }, name: { type: "string" }, label: { type: "string" }, description: { type: "string" }, executable_path: { type: "string" }, fallback_path: { type: ["string", "null"] }, parameters: { type: "string" }, window_process: { type: "string" }, icon: { type: ["string", "null"] }, order: { type: "number" }, }, }; const exclusiveProgramSchema = { title: "exclusiveProgram", version: 0, description: "describes an exclusive program for workplace", type: "object", primaryKey: "id", properties: { id: { type: "number" }, name: { type: "string" }, label: { type: "string" }, description: { type: "string" }, executable_path: { type: "string" }, fallback_path: { type: ["string", "null"] }, parameters: { type: "string" }, icon: { type: ["string", "null"] }, order: { type: "number" }, }, }; const locationSchema = { title: "location", version: 0, description: "describes a location for workplace_type", type: "object", primaryKey: "id", properties: { id: { type: "number" }, name: { type: "string" }, description: { type: "string" }, }, }; const workplaceTypeSchema = { title: "workplaceType", version: 0, description: "describes an workplace type depend on location info", type: "object", primaryKey: "name", properties: { name: { type: "string", maxLength: 12 }, description: { type: "string" }, location: { type: "object", properties: locationSchema.properties }, password: ["string", "null"], programs: { type: "array", items: { type: "object", properties: programSchema.properties }, }, utility_software: { type: "array", items: { type: "object", properties: utilitySoftwareSchema.properties }, }, sites: { type: "array", items: { type: "object", properties: SiteSchema.properties }, }, }, encrypted: ["password"], }; // !On change edit .rxdbSlice/databaseSlice too! const workplaceSchema = { title: "workplace", version: 0, description: "describes an workplace", type: "object", primaryKey: "hostname", properties: { hostname: { type: "string", maxLength: 18 }, description: { type: "string" }, workplace_system: { type: ["string", "null"] }, workplace_name: { type: ["string", "null"] }, workplace_type: workplaceTypeSchema.properties, exclusive_program: { type: ["object", "null"], properties: exclusiveProgramSchema.properties, }, sites: { type: "array", items: { type: "object", properties: SiteSchema.properties }, }, is_active: { type: "boolean" }, organizational_unit: { type: ["number", "null"] }, }, }; const sourceSchema = { title: "source", version: 0, description: "describes an process sources (links)", type: "object", primaryKey: "id", properties: { id: { type: "number" }, title: { type: "string" }, icon: { type: ["string", "null"] }, href: { type: "string" }, open_with_default_browser: { type: "boolean" }, is_frameless: { type: "boolean" }, }, }; const linkSchema = { title: "links", version: 0, description: "describes an process ", type: "object", primaryKey: "id", properties: { id: { type: "number" }, name: { type: "string" }, sources: { type: "array", items: { type: "object", properties: sourceSchema.properties }, }, }, }; export const attachmentSchema = { title: "attachment", version: 0, description: "describes an attachment stored as base64data", type: "object", primaryKey: "name", properties: { name: { type: "string", maxLength: 40 }, path: { type: "string" }, type: { type: "string" }, base64data: { type: "string" }, }, }; // _id usage after rxdb 12, see https://github.com/cloudant/mango#readme export const settingsSchema = { version: 0, title: "settings", description: "describes an app settings", primaryKey: "_id", type: "object", properties: { _id: { type: "string", maxLength: 20 }, workplace: workplaceSchema, links: { type: "array", items: { type: "object", properties: linkSchema.properties }, }, token: { type: "string" }, }, encrypted: ["token"], };