@timeback/edubridge 0.1.0 → 0.1.1
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/errors.d.ts +2 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +62 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14589 -84
- package/dist/resources/analytics.d.ts +2 -1
- package/dist/resources/analytics.d.ts.map +1 -1
- package/dist/resources/applications.d.ts.map +1 -1
- package/dist/resources/enrollments.d.ts +2 -1
- package/dist/resources/enrollments.d.ts.map +1 -1
- package/dist/resources/learning-reports.d.ts.map +1 -1
- package/dist/resources/subject-track.d.ts +2 -1
- package/dist/resources/subject-track.d.ts.map +1 -1
- package/dist/resources/users.d.ts +2 -1
- package/dist/resources/users.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/types/analytics.d.ts +0 -208
- package/dist/types/analytics.d.ts.map +0 -1
- package/dist/types/applications.d.ts +0 -27
- package/dist/types/applications.d.ts.map +0 -1
- package/dist/types/base.d.ts +0 -38
- package/dist/types/base.d.ts.map +0 -1
- package/dist/types/enrollments.d.ts +0 -113
- package/dist/types/enrollments.d.ts.map +0 -1
- package/dist/types/learning-reports.d.ts +0 -27
- package/dist/types/learning-reports.d.ts.map +0 -1
- package/dist/types/subject-track.d.ts +0 -54
- package/dist/types/subject-track.d.ts.map +0 -1
- package/dist/types/users.d.ts +0 -107
- package/dist/types/users.d.ts.map +0 -1
package/dist/errors.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Re-exports common errors from `@timeback/internal-client-infra`.
|
|
5
5
|
* Edubridge uses the same error format as other Timeback clients.
|
|
6
6
|
*/
|
|
7
|
-
import { ApiError, ForbiddenError, NotFoundError, UnauthorizedError, ValidationError } from '@timeback/internal-client-infra';
|
|
8
|
-
export { ApiError as EdubridgeError, ForbiddenError, NotFoundError, UnauthorizedError, ValidationError, };
|
|
7
|
+
import { ApiError, ForbiddenError, InputValidationError, NotFoundError, UnauthorizedError, ValidationError } from '@timeback/internal-client-infra';
|
|
8
|
+
export { ApiError as EdubridgeError, ForbiddenError, InputValidationError, NotFoundError, UnauthorizedError, ValidationError, };
|
|
9
9
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,CAAA"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACN,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACN,QAAQ,IAAI,cAAc,EAC1B,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,eAAe,GACf,CAAA"}
|
package/dist/errors.js
CHANGED
|
@@ -15,6 +15,15 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
15
15
|
});
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
|
+
var __export = (target, all) => {
|
|
19
|
+
for (var name in all)
|
|
20
|
+
__defProp(target, name, {
|
|
21
|
+
get: all[name],
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
set: (newValue) => all[name] = () => newValue
|
|
25
|
+
});
|
|
26
|
+
};
|
|
18
27
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
19
28
|
|
|
20
29
|
// ../../internal/constants/src/endpoints.ts
|
|
@@ -68,9 +77,12 @@ var PLATFORM_ENDPOINTS = {
|
|
|
68
77
|
// ../../internal/constants/src/typescript.ts
|
|
69
78
|
var TypeScriptPackages = {
|
|
70
79
|
tsc: "tsc",
|
|
71
|
-
nativePreview: "@typescript/native-preview
|
|
80
|
+
nativePreview: "@typescript/native-preview"
|
|
81
|
+
};
|
|
82
|
+
var TYPESCRIPT_RUNNER = {
|
|
83
|
+
package: TypeScriptPackages.nativePreview,
|
|
84
|
+
bin: "tsgo"
|
|
72
85
|
};
|
|
73
|
-
var TYPESCRIPT_PACKAGE = TypeScriptPackages.nativePreview;
|
|
74
86
|
// ../../internal/logger/src/debug.ts
|
|
75
87
|
var patterns = null;
|
|
76
88
|
var debugAll = false;
|
|
@@ -971,6 +983,27 @@ class ValidationError extends ApiError {
|
|
|
971
983
|
super(message, 422, response);
|
|
972
984
|
}
|
|
973
985
|
}
|
|
986
|
+
|
|
987
|
+
class InputValidationError extends ApiError {
|
|
988
|
+
name = "InputValidationError";
|
|
989
|
+
issues;
|
|
990
|
+
constructor(message, issues) {
|
|
991
|
+
const response = {
|
|
992
|
+
imsx_codeMajor: "failure",
|
|
993
|
+
imsx_severity: "error",
|
|
994
|
+
imsx_description: message,
|
|
995
|
+
imsx_error_details: issues.map((issue) => ({
|
|
996
|
+
path: issue.path,
|
|
997
|
+
message: issue.message
|
|
998
|
+
}))
|
|
999
|
+
};
|
|
1000
|
+
super(message, 400, response);
|
|
1001
|
+
this.issues = issues;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
function createInputValidationError(message, issues) {
|
|
1005
|
+
return new InputValidationError(message, issues);
|
|
1006
|
+
}
|
|
974
1007
|
// ../../internal/client-infra/src/transport/constants.ts
|
|
975
1008
|
var MAX_RETRIES = 3;
|
|
976
1009
|
var RETRY_STATUS_CODES = [429, 503];
|
|
@@ -996,8 +1029,9 @@ class BaseTransport {
|
|
|
996
1029
|
fetch: fetchFn
|
|
997
1030
|
});
|
|
998
1031
|
}
|
|
1032
|
+
const normalizedBaseUrl = config.baseUrl.endsWith("/") ? config.baseUrl : `${config.baseUrl}/`;
|
|
999
1033
|
this.config = {
|
|
1000
|
-
baseUrl:
|
|
1034
|
+
baseUrl: normalizedBaseUrl,
|
|
1001
1035
|
timeout: config.timeout ?? 30000,
|
|
1002
1036
|
fetch: fetchFn,
|
|
1003
1037
|
tokenProvider
|
|
@@ -1083,7 +1117,8 @@ class BaseTransport {
|
|
|
1083
1117
|
if (/^[a-z][a-z0-9+.-]*:/i.test(path)) {
|
|
1084
1118
|
throw new Error(`Absolute URLs are not allowed in path: ${path}. Use relative paths only.`);
|
|
1085
1119
|
}
|
|
1086
|
-
const
|
|
1120
|
+
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
1121
|
+
const url = new URL(normalizedPath, this.config.baseUrl);
|
|
1087
1122
|
if (params) {
|
|
1088
1123
|
for (const [key, value] of Object.entries(params)) {
|
|
1089
1124
|
if (value !== undefined) {
|
|
@@ -1208,10 +1243,33 @@ function parseBodyPaginationRaw(body) {
|
|
|
1208
1243
|
total: body.totalCount
|
|
1209
1244
|
};
|
|
1210
1245
|
}
|
|
1246
|
+
// ../../internal/client-infra/src/validation/index.ts
|
|
1247
|
+
function issue(path, message) {
|
|
1248
|
+
return { path, message };
|
|
1249
|
+
}
|
|
1250
|
+
function validateWithSchema(schema, data, context) {
|
|
1251
|
+
const result = schema.safeParse(data);
|
|
1252
|
+
if (result.success) {
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
const issues = result.error.issues.map((errorIssue) => ({
|
|
1256
|
+
path: errorIssue.path.join(".") || "(root)",
|
|
1257
|
+
message: errorIssue.message
|
|
1258
|
+
}));
|
|
1259
|
+
throw createInputValidationError(`Invalid ${context} data`, issues);
|
|
1260
|
+
}
|
|
1261
|
+
function validateNonEmptyString(value, name) {
|
|
1262
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
1263
|
+
throw createInputValidationError(`Invalid ${name}`, [
|
|
1264
|
+
issue(name, "Must be a non-empty string")
|
|
1265
|
+
]);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1211
1268
|
export {
|
|
1212
1269
|
ValidationError,
|
|
1213
1270
|
UnauthorizedError,
|
|
1214
1271
|
NotFoundError,
|
|
1272
|
+
InputValidationError,
|
|
1215
1273
|
ForbiddenError,
|
|
1216
1274
|
ApiError as EdubridgeError
|
|
1217
1275
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,8 @@ export { createEdubridgeClient } from './factory';
|
|
|
37
37
|
export type { EdubridgeClientConfig } from './types/client';
|
|
38
38
|
export type { Environment, EnvAuth, ExplicitAuth } from './types/client';
|
|
39
39
|
export type { AuthCheckResult, ListParams, PageResult } from '@timeback/internal-client-infra';
|
|
40
|
-
export type { ActivityMetricsData,
|
|
40
|
+
export type { ActivityMetricsData, AggregatedMetrics, DailyActivityMap, EnrollmentFacts, GradeMasteryData, HighestGradeMastered, SubjectMetrics, TimeSpentMetricsData, WeeklyFactRecord, WeeklyFacts, } from '@timeback/types/protocols/edubridge';
|
|
41
|
+
export type { ActivityParams, EnrollmentFactsParams, WeeklyFactsParams, } from '@timeback/types/zod';
|
|
41
42
|
export { aggregateActivityMetrics } from './utils';
|
|
42
43
|
export { Transport } from './lib';
|
|
43
44
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAMH,OAAO,EAAE,eAAe,EAAE,KAAK,uBAAuB,EAAE,MAAM,UAAU,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,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