placementt-core 1.400.1040 → 1.400.1042
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/lib/callables/destinationsConfig.d.ts +0 -28
- package/lib/callables/destinationsConfig.js +0 -16
- package/lib/callables/destinationsConfig.js.map +1 -1
- package/lib/callables/registry.d.ts +0 -44
- package/lib/firebase/firebaseQuery.d.ts +2 -2
- package/lib/firebase/firebaseQuery.js +27 -2
- package/lib/firebase/firebaseQuery.js.map +1 -1
- package/lib/firebase/readDatabase.d.ts +2 -2
- package/lib/reduxHooks.d.ts +4 -4
- package/package.json +1 -1
- package/src/callables/destinationsConfig.ts +0 -16
- package/src/firebase/firebaseQuery.tsx +36 -2
|
@@ -45,34 +45,6 @@ export declare const destinationsConfigCallables: {
|
|
|
45
45
|
created?: number | undefined;
|
|
46
46
|
}>;
|
|
47
47
|
};
|
|
48
|
-
"destinationsConfig-saveLeaverDestinations": {
|
|
49
|
-
request: z.ZodObject<{
|
|
50
|
-
oId: z.ZodString;
|
|
51
|
-
/** The school's own leaver destination categories, keyed by id. The nine
|
|
52
|
-
* NCCIS codes are fixed and are never sent — only what sits under them.
|
|
53
|
-
* Validated server side, which also stamps provenance and turns a
|
|
54
|
-
* removal into an archive. */
|
|
55
|
-
destinations: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
oId: string;
|
|
58
|
-
destinations: Record<string, unknown>;
|
|
59
|
-
}, {
|
|
60
|
-
oId: string;
|
|
61
|
-
destinations: Record<string, unknown>;
|
|
62
|
-
}>;
|
|
63
|
-
response: z.ZodObject<{
|
|
64
|
-
saved: z.ZodBoolean;
|
|
65
|
-
/** The stored map, including anything the server archived rather than
|
|
66
|
-
* deleted — the client adopts this rather than its own copy. */
|
|
67
|
-
destinations: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
68
|
-
}, "strip", z.ZodTypeAny, {
|
|
69
|
-
destinations: Record<string, unknown>;
|
|
70
|
-
saved: boolean;
|
|
71
|
-
}, {
|
|
72
|
-
destinations: Record<string, unknown>;
|
|
73
|
-
saved: boolean;
|
|
74
|
-
}>;
|
|
75
|
-
};
|
|
76
48
|
"destinationsConfig-provisionDestinationsNow": {
|
|
77
49
|
request: z.ZodObject<{
|
|
78
50
|
oId: z.ZodString;
|
|
@@ -32,22 +32,6 @@ exports.destinationsConfigCallables = {
|
|
|
32
32
|
created: zod_1.z.number().optional(),
|
|
33
33
|
}),
|
|
34
34
|
},
|
|
35
|
-
"destinationsConfig-saveLeaverDestinations": {
|
|
36
|
-
request: zod_1.z.object({
|
|
37
|
-
oId: zod_1.z.string(),
|
|
38
|
-
/** The school's own leaver destination categories, keyed by id. The nine
|
|
39
|
-
* NCCIS codes are fixed and are never sent — only what sits under them.
|
|
40
|
-
* Validated server side, which also stamps provenance and turns a
|
|
41
|
-
* removal into an archive. */
|
|
42
|
-
destinations: zod_1.z.record(zod_1.z.unknown()),
|
|
43
|
-
}),
|
|
44
|
-
response: zod_1.z.object({
|
|
45
|
-
saved: zod_1.z.boolean(),
|
|
46
|
-
/** The stored map, including anything the server archived rather than
|
|
47
|
-
* deleted — the client adopts this rather than its own copy. */
|
|
48
|
-
destinations: zod_1.z.record(zod_1.z.unknown()),
|
|
49
|
-
}),
|
|
50
|
-
},
|
|
51
35
|
"destinationsConfig-provisionDestinationsNow": {
|
|
52
36
|
request: zod_1.z.object({
|
|
53
37
|
oId: zod_1.z.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destinationsConfig.js","sourceRoot":"","sources":["../../src/callables/destinationsConfig.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAGtB;;;;;;;;;;GAUG;AACU,QAAA,2BAA2B,GAAG;IACvC,2CAA2C,EAAE;QACzC,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;YACd,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;YACf;0EAC8D;YAC9D,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AAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;YAChC,8EAA8E;YAC9E,KAAK,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;SACvD,CAAC;QACF,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;YACnB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;SAC3B,CAAC;KACL;CACoB,CAAC"}
|
|
@@ -787,28 +787,6 @@ export declare const allCallables: {
|
|
|
787
787
|
created?: number | undefined;
|
|
788
788
|
}>;
|
|
789
789
|
};
|
|
790
|
-
"destinationsConfig-saveLeaverDestinations": {
|
|
791
|
-
request: z.ZodObject<{
|
|
792
|
-
oId: z.ZodString;
|
|
793
|
-
destinations: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
794
|
-
}, "strip", z.ZodTypeAny, {
|
|
795
|
-
oId: string;
|
|
796
|
-
destinations: Record<string, unknown>;
|
|
797
|
-
}, {
|
|
798
|
-
oId: string;
|
|
799
|
-
destinations: Record<string, unknown>;
|
|
800
|
-
}>;
|
|
801
|
-
response: z.ZodObject<{
|
|
802
|
-
saved: z.ZodBoolean;
|
|
803
|
-
destinations: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
804
|
-
}, "strip", z.ZodTypeAny, {
|
|
805
|
-
destinations: Record<string, unknown>;
|
|
806
|
-
saved: boolean;
|
|
807
|
-
}, {
|
|
808
|
-
destinations: Record<string, unknown>;
|
|
809
|
-
saved: boolean;
|
|
810
|
-
}>;
|
|
811
|
-
};
|
|
812
790
|
"destinationsConfig-provisionDestinationsNow": {
|
|
813
791
|
request: z.ZodObject<{
|
|
814
792
|
oId: z.ZodString;
|
|
@@ -882,28 +860,6 @@ export declare const callableGroups: {
|
|
|
882
860
|
created?: number | undefined;
|
|
883
861
|
}>;
|
|
884
862
|
};
|
|
885
|
-
"destinationsConfig-saveLeaverDestinations": {
|
|
886
|
-
request: z.ZodObject<{
|
|
887
|
-
oId: z.ZodString;
|
|
888
|
-
destinations: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
889
|
-
}, "strip", z.ZodTypeAny, {
|
|
890
|
-
oId: string;
|
|
891
|
-
destinations: Record<string, unknown>;
|
|
892
|
-
}, {
|
|
893
|
-
oId: string;
|
|
894
|
-
destinations: Record<string, unknown>;
|
|
895
|
-
}>;
|
|
896
|
-
response: z.ZodObject<{
|
|
897
|
-
saved: z.ZodBoolean;
|
|
898
|
-
destinations: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
899
|
-
}, "strip", z.ZodTypeAny, {
|
|
900
|
-
destinations: Record<string, unknown>;
|
|
901
|
-
saved: boolean;
|
|
902
|
-
}, {
|
|
903
|
-
destinations: Record<string, unknown>;
|
|
904
|
-
saved: boolean;
|
|
905
|
-
}>;
|
|
906
|
-
};
|
|
907
863
|
"destinationsConfig-provisionDestinationsNow": {
|
|
908
864
|
request: z.ZodObject<{
|
|
909
865
|
oId: z.ZodString;
|
|
@@ -20,9 +20,9 @@ export default class FirebaseQuery {
|
|
|
20
20
|
}): Promise<DocumentReference<DocumentData>>;
|
|
21
21
|
getUniqueDocName(path: string[] | string, name: string, oId: string, product: Products): Promise<string>;
|
|
22
22
|
getDocData(path: string[] | string): Promise<DocumentData>;
|
|
23
|
-
getDocsWhere(path: string[] | string, constraints?: QueryConstraint[] | QueryConstraint, rawDocs?: boolean): Promise<
|
|
23
|
+
getDocsWhere(path: string[] | string, constraints?: QueryConstraint[] | QueryConstraint, rawDocs?: boolean): Promise<import("@firebase/firestore").QuerySnapshot<DocumentData> | {
|
|
24
24
|
[k: string]: any;
|
|
25
|
-
}>;
|
|
25
|
+
} | undefined>;
|
|
26
26
|
collectionUpdate(data: {
|
|
27
27
|
[key: string]: unknown;
|
|
28
28
|
}, path: string[] | string, constraints?: QueryConstraint[] | QueryConstraint): Promise<void>;
|
|
@@ -3,6 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const firestore_1 = require("firebase/firestore");
|
|
4
4
|
const firebaseConfig_1 = require("./firebaseConfig");
|
|
5
5
|
const util_1 = require("./util");
|
|
6
|
+
/**
|
|
7
|
+
* Report a read that failed, and carry on with an empty result.
|
|
8
|
+
*
|
|
9
|
+
* Both readers below answer a failure with 0 or {} so that one bad query cannot blank
|
|
10
|
+
* a page. That is worth keeping — but it used to report the failure with `console.log`,
|
|
11
|
+
* which put it in the same undifferentiated stream as the "GET COUNT" line above it
|
|
12
|
+
* and left it out of the console's error filter entirely. A missing composite index is
|
|
13
|
+
* the error that costs most to miss: Firestore answers `failed-precondition` with the
|
|
14
|
+
* URL that creates the index, and the empty result it turns into is indistinguishable
|
|
15
|
+
* from a collection that genuinely has nothing in it.
|
|
16
|
+
*
|
|
17
|
+
* So: still not fatal, but no longer quiet, and carrying the query that failed rather
|
|
18
|
+
* than the error alone — a bare index error names a collection and nothing about which
|
|
19
|
+
* of the dozen reads against it went wrong.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} kind which reader failed.
|
|
22
|
+
* @param {string[]|string} path the collection it was reading.
|
|
23
|
+
* @param {*} constraints the query's constraints.
|
|
24
|
+
* @param {*} error what Firestore threw.
|
|
25
|
+
* @return {undefined} nothing, so the caller falls back to its empty result.
|
|
26
|
+
*/
|
|
27
|
+
const queryFailed = (kind, path, constraints, error) => {
|
|
28
|
+
console.error(`GET ${kind} FAILED — ${typeof path === "string" ? path : path.join("/")}`, { constraints, error });
|
|
29
|
+
return undefined;
|
|
30
|
+
};
|
|
6
31
|
class FirebaseQuery {
|
|
7
32
|
createQuery(queryType, path, constraints) {
|
|
8
33
|
switch (queryType) {
|
|
@@ -14,7 +39,7 @@ class FirebaseQuery {
|
|
|
14
39
|
}
|
|
15
40
|
async getCount(path, constraints) {
|
|
16
41
|
console.log("GET COUNT", path, constraints);
|
|
17
|
-
const countObject = await (0, firestore_1.getCountFromServer)(this.createQuery("collection", path, constraints)).catch((e) =>
|
|
42
|
+
const countObject = await (0, firestore_1.getCountFromServer)(this.createQuery("collection", path, constraints)).catch((e) => queryFailed("COUNT", path, constraints, e));
|
|
18
43
|
if (!countObject)
|
|
19
44
|
return 0;
|
|
20
45
|
return (countObject).data().count;
|
|
@@ -79,7 +104,7 @@ class FirebaseQuery {
|
|
|
79
104
|
}
|
|
80
105
|
async getDocsWhere(path, constraints, rawDocs = false) {
|
|
81
106
|
const q = this.createQuery("collection", path, constraints);
|
|
82
|
-
const docs = await (0, firestore_1.getDocs)(q).catch((e) =>
|
|
107
|
+
const docs = await (0, firestore_1.getDocs)(q).catch((e) => queryFailed("DOCS", path, constraints, e));
|
|
83
108
|
if (rawDocs)
|
|
84
109
|
return docs;
|
|
85
110
|
if (!docs)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebaseQuery.js","sourceRoot":"","sources":["../../src/firebase/firebaseQuery.tsx"],"names":[],"mappings":";;AAAA,kDAEmI;AAEnI,qDAAoC;AACpC,iCAAiC;AAIjC,MAAqB,aAAa;IACtB,WAAW,CAAC,SAA4B,EAAE,IAAoB,EAAE,WAA8C;QAClH,QAAQ,SAAS,EAAE,CAAC;YACpB,KAAK,YAAY;gBACb,OAAO,IAAA,iBAAK,EAAC,IAAA,sBAAU,EAAC,mBAAE,EAAE,GAAI,IAAA,gBAAS,EAAC,IAAI,CAAW,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACvJ,KAAK,KAAK;gBACN,OAAO,IAAA,eAAG,EAAC,mBAAE,EAAE,GAAI,IAAA,gBAAS,EAAC,IAAI,CAAW,CAAC,CAAC;QACl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wB,CAAC;QAE5J,OAAO,IAAA,sBAAU,EAAC,CAAC,EAAE,CAAC,aAA2B,EAAE,EAAE;YACjD,IAAI,GAAG,EAAE,CAAC;gBACN,QAAQ,CAAC,aAAa,CAAC,CAAC;gBACxB,OAAO;YACX,CAAC;YACD,MAAM,QAAQ,GAAyB,EAAE,CAAC;YAE1C,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAA0B,EAAE,EAAE;gBACtD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;gBACxB,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,CAAC;gBACjB,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;YAC5B,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,oCAAoC,YAAY,EAAE,EAAE,KAAK,CAAC,CAAC;YACvE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAnKD,gCAmKC"}
|
|
@@ -28,8 +28,8 @@ export declare const getPlacementsWhere: ({ w, oId, uid, raw }: {
|
|
|
28
28
|
oId?: string;
|
|
29
29
|
uid?: string;
|
|
30
30
|
raw?: boolean;
|
|
31
|
-
}) => Promise<
|
|
31
|
+
}) => Promise<import("@firebase/firestore").QuerySnapshot<import("@firebase/firestore").DocumentData> | {
|
|
32
32
|
[k: string]: any;
|
|
33
|
-
}>;
|
|
33
|
+
} | undefined>;
|
|
34
34
|
export declare const checkPlacementConflicts: (instituteId: string, userGroupId: string) => Promise<number>;
|
|
35
35
|
export declare const getPlacementListingsById: (placementListings: string[]) => Promise<[string, PlacementListing][]>;
|
package/lib/reduxHooks.d.ts
CHANGED
|
@@ -118,9 +118,9 @@ export declare function useStudent({ user }: {
|
|
|
118
118
|
add: (formData: StudentPlacementData) => Promise<void>;
|
|
119
119
|
update: (placementId: string, attributes: Partial<StudentPlacementData>) => Promise<void>;
|
|
120
120
|
delete: (id: string) => Promise<void>;
|
|
121
|
-
getUserPlacements: () => Promise<
|
|
121
|
+
getUserPlacements: () => Promise<import("@firebase/firestore").QuerySnapshot<DocumentData> | {
|
|
122
122
|
[k: string]: any;
|
|
123
|
-
}>;
|
|
123
|
+
} | undefined>;
|
|
124
124
|
getPlacementsStart: (start: Date, end: Date) => Promise<{
|
|
125
125
|
[key: string]: StudentPlacementData;
|
|
126
126
|
}>;
|
|
@@ -334,9 +334,9 @@ export declare function useInstituteStudent({ user }: {
|
|
|
334
334
|
add: (formData: StudentPlacementData) => Promise<void>;
|
|
335
335
|
update: (placementId: string, attributes: Partial<StudentPlacementData>) => Promise<void>;
|
|
336
336
|
delete: (id: string) => Promise<void>;
|
|
337
|
-
getUserPlacements: () => Promise<
|
|
337
|
+
getUserPlacements: () => Promise<import("@firebase/firestore").QuerySnapshot<DocumentData> | {
|
|
338
338
|
[k: string]: any;
|
|
339
|
-
}>;
|
|
339
|
+
} | undefined>;
|
|
340
340
|
getPlacementsStart: (start: Date, end: Date) => Promise<{
|
|
341
341
|
[key: string]: StudentPlacementData;
|
|
342
342
|
}>;
|
package/package.json
CHANGED
|
@@ -31,22 +31,6 @@ export const destinationsConfigCallables = {
|
|
|
31
31
|
created: z.number().optional(),
|
|
32
32
|
}),
|
|
33
33
|
},
|
|
34
|
-
"destinationsConfig-saveLeaverDestinations": {
|
|
35
|
-
request: z.object({
|
|
36
|
-
oId: z.string(),
|
|
37
|
-
/** The school's own leaver destination categories, keyed by id. The nine
|
|
38
|
-
* NCCIS codes are fixed and are never sent — only what sits under them.
|
|
39
|
-
* Validated server side, which also stamps provenance and turns a
|
|
40
|
-
* removal into an archive. */
|
|
41
|
-
destinations: z.record(z.unknown()),
|
|
42
|
-
}),
|
|
43
|
-
response: z.object({
|
|
44
|
-
saved: z.boolean(),
|
|
45
|
-
/** The stored map, including anything the server archived rather than
|
|
46
|
-
* deleted — the client adopts this rather than its own copy. */
|
|
47
|
-
destinations: z.record(z.unknown()),
|
|
48
|
-
}),
|
|
49
|
-
},
|
|
50
34
|
"destinationsConfig-provisionDestinationsNow": {
|
|
51
35
|
request: z.object({
|
|
52
36
|
oId: z.string(),
|
|
@@ -7,6 +7,40 @@ import {pathToArr} from "./util";
|
|
|
7
7
|
import {Products} from "../typeDefinitions";
|
|
8
8
|
import { AppDispatch } from "../config";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Report a read that failed, and carry on with an empty result.
|
|
12
|
+
*
|
|
13
|
+
* Both readers below answer a failure with 0 or {} so that one bad query cannot blank
|
|
14
|
+
* a page. That is worth keeping — but it used to report the failure with `console.log`,
|
|
15
|
+
* which put it in the same undifferentiated stream as the "GET COUNT" line above it
|
|
16
|
+
* and left it out of the console's error filter entirely. A missing composite index is
|
|
17
|
+
* the error that costs most to miss: Firestore answers `failed-precondition` with the
|
|
18
|
+
* URL that creates the index, and the empty result it turns into is indistinguishable
|
|
19
|
+
* from a collection that genuinely has nothing in it.
|
|
20
|
+
*
|
|
21
|
+
* So: still not fatal, but no longer quiet, and carrying the query that failed rather
|
|
22
|
+
* than the error alone — a bare index error names a collection and nothing about which
|
|
23
|
+
* of the dozen reads against it went wrong.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} kind which reader failed.
|
|
26
|
+
* @param {string[]|string} path the collection it was reading.
|
|
27
|
+
* @param {*} constraints the query's constraints.
|
|
28
|
+
* @param {*} error what Firestore threw.
|
|
29
|
+
* @return {undefined} nothing, so the caller falls back to its empty result.
|
|
30
|
+
*/
|
|
31
|
+
const queryFailed = (
|
|
32
|
+
kind: "COUNT"|"DOCS",
|
|
33
|
+
path: string[]|string,
|
|
34
|
+
constraints: QueryConstraint[]|QueryConstraint|undefined,
|
|
35
|
+
error: unknown,
|
|
36
|
+
): undefined => {
|
|
37
|
+
console.error(
|
|
38
|
+
`GET ${kind} FAILED — ${typeof path === "string" ? path : path.join("/")}`,
|
|
39
|
+
{constraints, error},
|
|
40
|
+
);
|
|
41
|
+
return undefined;
|
|
42
|
+
};
|
|
43
|
+
|
|
10
44
|
export default class FirebaseQuery {
|
|
11
45
|
private createQuery(queryType:"collection"|"doc", path:string[]|string, constraints?:QueryConstraint[]|QueryConstraint) {
|
|
12
46
|
switch (queryType) {
|
|
@@ -19,7 +53,7 @@ export default class FirebaseQuery {
|
|
|
19
53
|
|
|
20
54
|
async getCount(path:string[]|string, constraints?:QueryConstraint[]|QueryConstraint):Promise<number> {
|
|
21
55
|
console.log("GET COUNT", path, constraints);
|
|
22
|
-
const countObject = await getCountFromServer(this.createQuery("collection", path, constraints) as Query).catch((e) =>
|
|
56
|
+
const countObject = await getCountFromServer(this.createQuery("collection", path, constraints) as Query).catch((e) => queryFailed("COUNT", path, constraints, e));
|
|
23
57
|
if (!countObject) return 0;
|
|
24
58
|
return (countObject).data().count;
|
|
25
59
|
}
|
|
@@ -93,7 +127,7 @@ export default class FirebaseQuery {
|
|
|
93
127
|
async getDocsWhere(path: string[]|string, constraints?:QueryConstraint[]|QueryConstraint, rawDocs=false) {
|
|
94
128
|
const q = this.createQuery("collection", path, constraints);
|
|
95
129
|
|
|
96
|
-
const docs = await getDocs(q as Query).catch((e) =>
|
|
130
|
+
const docs = await getDocs(q as Query).catch((e) => queryFailed("DOCS", path, constraints, e));
|
|
97
131
|
if (rawDocs) return docs;
|
|
98
132
|
if (!docs) return {};
|
|
99
133
|
console.log("GET DOCS WHERE", docs.size, path, constraints);
|