@managemint-solutions/sdk 0.8.0 → 0.9.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/README.md +73 -1
- package/dist/additional-details/index.d.ts +3 -1
- package/dist/additional-details/index.js +15 -28
- package/dist/additional-details/index.js.map +1 -1
- package/dist/audit/dto.d.ts +13 -0
- package/dist/audit/dto.js +90 -0
- package/dist/audit/dto.js.map +1 -0
- package/dist/audit/index.d.ts +89 -0
- package/dist/audit/index.js +285 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +11 -7
- package/dist/client.js.map +1 -1
- package/dist/clients/index.d.ts +3 -1
- package/dist/clients/index.js +25 -62
- package/dist/clients/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/nest/index.d.ts +11 -0
- package/dist/nest/index.js +12 -1
- package/dist/nest/index.js.map +1 -1
- package/dist/notes/index.d.ts +3 -1
- package/dist/notes/index.js +16 -27
- package/dist/notes/index.js.map +1 -1
- package/dist/projects/index.d.ts +3 -1
- package/dist/projects/index.js +25 -62
- package/dist/projects/index.js.map +1 -1
- package/dist/statuses/index.d.ts +3 -1
- package/dist/statuses/index.js +17 -28
- package/dist/statuses/index.js.map +1 -1
- package/dist/supporting-files/index.d.ts +3 -1
- package/dist/supporting-files/index.js +14 -20
- package/dist/supporting-files/index.js.map +1 -1
- package/dist/tasks/index.d.ts +3 -1
- package/dist/tasks/index.js +21 -50
- package/dist/tasks/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.auditedTable = exports.AuditResource = exports.snapshotChanges = exports.diffChanges = exports.AUDIT_EXCLUDED_COLUMNS = void 0;
|
|
18
|
+
const enum_1 = require("@managemint-solutions/entities/audit-trail/enum");
|
|
19
|
+
const errors_1 = require("../errors");
|
|
20
|
+
__exportStar(require("./dto"), exports);
|
|
21
|
+
/**
|
|
22
|
+
* Bookkeeping columns a diff never reports: identity, tenancy and the who/when stamps of the
|
|
23
|
+
* transition itself (the action already says what happened), plus the `entity_type`/`entity_id`
|
|
24
|
+
* pair, which becomes `related_entity_*` on the audit row instead.
|
|
25
|
+
*/
|
|
26
|
+
exports.AUDIT_EXCLUDED_COLUMNS = new Set([
|
|
27
|
+
'id',
|
|
28
|
+
'mms_id',
|
|
29
|
+
'organization_id',
|
|
30
|
+
'created_at',
|
|
31
|
+
'created_by',
|
|
32
|
+
'user_id',
|
|
33
|
+
'updated_at',
|
|
34
|
+
'last_updated_by',
|
|
35
|
+
'archived_at',
|
|
36
|
+
'archived_by',
|
|
37
|
+
'unarchived_at',
|
|
38
|
+
'unarchived_by',
|
|
39
|
+
'deleted_at',
|
|
40
|
+
'deleted_by',
|
|
41
|
+
'restored_at',
|
|
42
|
+
'restored_by',
|
|
43
|
+
'entity_type',
|
|
44
|
+
'entity_id',
|
|
45
|
+
]);
|
|
46
|
+
/** `undefined` and `null` are the same absent value as far as a row diff is concerned. */
|
|
47
|
+
const normalize = (value) => value ?? null;
|
|
48
|
+
/**
|
|
49
|
+
* The fields that differ between two flat rows, as `{ field: { old, new } }`. Values stay real
|
|
50
|
+
* JSON (booleans stay booleans, jsonb stays an object) and are compared by serialized value, so
|
|
51
|
+
* arrays and objects are equal when their contents are.
|
|
52
|
+
*/
|
|
53
|
+
const diffChanges = (before, after) => {
|
|
54
|
+
const changes = {};
|
|
55
|
+
for (const key of new Set([...Object.keys(before), ...Object.keys(after)])) {
|
|
56
|
+
if (exports.AUDIT_EXCLUDED_COLUMNS.has(key))
|
|
57
|
+
continue;
|
|
58
|
+
const oldValue = normalize(before[key]);
|
|
59
|
+
const newValue = normalize(after[key]);
|
|
60
|
+
if (JSON.stringify(oldValue) === JSON.stringify(newValue))
|
|
61
|
+
continue;
|
|
62
|
+
changes[key] = { old: oldValue, new: newValue };
|
|
63
|
+
}
|
|
64
|
+
return changes;
|
|
65
|
+
};
|
|
66
|
+
exports.diffChanges = diffChanges;
|
|
67
|
+
/**
|
|
68
|
+
* A whole row as a change set — `'new'` for an insert, `'old'` for a hard delete — so the trail
|
|
69
|
+
* stays self-contained once the row is gone. Columns that hold nothing are left out.
|
|
70
|
+
*/
|
|
71
|
+
const snapshotChanges = (row, side) => {
|
|
72
|
+
const changes = {};
|
|
73
|
+
for (const [key, value] of Object.entries(row)) {
|
|
74
|
+
if (exports.AUDIT_EXCLUDED_COLUMNS.has(key) || value === null || value === undefined)
|
|
75
|
+
continue;
|
|
76
|
+
changes[key] = side === 'new' ? { old: null, new: value } : { old: value, new: null };
|
|
77
|
+
}
|
|
78
|
+
return changes;
|
|
79
|
+
};
|
|
80
|
+
exports.snapshotChanges = snapshotChanges;
|
|
81
|
+
const AUDIT_TRAIL_SELECT = `
|
|
82
|
+
mms_id,
|
|
83
|
+
created_at,
|
|
84
|
+
action,
|
|
85
|
+
entity_type,
|
|
86
|
+
entity_id,
|
|
87
|
+
created_by:user_profiles!created_by (*),
|
|
88
|
+
related_entity_type,
|
|
89
|
+
related_entity_id,
|
|
90
|
+
changes
|
|
91
|
+
`;
|
|
92
|
+
/**
|
|
93
|
+
* The `audit_logs` table. Reads are the audit trail endpoint; writes go through `record`, which
|
|
94
|
+
* every audited write calls for itself — no feature ever writes an audit line by hand.
|
|
95
|
+
*/
|
|
96
|
+
class AuditResource {
|
|
97
|
+
supabase;
|
|
98
|
+
actor;
|
|
99
|
+
onError;
|
|
100
|
+
constructor(supabase, actor, onError) {
|
|
101
|
+
this.supabase = supabase;
|
|
102
|
+
this.actor = actor;
|
|
103
|
+
this.onError = onError;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Writes the audit row(s) — one insert, however many entries. **Never throws**: a logging
|
|
107
|
+
* problem must not fail the business write, so a failure goes to `onAuditError`
|
|
108
|
+
* (default `console.error`) instead.
|
|
109
|
+
*/
|
|
110
|
+
async record(entry) {
|
|
111
|
+
const entries = Array.isArray(entry) ? entry : [entry];
|
|
112
|
+
if (entries.length === 0)
|
|
113
|
+
return;
|
|
114
|
+
try {
|
|
115
|
+
const { error } = await this.supabase.from('audit_logs').insert(entries.map((item) => ({
|
|
116
|
+
created_by: this.actor.mms_id,
|
|
117
|
+
organization_id: this.actor.organization_id,
|
|
118
|
+
action: item.action,
|
|
119
|
+
entity_type: item.entityType,
|
|
120
|
+
entity_id: item.entityId,
|
|
121
|
+
related_entity_type: item.relatedEntityType ?? null,
|
|
122
|
+
related_entity_id: item.relatedEntityId ?? null,
|
|
123
|
+
changes: item.changes,
|
|
124
|
+
})));
|
|
125
|
+
if (error)
|
|
126
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
const handle = this.onError ?? ((thrown, failed) => console.error(thrown, failed));
|
|
130
|
+
handle(error, entries);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async list(query) {
|
|
134
|
+
const page = query.page;
|
|
135
|
+
const pageSize = query.page_size;
|
|
136
|
+
const offset = (page - 1) * pageSize;
|
|
137
|
+
// `order`/`range` return `this`, so the builder stays a filter builder and the conditional
|
|
138
|
+
// filters below can be reassigned onto it without a cast.
|
|
139
|
+
let auditTrailQuery = this.supabase
|
|
140
|
+
.from('audit_logs')
|
|
141
|
+
.select(AUDIT_TRAIL_SELECT, { count: 'estimated' })
|
|
142
|
+
.eq('organization_id', this.actor.organization_id)
|
|
143
|
+
.order('created_at', { ascending: false })
|
|
144
|
+
.range(offset, offset + pageSize - 1);
|
|
145
|
+
if (query.created_after) {
|
|
146
|
+
auditTrailQuery = auditTrailQuery.gte('created_at', query.created_after);
|
|
147
|
+
}
|
|
148
|
+
if (query.created_before) {
|
|
149
|
+
auditTrailQuery = auditTrailQuery.lte('created_at', query.created_before);
|
|
150
|
+
}
|
|
151
|
+
if (query.created_by) {
|
|
152
|
+
auditTrailQuery = auditTrailQuery.eq('created_by', query.created_by);
|
|
153
|
+
}
|
|
154
|
+
if (query.action) {
|
|
155
|
+
auditTrailQuery = auditTrailQuery.eq('action', query.action);
|
|
156
|
+
}
|
|
157
|
+
if (query.entity_type) {
|
|
158
|
+
auditTrailQuery = auditTrailQuery.eq('entity_type', query.entity_type);
|
|
159
|
+
}
|
|
160
|
+
if (query.entity_id) {
|
|
161
|
+
auditTrailQuery = auditTrailQuery.eq('entity_id', query.entity_id);
|
|
162
|
+
}
|
|
163
|
+
const { data, error, count } = await auditTrailQuery;
|
|
164
|
+
if (error)
|
|
165
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
166
|
+
const totalEstimated = count ?? 0;
|
|
167
|
+
const totalPages = totalEstimated > 0 ? Math.ceil(totalEstimated / pageSize) : 0;
|
|
168
|
+
return {
|
|
169
|
+
results: (data ?? []),
|
|
170
|
+
page,
|
|
171
|
+
per_page: pageSize,
|
|
172
|
+
count: totalEstimated,
|
|
173
|
+
total_pages: totalPages,
|
|
174
|
+
has_next_page: page < totalPages,
|
|
175
|
+
has_previous_page: page > 1,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.AuditResource = AuditResource;
|
|
180
|
+
/**
|
|
181
|
+
* The audited write helper every resource writes through: it does the pre-read, the write, the
|
|
182
|
+
* diff and the `audit_logs` insert itself, so no feature carries audit code. The write fails
|
|
183
|
+
* loudly (`SupabaseClientError`); only the audit insert is swallowed.
|
|
184
|
+
*/
|
|
185
|
+
const auditedTable = (supabase, actor, audit, options) => {
|
|
186
|
+
const scoped = options.scopeByOrganization !== false;
|
|
187
|
+
// Tables that hang off another entity (notes, additional details, supporting files) carry the
|
|
188
|
+
// owner in `entity_type`/`entity_id`; the audit row records it as the related entity.
|
|
189
|
+
const relatedOf = (row) => ({
|
|
190
|
+
relatedEntityType: row.entity_type ?? null,
|
|
191
|
+
relatedEntityId: row.entity_id ?? null,
|
|
192
|
+
});
|
|
193
|
+
const read = async (id) => {
|
|
194
|
+
// `eq` returns `this`, so the org filter can be reassigned onto the builder without a cast.
|
|
195
|
+
let query = supabase.from(options.table).select('*').eq('mms_id', id);
|
|
196
|
+
if (scoped)
|
|
197
|
+
query = query.eq('organization_id', actor.organization_id);
|
|
198
|
+
const { data, error } = await query.single();
|
|
199
|
+
if (error)
|
|
200
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
201
|
+
return data;
|
|
202
|
+
};
|
|
203
|
+
const write = async (id, action, payload) => {
|
|
204
|
+
const before = await read(id);
|
|
205
|
+
let query = supabase
|
|
206
|
+
.from(options.table)
|
|
207
|
+
.update(typeof payload === 'function' ? payload(before) : payload)
|
|
208
|
+
.eq('mms_id', id);
|
|
209
|
+
if (scoped)
|
|
210
|
+
query = query.eq('organization_id', actor.organization_id);
|
|
211
|
+
const { data, error } = await query.select('*').single();
|
|
212
|
+
if (error)
|
|
213
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
214
|
+
const after = data;
|
|
215
|
+
await audit.record({
|
|
216
|
+
action,
|
|
217
|
+
entityType: options.entityType,
|
|
218
|
+
entityId: id,
|
|
219
|
+
changes: (0, exports.diffChanges)(before, after),
|
|
220
|
+
...relatedOf(before),
|
|
221
|
+
});
|
|
222
|
+
return after;
|
|
223
|
+
};
|
|
224
|
+
return {
|
|
225
|
+
async insert(payload) {
|
|
226
|
+
const { data, error } = await supabase
|
|
227
|
+
.from(options.table)
|
|
228
|
+
.insert(payload)
|
|
229
|
+
.select('*')
|
|
230
|
+
.single();
|
|
231
|
+
if (error)
|
|
232
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
233
|
+
const row = data;
|
|
234
|
+
await audit.record({
|
|
235
|
+
action: enum_1.AuditTrailAction.INSERT,
|
|
236
|
+
entityType: options.entityType,
|
|
237
|
+
entityId: row.mms_id,
|
|
238
|
+
changes: (0, exports.snapshotChanges)(row, 'new'),
|
|
239
|
+
...relatedOf(row),
|
|
240
|
+
});
|
|
241
|
+
return row;
|
|
242
|
+
},
|
|
243
|
+
async insertMany(payloads) {
|
|
244
|
+
if (payloads.length === 0)
|
|
245
|
+
return [];
|
|
246
|
+
const { data, error } = await supabase.from(options.table).insert(payloads).select('*');
|
|
247
|
+
if (error)
|
|
248
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
249
|
+
const rows = (data ?? []);
|
|
250
|
+
await audit.record(rows.map((row) => ({
|
|
251
|
+
action: enum_1.AuditTrailAction.INSERT,
|
|
252
|
+
entityType: options.entityType,
|
|
253
|
+
entityId: row.mms_id,
|
|
254
|
+
changes: (0, exports.snapshotChanges)(row, 'new'),
|
|
255
|
+
...relatedOf(row),
|
|
256
|
+
})));
|
|
257
|
+
return rows;
|
|
258
|
+
},
|
|
259
|
+
update(id, payload) {
|
|
260
|
+
return write(id, enum_1.AuditTrailAction.UPDATE, payload);
|
|
261
|
+
},
|
|
262
|
+
transition(id, action, payload) {
|
|
263
|
+
return write(id, action, payload);
|
|
264
|
+
},
|
|
265
|
+
async remove(id) {
|
|
266
|
+
const before = await read(id);
|
|
267
|
+
let query = supabase.from(options.table).delete().eq('mms_id', id);
|
|
268
|
+
if (scoped)
|
|
269
|
+
query = query.eq('organization_id', actor.organization_id);
|
|
270
|
+
const { error } = await query;
|
|
271
|
+
if (error)
|
|
272
|
+
throw (0, errors_1.mapPostgrestError)(error);
|
|
273
|
+
await audit.record({
|
|
274
|
+
action: enum_1.AuditTrailAction.DELETE,
|
|
275
|
+
entityType: options.entityType,
|
|
276
|
+
entityId: id,
|
|
277
|
+
changes: (0, exports.snapshotChanges)(before, 'old'),
|
|
278
|
+
...relatedOf(before),
|
|
279
|
+
});
|
|
280
|
+
return before;
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
exports.auditedTable = auditedTable;
|
|
285
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/audit/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,0EAGyD;AAEzD,sCAA8C;AAG9C,wCAAsB;AAyBtB;;;;GAIG;AACU,QAAA,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IACjE,IAAI;IACJ,QAAQ;IACR,iBAAiB;IACjB,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,YAAY;IACZ,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,eAAe;IACf,eAAe;IACf,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,aAAa;IACb,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH,0FAA0F;AAC1F,MAAM,SAAS,GAAG,CAAC,KAAc,EAAW,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC;AAE7D;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,MAAgB,EAAE,KAAe,EAAgB,EAAE;IAC7E,MAAM,OAAO,GAAiB,EAAE,CAAC;IAEjC,KAAK,MAAM,GAAG,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,C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CAAC;YAE1C,MAAM,KAAK,CAAC,MAAM,CAAC;gBACjB,MAAM,EAAE,uBAAgB,CAAC,MAAM;gBAC/B,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE,IAAA,uBAAe,EAAC,MAAM,EAAE,KAAK,CAAC;gBACvC,GAAG,SAAS,CAAC,MAAM,CAAC;aACrB,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AA1HW,QAAA,YAAY,gBA0HvB"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type SupabaseClient as SupabaseJsClient } from '@supabase/supabase-js';
|
|
2
2
|
import { type AuthContext } from './auth';
|
|
3
|
+
import { AuditResource, type AuditErrorHandler } from './audit';
|
|
3
4
|
import { AdditionalDetailsResource } from './additional-details';
|
|
4
5
|
import { ClientsResource } from './clients';
|
|
5
6
|
import { NotesResource } from './notes';
|
|
@@ -12,10 +13,13 @@ export type SupabaseClientConfig = {
|
|
|
12
13
|
url: string;
|
|
13
14
|
key: string;
|
|
14
15
|
accessToken: string;
|
|
16
|
+
/** Where a failed audit insert is reported. Defaults to `console.error`. */
|
|
17
|
+
onAuditError?: AuditErrorHandler;
|
|
15
18
|
};
|
|
16
19
|
export declare class SupabaseClient {
|
|
17
20
|
readonly supabase: TypedSupabaseClient;
|
|
18
21
|
readonly auth: AuthContext;
|
|
22
|
+
readonly audit: AuditResource;
|
|
19
23
|
readonly statuses: StatusesResource;
|
|
20
24
|
readonly additionalDetails: AdditionalDetailsResource;
|
|
21
25
|
readonly notes: NotesResource;
|
package/dist/client.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSupabaseClient = exports.SupabaseClient = void 0;
|
|
4
4
|
const supabase_js_1 = require("@supabase/supabase-js");
|
|
5
5
|
const auth_1 = require("./auth");
|
|
6
|
+
const audit_1 = require("./audit");
|
|
6
7
|
const additional_details_1 = require("./additional-details");
|
|
7
8
|
const clients_1 = require("./clients");
|
|
8
9
|
const notes_1 = require("./notes");
|
|
@@ -13,6 +14,7 @@ const tasks_1 = require("./tasks");
|
|
|
13
14
|
class SupabaseClient {
|
|
14
15
|
supabase; // escape hatch for not-yet-migrated queries
|
|
15
16
|
auth;
|
|
17
|
+
audit;
|
|
16
18
|
statuses;
|
|
17
19
|
additionalDetails;
|
|
18
20
|
notes;
|
|
@@ -26,13 +28,15 @@ class SupabaseClient {
|
|
|
26
28
|
global: { headers: { Authorization: `Bearer ${config.accessToken}` } },
|
|
27
29
|
auth: { persistSession: false, autoRefreshToken: false },
|
|
28
30
|
});
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
31
|
+
// Built before the resources: every write they make goes through it.
|
|
32
|
+
this.audit = new audit_1.AuditResource(this.supabase, this.auth, config.onAuditError);
|
|
33
|
+
this.statuses = new statuses_1.StatusesResource(this.supabase, this.auth, this.audit);
|
|
34
|
+
this.additionalDetails = new additional_details_1.AdditionalDetailsResource(this.supabase, this.auth, this.audit);
|
|
35
|
+
this.notes = new notes_1.NotesResource(this.supabase, this.auth, this.audit);
|
|
36
|
+
this.supportingFiles = new supporting_files_1.SupportingFilesResource(this.supabase, this.auth, this.audit);
|
|
37
|
+
this.clients = new clients_1.ClientsResource(this.supabase, this.auth, this.audit);
|
|
38
|
+
this.projects = new projects_1.ProjectsResource(this.supabase, this.auth, this.audit);
|
|
39
|
+
this.tasks = new tasks_1.TasksResource(this.supabase, this.auth, this.audit);
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
exports.SupabaseClient = SupabaseClient;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names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AI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3E,IAAI,CAAC,iBAAiB,GAAG,IAAI,8CAAyB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7F,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACrE,IAAI,CAAC,eAAe,GAAG,IAAI,0CAAuB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACzF,IAAI,CAAC,OAAO,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACzE,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACvE,CAAC;CACF;AA5BD,wCA4BC;AAEM,MAAM,oBAAoB,GAAG,CAAC,MAA4B,EAAkB,EAAE,CACnF,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AADhB,QAAA,oBAAoB,wBACJ"}
|
package/dist/clients/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { ClientEntity, ClientSummary } from '@managemint-solutions/entities/clients';
|
|
2
2
|
import type { MmsList } from '@managemint-solutions/entities/common';
|
|
3
3
|
import type { AuthContext } from '../auth';
|
|
4
|
+
import { type AuditResource } from '../audit';
|
|
4
5
|
import type { TypedSupabaseClient } from '../client';
|
|
5
6
|
import type { CreateClientDto, GetClientsDto, UpdateClientDto } from './dto';
|
|
6
7
|
export * from './dto';
|
|
7
8
|
export declare class ClientsResource {
|
|
8
9
|
private readonly supabase;
|
|
9
10
|
private readonly auth;
|
|
10
|
-
|
|
11
|
+
private readonly table;
|
|
12
|
+
constructor(supabase: TypedSupabaseClient, auth: AuthContext, audit: AuditResource);
|
|
11
13
|
list(query: GetClientsDto): Promise<MmsList<ClientSummary>>;
|
|
12
14
|
getById(clientId: string): Promise<ClientEntity>;
|
|
13
15
|
create(input: CreateClientDto): Promise<ClientEntity>;
|
package/dist/clients/index.js
CHANGED
|
@@ -15,6 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.ClientsResource = void 0;
|
|
18
|
+
const enum_1 = require("@managemint-solutions/entities/audit-trail/enum");
|
|
19
|
+
const audit_1 = require("../audit");
|
|
18
20
|
const errors_1 = require("../errors");
|
|
19
21
|
__exportStar(require("./dto"), exports);
|
|
20
22
|
// The public contract is the shared ClientSummary / ClientEntity from
|
|
@@ -98,9 +100,14 @@ const CLIENT_DETAIL_SELECT = `
|
|
|
98
100
|
class ClientsResource {
|
|
99
101
|
supabase;
|
|
100
102
|
auth;
|
|
101
|
-
|
|
103
|
+
table;
|
|
104
|
+
constructor(supabase, auth, audit) {
|
|
102
105
|
this.supabase = supabase;
|
|
103
106
|
this.auth = auth;
|
|
107
|
+
this.table = (0, audit_1.auditedTable)(supabase, auth, audit, {
|
|
108
|
+
table: 'clients',
|
|
109
|
+
entityType: enum_1.AuditTrailEntityType.CLIENTS,
|
|
110
|
+
});
|
|
104
111
|
}
|
|
105
112
|
async list(query) {
|
|
106
113
|
const page = query.page;
|
|
@@ -169,97 +176,53 @@ class ClientsResource {
|
|
|
169
176
|
return data;
|
|
170
177
|
}
|
|
171
178
|
async create(input) {
|
|
172
|
-
const
|
|
173
|
-
.from('clients')
|
|
174
|
-
.insert({
|
|
179
|
+
const row = await this.table.insert({
|
|
175
180
|
...input,
|
|
176
181
|
organization_id: this.auth.organization_id,
|
|
177
182
|
created_by: this.auth.mms_id,
|
|
178
183
|
created_at: new Date().toISOString(),
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
.single();
|
|
182
|
-
if (error)
|
|
183
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
184
|
-
return this.getById(data.mms_id);
|
|
184
|
+
});
|
|
185
|
+
return this.getById(row.mms_id);
|
|
185
186
|
}
|
|
186
187
|
async update(clientId, input) {
|
|
187
|
-
|
|
188
|
-
.from('clients')
|
|
189
|
-
.update({
|
|
188
|
+
await this.table.update(clientId, {
|
|
190
189
|
...input,
|
|
191
190
|
last_updated_by: this.auth.mms_id,
|
|
192
191
|
updated_at: new Date().toISOString(),
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
.eq('mms_id', clientId)
|
|
196
|
-
.select('mms_id')
|
|
197
|
-
.single();
|
|
198
|
-
if (error)
|
|
199
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
200
|
-
return this.getById(data.mms_id);
|
|
192
|
+
});
|
|
193
|
+
return this.getById(clientId);
|
|
201
194
|
}
|
|
202
195
|
async archive(clientId) {
|
|
203
|
-
|
|
204
|
-
.from('clients')
|
|
205
|
-
.update({
|
|
196
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.ARCHIVE, {
|
|
206
197
|
archived: true,
|
|
207
198
|
archived_at: new Date().toISOString(),
|
|
208
199
|
archived_by: this.auth.mms_id,
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
.eq('mms_id', clientId)
|
|
212
|
-
.select('mms_id')
|
|
213
|
-
.single();
|
|
214
|
-
if (error)
|
|
215
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
216
|
-
return this.getById(data.mms_id);
|
|
200
|
+
});
|
|
201
|
+
return this.getById(clientId);
|
|
217
202
|
}
|
|
218
203
|
async unarchive(clientId) {
|
|
219
|
-
|
|
220
|
-
.from('clients')
|
|
221
|
-
.update({
|
|
204
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.UNARCHIVE, {
|
|
222
205
|
archived: false,
|
|
223
206
|
unarchived_at: new Date().toISOString(),
|
|
224
207
|
unarchived_by: this.auth.mms_id,
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
.eq('mms_id', clientId)
|
|
228
|
-
.select('mms_id')
|
|
229
|
-
.single();
|
|
230
|
-
if (error)
|
|
231
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
232
|
-
return this.getById(data.mms_id);
|
|
208
|
+
});
|
|
209
|
+
return this.getById(clientId);
|
|
233
210
|
}
|
|
234
211
|
async restore(clientId) {
|
|
235
|
-
|
|
236
|
-
.from('clients')
|
|
237
|
-
.update({
|
|
212
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.RESTORE, {
|
|
238
213
|
deleted: false,
|
|
239
214
|
restored_at: new Date().toISOString(),
|
|
240
215
|
restored_by: this.auth.mms_id,
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
.eq('mms_id', clientId)
|
|
244
|
-
.select('mms_id')
|
|
245
|
-
.single();
|
|
246
|
-
if (error)
|
|
247
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
248
|
-
return this.getById(data.mms_id);
|
|
216
|
+
});
|
|
217
|
+
return this.getById(clientId);
|
|
249
218
|
}
|
|
250
219
|
/** Soft delete — the row stays, flagged `deleted`, and `restore()` brings it back. */
|
|
251
220
|
async remove(clientId) {
|
|
252
|
-
|
|
253
|
-
.from('clients')
|
|
254
|
-
.update({
|
|
221
|
+
await this.table.transition(clientId, enum_1.AuditTrailAction.DELETE, {
|
|
255
222
|
deleted: true,
|
|
256
223
|
deleted_at: new Date().toISOString(),
|
|
257
224
|
deleted_by: this.auth.mms_id,
|
|
258
|
-
})
|
|
259
|
-
.eq('organization_id', this.auth.organization_id)
|
|
260
|
-
.eq('mms_id', clientId);
|
|
261
|
-
if (error)
|
|
262
|
-
throw (0, errors_1.mapPostgrestError)(error);
|
|
225
|
+
});
|
|
263
226
|
}
|
|
264
227
|
}
|
|
265
228
|
exports.ClientsResource = ClientsResource;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,0EAGyD;AAEzD,oCAA+E;AAE/E,sCAA8C;AAG9C,wCAAsB;AAEtB,sEAAsE;AACtE,gGAAgG;AAChG,4EAA4E;AAC5E,MAAM,kBAAkB,GAAG;;;;;;;;;;;OAWX,CAAC;AAEjB,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8Db,CAAC;AAEjB,MAAa,eAAe;IAIP;IACA;IAJF,KAAK,CAAe;IAErC,YACmB,QAA6B,EAC7B,IAAiB,EAClC,KAAoB;QAFH,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,SAAI,GAAJ,IAAI,CAAa;QAGlC,IAAI,CAAC,KAAK,GAAG,IAAA,oBAAY,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;YAC/C,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,2BAAoB,CAAC,OAAO;SACzC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAoB;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,CAAC;QACjC,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;QACrC,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAE3C,2FA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,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,uBAAgB,CAAC,OAAO,EAAE;YAC9D,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;SAC9B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,sFAAsF;IACtF,KAAK,CAAC,MAAM,CAAC,QAAgB;QAC3B,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,QAAQ,EAAE,uBAAgB,CAAC,MAAM,EAAE;YAC7D,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;SAC7B,CAAC,CAAC;IACL,CAAC;CACF;AAvJD,0CAuJC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./auth-client"), exports);
|
|
|
20
20
|
__exportStar(require("./errors"), exports);
|
|
21
21
|
__exportStar(require("./validators"), exports);
|
|
22
22
|
__exportStar(require("./transforms"), exports);
|
|
23
|
+
__exportStar(require("./audit"), exports);
|
|
23
24
|
__exportStar(require("./statuses"), exports);
|
|
24
25
|
__exportStar(require("./additional-details"), exports);
|
|
25
26
|
__exportStar(require("./notes"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,gDAA8B;AAC9B,2CAAyB;AACzB,+CAA6B;AAC7B,+CAA6B;AAC7B,6CAA2B;AAC3B,uDAAqC;AACrC,0CAAwB;AACxB,qDAAmC;AACnC,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB;AACxB,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,gDAA8B;AAC9B,2CAAyB;AACzB,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB;AACxB,6CAA2B;AAC3B,uDAAqC;AACrC,0CAAwB;AACxB,qDAAmC;AACnC,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB;AACxB,+CAA6B"}
|
package/dist/nest/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HttpException } from '@nestjs/common';
|
|
2
|
+
import type { AuditErrorHandler } from '../audit';
|
|
2
3
|
import { SupabaseClientError } from '../errors';
|
|
3
4
|
/**
|
|
4
5
|
* The HttpException Nest should send for an SDK error: same status, and the body is
|
|
@@ -6,6 +7,16 @@ import { SupabaseClientError } from '../errors';
|
|
|
6
7
|
* services can let SupabaseClientError propagate untouched.
|
|
7
8
|
*/
|
|
8
9
|
export declare const toHttpException: (error: SupabaseClientError) => HttpException;
|
|
10
|
+
export type SupabaseUserClientOptions = {
|
|
11
|
+
/** Where a failed audit insert is reported — e.g. `(error) => Sentry.captureException(error)`. */
|
|
12
|
+
onAuditError?: AuditErrorHandler;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Options the `@SupabaseUserClient()` decorator builds its per-request clients with. Call it
|
|
16
|
+
* once at startup (the decorator constructs the client itself, so there is nowhere else to
|
|
17
|
+
* pass them).
|
|
18
|
+
*/
|
|
19
|
+
export declare const configureSupabaseUserClient: (options: SupabaseUserClientOptions) => void;
|
|
9
20
|
export declare const SupabaseUserClient: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
10
21
|
/**
|
|
11
22
|
* A `SupabaseAuthClient` for routes a logged-out caller hits (sign-in, refresh, password
|
package/dist/nest/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SupabasePublicClient = exports.SupabaseUserClient = exports.toHttpException = void 0;
|
|
3
|
+
exports.SupabasePublicClient = exports.SupabaseUserClient = exports.configureSupabaseUserClient = exports.toHttpException = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const auth_client_1 = require("../auth-client");
|
|
6
6
|
const client_1 = require("../client");
|
|
@@ -28,6 +28,16 @@ const getBearerToken = (request) => {
|
|
|
28
28
|
}
|
|
29
29
|
return token;
|
|
30
30
|
};
|
|
31
|
+
let userClientOptions = {};
|
|
32
|
+
/**
|
|
33
|
+
* Options the `@SupabaseUserClient()` decorator builds its per-request clients with. Call it
|
|
34
|
+
* once at startup (the decorator constructs the client itself, so there is nowhere else to
|
|
35
|
+
* pass them).
|
|
36
|
+
*/
|
|
37
|
+
const configureSupabaseUserClient = (options) => {
|
|
38
|
+
userClientOptions = options;
|
|
39
|
+
};
|
|
40
|
+
exports.configureSupabaseUserClient = configureSupabaseUserClient;
|
|
31
41
|
exports.SupabaseUserClient = (0, common_1.createParamDecorator)((_, ctx) => {
|
|
32
42
|
const token = getBearerToken(ctx.switchToHttp().getRequest());
|
|
33
43
|
try {
|
|
@@ -35,6 +45,7 @@ exports.SupabaseUserClient = (0, common_1.createParamDecorator)((_, ctx) => {
|
|
|
35
45
|
url: getEnvOrThrow('SUPABASE_URL'),
|
|
36
46
|
key: getEnvOrThrow('SUPABASE_PUBLISHABLE_KEY'),
|
|
37
47
|
accessToken: token,
|
|
48
|
+
onAuditError: userClientOptions.onAuditError,
|
|
38
49
|
});
|
|
39
50
|
}
|
|
40
51
|
catch (error) {
|
package/dist/nest/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nest/index.ts"],"names":[],"mappings":";;;AAAA,2CAMwB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nest/index.ts"],"names":[],"mappings":";;;AAAA,2CAMwB;AAGxB,gDAAmF;AACnF,sCAAsE;AACtE,sCAAgD;AAEhD;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAA0B,EAAiB,EAAE,CAC3E,IAAI,sBAAa,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAD3D,QAAA,eAAe,mBAC4C;AAExE,MAAM,aAAa,GAAG,CAAC,GAAgD,EAAU,EAAE;IACjF,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,qCAA4B,CAAC,GAAG,GAAG,oBAAoB,CAAC,CAAC;IAC/E,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAU,EAAE;IAClD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;IAC7C,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,8BAAqB,CAAC,0BAA0B,CAAC,CAAC;IACzE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,MAAM,EAAE,WAAW,EAAE,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;QACjD,MAAM,IAAI,8BAAqB,CAAC,4CAA4C,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAOF,IAAI,iBAAiB,GAA8B,EAAE,CAAC;AAEtD;;;;GAIG;AACI,MAAM,2BAA2B,GAAG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