firstly 0.10.4 → 0.10.6
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 +16 -0
- package/esm/carbone/CarboneController.js +117 -103
- package/esm/feedback/FeedbackController.js +310 -289
- package/esm/mail/ui/LastMails.svelte +2 -1
- package/esm/sqlAdmin/SqlAdminController.d.ts +1 -0
- package/esm/sqlAdmin/SqlAdminController.js +33 -25
- package/esm/sqlAdmin/SqlDriftController.js +25 -13
- package/esm/sqlAdmin/server/drift/catalog.d.ts +4 -0
- package/esm/sqlAdmin/server/drift/catalog.js +25 -0
- package/esm/sqlAdmin/server/drift/createIndex.d.ts +2 -0
- package/esm/sqlAdmin/server/drift/createIndex.js +2 -1
- package/esm/sqlAdmin/server/drift/ident.d.ts +16 -0
- package/esm/sqlAdmin/server/drift/ident.js +22 -0
- package/esm/sqlAdmin/server/drift/nullable.js +11 -12
- package/esm/sqlAdmin/server/drift/orphanColumns.js +9 -8
- package/esm/sqlAdmin/server/drift/planPkSync.d.ts +4 -3
- package/esm/sqlAdmin/server/drift/planPkSync.js +8 -12
- package/esm/sqlAdmin/server/drift/primaryKeys.js +13 -10
- package/esm/sqlAdmin/server/drift/relationIndexes.d.ts +3 -3
- package/esm/sqlAdmin/server/drift/relationIndexes.js +23 -12
- package/esm/sqlAdmin/ui/SqlDrift.svelte +25 -19
- package/esm/sqlAdmin/ui/SqlTokens.svelte +5 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# firstly
|
|
2
2
|
|
|
3
|
+
## 0.10.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#383](https://github.com/jycouet/firstly/pull/383) [`3d0353b`](https://github.com/jycouet/firstly/commit/3d0353b176afd765883c50f6bc10c352b752df28) Thanks [@jycouet](https://github.com/jycouet)! - sqlAdmin drift: entities in a non-`public` schema (e.g. `ff_auth.ba-accounts`) are checked in their own schema, a table not created yet is reported as `missing` instead of failing the whole apply, and errors show the real message and failing statement (no more `[object Object]`).
|
|
8
|
+
|
|
9
|
+
## 0.10.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#380](https://github.com/jycouet/firstly/pull/380) [`84d2acf`](https://github.com/jycouet/firstly/commit/84d2acfb2898a83e9334442b72e7ff130b2f3991) Thanks [@renovate](https://github.com/apps/renovate)! - mail: nodemailer 10 (requires Node 20+; remote content fetched over HTTPS now validates TLS certificates).
|
|
14
|
+
|
|
15
|
+
- [#377](https://github.com/jycouet/firstly/pull/377) [`d200b62`](https://github.com/jycouet/firstly/commit/d200b62a027eda358ea4ead9be73bce5974b0e8d) Thanks [@jycouet](https://github.com/jycouet)! - sqlAdmin: server-only code is wrapped in `if (import.meta.env.SSR) { ... }`, so Vite 7 (Rollup) client builds no longer fail on `node:crypto` and the server helpers stay out of the client bundle.
|
|
16
|
+
|
|
17
|
+
- [#378](https://github.com/jycouet/firstly/pull/378) [`525ce42`](https://github.com/jycouet/firstly/commit/525ce424ba0affaec73e08e0c8cb906d20d21859) Thanks [@jycouet](https://github.com/jycouet)! - feedback & carbone: BackendMethod bodies are wrapped in `if (import.meta.env.SSR) { ... }`, so their server code (GitHub GraphQL queries, Carbone calls) no longer ships in the client bundle.
|
|
18
|
+
|
|
3
19
|
## 0.10.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -11,123 +11,137 @@ import { Roles_Carbon } from './Roles_Carbon';
|
|
|
11
11
|
export class CarboneController {
|
|
12
12
|
static server;
|
|
13
13
|
static async uploadTemplate(config) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const j = await res.json();
|
|
25
|
-
const templateId = j.data.templateId;
|
|
26
|
-
const newTemplate = await repo(CarboneTemplate).upsert({
|
|
27
|
-
where: { id: templateId, name, extension: j.data.templateExtension },
|
|
28
|
-
});
|
|
29
|
-
await repo(CarboneLog).insert({
|
|
30
|
-
templateId,
|
|
31
|
-
action: CarbonLogAction.template_upload,
|
|
32
|
-
});
|
|
33
|
-
// Delete all other templates with the same name
|
|
34
|
-
if (deleteOlderTemplatesWithSameName) {
|
|
35
|
-
const older = await repo(CarboneTemplate).find({
|
|
36
|
-
where: { name: newTemplate.name, id: { $ne: newTemplate.id } },
|
|
14
|
+
if (import.meta.env.SSR) {
|
|
15
|
+
const { name, base64, nameForCarbone, deleteOlderTemplatesWithSameName } = config;
|
|
16
|
+
// 30 max 1 13
|
|
17
|
+
const nameToUse = strTrimMid(nameForCarbone ?? name, { len: 16, midStr: '-' }) + '_' + dateCompact();
|
|
18
|
+
const res = await CarboneController.server.fetch({
|
|
19
|
+
api: `/template`,
|
|
20
|
+
body: JSON.stringify({ name, template: base64 }),
|
|
21
|
+
headers: {
|
|
22
|
+
'carbone-template-name': nameToUse,
|
|
23
|
+
},
|
|
37
24
|
});
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
const j = await res.json();
|
|
26
|
+
const templateId = j.data.templateId;
|
|
27
|
+
const newTemplate = await repo(CarboneTemplate).upsert({
|
|
28
|
+
where: { id: templateId, name, extension: j.data.templateExtension },
|
|
29
|
+
});
|
|
30
|
+
await repo(CarboneLog).insert({
|
|
31
|
+
templateId,
|
|
32
|
+
action: CarbonLogAction.template_upload,
|
|
33
|
+
});
|
|
34
|
+
// Delete all other templates with the same name
|
|
35
|
+
if (deleteOlderTemplatesWithSameName) {
|
|
36
|
+
const older = await repo(CarboneTemplate).find({
|
|
37
|
+
where: { name: newTemplate.name, id: { $ne: newTemplate.id } },
|
|
38
|
+
});
|
|
39
|
+
for (const t of older) {
|
|
40
|
+
await CarboneController.deleteTemplate({ templateId: t.id });
|
|
41
|
+
}
|
|
40
42
|
}
|
|
43
|
+
return;
|
|
41
44
|
}
|
|
45
|
+
throw new Error('carbone.uploadTemplate: server-only');
|
|
42
46
|
}
|
|
43
47
|
static async downloadTemplate(config) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (import.meta.env.SSR) {
|
|
49
|
+
const { templateName, filename } = config;
|
|
50
|
+
let { templateId, templateExtension } = config;
|
|
51
|
+
if (templateName) {
|
|
52
|
+
const t = await repo(CarboneTemplate).findFirst({ name: templateName });
|
|
53
|
+
if (!t) {
|
|
54
|
+
throw new Error('Template not found');
|
|
55
|
+
}
|
|
56
|
+
templateId = t.id;
|
|
57
|
+
templateExtension = t.extension;
|
|
50
58
|
}
|
|
51
|
-
|
|
52
|
-
|
|
59
|
+
const response = await CarboneController.server.fetch({
|
|
60
|
+
api: `/template/${templateId}`,
|
|
61
|
+
method: 'GET',
|
|
62
|
+
});
|
|
63
|
+
await repo(CarboneLog).insert({
|
|
64
|
+
templateId,
|
|
65
|
+
action: CarbonLogAction.template_download,
|
|
66
|
+
});
|
|
67
|
+
const contentType = response.headers.get('content-type');
|
|
68
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
69
|
+
const base64 = Buffer.from(arrayBuffer).toString('base64');
|
|
70
|
+
const filenameToUse = filename ?? templateName ?? `template_${templateId}`;
|
|
71
|
+
return {
|
|
72
|
+
data: base64,
|
|
73
|
+
contentType: contentType || 'application/octet-stream',
|
|
74
|
+
filename: `${filenameToUse}.${templateExtension}`,
|
|
75
|
+
};
|
|
53
76
|
}
|
|
54
|
-
|
|
55
|
-
api: `/template/${templateId}`,
|
|
56
|
-
method: 'GET',
|
|
57
|
-
});
|
|
58
|
-
await repo(CarboneLog).insert({
|
|
59
|
-
templateId,
|
|
60
|
-
action: CarbonLogAction.template_download,
|
|
61
|
-
});
|
|
62
|
-
const contentType = response.headers.get('content-type');
|
|
63
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
64
|
-
const base64 = Buffer.from(arrayBuffer).toString('base64');
|
|
65
|
-
const filenameToUse = filename ?? templateName ?? `template_${templateId}`;
|
|
66
|
-
return {
|
|
67
|
-
data: base64,
|
|
68
|
-
contentType: contentType || 'application/octet-stream',
|
|
69
|
-
filename: `${filenameToUse}.${templateExtension}`,
|
|
70
|
-
};
|
|
77
|
+
throw new Error('carbone.downloadTemplate: server-only');
|
|
71
78
|
}
|
|
72
79
|
static async deleteTemplate(config) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
if (import.meta.env.SSR) {
|
|
81
|
+
const { templateId } = config;
|
|
82
|
+
await CarboneController.server.fetch({
|
|
83
|
+
api: `/template/${templateId}`,
|
|
84
|
+
method: 'DELETE',
|
|
85
|
+
});
|
|
86
|
+
await repo(CarboneLog).insert({
|
|
87
|
+
templateId,
|
|
88
|
+
action: CarbonLogAction.template_delete,
|
|
89
|
+
});
|
|
90
|
+
await repo(CarboneTemplate).delete({ id: templateId });
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
throw new Error('carbone.deleteTemplate: server-only');
|
|
83
94
|
}
|
|
84
95
|
static async render(config) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
else if (templateName) {
|
|
93
|
-
mode = 'templateName';
|
|
94
|
-
const t = await repo(CarboneTemplate).findFirst({ name: templateName });
|
|
95
|
-
if (!t) {
|
|
96
|
-
throw new Error('Template not found');
|
|
96
|
+
if (import.meta.env.SSR) {
|
|
97
|
+
const { templateName, templateBase64, data, filename } = config;
|
|
98
|
+
let { templateId, convertTo } = config;
|
|
99
|
+
// eslint-disable-next-line
|
|
100
|
+
let mode = '';
|
|
101
|
+
if (templateBase64) {
|
|
102
|
+
mode = 'templateBase64';
|
|
97
103
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
else if (templateName) {
|
|
105
|
+
mode = 'templateName';
|
|
106
|
+
const t = await repo(CarboneTemplate).findFirst({ name: templateName });
|
|
107
|
+
if (!t) {
|
|
108
|
+
throw new Error('Template not found');
|
|
109
|
+
}
|
|
110
|
+
templateId = t.id;
|
|
111
|
+
if (!convertTo) {
|
|
112
|
+
convertTo = t.extension;
|
|
113
|
+
}
|
|
101
114
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
else {
|
|
116
|
+
mode = 'templateId';
|
|
117
|
+
}
|
|
118
|
+
if (CarboneController.server.test) {
|
|
119
|
+
convertTo = 'pdf';
|
|
120
|
+
}
|
|
121
|
+
const response = templateBase64
|
|
122
|
+
? await CarboneController.server.fetch({
|
|
123
|
+
api: `/render/template?download=true`,
|
|
124
|
+
body: JSON.stringify({ data, template: templateBase64, convertTo: convertTo ?? 'pdf' }),
|
|
125
|
+
})
|
|
126
|
+
: await CarboneController.server.fetch({
|
|
127
|
+
api: `/render/${templateId}?download=true`,
|
|
128
|
+
body: JSON.stringify({ data, convertTo: convertTo ?? 'pdf' }),
|
|
129
|
+
});
|
|
130
|
+
await repo(CarboneLog).insert({
|
|
131
|
+
templateId: mode === 'templateBase64' ? 'templateBase64' : templateId,
|
|
132
|
+
action: CarbonLogAction.render,
|
|
117
133
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
filename: `${filenameToUse}.${convertTo}`,
|
|
130
|
-
};
|
|
134
|
+
const contentType = response.headers.get('content-type');
|
|
135
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
136
|
+
const base64 = Buffer.from(arrayBuffer).toString('base64');
|
|
137
|
+
const filenameToUse = filename ?? `template_${templateId}`;
|
|
138
|
+
return {
|
|
139
|
+
data: base64,
|
|
140
|
+
contentType: contentType || 'application/octet-stream',
|
|
141
|
+
filename: `${filenameToUse}.${convertTo}`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
throw new Error('carbone.render: server-only');
|
|
131
145
|
}
|
|
132
146
|
}
|
|
133
147
|
__decorate([
|