@timeback/core 0.1.7-beta.20260309215937 → 0.1.7-beta.20260310173551
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.
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
validateNonEmptyString,
|
|
8
8
|
validateUuid,
|
|
9
9
|
validateWithSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-y308dzvb.js";
|
|
11
11
|
|
|
12
12
|
// ../edubridge/src/utils.ts
|
|
13
13
|
var log = createScopedLogger("edubridge");
|
|
@@ -22,21 +22,6 @@ function normalizeUser(user) {
|
|
|
22
22
|
enabledUser: normalizeBoolean(user.enabledUser)
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function normalizeDate(date) {
|
|
26
|
-
if (date === undefined) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (date instanceof Date) {
|
|
30
|
-
return date.toISOString();
|
|
31
|
-
}
|
|
32
|
-
if (date.includes("T")) {
|
|
33
|
-
return date;
|
|
34
|
-
}
|
|
35
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
36
|
-
return `${date}T00:00:00.000Z`;
|
|
37
|
-
}
|
|
38
|
-
return date;
|
|
39
|
-
}
|
|
40
25
|
function aggregateActivityMetrics(data) {
|
|
41
26
|
const result = {
|
|
42
27
|
totalXp: 0,
|
|
@@ -738,6 +723,7 @@ var TimebackConfig = z6.object({
|
|
|
738
723
|
// ../../types/src/zod/edubridge.ts
|
|
739
724
|
import { z as z7 } from "zod/v4";
|
|
740
725
|
var EdubridgeDateString = z7.union([IsoDateTimeString, IsoDateString]);
|
|
726
|
+
var EdubridgeDateStringInput = EdubridgeDateString.transform((date) => date.includes("T") ? date : `${date}T00:00:00.000Z`);
|
|
741
727
|
var EduBridgeEnrollment = z7.object({
|
|
742
728
|
id: z7.string(),
|
|
743
729
|
role: z7.string(),
|
|
@@ -827,18 +813,18 @@ var EdubridgeUsersListParams = z7.object({
|
|
|
827
813
|
orgSourcedIds: z7.array(NonEmptyString2).optional()
|
|
828
814
|
});
|
|
829
815
|
var EdubridgeActivityParams = EmailOrStudentId.extend({
|
|
830
|
-
startDate:
|
|
831
|
-
endDate:
|
|
816
|
+
startDate: EdubridgeDateStringInput,
|
|
817
|
+
endDate: EdubridgeDateStringInput,
|
|
832
818
|
timezone: z7.string().optional()
|
|
833
819
|
});
|
|
834
820
|
var EdubridgeWeeklyFactsParams = EmailOrStudentId.extend({
|
|
835
|
-
weekDate:
|
|
821
|
+
weekDate: EdubridgeDateStringInput,
|
|
836
822
|
timezone: z7.string().optional()
|
|
837
823
|
});
|
|
838
824
|
var EdubridgeEnrollmentFactsParams = z7.object({
|
|
839
825
|
enrollmentId: NonEmptyString2,
|
|
840
|
-
startDate:
|
|
841
|
-
endDate:
|
|
826
|
+
startDate: EdubridgeDateStringInput.optional(),
|
|
827
|
+
endDate: EdubridgeDateStringInput.optional(),
|
|
842
828
|
timezone: z7.string().optional()
|
|
843
829
|
});
|
|
844
830
|
// ../../types/src/zod/masterytrack.ts
|
|
@@ -929,7 +915,7 @@ var Ref = z9.object({
|
|
|
929
915
|
type: z9.string().optional(),
|
|
930
916
|
href: z9.string().optional()
|
|
931
917
|
}).strict();
|
|
932
|
-
var OneRosterDateString = z9.union([IsoDateString, IsoDateTimeString]);
|
|
918
|
+
var OneRosterDateString = z9.union([IsoDateString, IsoDateTimeString]).transform((date) => date.includes("T") ? date : `${date}T00:00:00Z`);
|
|
933
919
|
var OneRosterUserRoleInput = z9.object({
|
|
934
920
|
roleType: z9.enum(["primary", "secondary"]),
|
|
935
921
|
role: OneRosterUserRole,
|
|
@@ -1015,8 +1001,8 @@ var OneRosterLineItemCreateInput = z9.object({
|
|
|
1015
1001
|
class: Ref,
|
|
1016
1002
|
school: Ref,
|
|
1017
1003
|
category: Ref,
|
|
1018
|
-
assignDate:
|
|
1019
|
-
dueDate:
|
|
1004
|
+
assignDate: OneRosterDateString,
|
|
1005
|
+
dueDate: OneRosterDateString,
|
|
1020
1006
|
status: Status,
|
|
1021
1007
|
description: z9.string().optional(),
|
|
1022
1008
|
resultValueMin: z9.number().nullable().optional(),
|
|
@@ -1029,7 +1015,7 @@ var OneRosterResultCreateInput = z9.object({
|
|
|
1029
1015
|
lineItem: Ref,
|
|
1030
1016
|
student: Ref,
|
|
1031
1017
|
class: Ref.optional(),
|
|
1032
|
-
scoreDate:
|
|
1018
|
+
scoreDate: OneRosterDateString,
|
|
1033
1019
|
scoreStatus: z9.enum([
|
|
1034
1020
|
"exempt",
|
|
1035
1021
|
"fully graded",
|
|
@@ -1098,7 +1084,7 @@ var OneRosterAssessmentResultCreateInput = z9.object({
|
|
|
1098
1084
|
student: Ref,
|
|
1099
1085
|
score: z9.number().nullable().optional(),
|
|
1100
1086
|
textScore: z9.string().nullable().optional(),
|
|
1101
|
-
scoreDate:
|
|
1087
|
+
scoreDate: OneRosterDateString,
|
|
1102
1088
|
scoreScale: Ref.nullable().optional(),
|
|
1103
1089
|
scorePercentile: z9.number().nullable().optional(),
|
|
1104
1090
|
scoreStatus: z9.enum([
|
|
@@ -1829,37 +1815,37 @@ class AnalyticsResource {
|
|
|
1829
1815
|
this.transport = transport;
|
|
1830
1816
|
}
|
|
1831
1817
|
async getActivity(params) {
|
|
1832
|
-
validateWithSchema(EdubridgeActivityParams, params, "activity params");
|
|
1818
|
+
const validated = validateWithSchema(EdubridgeActivityParams, params, "activity params");
|
|
1833
1819
|
const response = await this.transport.request(`${this.transport.paths.base}/analytics/activity`, {
|
|
1834
1820
|
params: {
|
|
1835
|
-
email:
|
|
1836
|
-
studentId:
|
|
1837
|
-
startDate:
|
|
1838
|
-
endDate:
|
|
1839
|
-
timezone:
|
|
1821
|
+
email: validated.email,
|
|
1822
|
+
studentId: validated.studentId,
|
|
1823
|
+
startDate: validated.startDate,
|
|
1824
|
+
endDate: validated.endDate,
|
|
1825
|
+
timezone: validated.timezone
|
|
1840
1826
|
}
|
|
1841
1827
|
});
|
|
1842
1828
|
return response.facts;
|
|
1843
1829
|
}
|
|
1844
1830
|
async getWeeklyFacts(params) {
|
|
1845
|
-
validateWithSchema(EdubridgeWeeklyFactsParams, params, "weekly facts params");
|
|
1831
|
+
const validated = validateWithSchema(EdubridgeWeeklyFactsParams, params, "weekly facts params");
|
|
1846
1832
|
const response = await this.transport.request(`${this.transport.paths.base}/analytics/facts/weekly`, {
|
|
1847
1833
|
params: {
|
|
1848
|
-
email:
|
|
1849
|
-
studentId:
|
|
1850
|
-
weekDate:
|
|
1851
|
-
timezone:
|
|
1834
|
+
email: validated.email,
|
|
1835
|
+
studentId: validated.studentId,
|
|
1836
|
+
weekDate: validated.weekDate,
|
|
1837
|
+
timezone: validated.timezone
|
|
1852
1838
|
}
|
|
1853
1839
|
});
|
|
1854
1840
|
return response.facts;
|
|
1855
1841
|
}
|
|
1856
1842
|
async getEnrollmentFacts(params) {
|
|
1857
|
-
validateWithSchema(EdubridgeEnrollmentFactsParams, params, "enrollment facts params");
|
|
1858
|
-
const response = await this.transport.request(`${this.transport.paths.base}/analytics/enrollment/${encodeURIComponent(
|
|
1843
|
+
const validated = validateWithSchema(EdubridgeEnrollmentFactsParams, params, "enrollment facts params");
|
|
1844
|
+
const response = await this.transport.request(`${this.transport.paths.base}/analytics/enrollment/${encodeURIComponent(validated.enrollmentId)}`, {
|
|
1859
1845
|
params: {
|
|
1860
|
-
startDate:
|
|
1861
|
-
endDate:
|
|
1862
|
-
timezone:
|
|
1846
|
+
startDate: validated.startDate,
|
|
1847
|
+
endDate: validated.endDate,
|
|
1848
|
+
timezone: validated.timezone
|
|
1863
1849
|
}
|
|
1864
1850
|
});
|
|
1865
1851
|
return response.facts;
|
|
@@ -1540,7 +1540,7 @@ function issue(path, message) {
|
|
|
1540
1540
|
function validateWithSchema(schema, data, context) {
|
|
1541
1541
|
const result = schema.safeParse(data);
|
|
1542
1542
|
if (result.success) {
|
|
1543
|
-
return;
|
|
1543
|
+
return result.data;
|
|
1544
1544
|
}
|
|
1545
1545
|
const issues = result.error.issues.map((errorIssue) => ({
|
|
1546
1546
|
path: errorIssue.path.join(".") || "(root)",
|
package/dist/errors.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
WebhookFilterCreateInput,
|
|
78
78
|
WebhookFilterUpdateInput,
|
|
79
79
|
WebhookUpdateInput
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-cx16s110.js";
|
|
81
81
|
import {
|
|
82
82
|
ApiError,
|
|
83
83
|
BaseTransport,
|
|
@@ -103,7 +103,7 @@ import {
|
|
|
103
103
|
validateUuid,
|
|
104
104
|
validateWithSchema,
|
|
105
105
|
whereToFilter
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-y308dzvb.js";
|
|
107
107
|
import {
|
|
108
108
|
CALIPER_DATA_VERSION,
|
|
109
109
|
CALIPER_ENV_VARS
|
|
@@ -964,10 +964,8 @@ class BaseResource {
|
|
|
964
964
|
}
|
|
965
965
|
create(data) {
|
|
966
966
|
const schema = this.createSchema;
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
}
|
|
970
|
-
const body = this.wrapBody(data);
|
|
967
|
+
const validated = schema ? validateWithSchema(schema, data, this.resourceName) : data;
|
|
968
|
+
const body = this.wrapBody(validated);
|
|
971
969
|
return this.transport.request(this.basePath, {
|
|
972
970
|
method: "POST",
|
|
973
971
|
body
|
|
@@ -993,10 +991,8 @@ class BaseResource {
|
|
|
993
991
|
}
|
|
994
992
|
async sendUpdate(sourcedId, data) {
|
|
995
993
|
const schema = this.updateSchema;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
}
|
|
999
|
-
const body = this.wrapBody(data);
|
|
994
|
+
const validated = schema ? validateWithSchema(schema, data, `update ${this.resourceName}`) : data;
|
|
995
|
+
const body = this.wrapBody(validated);
|
|
1000
996
|
await this.transport.request(`${this.basePath}/${sourcedId}`, {
|
|
1001
997
|
method: "PUT",
|
|
1002
998
|
body
|
|
@@ -1005,10 +1001,8 @@ class BaseResource {
|
|
|
1005
1001
|
}
|
|
1006
1002
|
async sendUpdateAndReturn(sourcedId, data) {
|
|
1007
1003
|
const schema = this.updateSchema;
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
}
|
|
1011
|
-
const body = this.wrapBody(data);
|
|
1004
|
+
const validated = schema ? validateWithSchema(schema, data, `update ${this.resourceName}`) : data;
|
|
1005
|
+
const body = this.wrapBody(validated);
|
|
1012
1006
|
const response = await this.transport.request(`${this.basePath}/${sourcedId}`, {
|
|
1013
1007
|
method: "PUT",
|
|
1014
1008
|
body
|
|
@@ -1861,10 +1855,10 @@ class ScopedSchoolResource {
|
|
|
1861
1855
|
return new Paginator3(this.transport, `${this.gradebookPath}/lineItems`, params, "lineItems");
|
|
1862
1856
|
}
|
|
1863
1857
|
createLineItem(data) {
|
|
1864
|
-
validateWithSchema(OneRosterLineItemCreateInput, data, "line item");
|
|
1858
|
+
const validated = validateWithSchema(OneRosterLineItemCreateInput, data, "line item");
|
|
1865
1859
|
return this.transport.request(`${this.gradebookPath}/lineItems`, {
|
|
1866
1860
|
method: "POST",
|
|
1867
|
-
body: { lineItems: [
|
|
1861
|
+
body: { lineItems: [validated] }
|
|
1868
1862
|
});
|
|
1869
1863
|
}
|
|
1870
1864
|
scoreScales(params) {
|
|
@@ -1918,10 +1912,10 @@ class ScopedClassAcademicSessionResource {
|
|
|
1918
1912
|
this.gradebookPath = `${transport.paths.gradebook}/classes/${classId}/academicSessions/${sessionId}`;
|
|
1919
1913
|
}
|
|
1920
1914
|
createResult(result) {
|
|
1921
|
-
validateWithSchema(OneRosterResultCreateInput, result, "result");
|
|
1915
|
+
const validated = validateWithSchema(OneRosterResultCreateInput, result, "result");
|
|
1922
1916
|
return this.transport.request(`${this.gradebookPath}/results`, {
|
|
1923
1917
|
method: "POST",
|
|
1924
|
-
body: { results: [
|
|
1918
|
+
body: { results: [validated] }
|
|
1925
1919
|
});
|
|
1926
1920
|
}
|
|
1927
1921
|
}
|
|
@@ -2013,10 +2007,10 @@ class ScopedClassResource {
|
|
|
2013
2007
|
return new Paginator3(this.transport, `${this.gradebookPath}/lineItems`, params, "lineItems");
|
|
2014
2008
|
}
|
|
2015
2009
|
createLineItem(data) {
|
|
2016
|
-
validateWithSchema(OneRosterLineItemCreateInput, data, "line item");
|
|
2010
|
+
const validated = validateWithSchema(OneRosterLineItemCreateInput, data, "line item");
|
|
2017
2011
|
return this.transport.request(`${this.gradebookPath}/lineItems`, {
|
|
2018
2012
|
method: "POST",
|
|
2019
|
-
body: { lineItems: [
|
|
2013
|
+
body: { lineItems: [validated] }
|
|
2020
2014
|
});
|
|
2021
2015
|
}
|
|
2022
2016
|
results(params) {
|
|
@@ -2347,10 +2341,10 @@ class ScopedTermResource {
|
|
|
2347
2341
|
return new Paginator3(this.transport, `${this.basePath}/gradingPeriods`, params, "gradingPeriods");
|
|
2348
2342
|
}
|
|
2349
2343
|
createGradingPeriod(data) {
|
|
2350
|
-
validateWithSchema(OneRosterAcademicSessionCreateInput, data, "grading period");
|
|
2344
|
+
const validated = validateWithSchema(OneRosterAcademicSessionCreateInput, data, "grading period");
|
|
2351
2345
|
return this.transport.request(`${this.basePath}/gradingPeriods`, {
|
|
2352
2346
|
method: "POST",
|
|
2353
|
-
body: { academicSession:
|
|
2347
|
+
body: { academicSession: validated }
|
|
2354
2348
|
});
|
|
2355
2349
|
}
|
|
2356
2350
|
}
|
package/dist/utils.js
CHANGED