@tak-ps/cloudtak 13.0.0 → 13.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import type { Router, RouteRecordRaw } from 'vue-router';
4
4
  import type { Pinia } from 'pinia';
5
5
  import type { MenuItemConfig } from './src/stores/modules/menu.ts';
6
6
  import type { BottomBarItemConfig } from './src/stores/modules/bottombar.ts';
7
- import { type DBFeature } from './src/base/database.ts';
7
+ import { type DBFeature } from './src/database.ts';
8
8
  import { type Observable } from 'rxjs';
9
9
  import mapgl from 'maplibre-gl';
10
10
  export type { MenuItemConfig };
@@ -1,4 +1,4 @@
1
- import type { DBChatroomChat } from './database.ts';
1
+ import type { DBChatroomChat } from '../database.ts';
2
2
  import type Atlas from '../workers/atlas.ts';
3
3
  import type { Remote } from 'comlink';
4
4
  export default class ChatroomChats {
@@ -1,4 +1,4 @@
1
- import type { DBChatroom } from './database.ts';
1
+ import type { DBChatroom } from '../database.ts';
2
2
  import ChatroomChats from './chatroom-chats.ts';
3
3
  import { type Observable } from 'dexie';
4
4
  import type { ProfileChatroomList, ProfileChatList } from '../types.ts';
@@ -1,14 +1,23 @@
1
1
  import { type Observable } from 'dexie';
2
- import type { Contact } from '../types.ts';
3
- export default class ContactManager {
2
+ import type { Contact as TAKContact } from '../types.ts';
3
+ import BaseInterface from './interface.ts';
4
+ import type { BaseInterface_ListOptions, BaseInterface_FromOptions } from './interface.ts';
5
+ export type Contact_ListOptions = BaseInterface_ListOptions & {
6
+ token?: string;
7
+ filter?: string;
8
+ };
9
+ export type Contact_FromOptions = BaseInterface_FromOptions & {
10
+ token?: string;
11
+ };
12
+ export default class ContactManager extends BaseInterface {
13
+ static readonly listCacheKey = "contact";
14
+ static count(): Promise<number>;
4
15
  static liveCount(): Observable<number>;
5
- static liveList(filter?: string): Observable<Contact[]>;
6
- static list(opts?: {
7
- token?: string;
8
- filter?: string;
9
- }): Promise<Contact[]>;
10
- static get(uid: string): Promise<Contact | undefined>;
11
- static getByCallsign(callsign: string): Promise<Contact | undefined>;
12
- static put(contact: Contact): Promise<void>;
13
- static sync(token?: string): Promise<Contact[]>;
16
+ static liveList(): Observable<TAKContact[]>;
17
+ static list(opts?: Contact_ListOptions): Promise<TAKContact[]>;
18
+ static from(uid: string, opts?: Contact_FromOptions): Promise<TAKContact | undefined>;
19
+ static liveFrom(uid: string): Observable<TAKContact | undefined>;
20
+ static getByCallsign(callsign: string): Promise<TAKContact | undefined>;
21
+ static put(contact: TAKContact): Promise<void>;
22
+ static sync(token?: string): Promise<void>;
14
23
  }
@@ -20,7 +20,13 @@ export default class GroupManager {
20
20
  active?: boolean;
21
21
  direction?: string;
22
22
  }): Promise<GroupChannel[]>;
23
+ /**
24
+ * Get a single GroupChannel by name.
25
+ */
23
26
  static get(name: string): Promise<GroupChannel | undefined>;
27
+ /**
28
+ * Put one or more GroupChannels into the database.
29
+ */
24
30
  static put(channels: GroupChannel[] | GroupChannel): Promise<void>;
25
31
  static sync(token?: string): Promise<GroupChannel[]>;
26
32
  static update(channels: GroupChannel[], token?: string): Promise<GroupChannel[]>;
@@ -1,4 +1,4 @@
1
- import { type DBIcon } from './database.ts';
1
+ import { type DBIcon } from '../database.ts';
2
2
  export interface IconHydrateResult {
3
3
  /** Iconsets that were added or refreshed during the diff. */
4
4
  changed: string[];
@@ -10,6 +10,14 @@ export interface IconHydrateResult {
10
10
  export default class Icon {
11
11
  static has(icon: string): Promise<boolean>;
12
12
  static get(icon: string): Promise<DBIcon | undefined>;
13
+ /**
14
+ * Return all cached icons ordered by key.
15
+ */
16
+ static all(): Promise<DBIcon[]>;
17
+ /**
18
+ * Return all icons belonging to a given iconset uid, ordered by path.
19
+ */
20
+ static list(iconsetUid: string): Promise<DBIcon[]>;
13
21
  /**
14
22
  * Diff the server iconset list against Dexie and refetch icons for any
15
23
  * iconsets that are new or whose `version`/`updated` differs.
@@ -30,6 +38,7 @@ export default class Icon {
30
38
  */
31
39
  static addIconset(uid: string, opts: {
32
40
  token: string;
41
+ force?: boolean;
33
42
  }): Promise<boolean>;
34
43
  /**
35
44
  * Remove an iconset and all of its icons from Dexie. Returns true when
@@ -0,0 +1,20 @@
1
+ import { type Observable } from 'dexie';
2
+ import { type DBIconset } from '../database.ts';
3
+ import BaseInterface from './interface.ts';
4
+ import type { BaseInterface_ListOptions, BaseInterface_FromOptions } from './interface.ts';
5
+ export type Iconset_ListOptions = BaseInterface_ListOptions & {
6
+ token?: string;
7
+ };
8
+ export default class IconsetManager extends BaseInterface {
9
+ static readonly listCacheKey = "iconset";
10
+ static count(): Promise<number>;
11
+ static liveCount(): Observable<number>;
12
+ /**
13
+ * Return all locally cached iconsets ordered by name.
14
+ */
15
+ static list(opts?: Iconset_ListOptions): Promise<DBIconset[]>;
16
+ static liveList(): Observable<DBIconset[]>;
17
+ static from(uid: string, opts?: BaseInterface_FromOptions): Promise<DBIconset | undefined>;
18
+ static liveFrom(uid: string): Observable<DBIconset | undefined>;
19
+ static sync(token?: string): Promise<void>;
20
+ }
@@ -0,0 +1,71 @@
1
+ import type { Observable } from 'dexie';
2
+ export interface BaseInterface_ListOptions {
3
+ sync?: boolean;
4
+ }
5
+ export interface BaseInterface_FromOptions {
6
+ sync?: boolean;
7
+ }
8
+ export default class BaseInterface {
9
+ /**
10
+ * A unique key used for caching the list of items in memory, the dexie cache database contains the key
11
+ * and the date/time when the value was last synced with the database. This allows the library to determine
12
+ * when to invalidate the cache and fetch fresh data from the database.
13
+ */
14
+ static readonly listCacheKey: string;
15
+ /**
16
+ * Returns the total number of items in the database
17
+ */
18
+ static count(): Promise<number>;
19
+ /**
20
+ * Returns the total number of items in the database and updates in real-time when the count changes
21
+ */
22
+ static liveCount(): Observable<number>;
23
+ /**
24
+ * Returns when the local cache was last populated for this manager.
25
+ */
26
+ static hydrated(): Promise<Date | null>;
27
+ /**
28
+ * Returns a list of all items in the database
29
+ *
30
+ * If the sync option is set to true, the method will first trigger a sync to update the local database with the latest data from the server before returning the list of items.
31
+ */
32
+ static list(opts?: BaseInterface_ListOptions): Promise<unknown[]>;
33
+ /**
34
+ * Returns a list of all items in the database and updates in real-time when the list changes
35
+ */
36
+ static liveList(): Observable<unknown[]>;
37
+ /**
38
+ * Trigger a sync to update the local database with the latest data from the server
39
+ */
40
+ static sync(): Promise<void>;
41
+ /**
42
+ * Returns a single item from the database by its unique identifier
43
+ *
44
+ * @param id - The unique identifier of the item to retrieve
45
+ * @param opts - Optional parameters for fetching the item, such as whether to trigger a sync before fetching
46
+ */
47
+ static from(id: string, opts?: BaseInterface_FromOptions): Promise<unknown>;
48
+ /**
49
+ * Returns a single item from the database by its unique identifier and updates in real-time when the item changes
50
+ *
51
+ * @param id - The unique identifier of the item to retrieve
52
+ */
53
+ static liveFrom(id: string): Observable<unknown>;
54
+ /**
55
+ * Generates a new item, attempt to save it via the API and save it to the database
56
+ */
57
+ static generate(): Promise<unknown>;
58
+ /**
59
+ * Updates an item in the database by its unique identifier and attempts to update it via the API
60
+ *
61
+ * @param id - The unique identifier of the item to update
62
+ * @param data - The data to update the item with
63
+ */
64
+ static update(): Promise<void>;
65
+ /**
66
+ * Deletes an item from the database by its unique identifier and attempts to delete it via the API
67
+ *
68
+ * @param id - The unique identifier of the item to delete
69
+ */
70
+ static delete(id: string): Promise<void>;
71
+ }
@@ -1,4 +1,4 @@
1
- import type { DBMissionTemplateLog } from './database.ts';
1
+ import type { DBMissionTemplateLog } from '../database.ts';
2
2
  export default class MissionTemplateLogs {
3
3
  template: string;
4
4
  constructor(template: string);
@@ -1,4 +1,4 @@
1
- import type { DBMissionTemplate } from './database.ts';
1
+ import type { DBMissionTemplate } from '../database.ts';
2
2
  import MissionTemplateLogs from './mission-template-logs.ts';
3
3
  import type { MissionTemplateList } from '../types.ts';
4
4
  export default class MissionTemplate {
@@ -1,5 +1,5 @@
1
- import { NotificationType } from './database.ts';
2
- import type { DBNotification } from './database.ts';
1
+ import { NotificationType } from '../database.ts';
2
+ import type { DBNotification } from '../database.ts';
3
3
  export { NotificationType };
4
4
  export default class TAKNotification {
5
5
  id: string;
@@ -1,4 +1,4 @@
1
- import type { DBSubscriptionChat } from './database.ts';
1
+ import type { DBSubscriptionChat } from '../database.ts';
2
2
  import { type Observable } from 'dexie';
3
3
  import type Atlas from '../workers/atlas.ts';
4
4
  import type { Remote } from 'comlink';
@@ -1,4 +1,4 @@
1
- import type { DBSubscriptionContent } from './database.ts';
1
+ import type { DBSubscriptionContent } from '../database.ts';
2
2
  import type { Mission } from '../types.ts';
3
3
  /**
4
4
  * High Level Wrapper around Mission Contents (file attachments)
@@ -1,4 +1,4 @@
1
- import type { DBSubscriptionLog } from './database.ts';
1
+ import type { DBSubscriptionLog } from '../database.ts';
2
2
  import type { MissionLog } from '../types.ts';
3
3
  /**
4
4
  * High Level Wrapper around the Data/Mission Sync API
@@ -1,4 +1,4 @@
1
- import type { DBSubscriptionLog } from '../../../../base/database.ts';
1
+ import type { DBSubscriptionLog } from '../../../../database.ts';
2
2
  import Subscription from '../../../../base/subscription.ts';
3
3
  type __VLS_Props = {
4
4
  log: DBSubscriptionLog;
@@ -7,6 +7,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
7
7
  type: BooleanConstructor;
8
8
  default: boolean;
9
9
  };
10
+ refreshKey: {
11
+ type: NumberConstructor;
12
+ default: number;
13
+ };
10
14
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
11
15
  iconset: {
12
16
  type: StringConstructor;
@@ -16,9 +20,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
16
20
  type: BooleanConstructor;
17
21
  default: boolean;
18
22
  };
23
+ refreshKey: {
24
+ type: NumberConstructor;
25
+ default: number;
26
+ };
19
27
  }>> & Readonly<{}>, {
20
28
  iconset: string;
21
29
  labels: boolean;
30
+ refreshKey: number;
22
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
23
32
  declare const _default: typeof __VLS_export;
24
33
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import Dexie, { type EntityTable } from 'dexie';
2
- import type { Feature, GroupChannel, Mission, MissionRole, MissionChange, MissionLog, Contact, Server } from '../types.ts';
2
+ import type { Feature, GroupChannel, Mission, MissionRole, MissionChange, MissionLog, Contact, Server } from './types.ts';
3
3
  export interface DBIcon {
4
4
  /** Maplibre image id, e.g. "<iconsetUid>:<icon-path-without-extension>" */
5
5
  name: string;
@@ -48,6 +48,7 @@ export interface DBIconset {
48
48
  version: number;
49
49
  name: string;
50
50
  username: string | null;
51
+ username_internal: boolean;
51
52
  default_group: string | null;
52
53
  default_friendly: string | null;
53
54
  default_hostile: string | null;
@@ -4,7 +4,7 @@ import MenuManager from './modules/menu.ts';
4
4
  import BottomBarManager from './modules/bottombar.ts';
5
5
  import * as Comlink from 'comlink';
6
6
  import COT from '../base/cot.ts';
7
- import type { DatabaseType } from '../base/database.ts';
7
+ import type { DatabaseType } from '../database.ts';
8
8
  import { LocationState } from '../base/events.ts';
9
9
  import Overlay from '../base/overlay.ts';
10
10
  import Subscription from '../base/subscription.ts';
@@ -1,7 +1,7 @@
1
1
  import type { Map as MapLibreMap } from 'maplibre-gl';
2
2
  import type * as Comlink from 'comlink';
3
3
  import type Atlas from '../../workers/atlas.ts';
4
- import { type DBIconset } from '../../base/database.ts';
4
+ import { type DBIconset } from '../../database.ts';
5
5
  export default class IconManager {
6
6
  private cache;
7
7
  private map;
@@ -51,7 +51,9 @@ export default class IconManager {
51
51
  * reference a specific iconset so it is available even if the user-wide
52
52
  * hydrate hasn't completed yet.
53
53
  */
54
- addIconset(uid: string): Promise<void>;
54
+ addIconset(uid: string, opts?: {
55
+ force?: boolean;
56
+ }): Promise<void>;
55
57
  removeIconset(uid: string): Promise<void>;
56
58
  private applyHydrateResult;
57
59
  private purgeMapImagesForIconset;
@@ -7,6 +7,8 @@ export default class AtlasIcons {
7
7
  hydrate(opts?: {
8
8
  force?: boolean;
9
9
  }): Promise<IconHydrateResult>;
10
- addIconset(uid: string): Promise<boolean>;
10
+ addIconset(uid: string, opts?: {
11
+ force?: boolean;
12
+ }): Promise<boolean>;
11
13
  removeIconset(uid: string): Promise<boolean>;
12
14
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/cloudtak",
3
3
  "type": "module",
4
- "version": "13.0.0",
4
+ "version": "13.0.2",
5
5
  "types": "dist/types/plugin.d.ts",
6
6
  "files": [
7
7
  "dist/types"