firstly 0.2.0 → 0.3.0
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 +23 -0
- package/esm/bin/cmd.js +3 -158
- package/esm/changeLog/index.d.ts +1 -6
- package/esm/feedback/FeedbackController.d.ts +6 -2
- package/esm/feedback/FeedbackController.js +145 -143
- package/esm/feedback/server/index.d.ts +2 -2
- package/esm/feedback/server/index.js +3 -3
- package/esm/feedback/types.d.ts +5 -0
- package/esm/feedback/ui/DialogIssue.svelte +5 -5
- package/esm/feedback/ui/DialogIssues.svelte +5 -5
- package/esm/feedback/ui/DialogMilestones.svelte +1 -1
- package/esm/internals/BaseEnum.d.ts +2 -1
- package/esm/internals/FF_Entity.js +1 -17
- package/esm/internals/FF_Fields.d.ts +4 -3
- package/esm/internals/FF_Fields.js +14 -55
- package/esm/internals/cellsBuildor.d.ts +2 -1
- package/esm/internals/cellsBuildor.js +5 -4
- package/esm/internals/index.d.ts +7 -12
- package/esm/internals/storeItem.d.ts +12 -20
- package/esm/internals/storeItem.js +20 -6
- package/esm/mail/server/index.d.ts +8 -2
- package/esm/mail/server/index.js +35 -7
- package/esm/server/index.d.ts +1 -1
- package/esm/svelte/FF_Cell.svelte +3 -5
- package/esm/svelte/FF_Cell.svelte.d.ts +4 -2
- package/esm/svelte/FF_Form.svelte +4 -5
- package/esm/svelte/FF_Grid.svelte +2 -2
- package/esm/svelte/FF_Layout.svelte +3 -3
- package/esm/svelte/FF_Repo.svelte.d.ts +9 -0
- package/esm/svelte/FF_Repo.svelte.js +39 -0
- package/esm/svelte/class/SP.svelte.js +14 -2
- package/esm/svelte/dialog/DialogManagement.svelte +2 -5
- package/esm/svelte/dialog/DialogPrimitive.svelte +1 -2
- package/esm/svelte/dialog/dialog.js +2 -2
- package/esm/svelte/ff_Config.svelte.js +2 -2
- package/esm/svelte/index.d.ts +2 -7
- package/esm/svelte/index.js +2 -7
- package/esm/ui/Button.svelte +34 -66
- package/esm/ui/Button.svelte.d.ts +9 -35
- package/esm/ui/Clipboardable.svelte +13 -17
- package/esm/ui/Clipboardable.svelte.d.ts +9 -33
- package/esm/ui/Field.svelte +48 -9
- package/esm/ui/FieldGroup.svelte.d.ts +1 -1
- package/esm/ui/Grid.svelte +13 -87
- package/esm/ui/Grid.svelte.d.ts +0 -1
- package/esm/ui/Grid2.svelte +26 -90
- package/esm/ui/Grid2.svelte.d.ts +1 -2
- package/esm/ui/GridPaginate.svelte +1 -1
- package/esm/ui/GridPaginate2.svelte +2 -2
- package/esm/ui/Icon.svelte +2 -18
- package/esm/ui/Icon.svelte.d.ts +0 -2
- package/esm/ui/LibIcon.js +2 -2
- package/esm/ui/Loading.svelte +1 -1
- package/esm/ui/dialog/DialogManagement.svelte +14 -5
- package/esm/ui/dialog/DialogPrimitive.svelte +3 -3
- package/esm/ui/dialog/FormEditAction.svelte +4 -4
- package/esm/ui/dialog/dialog.d.ts +5 -2
- package/esm/ui/dialog/dialog.js +2 -2
- package/esm/ui/index.d.ts +1 -0
- package/esm/ui/index.js +1 -0
- package/esm/ui/internals/FieldContainer.svelte +25 -14
- package/esm/ui/internals/FieldContainer.svelte.d.ts +9 -30
- package/esm/ui/internals/Input.svelte.d.ts +1 -1
- package/esm/ui/internals/Textarea.svelte +2 -5
- package/esm/ui/internals/select/MultiSelectMelt.svelte +10 -8
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +1 -1
- package/esm/ui/internals/select/Select2.svelte +88 -0
- package/esm/ui/internals/select/Select2.svelte.d.ts +12 -0
- package/esm/ui/internals/select/SelectMelt.svelte +33 -24
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +1 -1
- package/esm/ui/internals/select/SelectRadio.svelte +2 -2
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +1 -1
- package/esm/ui/link/Link.svelte +1 -1
- package/esm/ui/link/LinkPlus.svelte +9 -5
- package/esm/ui/link/LinkPlus.svelte.d.ts +5 -19
- package/esm/virtual/Customer.js +1 -2
- package/esm/virtual/UIEntity.js +9 -5
- package/package.json +11 -25
- package/esm/auth/AuthController.d.ts +0 -58
- package/esm/auth/AuthController.js +0 -114
- package/esm/auth/Entities.d.ts +0 -47
- package/esm/auth/Entities.js +0 -182
- package/esm/auth/README.md +0 -3
- package/esm/auth/index.d.ts +0 -5
- package/esm/auth/index.js +0 -5
- package/esm/auth/server/AuthController.server.d.ts +0 -58
- package/esm/auth/server/AuthController.server.js +0 -498
- package/esm/auth/server/handleAuth.d.ts +0 -4
- package/esm/auth/server/handleAuth.js +0 -142
- package/esm/auth/server/handleGuard.d.ts +0 -22
- package/esm/auth/server/handleGuard.js +0 -34
- package/esm/auth/server/helperDb.d.ts +0 -10
- package/esm/auth/server/helperDb.js +0 -56
- package/esm/auth/server/helperFirstly.d.ts +0 -1
- package/esm/auth/server/helperFirstly.js +0 -9
- package/esm/auth/server/helperOslo.d.ts +0 -7
- package/esm/auth/server/helperOslo.js +0 -24
- package/esm/auth/server/helperRemultServer.d.ts +0 -5
- package/esm/auth/server/helperRemultServer.js +0 -44
- package/esm/auth/server/helperRole.d.ts +0 -19
- package/esm/auth/server/helperRole.js +0 -57
- package/esm/auth/server/index.d.ts +0 -8
- package/esm/auth/server/index.js +0 -8
- package/esm/auth/server/module.d.ts +0 -300
- package/esm/auth/server/module.js +0 -230
- package/esm/auth/server/providers/github.d.ts +0 -33
- package/esm/auth/server/providers/github.js +0 -87
- package/esm/auth/server/providers/helperProvider.d.ts +0 -1
- package/esm/auth/server/providers/helperProvider.js +0 -25
- package/esm/auth/static/assets/Page-9Ytj29NS.d.ts +0 -2
- package/esm/auth/static/assets/Page-9Ytj29NS.js +0 -1
- package/esm/auth/static/assets/Page-BHW08QWz.css +0 -1
- package/esm/auth/static/assets/Page-C1pM-UDt.d.ts +0 -2
- package/esm/auth/static/assets/Page-C1pM-UDt.js +0 -20
- package/esm/auth/static/assets/Page-CPz6KCw_.d.ts +0 -2
- package/esm/auth/static/assets/Page-CPz6KCw_.js +0 -1
- package/esm/auth/static/assets/index-AoBb9Ds5.d.ts +0 -232
- package/esm/auth/static/assets/index-AoBb9Ds5.js +0 -2
- package/esm/auth/static/assets/index-DKWpA6v7.css +0 -4
- package/esm/auth/static/favicon.svg +0 -79
- package/esm/auth/static/index.html +0 -13
- package/esm/auth/types.d.ts +0 -73
- package/esm/auth/types.js +0 -1
- package/esm/svelte/FF_Display.svelte +0 -51
- package/esm/svelte/FF_Display.svelte.d.ts +0 -29
- package/esm/svelte/FF_Edit.svelte +0 -104
- package/esm/svelte/FF_Edit.svelte.d.ts +0 -32
- package/esm/svelte/FF_Error.svelte +0 -23
- package/esm/svelte/FF_Error.svelte.d.ts +0 -29
- package/esm/svelte/FF_Field.svelte +0 -62
- package/esm/svelte/FF_Field.svelte.d.ts +0 -29
- package/esm/svelte/FF_Hint.svelte +0 -21
- package/esm/svelte/FF_Hint.svelte.d.ts +0 -29
- package/esm/svelte/FF_Label.svelte +0 -23
- package/esm/svelte/FF_Label.svelte.d.ts +0 -29
|
@@ -32,31 +32,31 @@ async function getGitHub(query, variables) {
|
|
|
32
32
|
}
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
|
-
async function addMetaData(issueId,
|
|
35
|
+
async function addMetaData(issueId, obj) {
|
|
36
36
|
if (import.meta.env.SSR) {
|
|
37
37
|
const commentToMinimize = await getGitHub(`mutation AddComment($input: AddCommentInput!) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
addComment(input: $input) {
|
|
39
|
+
commentEdge {
|
|
40
|
+
node {
|
|
41
|
+
id
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`, {
|
|
47
47
|
input: {
|
|
48
48
|
subjectId: issueId,
|
|
49
|
-
body: `<pre>\n${JSON.stringify(
|
|
49
|
+
body: `<pre>\n${JSON.stringify(obj, null, 2)}\n</pre>`,
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
await getGitHub(`mutation MinimizeComment($input: MinimizeCommentInput!) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
minimizeComment(input: $input) {
|
|
54
|
+
minimizedComment {
|
|
55
|
+
isMinimized
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`, {
|
|
60
60
|
input: {
|
|
61
61
|
subjectId: commentToMinimize.addComment.commentEdge.node.id,
|
|
62
62
|
classifier: 'OFF_TOPIC',
|
|
@@ -67,26 +67,26 @@ async function addMetaData(issueId, author, page) {
|
|
|
67
67
|
export class FeedbackController {
|
|
68
68
|
static async getMilestones() {
|
|
69
69
|
const data = await getGitHub(`query Milestones(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
70
|
+
$repository: String!
|
|
71
|
+
$owner: String!
|
|
72
|
+
$filter: String
|
|
73
|
+
$take: Int = 25
|
|
74
|
+
$cursor: String
|
|
75
|
+
) {
|
|
76
|
+
repository(name: $repository, owner: $owner) {
|
|
77
|
+
milestones(query: $filter, last: $take, after: $cursor, states: OPEN) {
|
|
78
|
+
pageInfo {
|
|
79
|
+
endCursor
|
|
80
|
+
}
|
|
81
|
+
nodes {
|
|
82
|
+
id
|
|
83
|
+
number
|
|
84
|
+
title
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`, {
|
|
90
90
|
repository: remult.context.feedbackOptions.repo.name,
|
|
91
91
|
owner: remult.context.feedbackOptions.repo.owner,
|
|
92
92
|
filter: remult.context.feedbackOptions.milestones?.title_filter ?? '',
|
|
@@ -105,33 +105,33 @@ export class FeedbackController {
|
|
|
105
105
|
? { field: 'UPDATED_AT', direction: 'DESC' } // When close, the last issue updated.
|
|
106
106
|
: null; // When open take milestone order
|
|
107
107
|
const data = await getGitHub(`query Issues(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
108
|
+
$repository: String!
|
|
109
|
+
$owner: String!
|
|
110
|
+
$filters: IssueFilters
|
|
111
|
+
$milestoneNumber: Int!
|
|
112
|
+
$take: Int = 25
|
|
113
|
+
$cursor: String
|
|
114
|
+
$issueOrder: IssueOrder
|
|
115
|
+
) {
|
|
116
|
+
repository(name: $repository, owner: $owner) {
|
|
117
|
+
milestone(number: $milestoneNumber) {
|
|
118
|
+
issues(first: $take, after: $cursor, filterBy: $filters, orderBy: $issueOrder) {
|
|
119
|
+
nodes {
|
|
120
|
+
id
|
|
121
|
+
number
|
|
122
|
+
titleHTML
|
|
123
|
+
state
|
|
124
124
|
labels(first:10){
|
|
125
125
|
nodes {
|
|
126
126
|
name
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`, {
|
|
135
135
|
repository: remult.context.feedbackOptions.repo.name,
|
|
136
136
|
owner: remult.context.feedbackOptions.repo.owner,
|
|
137
137
|
milestoneNumber,
|
|
@@ -156,38 +156,38 @@ export class FeedbackController {
|
|
|
156
156
|
}
|
|
157
157
|
static async getIssue(issueNumber) {
|
|
158
158
|
const data = await getGitHub(`query Issue($repository: String!, $owner: String!, $issueNumber: Int!) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
159
|
+
repository(name: $repository, owner: $owner) {
|
|
160
|
+
issue(number: $issueNumber) {
|
|
161
|
+
id
|
|
162
|
+
createdAt
|
|
163
|
+
bodyHTML
|
|
164
|
+
state
|
|
165
|
+
title
|
|
166
|
+
labels(first: 25){
|
|
167
|
+
nodes{
|
|
168
|
+
id
|
|
169
|
+
name
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
comments(first: 100) {
|
|
173
|
+
nodes {
|
|
174
|
+
id
|
|
175
|
+
isMinimized
|
|
176
|
+
createdAt
|
|
177
|
+
body
|
|
178
|
+
bodyHTML
|
|
179
|
+
reactionGroups {
|
|
180
|
+
content
|
|
181
|
+
reactors(first: 1) {
|
|
182
|
+
totalCount
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
`, {
|
|
191
191
|
repository: remult.context.feedbackOptions.repo.name,
|
|
192
192
|
owner: remult.context.feedbackOptions.repo.owner,
|
|
193
193
|
issueNumber,
|
|
@@ -204,7 +204,7 @@ export class FeedbackController {
|
|
|
204
204
|
for (let i = 0; i < comments.length; i++) {
|
|
205
205
|
if (comments[i].isMinimized) {
|
|
206
206
|
const parsed = JSON.parse(comments[i].body.replaceAll('<pre>\n', '').replaceAll('\n</pre>', ''));
|
|
207
|
-
items[items.length - 1].who = parsed
|
|
207
|
+
items[items.length - 1].who = parsed?.author ?? '???';
|
|
208
208
|
items[items.length - 1].public = true;
|
|
209
209
|
}
|
|
210
210
|
else {
|
|
@@ -230,35 +230,35 @@ export class FeedbackController {
|
|
|
230
230
|
};
|
|
231
231
|
return toRet;
|
|
232
232
|
}
|
|
233
|
-
static async createIssue(milestoneId, title, body,
|
|
233
|
+
static async createIssue(milestoneId, title, body, metadata) {
|
|
234
234
|
const repoInfo = await getGitHub(`query RepoInfo(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
$repository: String!
|
|
236
|
+
$owner: String!
|
|
237
|
+
) {
|
|
238
|
+
repository(name: $repository, owner: $owner) {
|
|
239
|
+
id
|
|
240
240
|
labels(first: 25){
|
|
241
241
|
nodes{
|
|
242
242
|
id
|
|
243
243
|
name
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
}
|
|
247
|
+
}`, {
|
|
248
248
|
repository: remult.context.feedbackOptions.repo.name,
|
|
249
249
|
owner: remult.context.feedbackOptions.repo.owner,
|
|
250
250
|
});
|
|
251
251
|
const repoInfoData = repoInfo.repository;
|
|
252
252
|
const create_label = repoInfoData.labels.nodes.find((c) => c.name === remult.context.feedbackOptions.create_label);
|
|
253
253
|
const newIssue = await getGitHub(`mutation CreateIssue($input: CreateIssueInput!) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
254
|
+
createIssue(input: $input) {
|
|
255
|
+
issue {
|
|
256
|
+
id
|
|
257
|
+
number
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
`, {
|
|
262
262
|
input: {
|
|
263
263
|
repositoryId: repoInfoData.id,
|
|
264
264
|
milestoneId: milestoneId,
|
|
@@ -268,19 +268,20 @@ export class FeedbackController {
|
|
|
268
268
|
},
|
|
269
269
|
});
|
|
270
270
|
const toRet = newIssue.createIssue.issue;
|
|
271
|
-
|
|
271
|
+
const feedbackMetadata = remult.context.feedbackOptions.transformMetadata?.({
|
|
272
|
+
user: remult.user,
|
|
273
|
+
metadata,
|
|
274
|
+
}) ?? metadata;
|
|
275
|
+
await addMetaData(toRet.id, feedbackMetadata);
|
|
272
276
|
remult.context.feedbackOptions.saved?.({
|
|
273
277
|
number: toRet.number,
|
|
274
278
|
title: title,
|
|
275
279
|
body,
|
|
276
|
-
metadata:
|
|
277
|
-
author: JSON.stringify(remult.user?.name),
|
|
278
|
-
page,
|
|
279
|
-
},
|
|
280
|
+
metadata: feedbackMetadata,
|
|
280
281
|
});
|
|
281
282
|
return toRet;
|
|
282
283
|
}
|
|
283
|
-
static async addCommentOnIssue(issueId, issueNumber, title, body,
|
|
284
|
+
static async addCommentOnIssue(issueId, issueNumber, title, body, metadata, labels) {
|
|
284
285
|
const inputComment = {
|
|
285
286
|
subjectId: issueId,
|
|
286
287
|
body,
|
|
@@ -292,32 +293,33 @@ export class FeedbackController {
|
|
|
292
293
|
: labels).map((c) => c.id),
|
|
293
294
|
};
|
|
294
295
|
await getGitHub(`mutation AddComment($inputComment: AddCommentInput!, $inputIssue: UpdateIssueInput!) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
296
|
+
addComment(input: $inputComment) {
|
|
297
|
+
commentEdge {
|
|
298
|
+
node {
|
|
299
|
+
id
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
302
303
|
updateIssue(input: $inputIssue) {
|
|
303
304
|
issue {
|
|
304
305
|
id
|
|
305
306
|
}
|
|
306
307
|
}
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
}
|
|
309
|
+
`, {
|
|
309
310
|
inputComment,
|
|
310
311
|
inputIssue,
|
|
311
312
|
});
|
|
312
|
-
|
|
313
|
+
const feedbackMetadata = remult.context.feedbackOptions.transformMetadata?.({
|
|
314
|
+
user: remult.user,
|
|
315
|
+
metadata,
|
|
316
|
+
}) ?? metadata;
|
|
317
|
+
await addMetaData(issueId, feedbackMetadata);
|
|
313
318
|
remult.context.feedbackOptions.saved?.({
|
|
314
319
|
number: issueNumber,
|
|
315
320
|
title,
|
|
316
321
|
body,
|
|
317
|
-
metadata:
|
|
318
|
-
author: JSON.stringify(remult.user?.name),
|
|
319
|
-
page,
|
|
320
|
-
},
|
|
322
|
+
metadata: feedbackMetadata,
|
|
321
323
|
});
|
|
322
324
|
return 'done';
|
|
323
325
|
}
|
|
@@ -337,13 +339,13 @@ export class FeedbackController {
|
|
|
337
339
|
id
|
|
338
340
|
}
|
|
339
341
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
342
|
+
closeIssue(input: $inputClose) {
|
|
343
|
+
issue {
|
|
344
|
+
id
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
`, {
|
|
347
349
|
inputIssue,
|
|
348
350
|
inputClose,
|
|
349
351
|
});
|
|
@@ -354,13 +356,13 @@ export class FeedbackController {
|
|
|
354
356
|
issueId,
|
|
355
357
|
};
|
|
356
358
|
await getGitHub(`mutation ReOpenIssue($input: ReopenIssueInput!) {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
359
|
+
reopenIssue(input: $input) {
|
|
360
|
+
issue {
|
|
361
|
+
id
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
`, {
|
|
364
366
|
input,
|
|
365
367
|
});
|
|
366
368
|
return 'done';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Module } from 'remult/server';
|
|
2
2
|
import type { FeedbackOptions } from '../types';
|
|
3
|
-
export declare const feedback: (o: FeedbackOptions) =>
|
|
3
|
+
export declare const feedback: (o: FeedbackOptions) => Module<unknown>;
|
|
4
4
|
declare module 'remult' {
|
|
5
5
|
interface RemultContext {
|
|
6
6
|
feedbackOptions: FeedbackOptions;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { remult } from 'remult';
|
|
2
|
-
import {
|
|
2
|
+
import { Module } from 'remult/server';
|
|
3
3
|
import { FeedbackController } from '../FeedbackController';
|
|
4
4
|
export const feedback = (o) => {
|
|
5
|
-
return new
|
|
6
|
-
|
|
5
|
+
return new Module({
|
|
6
|
+
key: 'feedback',
|
|
7
7
|
controllers: [FeedbackController],
|
|
8
8
|
initRequest: async (kitEvent, op) => {
|
|
9
9
|
remult.context.feedbackOptions = o;
|
package/esm/feedback/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UserInfo } from 'remult';
|
|
1
2
|
export type FeedbackOptions = {
|
|
2
3
|
GITHUB_API_TOKEN: string;
|
|
3
4
|
repo: {
|
|
@@ -10,6 +11,10 @@ export type FeedbackOptions = {
|
|
|
10
11
|
};
|
|
11
12
|
highlight_label?: string;
|
|
12
13
|
create_label?: string;
|
|
14
|
+
transformMetadata?: (o: {
|
|
15
|
+
user: UserInfo | undefined;
|
|
16
|
+
metadata: Record<string, any>;
|
|
17
|
+
}) => Record<string, any>;
|
|
13
18
|
saved?: (args: {
|
|
14
19
|
number: number;
|
|
15
20
|
title: string;
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
const p = $page.url.pathname + $page.url.search
|
|
47
47
|
if (!issue?.id) {
|
|
48
|
-
const result = await FeedbackController.createIssue(milestoneId, title, content, p)
|
|
48
|
+
const result = await FeedbackController.createIssue(milestoneId, title, content, { page: p })
|
|
49
49
|
issueNumber = result.number
|
|
50
50
|
} else {
|
|
51
51
|
await FeedbackController.addCommentOnIssue(
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
issueNumber!,
|
|
54
54
|
issue.title,
|
|
55
55
|
content,
|
|
56
|
-
p,
|
|
56
|
+
{ page: p },
|
|
57
57
|
issue.labels,
|
|
58
58
|
)
|
|
59
59
|
}
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
|
|
127
127
|
{#if issue?.state === 'CLOSED'}
|
|
128
128
|
<div class="flex justify-end">
|
|
129
|
-
<Button
|
|
129
|
+
<Button onclick={reOpen} class="btn-neutral">Re Ouvrir</Button>
|
|
130
130
|
</div>
|
|
131
131
|
{:else}
|
|
132
132
|
{#if issueNumber === null}
|
|
@@ -138,11 +138,11 @@
|
|
|
138
138
|
></Textarea>
|
|
139
139
|
<div class="flex justify-between">
|
|
140
140
|
{#if issueNumber}
|
|
141
|
-
<Button
|
|
141
|
+
<Button onclick={close} tabindex={-1} class="btn-error">Clore le feedback</Button>
|
|
142
142
|
{:else}
|
|
143
143
|
<div></div>
|
|
144
144
|
{/if}
|
|
145
|
-
<Button
|
|
145
|
+
<Button onclick={send} disabled={disableButton(issueNumber, title, content)}>Envoyer</Button>
|
|
146
146
|
</div>
|
|
147
147
|
{/if}
|
|
148
148
|
{/if}
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
<div>
|
|
43
43
|
<Button
|
|
44
44
|
class={issueState === 'OPEN' ? 'btn-primary' : 'btn-ghost'}
|
|
45
|
-
|
|
45
|
+
onclick={() => update('OPEN')}>En cours</Button
|
|
46
46
|
>
|
|
47
47
|
<Button
|
|
48
48
|
class={issueState === 'CLOSED' ? 'btn-primary' : 'btn-ghost'}
|
|
49
|
-
|
|
49
|
+
onclick={() => update('CLOSED')}>Clos</Button
|
|
50
50
|
>
|
|
51
51
|
</div>
|
|
52
52
|
|
|
53
53
|
<Button
|
|
54
|
-
|
|
54
|
+
onclick={async () => {
|
|
55
55
|
await dialog.show({
|
|
56
56
|
component: DialogIssue,
|
|
57
57
|
classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
{#each issues as issue}
|
|
72
72
|
<Button
|
|
73
|
-
|
|
73
|
+
onclick={async () => {
|
|
74
74
|
await dialog.show({
|
|
75
75
|
component: DialogIssue,
|
|
76
76
|
classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
>
|
|
87
87
|
<div class="flex w-full justify-center justify-items-center text-left">
|
|
88
88
|
<div class="flex-grow">
|
|
89
|
-
<span class="mr-2 inline-block w-8 text-right text-xs
|
|
89
|
+
<span class="mr-2 inline-block w-8 text-right text-xs text-base-content/60 italic"
|
|
90
90
|
>#{issue.number}</span
|
|
91
91
|
>
|
|
92
92
|
{@html issue.titleHTML}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FindOptionsBase, Repository } from 'remult';
|
|
2
|
+
export type BaseItemLight = Partial<BaseItem>;
|
|
2
3
|
export type FF_Icon = {
|
|
3
4
|
data?: string | string[];
|
|
4
5
|
size?: string | number;
|
|
@@ -7,7 +8,7 @@ export type FF_Icon = {
|
|
|
7
8
|
caption?: string;
|
|
8
9
|
};
|
|
9
10
|
export type BaseItem = BaseEnumOptions & {
|
|
10
|
-
id: string;
|
|
11
|
+
id: string | null;
|
|
11
12
|
captionSub?: string | (string | undefined)[];
|
|
12
13
|
href?: string;
|
|
13
14
|
repo?: Repository<any>;
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import { Entity } from 'remult';
|
|
2
2
|
import { withChangeLog } from '../changeLog';
|
|
3
|
-
const toAllow = (permission) => {
|
|
4
|
-
if (permission) {
|
|
5
|
-
if (Array.isArray(permission)) {
|
|
6
|
-
return permission.map((p) => p.id);
|
|
7
|
-
}
|
|
8
|
-
return permission.id;
|
|
9
|
-
}
|
|
10
|
-
return undefined;
|
|
11
|
-
};
|
|
12
3
|
export function FF_Entity(key, options) {
|
|
13
|
-
return Entity(key, withChangeLog({
|
|
14
|
-
...options,
|
|
15
|
-
allowApiCrud: options?.allowApiCrud ?? toAllow(options?.permissionApiCrud),
|
|
16
|
-
allowApiDelete: options?.allowApiDelete ?? toAllow(options?.permissionApiDelete),
|
|
17
|
-
allowApiInsert: options?.allowApiInsert ?? toAllow(options?.permissionApiInsert),
|
|
18
|
-
allowApiRead: options?.allowApiRead ?? toAllow(options?.permissionApiRead),
|
|
19
|
-
allowApiUpdate: options?.allowApiUpdate ?? toAllow(options?.permissionApiUpdate),
|
|
20
|
-
}));
|
|
4
|
+
return Entity(key, withChangeLog({ ...options }));
|
|
21
5
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { type ClassType, type FieldOptions
|
|
1
|
+
import { type ClassType, type FieldOptions } from 'remult';
|
|
2
2
|
import type { BaseEnum } from './BaseEnum';
|
|
3
3
|
export declare class FF_Fields {
|
|
4
|
-
static string<entityType = unknown, valueType = string>(o?: StringFieldOptions<entityType, valueType>): import("remult").ClassFieldDecorator<entityType, valueType | undefined>;
|
|
5
4
|
static currency<entityType = unknown>(o?: FieldOptions<entityType, number>): import("remult").ClassFieldDecorator<entityType, number | undefined>;
|
|
6
|
-
static dateOnly<entityType = any>(o?: FieldOptions<entityType, Date>): import("remult").ClassFieldDecorator<entityType, Date | undefined>;
|
|
7
5
|
static arrayEnum<enumType = any, entityType = any>(enumClass: enumType, o?: FieldOptions<entityType, any[]>): import("remult").ClassFieldDecorator<entityType, any[] | undefined>;
|
|
8
6
|
static arrayEnumToGql<enumType = any, entityType = any>(enumClass: enumType, o?: FieldOptions<entityType, any[]>): import("remult").ClassFieldDecorator<entityType, any[] | undefined>;
|
|
9
7
|
static arrayValueList<enumType = any, entityType = any>(enumClass: ClassType<BaseEnum<any>>, o?: FieldOptions<entityType, any[]>): import("remult").ClassFieldDecorator<entityType, any[] | undefined>;
|
|
8
|
+
static vector32<entityType = unknown>(...options: (FieldOptions<entityType, number[]> & {
|
|
9
|
+
dimensions?: number;
|
|
10
|
+
})[]): import("remult").ClassFieldDecorator<entityType, number[] | undefined>;
|
|
10
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fields, Validators
|
|
1
|
+
import { Fields, Validators } from 'remult';
|
|
2
2
|
import { displayCurrency } from '../formats';
|
|
3
3
|
import { getEnums } from './helper';
|
|
4
4
|
// Translate default messages
|
|
@@ -6,52 +6,7 @@ import { getEnums } from './helper';
|
|
|
6
6
|
// It look like I have 2 remult loaded... But even trying to remove one, I still have the issue
|
|
7
7
|
Validators.unique.defaultMessage = 'Existe déjà!';
|
|
8
8
|
Validators.required.defaultMessage = 'Obligatoire!';
|
|
9
|
-
// export function addValidators(
|
|
10
|
-
// validators: FieldOptions['validate'],
|
|
11
|
-
// newValidator: FieldOptions['validate'],
|
|
12
|
-
// atStart = false,
|
|
13
|
-
// ) {
|
|
14
|
-
// if (!newValidator) return validators
|
|
15
|
-
// const newValidators = Array.isArray(newValidator) ? newValidator : [newValidator]
|
|
16
|
-
// const validatorsArray = Array.isArray(validators) ? validators : validators ? [validators] : []
|
|
17
|
-
// return atStart ? [...newValidators, ...validatorsArray] : [...validatorsArray, ...newValidators]
|
|
18
|
-
// }
|
|
19
|
-
// REMULT P2: A/ Add in the doc that allowNull is false by default
|
|
20
|
-
// B/ Would be great to have a Validators.required automatically when allowNull is not true.
|
|
21
|
-
// C/ WARNING Validators.required is also checking for empty string
|
|
22
|
-
const validate_update_when_not_allow_null = (o) => {
|
|
23
|
-
const validate = [];
|
|
24
|
-
if (o.includeInApi !== false &&
|
|
25
|
-
o.serverExpression === undefined &&
|
|
26
|
-
o.sqlExpression === undefined &&
|
|
27
|
-
(o.allowNull === undefined || o.allowNull === false) &&
|
|
28
|
-
// if require: false is explicitly set, then we don't need to add required validator
|
|
29
|
-
o.required !== false) {
|
|
30
|
-
// addValidators(o.validate, [Validators.required], true)
|
|
31
|
-
validate.push(Validators.required);
|
|
32
|
-
}
|
|
33
|
-
// let's add original validate if any
|
|
34
|
-
if (o.validate) {
|
|
35
|
-
if (Array.isArray(o.validate)) {
|
|
36
|
-
validate.push(...o.validate);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
validate.push(o.validate);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return validate;
|
|
43
|
-
};
|
|
44
9
|
export class FF_Fields {
|
|
45
|
-
static string(o) {
|
|
46
|
-
if (o === undefined) {
|
|
47
|
-
o = {};
|
|
48
|
-
}
|
|
49
|
-
// let's return the field
|
|
50
|
-
return Fields.string({
|
|
51
|
-
...o,
|
|
52
|
-
validate: validate_update_when_not_allow_null(o),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
10
|
static currency(o) {
|
|
56
11
|
// let's return the field
|
|
57
12
|
return Fields.number({
|
|
@@ -80,15 +35,6 @@ export class FF_Fields {
|
|
|
80
35
|
},
|
|
81
36
|
});
|
|
82
37
|
}
|
|
83
|
-
static dateOnly(o) {
|
|
84
|
-
// empty if there is nothing coming here.
|
|
85
|
-
if (o === undefined) {
|
|
86
|
-
o = {};
|
|
87
|
-
}
|
|
88
|
-
o.inputType = 'dateOnly';
|
|
89
|
-
// let's return the field
|
|
90
|
-
return Fields.dateOnly({ ...o, validate: validate_update_when_not_allow_null(o) });
|
|
91
|
-
}
|
|
92
38
|
static arrayEnum(enumClass, o) {
|
|
93
39
|
return Fields.json(() => Array, {
|
|
94
40
|
...o,
|
|
@@ -182,4 +128,17 @@ export class FF_Fields {
|
|
|
182
128
|
},
|
|
183
129
|
});
|
|
184
130
|
}
|
|
131
|
+
static vector32(...options) {
|
|
132
|
+
const dimensions = options[0].dimensions ?? 1024;
|
|
133
|
+
return Fields.object({
|
|
134
|
+
valueConverter: {
|
|
135
|
+
fieldTypeInDb: `F32_BLOB(${dimensions})`,
|
|
136
|
+
toDb: (val) => JSON.stringify(val),
|
|
137
|
+
// TODO: remove ts-ignore when remult@3.3.0-next.1 is released (that has toDbSql)
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
toDbSql: (val) => `vector32(${val})`,
|
|
140
|
+
fromDb: (val) => Array.from(new Float32Array(val)),
|
|
141
|
+
},
|
|
142
|
+
}, ...options);
|
|
143
|
+
}
|
|
185
144
|
}
|