@better-giving/endowment 4.0.8 → 4.0.9
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/dist/db.d.mts +3 -3
- package/dist/db.mjs +12 -3
- package/package.json +1 -1
- package/src/db.mts +18 -4
package/dist/db.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Db, type UpdateComps } from "@better-giving/db";
|
|
2
2
|
import type { IMedia, IMediaPage, INpoReferredBy, INpoWithRegNum, INpoWithRid, TBinFlag, TNpoDbKeys, TNpoDbProjectedTo } from "./interfaces.mjs";
|
|
3
|
-
import type { IMediaSearchObj, IMediaUpdate, IMilestone, IMilestoneUpdate, INpo, INpoUpdate, IProgram, IProgramDb, IProgramNew, IProgramUpdate, TMediaType } from "./schema.mjs";
|
|
3
|
+
import type { IMediaSearchObj, IMediaUpdate, IMilestone, IMilestoneNew, IMilestoneUpdate, INpo, INpoUpdate, IProgram, IProgramDb, IProgramNew, IProgramUpdate, TMediaType } from "./schema.mjs";
|
|
4
4
|
export declare class NpoDb extends Db {
|
|
5
5
|
static readonly name = "endowments_v3";
|
|
6
6
|
static readonly slug_env_gsi: "slug-env-gsi";
|
|
@@ -109,8 +109,7 @@ export declare class NpoDb extends Db {
|
|
|
109
109
|
PK: string;
|
|
110
110
|
SK: string;
|
|
111
111
|
};
|
|
112
|
-
prog_milestone_record(prog: string, data:
|
|
113
|
-
id: string;
|
|
112
|
+
prog_milestone_record(prog: string, data: IMilestoneNew): {
|
|
114
113
|
date: string;
|
|
115
114
|
title: string;
|
|
116
115
|
description: string;
|
|
@@ -137,6 +136,7 @@ export declare class NpoDb extends Db {
|
|
|
137
136
|
npo_update(id: number, update: INpoUpdate): Promise<import("@aws-sdk/lib-dynamodb").UpdateCommandOutput>;
|
|
138
137
|
prog_milestones(id: string): Promise<IMilestone[]>;
|
|
139
138
|
prog_milestone_delete(pid: string, mid: string): Promise<import("@aws-sdk/lib-dynamodb").DeleteCommandOutput>;
|
|
139
|
+
prog_milestone_put(pid: string, content: IMilestoneNew): Promise<string>;
|
|
140
140
|
prog_milestone_update(pid: string, mid: string, update: IMilestoneUpdate): Promise<Record<string, any> | undefined>;
|
|
141
141
|
npo_program(id: string, npo_id: number): Promise<IProgram | undefined>;
|
|
142
142
|
npo_programs(id: number): Promise<IProgramDb[]>;
|
package/dist/db.mjs
CHANGED
|
@@ -148,8 +148,9 @@ export class NpoDb extends Db {
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
prog_milestone_record(prog, data) {
|
|
151
|
+
const mid = crypto.randomUUID();
|
|
151
152
|
return {
|
|
152
|
-
...this.key_prog_milestone(
|
|
153
|
+
...this.key_prog_milestone(mid, prog),
|
|
153
154
|
...data,
|
|
154
155
|
};
|
|
155
156
|
}
|
|
@@ -289,6 +290,15 @@ export class NpoDb extends Db {
|
|
|
289
290
|
});
|
|
290
291
|
return this.client.send(cmd);
|
|
291
292
|
}
|
|
293
|
+
async prog_milestone_put(pid, content) {
|
|
294
|
+
const mid = crypto.randomUUID();
|
|
295
|
+
const item = this.prog_milestone_record(pid, content);
|
|
296
|
+
const cmd = new PutCommand({
|
|
297
|
+
TableName: NpoDb.name,
|
|
298
|
+
Item: item,
|
|
299
|
+
});
|
|
300
|
+
return this.client.send(cmd).then(() => mid);
|
|
301
|
+
}
|
|
292
302
|
async prog_milestone_update(pid, mid, update) {
|
|
293
303
|
const upd8 = new UpdateBuilder();
|
|
294
304
|
for (const [key, value] of Object.entries(update)) {
|
|
@@ -342,10 +352,9 @@ export class NpoDb extends Db {
|
|
|
342
352
|
Item: db_prog,
|
|
343
353
|
});
|
|
344
354
|
for (const m of milestones || []) {
|
|
345
|
-
const mid = crypto.randomUUID();
|
|
346
355
|
txs.put({
|
|
347
356
|
TableName: NpoDb.name,
|
|
348
|
-
Item: this.prog_milestone_record(pid,
|
|
357
|
+
Item: this.prog_milestone_record(pid, m),
|
|
349
358
|
});
|
|
350
359
|
}
|
|
351
360
|
const cmd = new TransactWriteCommand({
|
package/package.json
CHANGED
package/src/db.mts
CHANGED
|
@@ -25,6 +25,7 @@ import type {
|
|
|
25
25
|
IMediaSearchObj,
|
|
26
26
|
IMediaUpdate,
|
|
27
27
|
IMilestone,
|
|
28
|
+
IMilestoneNew,
|
|
28
29
|
IMilestoneUpdate,
|
|
29
30
|
INpo,
|
|
30
31
|
INpoUpdate,
|
|
@@ -200,9 +201,10 @@ export class NpoDb extends Db {
|
|
|
200
201
|
};
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
prog_milestone_record(prog: string, data:
|
|
204
|
+
prog_milestone_record(prog: string, data: IMilestoneNew) {
|
|
205
|
+
const mid = crypto.randomUUID();
|
|
204
206
|
return {
|
|
205
|
-
...this.key_prog_milestone(
|
|
207
|
+
...this.key_prog_milestone(mid, prog),
|
|
206
208
|
...data,
|
|
207
209
|
};
|
|
208
210
|
}
|
|
@@ -370,6 +372,19 @@ export class NpoDb extends Db {
|
|
|
370
372
|
});
|
|
371
373
|
return this.client.send(cmd);
|
|
372
374
|
}
|
|
375
|
+
async prog_milestone_put(
|
|
376
|
+
pid: string,
|
|
377
|
+
content: IMilestoneNew
|
|
378
|
+
): Promise<string> {
|
|
379
|
+
const mid = crypto.randomUUID();
|
|
380
|
+
const item = this.prog_milestone_record(pid, content);
|
|
381
|
+
const cmd = new PutCommand({
|
|
382
|
+
TableName: NpoDb.name,
|
|
383
|
+
Item: item,
|
|
384
|
+
});
|
|
385
|
+
return this.client.send(cmd).then(() => mid);
|
|
386
|
+
}
|
|
387
|
+
|
|
373
388
|
async prog_milestone_update(
|
|
374
389
|
pid: string,
|
|
375
390
|
mid: string,
|
|
@@ -434,10 +449,9 @@ export class NpoDb extends Db {
|
|
|
434
449
|
});
|
|
435
450
|
|
|
436
451
|
for (const m of milestones || []) {
|
|
437
|
-
const mid = crypto.randomUUID();
|
|
438
452
|
txs.put({
|
|
439
453
|
TableName: NpoDb.name,
|
|
440
|
-
Item: this.prog_milestone_record(pid,
|
|
454
|
+
Item: this.prog_milestone_record(pid, m),
|
|
441
455
|
});
|
|
442
456
|
}
|
|
443
457
|
|