Cosmos Journeyer API Documentation - v1.10.1
    Preparing search index...

    Interface defining the storage backend for save data.

    interface SaveBackend {
        read(
            starSystemDatabase: StarSystemDatabase,
        ): Promise<
            Result<
                Record<
                    string,
                    {
                        auto: {
                            player: {
                                balance: number;
                                completedMissions: {
                                    missionGiver: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                    reward: number;
                                    tree: MissionNodeSerializedShape;
                                    type: MissionType;
                                }[];
                                creationDate: string;
                                currentItinerary: {
                                    localX: number;
                                    localY: number;
                                    localZ: number;
                                    starSectorX: number;
                                    starSectorY: number;
                                    starSectorZ: number;
                                }[];
                                currentMissions: {
                                    missionGiver: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                    reward: number;
                                    tree: MissionNodeSerializedShape;
                                    type: MissionType;
                                }[];
                                discoveries: {
                                    local: {
                                        discoveryTimestamp: number;
                                        explorerName: string;
                                        objectId: { idInSystem: ...; systemCoordinates: ... };
                                    }[];
                                    uploaded: {
                                        discoveryTimestamp: number;
                                        explorerName: string;
                                        objectId: { idInSystem: ...; systemCoordinates: ... };
                                    }[];
                                };
                                name: string;
                                spaceShips: {
                                    components: {
                                        optional: [(...), (...), (...)];
                                        primary: { fuelTank: ...; thrusters: ...; warpDrive: ... };
                                    };
                                    id: string;
                                    name: string;
                                    type: WANDERER;
                                }[];
                                spareSpaceshipComponents: (
                                    | { quality: number; size: number; type: "discoveryScanner" }
                                    | { quality: number; size: number; type: "fuelScoop" }
                                    | {
                                        currentFuel01: number;
                                        quality: number;
                                        size: number;
                                        type: "fuelTank";
                                    }
                                    | { quality: number; size: number; type: "thrusters" }
                                    | { quality: number; size: number; type: "warpDrive" }
                                )[];
                                systemBookmarks: {
                                    localX: number;
                                    localY: number;
                                    localZ: number;
                                    starSectorX: number;
                                    starSectorY: number;
                                    starSectorZ: number;
                                }[];
                                timePlayedSeconds: number;
                                tutorials: {
                                    flightCompleted: boolean;
                                    fuelScoopingCompleted: boolean;
                                    starMapCompleted: boolean;
                                    stationLandingCompleted: boolean;
                                };
                                uuid: string;
                                visitedSystemHistory: {
                                    localX: number;
                                    localY: number;
                                    localZ: number;
                                    starSectorX: number;
                                    starSectorY: number;
                                    starSectorZ: number;
                                }[];
                            };
                            playerLocation: | {
                                position: { x: number; y: number; z: number };
                                rotation: { w: number; x: number; y: number; z: number };
                                type: "relative";
                                universeObjectId: {
                                    idInSystem: string;
                                    systemCoordinates: {
                                        localX: number;
                                        localY: number;
                                        localZ: number;
                                        starSectorX: number;
                                        starSectorY: number;
                                        starSectorZ: number;
                                    };
                                };
                            }
                            | {
                                type: "atStation";
                                universeObjectId: {
                                    idInSystem: string;
                                    systemCoordinates: {
                                        localX: number;
                                        localY: number;
                                        localZ: number;
                                        starSectorX: number;
                                        starSectorY: number;
                                        starSectorZ: number;
                                    };
                                };
                            }
                            | {
                                latitude: number;
                                longitude: number;
                                type: "onSurface";
                                universeObjectId: {
                                    idInSystem: string;
                                    systemCoordinates: {
                                        localX: number;
                                        localY: number;
                                        localZ: number;
                                        starSectorX: number;
                                        starSectorY: number;
                                        starSectorZ: number;
                                    };
                                };
                            }
                            | { shipId: string; type: "inSpaceship" };
                            shipLocations: Record<
                                string,
                                | {
                                    position: { x: number; y: number; z: number };
                                    rotation: { w: number; x: number; y: number; z: number };
                                    type: "relative";
                                    universeObjectId: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                }
                                | {
                                    type: "atStation";
                                    universeObjectId: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                }
                                | {
                                    latitude: number;
                                    longitude: number;
                                    type: "onSurface";
                                    universeObjectId: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                }
                                | { shipId: string; type: "inSpaceship" },
                            >;
                            timestamp: number;
                        }[];
                        manual: {
                            player: {
                                balance: number;
                                completedMissions: {
                                    missionGiver: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                    reward: number;
                                    tree: MissionNodeSerializedShape;
                                    type: MissionType;
                                }[];
                                creationDate: string;
                                currentItinerary: {
                                    localX: number;
                                    localY: number;
                                    localZ: number;
                                    starSectorX: number;
                                    starSectorY: number;
                                    starSectorZ: number;
                                }[];
                                currentMissions: {
                                    missionGiver: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                    reward: number;
                                    tree: MissionNodeSerializedShape;
                                    type: MissionType;
                                }[];
                                discoveries: {
                                    local: {
                                        discoveryTimestamp: number;
                                        explorerName: string;
                                        objectId: { idInSystem: ...; systemCoordinates: ... };
                                    }[];
                                    uploaded: {
                                        discoveryTimestamp: number;
                                        explorerName: string;
                                        objectId: { idInSystem: ...; systemCoordinates: ... };
                                    }[];
                                };
                                name: string;
                                spaceShips: {
                                    components: {
                                        optional: [(...), (...), (...)];
                                        primary: { fuelTank: ...; thrusters: ...; warpDrive: ... };
                                    };
                                    id: string;
                                    name: string;
                                    type: WANDERER;
                                }[];
                                spareSpaceshipComponents: (
                                    | { quality: number; size: number; type: "discoveryScanner" }
                                    | { quality: number; size: number; type: "fuelScoop" }
                                    | {
                                        currentFuel01: number;
                                        quality: number;
                                        size: number;
                                        type: "fuelTank";
                                    }
                                    | { quality: number; size: number; type: "thrusters" }
                                    | { quality: number; size: number; type: "warpDrive" }
                                )[];
                                systemBookmarks: {
                                    localX: number;
                                    localY: number;
                                    localZ: number;
                                    starSectorX: number;
                                    starSectorY: number;
                                    starSectorZ: number;
                                }[];
                                timePlayedSeconds: number;
                                tutorials: {
                                    flightCompleted: boolean;
                                    fuelScoopingCompleted: boolean;
                                    starMapCompleted: boolean;
                                    stationLandingCompleted: boolean;
                                };
                                uuid: string;
                                visitedSystemHistory: {
                                    localX: number;
                                    localY: number;
                                    localZ: number;
                                    starSectorX: number;
                                    starSectorY: number;
                                    starSectorZ: number;
                                }[];
                            };
                            playerLocation: | {
                                position: { x: number; y: number; z: number };
                                rotation: { w: number; x: number; y: number; z: number };
                                type: "relative";
                                universeObjectId: {
                                    idInSystem: string;
                                    systemCoordinates: {
                                        localX: number;
                                        localY: number;
                                        localZ: number;
                                        starSectorX: number;
                                        starSectorY: number;
                                        starSectorZ: number;
                                    };
                                };
                            }
                            | {
                                type: "atStation";
                                universeObjectId: {
                                    idInSystem: string;
                                    systemCoordinates: {
                                        localX: number;
                                        localY: number;
                                        localZ: number;
                                        starSectorX: number;
                                        starSectorY: number;
                                        starSectorZ: number;
                                    };
                                };
                            }
                            | {
                                latitude: number;
                                longitude: number;
                                type: "onSurface";
                                universeObjectId: {
                                    idInSystem: string;
                                    systemCoordinates: {
                                        localX: number;
                                        localY: number;
                                        localZ: number;
                                        starSectorX: number;
                                        starSectorY: number;
                                        starSectorZ: number;
                                    };
                                };
                            }
                            | { shipId: string; type: "inSpaceship" };
                            shipLocations: Record<
                                string,
                                | {
                                    position: { x: number; y: number; z: number };
                                    rotation: { w: number; x: number; y: number; z: number };
                                    type: "relative";
                                    universeObjectId: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                }
                                | {
                                    type: "atStation";
                                    universeObjectId: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                }
                                | {
                                    latitude: number;
                                    longitude: number;
                                    type: "onSurface";
                                    universeObjectId: {
                                        idInSystem: string;
                                        systemCoordinates: {
                                            localX: ...;
                                            localY: ...;
                                            localZ: ...;
                                            starSectorX: ...;
                                            starSectorY: ...;
                                            starSectorZ: ...;
                                        };
                                    };
                                }
                                | { shipId: string; type: "inSpaceship" },
                            >;
                            timestamp: number;
                        }[];
                    },
                >,
                SaveLoadingError,
            >,
        >;
        write(saves: Record<string, CmdrSaves>): boolean;
    }

    Implemented by

    Index

    Methods

    Methods

    • Reads save data from the storage backend.

      Parameters

      Returns Promise<
          Result<
              Record<
                  string,
                  {
                      auto: {
                          player: {
                              balance: number;
                              completedMissions: {
                                  missionGiver: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                                  reward: number;
                                  tree: MissionNodeSerializedShape;
                                  type: MissionType;
                              }[];
                              creationDate: string;
                              currentItinerary: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              }[];
                              currentMissions: {
                                  missionGiver: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                                  reward: number;
                                  tree: MissionNodeSerializedShape;
                                  type: MissionType;
                              }[];
                              discoveries: {
                                  local: {
                                      discoveryTimestamp: number;
                                      explorerName: string;
                                      objectId: { idInSystem: ...; systemCoordinates: ... };
                                  }[];
                                  uploaded: {
                                      discoveryTimestamp: number;
                                      explorerName: string;
                                      objectId: { idInSystem: ...; systemCoordinates: ... };
                                  }[];
                              };
                              name: string;
                              spaceShips: {
                                  components: {
                                      optional: [(...), (...), (...)];
                                      primary: { fuelTank: ...; thrusters: ...; warpDrive: ... };
                                  };
                                  id: string;
                                  name: string;
                                  type: WANDERER;
                              }[];
                              spareSpaceshipComponents: (
                                  | { quality: number; size: number; type: "discoveryScanner" }
                                  | { quality: number; size: number; type: "fuelScoop" }
                                  | {
                                      currentFuel01: number;
                                      quality: number;
                                      size: number;
                                      type: "fuelTank";
                                  }
                                  | { quality: number; size: number; type: "thrusters" }
                                  | { quality: number; size: number; type: "warpDrive" }
                              )[];
                              systemBookmarks: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              }[];
                              timePlayedSeconds: number;
                              tutorials: {
                                  flightCompleted: boolean;
                                  fuelScoopingCompleted: boolean;
                                  starMapCompleted: boolean;
                                  stationLandingCompleted: boolean;
                              };
                              uuid: string;
                              visitedSystemHistory: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              }[];
                          };
                          playerLocation: | {
                              position: { x: number; y: number; z: number };
                              rotation: { w: number; x: number; y: number; z: number };
                              type: "relative";
                              universeObjectId: {
                                  idInSystem: string;
                                  systemCoordinates: {
                                      localX: number;
                                      localY: number;
                                      localZ: number;
                                      starSectorX: number;
                                      starSectorY: number;
                                      starSectorZ: number;
                                  };
                              };
                          }
                          | {
                              type: "atStation";
                              universeObjectId: {
                                  idInSystem: string;
                                  systemCoordinates: {
                                      localX: number;
                                      localY: number;
                                      localZ: number;
                                      starSectorX: number;
                                      starSectorY: number;
                                      starSectorZ: number;
                                  };
                              };
                          }
                          | {
                              latitude: number;
                              longitude: number;
                              type: "onSurface";
                              universeObjectId: {
                                  idInSystem: string;
                                  systemCoordinates: {
                                      localX: number;
                                      localY: number;
                                      localZ: number;
                                      starSectorX: number;
                                      starSectorY: number;
                                      starSectorZ: number;
                                  };
                              };
                          }
                          | { shipId: string; type: "inSpaceship" };
                          shipLocations: Record<
                              string,
                              | {
                                  position: { x: number; y: number; z: number };
                                  rotation: { w: number; x: number; y: number; z: number };
                                  type: "relative";
                                  universeObjectId: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                              }
                              | {
                                  type: "atStation";
                                  universeObjectId: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                              }
                              | {
                                  latitude: number;
                                  longitude: number;
                                  type: "onSurface";
                                  universeObjectId: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                              }
                              | { shipId: string; type: "inSpaceship" },
                          >;
                          timestamp: number;
                      }[];
                      manual: {
                          player: {
                              balance: number;
                              completedMissions: {
                                  missionGiver: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                                  reward: number;
                                  tree: MissionNodeSerializedShape;
                                  type: MissionType;
                              }[];
                              creationDate: string;
                              currentItinerary: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              }[];
                              currentMissions: {
                                  missionGiver: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                                  reward: number;
                                  tree: MissionNodeSerializedShape;
                                  type: MissionType;
                              }[];
                              discoveries: {
                                  local: {
                                      discoveryTimestamp: number;
                                      explorerName: string;
                                      objectId: { idInSystem: ...; systemCoordinates: ... };
                                  }[];
                                  uploaded: {
                                      discoveryTimestamp: number;
                                      explorerName: string;
                                      objectId: { idInSystem: ...; systemCoordinates: ... };
                                  }[];
                              };
                              name: string;
                              spaceShips: {
                                  components: {
                                      optional: [(...), (...), (...)];
                                      primary: { fuelTank: ...; thrusters: ...; warpDrive: ... };
                                  };
                                  id: string;
                                  name: string;
                                  type: WANDERER;
                              }[];
                              spareSpaceshipComponents: (
                                  | { quality: number; size: number; type: "discoveryScanner" }
                                  | { quality: number; size: number; type: "fuelScoop" }
                                  | {
                                      currentFuel01: number;
                                      quality: number;
                                      size: number;
                                      type: "fuelTank";
                                  }
                                  | { quality: number; size: number; type: "thrusters" }
                                  | { quality: number; size: number; type: "warpDrive" }
                              )[];
                              systemBookmarks: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              }[];
                              timePlayedSeconds: number;
                              tutorials: {
                                  flightCompleted: boolean;
                                  fuelScoopingCompleted: boolean;
                                  starMapCompleted: boolean;
                                  stationLandingCompleted: boolean;
                              };
                              uuid: string;
                              visitedSystemHistory: {
                                  localX: number;
                                  localY: number;
                                  localZ: number;
                                  starSectorX: number;
                                  starSectorY: number;
                                  starSectorZ: number;
                              }[];
                          };
                          playerLocation: | {
                              position: { x: number; y: number; z: number };
                              rotation: { w: number; x: number; y: number; z: number };
                              type: "relative";
                              universeObjectId: {
                                  idInSystem: string;
                                  systemCoordinates: {
                                      localX: number;
                                      localY: number;
                                      localZ: number;
                                      starSectorX: number;
                                      starSectorY: number;
                                      starSectorZ: number;
                                  };
                              };
                          }
                          | {
                              type: "atStation";
                              universeObjectId: {
                                  idInSystem: string;
                                  systemCoordinates: {
                                      localX: number;
                                      localY: number;
                                      localZ: number;
                                      starSectorX: number;
                                      starSectorY: number;
                                      starSectorZ: number;
                                  };
                              };
                          }
                          | {
                              latitude: number;
                              longitude: number;
                              type: "onSurface";
                              universeObjectId: {
                                  idInSystem: string;
                                  systemCoordinates: {
                                      localX: number;
                                      localY: number;
                                      localZ: number;
                                      starSectorX: number;
                                      starSectorY: number;
                                      starSectorZ: number;
                                  };
                              };
                          }
                          | { shipId: string; type: "inSpaceship" };
                          shipLocations: Record<
                              string,
                              | {
                                  position: { x: number; y: number; z: number };
                                  rotation: { w: number; x: number; y: number; z: number };
                                  type: "relative";
                                  universeObjectId: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                              }
                              | {
                                  type: "atStation";
                                  universeObjectId: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                              }
                              | {
                                  latitude: number;
                                  longitude: number;
                                  type: "onSurface";
                                  universeObjectId: {
                                      idInSystem: string;
                                      systemCoordinates: {
                                          localX: ...;
                                          localY: ...;
                                          localZ: ...;
                                          starSectorX: ...;
                                          starSectorY: ...;
                                          starSectorZ: ...;
                                      };
                                  };
                              }
                              | { shipId: string; type: "inSpaceship" },
                          >;
                          timestamp: number;
                      }[];
                  },
              >,
              SaveLoadingError,
          >,
      >

      Result containing either the loaded saves or an error

    • Writes save data to the storage backend.

      Parameters

      • saves: Record<string, CmdrSaves>

        Record of commander saves, keyed by commander string

      Returns boolean

      Boolean indicating success or failure of the write operation