fmode-ng 0.0.95 → 0.0.97

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.
@@ -0,0 +1,21 @@
1
+ export declare class FmodeACL {
2
+ static _instance: any | null;
3
+ static bindInstance(instance: any): void;
4
+ private permissions;
5
+ constructor(aclData?: Record<string, {
6
+ read: boolean;
7
+ write: boolean;
8
+ }>);
9
+ setPublicReadAccess(allowed: boolean): this;
10
+ setPublicWriteAccess(allowed: boolean): this;
11
+ setReadAccess(userId: string | any, allowed: boolean): this;
12
+ setWriteAccess(userId: string | any, allowed: boolean): this;
13
+ getPublicReadAccess(): boolean;
14
+ getPublicWriteAccess(): boolean;
15
+ getReadAccess(userId: string | any): boolean;
16
+ getWriteAccess(userId: string | any): boolean;
17
+ toJSON(): Record<string, {
18
+ read: boolean;
19
+ write: boolean;
20
+ }>;
21
+ }
@@ -0,0 +1,21 @@
1
+ export declare class FmodeFile {
2
+ static _instance: any | null;
3
+ static bindInstance(instance: any): void;
4
+ __type: "File";
5
+ name: string;
6
+ url: string;
7
+ data?: string | Blob | File | ArrayBuffer;
8
+ constructor(name: string, data: string | Blob | File | ArrayBuffer | {
9
+ base64: string;
10
+ });
11
+ private _base64ToArrayBuffer;
12
+ static save(name: string, data: any | Blob | File | ArrayBuffer | string, options?: {
13
+ type?: string;
14
+ useMasterKey?: boolean;
15
+ }): Promise<FmodeFile>;
16
+ toJSON(): {
17
+ __type: string;
18
+ name: string;
19
+ url: string;
20
+ };
21
+ }
@@ -0,0 +1,20 @@
1
+ export declare class FmodeGeoPoint {
2
+ static _instance: any | null;
3
+ static bindInstance(instance: any): void;
4
+ __type: "GeoPoint";
5
+ latitude: number;
6
+ longitude: number;
7
+ constructor(latitude: number, longitude: number);
8
+ static current(options?: {
9
+ enableHighAccuracy?: boolean;
10
+ }): Promise<FmodeGeoPoint>;
11
+ kilometersTo(point: FmodeGeoPoint): number;
12
+ milesTo(point: FmodeGeoPoint): number;
13
+ radiansTo(point: FmodeGeoPoint): number;
14
+ private _calculateDistance;
15
+ toJSON(): {
16
+ __type: string;
17
+ latitude: number;
18
+ longitude: number;
19
+ };
20
+ }
@@ -0,0 +1,18 @@
1
+ import { FmodeQuery } from "../fmode.query";
2
+ import { FmodeObject } from "../fmode.object";
3
+ export declare class FmodeRelation<T extends FmodeObject> {
4
+ static _instance: any | null;
5
+ static bindInstance(instance: any): void;
6
+ __type: "Relation";
7
+ className: string;
8
+ parent: FmodeObject;
9
+ key: string;
10
+ constructor(parent: FmodeObject, key: string);
11
+ add(objects: T | T[]): void;
12
+ remove(objects: T[]): void;
13
+ query(): FmodeQuery<T>;
14
+ toJSON(): {
15
+ __type: string;
16
+ className: string;
17
+ };
18
+ }
@@ -1,20 +1,17 @@
1
+ import { FmodeRelation } from "./datatype/relation";
1
2
  type ACL = Record<string, {
2
3
  read: boolean;
3
4
  write: boolean;
4
5
  }>;
5
- type Pointer = {
6
- __type: 'Pointer';
7
- className: string;
8
- objectId: string;
9
- };
10
6
  type File = {
11
7
  __type: 'File';
12
8
  name: string;
13
9
  url: string;
14
10
  };
15
- type Relation = {
16
- __type: 'Relation';
11
+ type Pointer = {
12
+ __type: 'Pointer';
17
13
  className: string;
14
+ objectId: string;
18
15
  };
19
16
  export declare class FmodeObject {
20
17
  static _instance: any | null;
@@ -48,7 +45,7 @@ export declare class FmodeObject {
48
45
  static fetchAll<T extends FmodeObject>(objects: T[], options?: {
49
46
  useMasterKey?: boolean;
50
47
  }): Promise<T[]>;
51
- relation(key: string): Relation;
48
+ relation<T extends FmodeObject>(key: string): FmodeRelation<T>;
52
49
  static fromFile(name: string, data: Blob | File | any, type?: string): Promise<File>;
53
50
  }
54
51
  export {};
@@ -1,3 +1,7 @@
1
+ import { FmodeACL } from './datatype/acl';
2
+ import { FmodeFile } from './datatype/file';
3
+ import { FmodeGeoPoint } from './datatype/geopoint';
4
+ import { FmodeRelation } from './datatype/relation';
1
5
  import { FmodeObject } from './fmode.object';
2
6
  import { FmodeQuery } from './fmode.query';
3
7
  import { FmodeUser } from './fmode.user';
@@ -9,6 +13,10 @@ declare class FmodeParse {
9
13
  readonly Object: typeof FmodeObject;
10
14
  readonly Query: typeof FmodeQuery;
11
15
  readonly User: typeof FmodeUser;
16
+ readonly File: typeof FmodeFile;
17
+ readonly Relation: typeof FmodeRelation;
18
+ readonly ACL: typeof FmodeACL;
19
+ readonly GeoPoint: typeof FmodeGeoPoint;
12
20
  private constructor();
13
21
  static initialize(config: string | FmodeInitOptions): FmodeParse;
14
22
  static with(configName: string): FmodeParse;
@@ -20,5 +28,9 @@ declare const defaultExport: typeof FmodeParse & {
20
28
  Object: typeof FmodeObject;
21
29
  Query: typeof FmodeQuery;
22
30
  User: typeof FmodeUser;
31
+ ACL: typeof FmodeACL;
32
+ Relation: typeof FmodeRelation;
33
+ GeoPoint: typeof FmodeGeoPoint;
34
+ File: typeof FmodeFile;
23
35
  };
24
36
  export { FmodeParse as default, defaultExport as FmodeParse };
@@ -96,6 +96,50 @@ export declare class FmodeQuery<T extends FmodeObject = FmodeObject> {
96
96
  latitude: number;
97
97
  longitude: number;
98
98
  }>): this;
99
+ /**
100
+ * Adds a relation constraint to the query
101
+ */
102
+ relatedTo(parent: FmodeObject, key: string): this;
103
+ /**
104
+ * Adds a relation constraint for a specific object
105
+ */
106
+ relatedToObject(parent: FmodeObject, relationKey: string): this;
107
+ /**
108
+ * Adds a relation constraint for a specific query
109
+ */
110
+ relatedToQuery(parentClass: string, relationKey: string, query: FmodeQuery): this;
111
+ /**
112
+ * Matches objects that have a pointer to the given object
113
+ */
114
+ matchesPointer(key: string, object: FmodeObject): this;
115
+ /**
116
+ * Matches objects that have a pointer to any of the given objects
117
+ */
118
+ matchesAnyPointer(key: string, objects: FmodeObject[]): this;
119
+ /**
120
+ * Finds objects in a relation (alternative to using relatedTo)
121
+ */
122
+ static findRelation<T extends FmodeObject>(parent: FmodeObject, relationKey: string, options?: {
123
+ useMasterKey?: boolean;
124
+ }): Promise<T[]>;
125
+ /**
126
+ * Counts objects in a relation
127
+ */
128
+ static countRelation(parent: FmodeObject, relationKey: string, options?: {
129
+ useMasterKey?: boolean;
130
+ }): Promise<number>;
131
+ /**
132
+ * Adds objects to a relation (static helper)
133
+ */
134
+ static addToRelation<T extends FmodeObject>(parent: FmodeObject, relationKey: string, objects: T[], options?: {
135
+ useMasterKey?: boolean;
136
+ }): Promise<void>;
137
+ /**
138
+ * Removes objects from a relation (static helper)
139
+ */
140
+ static removeFromRelation<T extends FmodeObject>(parent: FmodeObject, relationKey: string, objects: T[], options?: {
141
+ useMasterKey?: boolean;
142
+ }): Promise<void>;
99
143
  include(...keys: string[]): this;
100
144
  select(...keys: string[]): this;
101
145
  limit(count: number): this;
@@ -62,7 +62,7 @@ export declare class EditUploadComponent implements OnInit {
62
62
  }[];
63
63
  qiniuConf: any;
64
64
  getUptoken(): Promise<any>;
65
- checkFileType(url: string): "video" | "image" | "file";
65
+ checkFileType(url: string): "file" | "video" | "image";
66
66
  upable(): boolean;
67
67
  imgShowing: boolean;
68
68
  fileUrl: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmode-ng",
3
- "version": "0.0.95",
3
+ "version": "0.0.97",
4
4
  "author": "未来全栈",
5
5
  "license": "COPYRIGHT © 未来飞马 未来全栈 www.fmode.cn All RIGHTS RESERVED",
6
6
  "exports": {