@nymphjs/tilmeld-client 1.0.0-beta.14 → 1.0.0-beta.141
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/CHANGELOG.md +569 -0
- package/README.md +7 -4
- package/dist/Group.d.ts +79 -0
- package/dist/Group.js +80 -0
- package/dist/Group.js.map +1 -0
- package/dist/Tilmeld.types.d.ts +12 -0
- package/dist/Tilmeld.types.js +2 -0
- package/dist/Tilmeld.types.js.map +1 -0
- package/{lib → dist}/User.d.ts +141 -14
- package/{lib → dist}/User.js +106 -39
- package/dist/User.js.map +1 -0
- package/dist/helpers.d.ts +58 -0
- package/{lib → dist}/helpers.js +23 -17
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +255 -0
- package/dist/index.test.js.map +1 -0
- package/jest.config.js +31 -5
- package/package.json +37 -33
- package/src/Group.ts +78 -38
- package/src/Tilmeld.types.ts +13 -0
- package/src/User.ts +198 -85
- package/src/helpers.ts +25 -12
- package/src/index.test.ts +327 -0
- package/src/index.ts +5 -7
- package/tsconfig.json +7 -4
- package/typedoc.json +4 -0
- package/lib/Group.d.ts +0 -41
- package/lib/Group.js +0 -54
- package/lib/Group.js.map +0 -1
- package/lib/User.js.map +0 -1
- package/lib/helpers.d.ts +0 -46
- package/lib/helpers.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -28
- package/lib/index.js.map +0 -1
- package/webpack.config.js +0 -31
package/package.json
CHANGED
|
@@ -1,52 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nymphjs/tilmeld-client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "
|
|
3
|
+
"version": "1.0.0-beta.141",
|
|
4
|
+
"description": "Nymph.js - Tilmeld Client",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"nymph",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"nymph.js",
|
|
11
|
+
"application data framework",
|
|
12
|
+
"application data and access framework",
|
|
13
|
+
"tilmeld"
|
|
12
14
|
],
|
|
13
15
|
"scripts": {
|
|
14
|
-
"clean": "
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"watch
|
|
21
|
-
"watch:js": "webpack --watch",
|
|
22
|
-
"prepare": "npm run clean && npm run build",
|
|
23
|
-
"test": "jest --detectOpenHandles",
|
|
24
|
-
"test:watch": "jest --watch"
|
|
16
|
+
"clean": "test -d dist && rm -r dist || true",
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"watch": "tsc --watch",
|
|
19
|
+
"prepublish": "npm run clean && npm run build",
|
|
20
|
+
"typecheck": "npx tsc --noEmit",
|
|
21
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
|
|
22
|
+
"test:watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests --watch"
|
|
25
23
|
},
|
|
26
24
|
"publishConfig": {
|
|
27
25
|
"access": "public"
|
|
28
26
|
},
|
|
27
|
+
"homepage": "https://nymph.io",
|
|
29
28
|
"repository": {
|
|
30
29
|
"type": "git",
|
|
31
|
-
"url": "
|
|
30
|
+
"url": "https://forge.sciactive.com/sciactive/nymphjs.git",
|
|
31
|
+
"directory": "packages/tilmeld-client"
|
|
32
32
|
},
|
|
33
|
-
"author": "Hunter Perrin <hperrin@
|
|
33
|
+
"author": "Hunter Perrin <hperrin@port87.com>",
|
|
34
34
|
"bugs": {
|
|
35
|
-
"url": "https://
|
|
35
|
+
"url": "https://forge.sciactive.com/sciactive/nymphjs/issues"
|
|
36
36
|
},
|
|
37
37
|
"license": "Apache-2.0",
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@tsconfig/recommended": "^1.0.2",
|
|
40
|
-
"@types/jest": "^29.4.0",
|
|
41
|
-
"jest": "^29.4.3",
|
|
42
|
-
"ts-jest": "^29.0.5",
|
|
43
|
-
"ts-loader": "^9.4.2",
|
|
44
|
-
"typescript": "^4.9.5",
|
|
45
|
-
"webpack": "^5.75.0",
|
|
46
|
-
"webpack-cli": "^5.0.1"
|
|
47
|
-
},
|
|
48
38
|
"dependencies": {
|
|
49
|
-
"@nymphjs/client": "^1.0.0-beta.
|
|
39
|
+
"@nymphjs/client": "^1.0.0-beta.141"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@nymphjs/driver-sqlite3": "^1.0.0-beta.141",
|
|
43
|
+
"@nymphjs/nymph": "^1.0.0-beta.141",
|
|
44
|
+
"@nymphjs/server": "^1.0.0-beta.141",
|
|
45
|
+
"@nymphjs/tilmeld": "^1.0.0-beta.141",
|
|
46
|
+
"@swc/core": "^1.16.1",
|
|
47
|
+
"@swc/jest": "^0.2.39",
|
|
48
|
+
"@tsconfig/recommended": "^1.0.13",
|
|
49
|
+
"@types/jest": "^30.0.0",
|
|
50
|
+
"cross-env": "^10.1.0",
|
|
51
|
+
"jest": "^30.4.2",
|
|
52
|
+
"ts-node": "^10.9.2",
|
|
53
|
+
"typescript": "^7.0.2"
|
|
50
54
|
},
|
|
51
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "976caad27c041b5b8dc5a897f6b2250cdbf9f20b"
|
|
52
56
|
}
|
package/src/Group.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Entity, Options, Selector } from '@nymphjs/client';
|
|
2
2
|
|
|
3
|
-
import type User from './User';
|
|
4
|
-
import type { CurrentUserData } from './User';
|
|
3
|
+
import type { User, CurrentUserData } from './User.js';
|
|
5
4
|
|
|
6
|
-
export
|
|
5
|
+
export interface GroupData {
|
|
7
6
|
/**
|
|
8
7
|
* The group's groupname.
|
|
9
8
|
*/
|
|
@@ -19,7 +18,7 @@ export type GroupData = {
|
|
|
19
18
|
/**
|
|
20
19
|
* The group's parent.
|
|
21
20
|
*/
|
|
22
|
-
parent?: Group
|
|
21
|
+
parent?: Group;
|
|
23
22
|
|
|
24
23
|
/**
|
|
25
24
|
* Whether the group can be used.
|
|
@@ -37,9 +36,9 @@ export type GroupData = {
|
|
|
37
36
|
* Whether this group is a default secondary group for unverified users.
|
|
38
37
|
*/
|
|
39
38
|
unverifiedSecondary?: boolean;
|
|
40
|
-
}
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
export
|
|
41
|
+
export interface CurrentGroupData extends GroupData {
|
|
43
42
|
/**
|
|
44
43
|
* The abilities granted to the group.
|
|
45
44
|
*/
|
|
@@ -56,70 +55,111 @@ export type CurrentGroupData = GroupData & {
|
|
|
56
55
|
* If generatePrimary is on, this will be the user who generated this group.
|
|
57
56
|
*/
|
|
58
57
|
user?: (User & CurrentUserData) | null;
|
|
59
|
-
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface AdminGroupData extends CurrentGroupData {}
|
|
60
61
|
|
|
61
|
-
export
|
|
62
|
+
export interface Group extends GroupData {}
|
|
62
63
|
|
|
63
|
-
export
|
|
64
|
+
export class Group extends Entity<GroupData> {
|
|
64
65
|
// The name of the server class
|
|
65
66
|
public static class = 'Group';
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
static async factoryGroupname(groupname?: string): Promise<Group> {
|
|
69
|
+
const entity = new this();
|
|
70
|
+
if (groupname != null) {
|
|
71
|
+
const entity = await this.nymph.getEntity(
|
|
72
|
+
{
|
|
73
|
+
class: this,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: '&',
|
|
77
|
+
ilike: ['groupname', groupname.replace(/([\\%_])/g, (s) => `\\${s}`)],
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
if (entity != null) {
|
|
81
|
+
return entity;
|
|
82
|
+
}
|
|
73
83
|
}
|
|
84
|
+
return entity;
|
|
74
85
|
}
|
|
75
86
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
87
|
+
constructor() {
|
|
88
|
+
super();
|
|
79
89
|
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
this.enabled = true;
|
|
91
|
+
(this as CurrentGroupData).abilities = [];
|
|
82
92
|
}
|
|
83
93
|
|
|
84
94
|
public async $checkGroupname(): Promise<{
|
|
85
95
|
result: boolean;
|
|
86
96
|
message: string;
|
|
87
97
|
}> {
|
|
88
|
-
return await this.$serverCall('$checkGroupname', [],
|
|
98
|
+
return await this.$serverCall('$checkGroupname', [], {
|
|
99
|
+
pushState: true,
|
|
100
|
+
});
|
|
89
101
|
}
|
|
90
102
|
|
|
91
103
|
public async $checkEmail(): Promise<{ result: boolean; message: string }> {
|
|
92
|
-
return await this.$serverCall('$checkEmail', [],
|
|
104
|
+
return await this.$serverCall('$checkEmail', [], {
|
|
105
|
+
pushState: true,
|
|
106
|
+
});
|
|
93
107
|
}
|
|
94
108
|
|
|
95
109
|
public async $getAvatar(): Promise<string> {
|
|
96
|
-
return await this.$serverCall('$getAvatar', [],
|
|
110
|
+
return await this.$serverCall('$getAvatar', [], {
|
|
111
|
+
pushState: true,
|
|
112
|
+
});
|
|
97
113
|
}
|
|
98
114
|
|
|
99
|
-
public async $getChildren(
|
|
100
|
-
|
|
115
|
+
public async $getChildren(
|
|
116
|
+
limit?: number,
|
|
117
|
+
offset?: number,
|
|
118
|
+
reverse?: boolean,
|
|
119
|
+
sort?: string,
|
|
120
|
+
): Promise<Group[]> {
|
|
121
|
+
return await this.$serverCall('$getChildren', [
|
|
122
|
+
limit,
|
|
123
|
+
offset,
|
|
124
|
+
reverse,
|
|
125
|
+
sort,
|
|
126
|
+
]);
|
|
101
127
|
}
|
|
102
128
|
|
|
103
|
-
public async $getDescendants(
|
|
104
|
-
|
|
105
|
-
): Promise<(Group & GroupData)[]> {
|
|
106
|
-
return await this.$serverCall('$getDescendants', [andSelf], true);
|
|
129
|
+
public async $getDescendants(andSelf = false): Promise<Group[]> {
|
|
130
|
+
return await this.$serverCall('$getDescendants', [andSelf]);
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
public async $getLevel(): Promise<number> {
|
|
110
|
-
return await this.$serverCall('$getLevel', []
|
|
134
|
+
return await this.$serverCall('$getLevel', []);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
public async $isDescendant(givenGroup: Group | string): Promise<boolean> {
|
|
138
|
+
return await this.$serverCall('$isDescendant', [givenGroup]);
|
|
111
139
|
}
|
|
112
140
|
|
|
113
|
-
public async $
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
141
|
+
public async $getUsers(
|
|
142
|
+
descendants = false,
|
|
143
|
+
limit?: number,
|
|
144
|
+
offset?: number,
|
|
145
|
+
reverse?: boolean,
|
|
146
|
+
sort?: string,
|
|
147
|
+
enabled?: boolean,
|
|
148
|
+
): Promise<User[]> {
|
|
149
|
+
return await this.$serverCall('$getUsers', [
|
|
150
|
+
descendants,
|
|
151
|
+
limit,
|
|
152
|
+
offset,
|
|
153
|
+
reverse,
|
|
154
|
+
sort,
|
|
155
|
+
enabled,
|
|
156
|
+
]);
|
|
117
157
|
}
|
|
118
158
|
|
|
119
159
|
public static async getPrimaryGroups(
|
|
120
160
|
options?: Options,
|
|
121
|
-
selectors?: Selector[]
|
|
122
|
-
): Promise<
|
|
161
|
+
selectors?: Selector[],
|
|
162
|
+
): Promise<Group[]> {
|
|
123
163
|
return await this.serverCallStatic('getPrimaryGroups', [
|
|
124
164
|
{ options, class: this.class },
|
|
125
165
|
selectors,
|
|
@@ -128,8 +168,8 @@ export default class Group extends Entity<GroupData> {
|
|
|
128
168
|
|
|
129
169
|
public static async getSecondaryGroups(
|
|
130
170
|
options?: Options,
|
|
131
|
-
selectors?: Selector[]
|
|
132
|
-
): Promise<
|
|
171
|
+
selectors?: Selector[],
|
|
172
|
+
): Promise<Group[]> {
|
|
133
173
|
return await this.serverCallStatic('getSecondaryGroups', [
|
|
134
174
|
{ options, class: this.class },
|
|
135
175
|
selectors,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Group } from './Group.js';
|
|
2
|
+
import { User } from './User.js';
|
|
3
|
+
|
|
4
|
+
export interface AccessControlData {
|
|
5
|
+
user?: User;
|
|
6
|
+
group?: Group;
|
|
7
|
+
acUser?: number;
|
|
8
|
+
acGroup?: number;
|
|
9
|
+
acOther?: number;
|
|
10
|
+
acFull?: string[];
|
|
11
|
+
acWrite?: string[];
|
|
12
|
+
acRead?: string[];
|
|
13
|
+
}
|