@kokimoki/app 0.2.0 → 0.2.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.
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from "./fields";
6
6
  export * from "./kokimoki-client";
7
7
  export * from "./synced-store";
8
8
  export * from "./user-media-handler";
9
+ export * from "./kokimoki-storage";
package/dist/index.js CHANGED
@@ -6,3 +6,4 @@ export * from "./fields";
6
6
  export * from "./kokimoki-client";
7
7
  export * from "./synced-store";
8
8
  export * from "./user-media-handler";
9
+ export * from "./kokimoki-storage";
@@ -9,11 +9,11 @@ export declare class KokimokiClient<StatelessDataT = any> extends KokimokiClient
9
9
  private _appId?;
10
10
  private _wsUrl?;
11
11
  private _apiUrl?;
12
- private _clientId?;
12
+ private _id?;
13
13
  private _token?;
14
14
  private _providers;
15
15
  constructor();
16
- get clientId(): string;
16
+ get id(): string;
17
17
  get appId(): string;
18
18
  get token(): string;
19
19
  get apiUrl(): string;
@@ -5,17 +5,17 @@ export class KokimokiClient extends EventEmitter {
5
5
  _appId;
6
6
  _wsUrl;
7
7
  _apiUrl;
8
- _clientId;
8
+ _id;
9
9
  _token;
10
10
  _providers = new Map();
11
11
  constructor() {
12
12
  super();
13
13
  }
14
- get clientId() {
15
- if (!this._clientId) {
14
+ get id() {
15
+ if (!this._id) {
16
16
  throw new Error("Client not connected");
17
17
  }
18
- return this._clientId;
18
+ return this._id;
19
19
  }
20
20
  get appId() {
21
21
  if (!this._appId) {
@@ -54,7 +54,7 @@ export class KokimokiClient extends EventEmitter {
54
54
  const { clientId, appToken, serverTime, token } = await res.json();
55
55
  const endTime = Date.now();
56
56
  const ping = Math.round((endTime - startTime) / 2);
57
- this._clientId = clientId;
57
+ this._id = clientId;
58
58
  this._token = appToken;
59
59
  this.serverTimeOffset = Date.now() - serverTime - ping;
60
60
  localStorage.setItem("KM_TOKEN", token);
@@ -1,3 +1,4 @@
1
+ import type { Paginated } from "./types/common";
1
2
  import type { Upload } from "./types/upload";
2
3
  export declare class KokimokiStorage {
3
4
  private createUpload;
@@ -7,9 +8,6 @@ export declare class KokimokiStorage {
7
8
  listUploads(filter?: {
8
9
  clientId?: string;
9
10
  mimeTypes?: string[];
10
- }, skip?: number, limit?: number): Promise<{
11
- total: any;
12
- items: any;
13
- }>;
11
+ }, skip?: number, limit?: number): Promise<Paginated<Upload>>;
14
12
  }
15
13
  export declare const kmStorage: KokimokiStorage;
@@ -57,8 +57,7 @@ export class KokimokiStorage {
57
57
  "Content-Type": "application/json",
58
58
  }),
59
59
  });
60
- const { total, items } = await res.json();
61
- return { total, items };
60
+ return await res.json();
62
61
  }
63
62
  }
64
63
  export const kmStorage = new KokimokiStorage();
@@ -1 +1,5 @@
1
1
  export type FacingMode = "user" | "environment";
2
+ export interface Paginated<T> {
3
+ items: T[];
4
+ total: number;
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kokimoki/app",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "Kokimoki app",
6
6
  "main": "dist/index.js",