@betterinternship/schema.moa 1.6.0 → 2.0.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/dist/db.d.ts +890 -923
- package/dist/db.doc.types.d.ts +432 -465
- package/dist/db.doc.types.js +26 -26
- package/dist/db.doc.types.js.map +1 -1
- package/dist/db.ent.types.d.ts +396 -396
- package/dist/db.ent.types.js +8 -8
- package/dist/db.js +29 -29
- package/dist/db.uni.types.d.ts +295 -295
- package/dist/db.uni.types.js +8 -8
- package/dist/env.d.ts +1 -1
- package/dist/env.js +6 -6
- package/dist/index.d.ts +4 -4
- package/dist/index.js +21 -21
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/db.ent.types.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Constants = void 0;
|
|
4
|
-
exports.Constants = {
|
|
5
|
-
public: {
|
|
6
|
-
Enums: {},
|
|
7
|
-
},
|
|
8
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Constants = void 0;
|
|
4
|
+
exports.Constants = {
|
|
5
|
+
public: {
|
|
6
|
+
Enums: {},
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
9
|
//# sourceMappingURL=db.ent.types.js.map
|
package/dist/db.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleDBError = exports.documentDb = exports.schoolDb = exports.entityDb = void 0;
|
|
4
|
-
const supabase_js_1 = require("@supabase/supabase-js");
|
|
5
|
-
const env_1 = require("./env");
|
|
6
|
-
const DB_SCHOOL_URL = env_1.ENV.SUPABASE_SCHOOL_URL;
|
|
7
|
-
const DB_ENTITY_URL = env_1.ENV.SUPABASE_ENTITY_URL;
|
|
8
|
-
const DB_DOCUMENTS_URL = env_1.ENV.SUPABASE_DOCUMENTS_URL;
|
|
9
|
-
const DB_SCHOOL_SERVICE_KEY = env_1.ENV.SUPABASE_SCHOOL_SERVICE_ROLE_KEY;
|
|
10
|
-
const DB_ENTITY_SERVICE_KEY = env_1.ENV.SUPABASE_ENTITY_SERVICE_ROLE_KEY;
|
|
11
|
-
const DB_DOCUMENTS_SERVICE_KEY = env_1.ENV.SUPABASE_DOCUMENTS_SERVICE_ROLE_KEY;
|
|
12
|
-
if (!DB_SCHOOL_URL || !DB_ENTITY_URL || !DB_SCHOOL_SERVICE_KEY || !DB_ENTITY_SERVICE_KEY || !DB_DOCUMENTS_URL || !DB_DOCUMENTS_SERVICE_KEY)
|
|
13
|
-
throw new Error("[ERROR:ENV] Missing Supabase configuration.");
|
|
14
|
-
exports.entityDb = (0, supabase_js_1.createClient)(DB_ENTITY_URL, DB_ENTITY_SERVICE_KEY);
|
|
15
|
-
exports.schoolDb = (0, supabase_js_1.createClient)(DB_SCHOOL_URL, DB_SCHOOL_SERVICE_KEY);
|
|
16
|
-
exports.documentDb = (0, supabase_js_1.createClient)(DB_DOCUMENTS_URL, DB_DOCUMENTS_SERVICE_KEY);
|
|
17
|
-
const handleDBError = (error, description = "") => {
|
|
18
|
-
switch (error.code) {
|
|
19
|
-
case "PGRST116":
|
|
20
|
-
throw new Error(description, { cause: "DB_RECORD_NOT_FOUND" });
|
|
21
|
-
case "23505":
|
|
22
|
-
throw new Error(description, { cause: "DB_RECORD_ALREADY_EXISTS" });
|
|
23
|
-
case "23503":
|
|
24
|
-
throw new Error(description, { cause: "DB_REFERENCED_ERROR_NOT_FOUND" });
|
|
25
|
-
default:
|
|
26
|
-
throw new Error(description, { cause: "DB_OPERATION_FAILED" });
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.handleDBError = handleDBError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleDBError = exports.documentDb = exports.schoolDb = exports.entityDb = void 0;
|
|
4
|
+
const supabase_js_1 = require("@supabase/supabase-js");
|
|
5
|
+
const env_1 = require("./env");
|
|
6
|
+
const DB_SCHOOL_URL = env_1.ENV.SUPABASE_SCHOOL_URL;
|
|
7
|
+
const DB_ENTITY_URL = env_1.ENV.SUPABASE_ENTITY_URL;
|
|
8
|
+
const DB_DOCUMENTS_URL = env_1.ENV.SUPABASE_DOCUMENTS_URL;
|
|
9
|
+
const DB_SCHOOL_SERVICE_KEY = env_1.ENV.SUPABASE_SCHOOL_SERVICE_ROLE_KEY;
|
|
10
|
+
const DB_ENTITY_SERVICE_KEY = env_1.ENV.SUPABASE_ENTITY_SERVICE_ROLE_KEY;
|
|
11
|
+
const DB_DOCUMENTS_SERVICE_KEY = env_1.ENV.SUPABASE_DOCUMENTS_SERVICE_ROLE_KEY;
|
|
12
|
+
if (!DB_SCHOOL_URL || !DB_ENTITY_URL || !DB_SCHOOL_SERVICE_KEY || !DB_ENTITY_SERVICE_KEY || !DB_DOCUMENTS_URL || !DB_DOCUMENTS_SERVICE_KEY)
|
|
13
|
+
throw new Error("[ERROR:ENV] Missing Supabase configuration.");
|
|
14
|
+
exports.entityDb = (0, supabase_js_1.createClient)(DB_ENTITY_URL, DB_ENTITY_SERVICE_KEY);
|
|
15
|
+
exports.schoolDb = (0, supabase_js_1.createClient)(DB_SCHOOL_URL, DB_SCHOOL_SERVICE_KEY);
|
|
16
|
+
exports.documentDb = (0, supabase_js_1.createClient)(DB_DOCUMENTS_URL, DB_DOCUMENTS_SERVICE_KEY);
|
|
17
|
+
const handleDBError = (error, description = "") => {
|
|
18
|
+
switch (error.code) {
|
|
19
|
+
case "PGRST116":
|
|
20
|
+
throw new Error(description, { cause: "DB_RECORD_NOT_FOUND" });
|
|
21
|
+
case "23505":
|
|
22
|
+
throw new Error(description, { cause: "DB_RECORD_ALREADY_EXISTS" });
|
|
23
|
+
case "23503":
|
|
24
|
+
throw new Error(description, { cause: "DB_REFERENCED_ERROR_NOT_FOUND" });
|
|
25
|
+
default:
|
|
26
|
+
throw new Error(description, { cause: "DB_OPERATION_FAILED" });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
exports.handleDBError = handleDBError;
|
|
30
30
|
//# sourceMappingURL=db.js.map
|