@better-giving/endowment 4.0.11 → 4.0.13
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 +1 -0
- package/dist/db.mjs +3 -3
- package/dist/interfaces.d.mts +1 -0
- package/dist/media.mjs +1 -1
- package/package.json +1 -1
- package/src/db.mts +4 -4
- package/src/interfaces.mts +1 -0
- package/src/media.mts +1 -1
package/dist/db.d.mts
CHANGED
package/dist/db.mjs
CHANGED
|
@@ -152,6 +152,7 @@ export class NpoDb extends Db {
|
|
|
152
152
|
return {
|
|
153
153
|
...this.key_prog_milestone(mid, prog),
|
|
154
154
|
...data,
|
|
155
|
+
id: mid,
|
|
155
156
|
};
|
|
156
157
|
}
|
|
157
158
|
npo_med_record(npo_id, { featured /** not saved as attribute */, ...d }) {
|
|
@@ -187,7 +188,7 @@ export class NpoDb extends Db {
|
|
|
187
188
|
return i && to_imedia(i);
|
|
188
189
|
}
|
|
189
190
|
async npo_med_update(npo, prev, update) {
|
|
190
|
-
const new_sk = med_sk(prev.id, prev.type, (update.featured ?? prev.featured) ? "
|
|
191
|
+
const new_sk = med_sk(prev.id, prev.type, (update.featured ?? prev.featured) ? "0" : "1");
|
|
191
192
|
const cmd = new UpdateCommand({
|
|
192
193
|
TableName: NpoDb.name,
|
|
193
194
|
Key: this.key_npo_med(prev.id, npo),
|
|
@@ -291,13 +292,12 @@ export class NpoDb extends Db {
|
|
|
291
292
|
return this.client.send(cmd);
|
|
292
293
|
}
|
|
293
294
|
async prog_milestone_put(pid, content) {
|
|
294
|
-
const mid = crypto.randomUUID();
|
|
295
295
|
const item = this.prog_milestone_record(pid, content);
|
|
296
296
|
const cmd = new PutCommand({
|
|
297
297
|
TableName: NpoDb.name,
|
|
298
298
|
Item: item,
|
|
299
299
|
});
|
|
300
|
-
return this.client.send(cmd).then(() =>
|
|
300
|
+
return this.client.send(cmd).then(() => item.id);
|
|
301
301
|
}
|
|
302
302
|
async prog_milestone_update(pid, mid, update) {
|
|
303
303
|
const upd8 = new UpdateBuilder();
|
package/dist/interfaces.d.mts
CHANGED
|
@@ -34,6 +34,7 @@ export interface IMediaPage extends IPageKeyed<IMedia> {
|
|
|
34
34
|
export type TNpoDbKeys = keyof INpoDb;
|
|
35
35
|
export type TArrayValues<T extends readonly unknown[]> = T[number];
|
|
36
36
|
export type TNpoDbProjectedTo<T> = T extends TNpoDbKeys[] ? Pick<INpoDb, TArrayValues<T>> : INpoDb;
|
|
37
|
+
/** 0 - true, 1 - false, 0 is lexicographically first */
|
|
37
38
|
export type TBinFlag = "0" | "1";
|
|
38
39
|
export interface INposPage<T extends keyof CloudsearchEndow = keyof CloudsearchEndow> {
|
|
39
40
|
items: Pick<CloudsearchEndow, T>[];
|
package/dist/media.mjs
CHANGED
|
@@ -44,5 +44,5 @@ export function med_key_filter(PK, params) {
|
|
|
44
44
|
export const to_imedia = (d) => {
|
|
45
45
|
const { gsi1SK, gsi1PK, PK, SK, ...rest } = d;
|
|
46
46
|
const x = med_sk_attr(gsi1SK);
|
|
47
|
-
return { ...rest, featured: x.featured === "
|
|
47
|
+
return { ...rest, featured: x.featured === "0" };
|
|
48
48
|
};
|
package/package.json
CHANGED
package/src/db.mts
CHANGED
|
@@ -206,7 +206,8 @@ export class NpoDb extends Db {
|
|
|
206
206
|
return {
|
|
207
207
|
...this.key_prog_milestone(mid, prog),
|
|
208
208
|
...data,
|
|
209
|
-
|
|
209
|
+
id: mid,
|
|
210
|
+
} satisfies IMilestone;
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
npo_med_record(
|
|
@@ -251,7 +252,7 @@ export class NpoDb extends Db {
|
|
|
251
252
|
const new_sk = med_sk(
|
|
252
253
|
prev.id,
|
|
253
254
|
prev.type,
|
|
254
|
-
(update.featured ?? prev.featured) ? "
|
|
255
|
+
(update.featured ?? prev.featured) ? "0" : "1"
|
|
255
256
|
);
|
|
256
257
|
|
|
257
258
|
const cmd = new UpdateCommand({
|
|
@@ -376,13 +377,12 @@ export class NpoDb extends Db {
|
|
|
376
377
|
pid: string,
|
|
377
378
|
content: IMilestoneNew
|
|
378
379
|
): Promise<string> {
|
|
379
|
-
const mid = crypto.randomUUID();
|
|
380
380
|
const item = this.prog_milestone_record(pid, content);
|
|
381
381
|
const cmd = new PutCommand({
|
|
382
382
|
TableName: NpoDb.name,
|
|
383
383
|
Item: item,
|
|
384
384
|
});
|
|
385
|
-
return this.client.send(cmd).then(() =>
|
|
385
|
+
return this.client.send(cmd).then(() => item.id);
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
async prog_milestone_update(
|
package/src/interfaces.mts
CHANGED
package/src/media.mts
CHANGED
|
@@ -63,5 +63,5 @@ export function med_key_filter(
|
|
|
63
63
|
export const to_imedia = (d: TRecord): IMedia => {
|
|
64
64
|
const { gsi1SK, gsi1PK, PK, SK, ...rest } = d;
|
|
65
65
|
const x = med_sk_attr(gsi1SK);
|
|
66
|
-
return { ...rest, featured: x.featured === "
|
|
66
|
+
return { ...rest, featured: x.featured === "0" } as any;
|
|
67
67
|
};
|