@happyvertical/smrt-education 0.57.36 → 0.57.38
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/AGENTS.md +4 -0
- package/agents/family-intake.md +97 -0
- package/dist/catalog.d.ts +4 -4
- package/dist/catalog.d.ts.map +1 -1
- package/dist/chunks/{workbook-photo-service-1wcnf-Xf.js → workbook-photo-service-DCmqeWLd.js} +448 -202
- package/dist/chunks/workbook-photo-service-DCmqeWLd.js.map +1 -0
- package/dist/course-source.d.ts +2 -2
- package/dist/course-source.d.ts.map +1 -1
- package/dist/family-intake-contracts.d.ts +56 -0
- package/dist/family-intake-contracts.d.ts.map +1 -0
- package/dist/family-intake-ingestion.d.ts +29 -0
- package/dist/family-intake-ingestion.d.ts.map +1 -0
- package/dist/family-intake-models.d.ts +58 -0
- package/dist/family-intake-models.d.ts.map +1 -0
- package/dist/family-intake-service.d.ts +70 -0
- package/dist/family-intake-service.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/ingestion.d.ts +2 -0
- package/dist/ingestion.d.ts.map +1 -1
- package/dist/ingestion.js +426 -13
- package/dist/ingestion.js.map +1 -1
- package/dist/intake-original-evidence.d.ts +10 -0
- package/dist/intake-original-evidence.d.ts.map +1 -0
- package/dist/learner-service.d.ts +2 -0
- package/dist/learner-service.d.ts.map +1 -1
- package/dist/learners.d.ts +5 -5
- package/dist/learners.d.ts.map +1 -1
- package/dist/lesson-assets.d.ts +2 -2
- package/dist/lesson-assets.d.ts.map +1 -1
- package/dist/manifest.json +1319 -78
- package/dist/smrt-knowledge.json +524 -10
- package/dist/submission-service.d.ts +1 -1
- package/dist/submission-service.d.ts.map +1 -1
- package/dist/submissions.d.ts +7 -7
- package/dist/submissions.d.ts.map +1 -1
- package/dist/workbook-models.d.ts +8 -8
- package/dist/workbook-models.d.ts.map +1 -1
- package/dist/workbook-photo-ingestion.d.ts.map +1 -1
- package/dist/workbook-photo-models.d.ts +6 -5
- package/dist/workbook-photo-models.d.ts.map +1 -1
- package/dist/workbook-photo-service.d.ts +6 -0
- package/dist/workbook-photo-service.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/chunks/workbook-photo-service-1wcnf-Xf.js.map +0 -1
package/dist/chunks/{workbook-photo-service-1wcnf-Xf.js → workbook-photo-service-DCmqeWLd.js}
RENAMED
|
@@ -4,8 +4,8 @@ import { AssetCollection, createAssetRuntime, withPrivateAssetAccess } from "@ha
|
|
|
4
4
|
import { TenantCollection } from "@happyvertical/smrt-users";
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
6
6
|
var __create = Object.create;
|
|
7
|
-
var __defProp$
|
|
8
|
-
var __getOwnPropDesc$
|
|
7
|
+
var __defProp$7 = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
9
9
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
11
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -13,35 +13,35 @@ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).expor
|
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
14
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
15
|
key = keys[i];
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp$
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp$7(to, key, {
|
|
17
17
|
get: ((k) => from[k]).bind(null, key),
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc$
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc$7(from, key)) || desc.enumerable
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$7(target, "default", {
|
|
24
24
|
value: mod,
|
|
25
25
|
enumerable: true
|
|
26
26
|
}) : target, mod));
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/catalog.ts
|
|
29
|
-
var __defProp$
|
|
30
|
-
var __getOwnPropDesc$
|
|
31
|
-
var __defNormalProp$
|
|
29
|
+
var __defProp$6 = Object.defineProperty;
|
|
30
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
31
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, {
|
|
32
32
|
enumerable: true,
|
|
33
33
|
configurable: true,
|
|
34
34
|
writable: true,
|
|
35
35
|
value
|
|
36
36
|
}) : obj[key] = value;
|
|
37
|
-
var __decorateClass$
|
|
38
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
37
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
38
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
39
39
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
40
|
-
if (kind && result) __defProp$
|
|
40
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
|
-
var __publicField$
|
|
44
|
-
var closed$
|
|
43
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
44
|
+
var closed$5 = {
|
|
45
45
|
api: false,
|
|
46
46
|
mcp: false,
|
|
47
47
|
cli: false
|
|
@@ -81,7 +81,7 @@ var Course = class extends SmrtObject {
|
|
|
81
81
|
applyModelOptions(this, options);
|
|
82
82
|
}
|
|
83
83
|
/** A personal copy remains pinned to its original family and license. */
|
|
84
|
-
async save() {
|
|
84
|
+
async save(options) {
|
|
85
85
|
if (this.licenseKind === "personal-use-copy" && !this.tenantId) throw new Error("personal-use-copy courses require an owning tenant");
|
|
86
86
|
if (this.licenseKind === "personal-use-copy" && this.status === "published") throw new Error("personal-use-copy courses cannot be published");
|
|
87
87
|
const prior = this.id ? await this.db.get(this.tableName, { id: this.id }) : null;
|
|
@@ -97,27 +97,27 @@ var Course = class extends SmrtObject {
|
|
|
97
97
|
license_kind: this.licenseKind
|
|
98
98
|
})) throw new Error("Persisted courses require explicit re-authoring to change tenant or license");
|
|
99
99
|
}
|
|
100
|
-
return await super.save();
|
|
100
|
+
return await super.save(options);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
__publicField$
|
|
104
|
-
__decorateClass$
|
|
105
|
-
__decorateClass$
|
|
106
|
-
Course = __decorateClass$
|
|
103
|
+
__publicField$6(Course, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
104
|
+
__decorateClass$6([tenantId({ nullable: true })], Course.prototype, "tenantId", 2);
|
|
105
|
+
__decorateClass$6([field({ required: true })], Course.prototype, "title", 2);
|
|
106
|
+
Course = __decorateClass$6([TenantScoped({ mode: "optional" }), smrt({
|
|
107
107
|
tableStrategy: "sti",
|
|
108
|
-
...closed$
|
|
108
|
+
...closed$5
|
|
109
109
|
})], Course);
|
|
110
110
|
var ExternalCourse = class extends Course {};
|
|
111
|
-
__publicField$
|
|
112
|
-
ExternalCourse = __decorateClass$
|
|
111
|
+
__publicField$6(ExternalCourse, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
112
|
+
ExternalCourse = __decorateClass$6([smrt({
|
|
113
113
|
tableName: "courses",
|
|
114
|
-
...closed$
|
|
114
|
+
...closed$5
|
|
115
115
|
})], ExternalCourse);
|
|
116
116
|
var AuthoredCourse = class extends Course {};
|
|
117
|
-
__publicField$
|
|
118
|
-
AuthoredCourse = __decorateClass$
|
|
117
|
+
__publicField$6(AuthoredCourse, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
118
|
+
AuthoredCourse = __decorateClass$6([smrt({
|
|
119
119
|
tableName: "courses",
|
|
120
|
-
...closed$
|
|
120
|
+
...closed$5
|
|
121
121
|
})], AuthoredCourse);
|
|
122
122
|
var CourseSection = class extends SmrtObject {
|
|
123
123
|
tenantId = null;
|
|
@@ -128,21 +128,21 @@ var CourseSection = class extends SmrtObject {
|
|
|
128
128
|
super(options);
|
|
129
129
|
applyModelOptions(this, options);
|
|
130
130
|
}
|
|
131
|
-
async save() {
|
|
131
|
+
async save(options) {
|
|
132
132
|
await requireParentTenant(this, "courses", this.courseId);
|
|
133
133
|
if ((this.id ? await this.db.get("course_sections", { id: this.id }) : null) && !await this.db.get("course_sections", {
|
|
134
134
|
id: this.id,
|
|
135
135
|
course_id: this.courseId,
|
|
136
136
|
tenant_id: this.tenantId
|
|
137
137
|
})) throw new Error("Persisted sections require explicit re-authoring to change parent");
|
|
138
|
-
return await super.save();
|
|
138
|
+
return await super.save(options);
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
|
-
__publicField$
|
|
142
|
-
__decorateClass$
|
|
143
|
-
__decorateClass$
|
|
144
|
-
__decorateClass$
|
|
145
|
-
CourseSection = __decorateClass$
|
|
141
|
+
__publicField$6(CourseSection, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
142
|
+
__decorateClass$6([tenantId({ nullable: true })], CourseSection.prototype, "tenantId", 2);
|
|
143
|
+
__decorateClass$6([foreignKey("Course", { required: true })], CourseSection.prototype, "courseId", 2);
|
|
144
|
+
__decorateClass$6([field({ required: true })], CourseSection.prototype, "title", 2);
|
|
145
|
+
CourseSection = __decorateClass$6([TenantScoped({ mode: "optional" }), smrt({ ...closed$5 })], CourseSection);
|
|
146
146
|
var Lesson = class extends SmrtObject {
|
|
147
147
|
tenantId = null;
|
|
148
148
|
sectionId = "";
|
|
@@ -159,29 +159,29 @@ var Lesson = class extends SmrtObject {
|
|
|
159
159
|
super(options);
|
|
160
160
|
applyModelOptions(this, options);
|
|
161
161
|
}
|
|
162
|
-
async save() {
|
|
162
|
+
async save(options) {
|
|
163
163
|
await requireParentTenant(this, "course_sections", this.sectionId);
|
|
164
164
|
if ((this.id ? await this.db.get("lessons", { id: this.id }) : null) && !await this.db.get("lessons", {
|
|
165
165
|
id: this.id,
|
|
166
166
|
section_id: this.sectionId,
|
|
167
167
|
tenant_id: this.tenantId
|
|
168
168
|
})) throw new Error("Persisted lessons require explicit re-authoring to change parent");
|
|
169
|
-
return await super.save();
|
|
169
|
+
return await super.save(options);
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
|
-
__publicField$
|
|
173
|
-
__decorateClass$
|
|
174
|
-
__decorateClass$
|
|
175
|
-
__decorateClass$
|
|
176
|
-
Lesson = __decorateClass$
|
|
172
|
+
__publicField$6(Lesson, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
173
|
+
__decorateClass$6([tenantId({ nullable: true })], Lesson.prototype, "tenantId", 2);
|
|
174
|
+
__decorateClass$6([foreignKey("CourseSection", { required: true })], Lesson.prototype, "sectionId", 2);
|
|
175
|
+
__decorateClass$6([field({ required: true })], Lesson.prototype, "title", 2);
|
|
176
|
+
Lesson = __decorateClass$6([TenantScoped({ mode: "optional" }), smrt({
|
|
177
177
|
tableStrategy: "sti",
|
|
178
|
-
...closed$
|
|
178
|
+
...closed$5
|
|
179
179
|
})], Lesson);
|
|
180
180
|
var Reading = class extends Lesson {};
|
|
181
|
-
__publicField$
|
|
182
|
-
Reading = __decorateClass$
|
|
181
|
+
__publicField$6(Reading, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
182
|
+
Reading = __decorateClass$6([smrt({
|
|
183
183
|
tableName: "lessons",
|
|
184
|
-
...closed$
|
|
184
|
+
...closed$5
|
|
185
185
|
})], Reading);
|
|
186
186
|
var Video = class extends Lesson {
|
|
187
187
|
videoUrl = "";
|
|
@@ -190,10 +190,10 @@ var Video = class extends Lesson {
|
|
|
190
190
|
applyModelOptions(this, options);
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
-
__publicField$
|
|
194
|
-
Video = __decorateClass$
|
|
193
|
+
__publicField$6(Video, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
194
|
+
Video = __decorateClass$6([smrt({
|
|
195
195
|
tableName: "lessons",
|
|
196
|
-
...closed$
|
|
196
|
+
...closed$5
|
|
197
197
|
})], Video);
|
|
198
198
|
var Worksheet = class extends Lesson {
|
|
199
199
|
printableUrl = "";
|
|
@@ -205,16 +205,16 @@ var Worksheet = class extends Lesson {
|
|
|
205
205
|
applyModelOptions(this, options);
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
|
-
__publicField$
|
|
209
|
-
Worksheet = __decorateClass$
|
|
208
|
+
__publicField$6(Worksheet, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
209
|
+
Worksheet = __decorateClass$6([smrt({
|
|
210
210
|
tableName: "lessons",
|
|
211
|
-
...closed$
|
|
211
|
+
...closed$5
|
|
212
212
|
})], Worksheet);
|
|
213
213
|
var Exercise = class extends Lesson {};
|
|
214
|
-
__publicField$
|
|
215
|
-
Exercise = __decorateClass$
|
|
214
|
+
__publicField$6(Exercise, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
215
|
+
Exercise = __decorateClass$6([smrt({
|
|
216
216
|
tableName: "lessons",
|
|
217
|
-
...closed$
|
|
217
|
+
...closed$5
|
|
218
218
|
})], Exercise);
|
|
219
219
|
GlobalInterceptors.register({
|
|
220
220
|
name: "education-catalog-identity",
|
|
@@ -246,22 +246,22 @@ GlobalInterceptors.register({
|
|
|
246
246
|
});
|
|
247
247
|
//#endregion
|
|
248
248
|
//#region src/learners.ts
|
|
249
|
-
var __defProp$
|
|
250
|
-
var __getOwnPropDesc$
|
|
251
|
-
var __defNormalProp$
|
|
249
|
+
var __defProp$5 = Object.defineProperty;
|
|
250
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
251
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, {
|
|
252
252
|
enumerable: true,
|
|
253
253
|
configurable: true,
|
|
254
254
|
writable: true,
|
|
255
255
|
value
|
|
256
256
|
}) : obj[key] = value;
|
|
257
|
-
var __decorateClass$
|
|
258
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
257
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
258
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
259
259
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
260
|
-
if (kind && result) __defProp$
|
|
260
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
261
261
|
return result;
|
|
262
262
|
};
|
|
263
|
-
var __publicField$
|
|
264
|
-
var closed$
|
|
263
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
264
|
+
var closed$4 = {
|
|
265
265
|
api: false,
|
|
266
266
|
mcp: false,
|
|
267
267
|
cli: false
|
|
@@ -306,7 +306,7 @@ var Learner = class extends SmrtObject {
|
|
|
306
306
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Learner settings must be an object");
|
|
307
307
|
this.settings = JSON.stringify(value);
|
|
308
308
|
}
|
|
309
|
-
async save() {
|
|
309
|
+
async save(options) {
|
|
310
310
|
await immutableIdentity$1(this, {
|
|
311
311
|
user_id: this.userId,
|
|
312
312
|
profile_id: this.profileId
|
|
@@ -323,14 +323,14 @@ var Learner = class extends SmrtObject {
|
|
|
323
323
|
status: "active"
|
|
324
324
|
})) throw new Error("Learner requires a linked user/profile and active tenant membership");
|
|
325
325
|
if (!Number.isSafeInteger(this.level) || this.level < 0) throw new Error("Learner level must be a nonnegative integer");
|
|
326
|
-
return super.save();
|
|
326
|
+
return super.save(options);
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
|
-
__publicField$
|
|
330
|
-
__decorateClass$
|
|
331
|
-
__decorateClass$
|
|
332
|
-
__decorateClass$
|
|
333
|
-
Learner = __decorateClass$
|
|
329
|
+
__publicField$5(Learner, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
330
|
+
__decorateClass$5([tenantId()], Learner.prototype, "tenantId", 2);
|
|
331
|
+
__decorateClass$5([crossPackageRef("@happyvertical/smrt-users:User", { required: true })], Learner.prototype, "userId", 2);
|
|
332
|
+
__decorateClass$5([crossPackageRef("@happyvertical/smrt-profiles:Profile", { required: true })], Learner.prototype, "profileId", 2);
|
|
333
|
+
Learner = __decorateClass$5([TenantScoped({ mode: "required" }), smrt({ ...closed$4 })], Learner);
|
|
334
334
|
var Curriculum = class extends SmrtObject {
|
|
335
335
|
tenantId = "";
|
|
336
336
|
learnerId = "";
|
|
@@ -342,7 +342,7 @@ var Curriculum = class extends SmrtObject {
|
|
|
342
342
|
super(options);
|
|
343
343
|
applyOptions$1(this, options);
|
|
344
344
|
}
|
|
345
|
-
async save() {
|
|
345
|
+
async save(options) {
|
|
346
346
|
await immutableIdentity$1(this, { learner_id: this.learnerId });
|
|
347
347
|
requireEnum$1(this.status, [
|
|
348
348
|
"planned",
|
|
@@ -354,15 +354,15 @@ var Curriculum = class extends SmrtObject {
|
|
|
354
354
|
id: this.learnerId,
|
|
355
355
|
tenant_id: this.tenantId
|
|
356
356
|
})) throw new Error("Curriculum requires its tenant learner");
|
|
357
|
-
return super.save();
|
|
357
|
+
return super.save(options);
|
|
358
358
|
}
|
|
359
359
|
};
|
|
360
|
-
__publicField$
|
|
361
|
-
__decorateClass$
|
|
362
|
-
__decorateClass$
|
|
363
|
-
__decorateClass$
|
|
364
|
-
Curriculum = __decorateClass$
|
|
365
|
-
...closed$
|
|
360
|
+
__publicField$5(Curriculum, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
361
|
+
__decorateClass$5([tenantId()], Curriculum.prototype, "tenantId", 2);
|
|
362
|
+
__decorateClass$5([foreignKey("Learner", { required: true })], Curriculum.prototype, "learnerId", 2);
|
|
363
|
+
__decorateClass$5([field({ required: true })], Curriculum.prototype, "title", 2);
|
|
364
|
+
Curriculum = __decorateClass$5([TenantScoped({ mode: "required" }), smrt({
|
|
365
|
+
...closed$4,
|
|
366
366
|
tableName: "curricula"
|
|
367
367
|
})], Curriculum);
|
|
368
368
|
var Enrollment = class extends SmrtObject {
|
|
@@ -379,7 +379,7 @@ var Enrollment = class extends SmrtObject {
|
|
|
379
379
|
super(options);
|
|
380
380
|
applyOptions$1(this, options);
|
|
381
381
|
}
|
|
382
|
-
async save() {
|
|
382
|
+
async save(options) {
|
|
383
383
|
await immutableIdentity$1(this, {
|
|
384
384
|
curriculum_id: this.curriculumId,
|
|
385
385
|
learner_id: this.learnerId,
|
|
@@ -398,16 +398,16 @@ var Enrollment = class extends SmrtObject {
|
|
|
398
398
|
tenant_id: this.tenantId
|
|
399
399
|
})) throw new Error("Enrollment learner must match its tenant curriculum");
|
|
400
400
|
if (!Number.isSafeInteger(this.targetMinutesPerWeek) || this.targetMinutesPerWeek < 0) throw new Error("Target minutes must be a nonnegative integer");
|
|
401
|
-
return super.save();
|
|
401
|
+
return super.save(options);
|
|
402
402
|
}
|
|
403
403
|
};
|
|
404
|
-
__publicField$
|
|
405
|
-
__decorateClass$
|
|
406
|
-
__decorateClass$
|
|
407
|
-
__decorateClass$
|
|
408
|
-
__decorateClass$
|
|
409
|
-
Enrollment = __decorateClass$
|
|
410
|
-
...closed$
|
|
404
|
+
__publicField$5(Enrollment, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
405
|
+
__decorateClass$5([tenantId()], Enrollment.prototype, "tenantId", 2);
|
|
406
|
+
__decorateClass$5([foreignKey("Curriculum", { required: true })], Enrollment.prototype, "curriculumId", 2);
|
|
407
|
+
__decorateClass$5([foreignKey("Learner", { required: true })], Enrollment.prototype, "learnerId", 2);
|
|
408
|
+
__decorateClass$5([foreignKey("Course", { required: true })], Enrollment.prototype, "courseId", 2);
|
|
409
|
+
Enrollment = __decorateClass$5([TenantScoped({ mode: "required" }), smrt({
|
|
410
|
+
...closed$4,
|
|
411
411
|
conflictColumns: [
|
|
412
412
|
"tenant_id",
|
|
413
413
|
"curriculum_id",
|
|
@@ -429,7 +429,7 @@ var LessonProgress = class extends SmrtObject {
|
|
|
429
429
|
super(options);
|
|
430
430
|
applyOptions$1(this, options);
|
|
431
431
|
}
|
|
432
|
-
async save() {
|
|
432
|
+
async save(options) {
|
|
433
433
|
await immutableIdentity$1(this, {
|
|
434
434
|
enrollment_id: this.enrollmentId,
|
|
435
435
|
learner_id: this.learnerId,
|
|
@@ -455,20 +455,20 @@ var LessonProgress = class extends SmrtObject {
|
|
|
455
455
|
})) throw new Error("Progress requires its enrollment learner and course lesson");
|
|
456
456
|
for (const value of [this.attempts, this.timeSpentSeconds]) if (!Number.isSafeInteger(value) || value < 0) throw new Error("Progress counters must be nonnegative integers");
|
|
457
457
|
if (this.bestScore !== null && (!Number.isFinite(this.bestScore) || this.bestScore < 0 || this.bestScore > 1)) throw new Error("Score must be null or a number from zero to one");
|
|
458
|
-
return super.save();
|
|
458
|
+
return super.save(options);
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
|
-
__publicField$
|
|
462
|
-
__decorateClass$
|
|
463
|
-
__decorateClass$
|
|
464
|
-
__decorateClass$
|
|
465
|
-
__decorateClass$
|
|
466
|
-
__decorateClass$
|
|
461
|
+
__publicField$5(LessonProgress, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
462
|
+
__decorateClass$5([tenantId()], LessonProgress.prototype, "tenantId", 2);
|
|
463
|
+
__decorateClass$5([foreignKey("Enrollment", { required: true })], LessonProgress.prototype, "enrollmentId", 2);
|
|
464
|
+
__decorateClass$5([foreignKey("Learner", { required: true })], LessonProgress.prototype, "learnerId", 2);
|
|
465
|
+
__decorateClass$5([foreignKey("Lesson", { required: true })], LessonProgress.prototype, "lessonId", 2);
|
|
466
|
+
__decorateClass$5([field({
|
|
467
467
|
type: "decimal",
|
|
468
468
|
nullable: true
|
|
469
469
|
})], LessonProgress.prototype, "bestScore", 2);
|
|
470
|
-
LessonProgress = __decorateClass$
|
|
471
|
-
...closed$
|
|
470
|
+
LessonProgress = __decorateClass$5([TenantScoped({ mode: "required" }), smrt({
|
|
471
|
+
...closed$4,
|
|
472
472
|
tableName: "lesson_progress",
|
|
473
473
|
conflictColumns: [
|
|
474
474
|
"tenant_id",
|
|
@@ -478,21 +478,21 @@ LessonProgress = __decorateClass$4([TenantScoped({ mode: "required" }), smrt({
|
|
|
478
478
|
})], LessonProgress);
|
|
479
479
|
//#endregion
|
|
480
480
|
//#region src/lesson-assets.ts
|
|
481
|
-
var __defProp$
|
|
482
|
-
var __getOwnPropDesc$
|
|
483
|
-
var __defNormalProp$
|
|
481
|
+
var __defProp$4 = Object.defineProperty;
|
|
482
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
483
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, {
|
|
484
484
|
enumerable: true,
|
|
485
485
|
configurable: true,
|
|
486
486
|
writable: true,
|
|
487
487
|
value
|
|
488
488
|
}) : obj[key] = value;
|
|
489
|
-
var __decorateClass$
|
|
490
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
489
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
490
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
491
491
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
492
|
-
if (kind && result) __defProp$
|
|
492
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
493
493
|
return result;
|
|
494
494
|
};
|
|
495
|
-
var __publicField$
|
|
495
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
496
496
|
var LessonAsset = class extends SmrtObject {
|
|
497
497
|
tenantId = null;
|
|
498
498
|
lessonId = "";
|
|
@@ -503,7 +503,7 @@ var LessonAsset = class extends SmrtObject {
|
|
|
503
503
|
super(options);
|
|
504
504
|
for (const [key, value] of Object.entries(options)) if (Object.hasOwn(this, key)) this[key] = value;
|
|
505
505
|
}
|
|
506
|
-
async save() {
|
|
506
|
+
async save(options) {
|
|
507
507
|
const lesson = await this.db.get("lessons", { id: this.lessonId });
|
|
508
508
|
if (!lesson) throw new Error(`education lesson ${this.lessonId} does not exist`);
|
|
509
509
|
if (!await this.db.get("lessons", {
|
|
@@ -523,15 +523,15 @@ var LessonAsset = class extends SmrtObject {
|
|
|
523
523
|
const asset = await (await AssetCollection.create({ db: this.db })).get(this.assetId, { cache: false });
|
|
524
524
|
if (!this.tenantId || !asset || asset.tenantId !== this.tenantId || asset.accessMode !== "private" || !asset.ownerProfileId) throw new Error("Private lesson material requires an authorized private asset");
|
|
525
525
|
}
|
|
526
|
-
return await super.save();
|
|
526
|
+
return await super.save(options);
|
|
527
527
|
}
|
|
528
528
|
};
|
|
529
|
-
__publicField$
|
|
530
|
-
__decorateClass$
|
|
531
|
-
__decorateClass$
|
|
532
|
-
__decorateClass$
|
|
533
|
-
__decorateClass$
|
|
534
|
-
LessonAsset = __decorateClass$
|
|
529
|
+
__publicField$4(LessonAsset, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
530
|
+
__decorateClass$4([tenantId({ nullable: true })], LessonAsset.prototype, "tenantId", 2);
|
|
531
|
+
__decorateClass$4([foreignKey("Lesson", { required: true })], LessonAsset.prototype, "lessonId", 2);
|
|
532
|
+
__decorateClass$4([crossPackageRef("@happyvertical/smrt-assets:Asset", { required: true })], LessonAsset.prototype, "assetId", 2);
|
|
533
|
+
__decorateClass$4([field({ required: true })], LessonAsset.prototype, "relationship", 2);
|
|
534
|
+
LessonAsset = __decorateClass$4([TenantScoped({ mode: "optional" }), smrt({
|
|
535
535
|
tableName: "lesson_assets",
|
|
536
536
|
conflictColumns: [
|
|
537
537
|
"tenant_id",
|
|
@@ -545,22 +545,22 @@ LessonAsset = __decorateClass$3([TenantScoped({ mode: "optional" }), smrt({
|
|
|
545
545
|
})], LessonAsset);
|
|
546
546
|
//#endregion
|
|
547
547
|
//#region src/submissions.ts
|
|
548
|
-
var __defProp$
|
|
549
|
-
var __getOwnPropDesc$
|
|
550
|
-
var __defNormalProp$
|
|
548
|
+
var __defProp$3 = Object.defineProperty;
|
|
549
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
550
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
|
|
551
551
|
enumerable: true,
|
|
552
552
|
configurable: true,
|
|
553
553
|
writable: true,
|
|
554
554
|
value
|
|
555
555
|
}) : obj[key] = value;
|
|
556
|
-
var __decorateClass$
|
|
557
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
556
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
557
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
558
558
|
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
559
|
-
if (kind && result) __defProp$
|
|
559
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
560
560
|
return result;
|
|
561
561
|
};
|
|
562
|
-
var __publicField$
|
|
563
|
-
var closed$
|
|
562
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
563
|
+
var closed$3 = {
|
|
564
564
|
api: false,
|
|
565
565
|
mcp: false,
|
|
566
566
|
cli: false
|
|
@@ -618,7 +618,7 @@ var Submission = class extends SmrtObject {
|
|
|
618
618
|
super(options);
|
|
619
619
|
applyOptions(this, options);
|
|
620
620
|
}
|
|
621
|
-
async save() {
|
|
621
|
+
async save(options) {
|
|
622
622
|
await immutableIdentity(this, {
|
|
623
623
|
learner_id: this.learnerId,
|
|
624
624
|
lesson_id: this.lessonId,
|
|
@@ -647,23 +647,23 @@ var Submission = class extends SmrtObject {
|
|
|
647
647
|
learner_id: this.learnerId,
|
|
648
648
|
lesson_id: this.lessonId
|
|
649
649
|
})) throw new Error("Submission requires its tenant learner, lesson, and progress record");
|
|
650
|
-
return super.save();
|
|
650
|
+
return super.save(options);
|
|
651
651
|
}
|
|
652
652
|
};
|
|
653
|
-
__publicField$
|
|
654
|
-
__decorateClass$
|
|
655
|
-
__decorateClass$
|
|
656
|
-
__decorateClass$
|
|
657
|
-
__decorateClass$
|
|
658
|
-
__decorateClass$
|
|
659
|
-
__decorateClass$
|
|
660
|
-
__decorateClass$
|
|
653
|
+
__publicField$3(Submission, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
654
|
+
__decorateClass$3([tenantId()], Submission.prototype, "tenantId", 2);
|
|
655
|
+
__decorateClass$3([foreignKey("Learner", { required: true })], Submission.prototype, "learnerId", 2);
|
|
656
|
+
__decorateClass$3([foreignKey("Lesson", { required: true })], Submission.prototype, "lessonId", 2);
|
|
657
|
+
__decorateClass$3([foreignKey("LessonProgress", { required: true })], Submission.prototype, "progressId", 2);
|
|
658
|
+
__decorateClass$3([field({ required: true })], Submission.prototype, "kind", 2);
|
|
659
|
+
__decorateClass$3([foreignKey("Submission", { nullable: true })], Submission.prototype, "previousSubmissionId", 2);
|
|
660
|
+
__decorateClass$3([field({
|
|
661
661
|
type: "text",
|
|
662
662
|
nullable: true
|
|
663
663
|
})], Submission.prototype, "intakeItemId", 2);
|
|
664
|
-
Submission = __decorateClass$
|
|
664
|
+
Submission = __decorateClass$3([TenantScoped({ mode: "required" }), smrt({
|
|
665
665
|
tableStrategy: "sti",
|
|
666
|
-
...closed$
|
|
666
|
+
...closed$3
|
|
667
667
|
})], Submission);
|
|
668
668
|
var SubmissionIntakeBinding = class extends SmrtObject {
|
|
669
669
|
tenantId = "";
|
|
@@ -673,7 +673,7 @@ var SubmissionIntakeBinding = class extends SmrtObject {
|
|
|
673
673
|
super(options);
|
|
674
674
|
applyOptions(this, options);
|
|
675
675
|
}
|
|
676
|
-
async save() {
|
|
676
|
+
async save(options) {
|
|
677
677
|
if (!this.tenantId?.trim() || !this.intakeItemId?.trim()) throw new Error("Submission intake binding requires tenant and item");
|
|
678
678
|
if (this.intakeItemId.length > 200) throw new Error("Submission intake item id is invalid");
|
|
679
679
|
if (!await this.db.get("submissions", {
|
|
@@ -681,19 +681,19 @@ var SubmissionIntakeBinding = class extends SmrtObject {
|
|
|
681
681
|
tenant_id: this.tenantId,
|
|
682
682
|
intake_item_id: this.intakeItemId
|
|
683
683
|
})) throw new Error("Submission intake binding must match its submission");
|
|
684
|
-
return super.save();
|
|
684
|
+
return super.save(options);
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
|
-
__publicField$
|
|
688
|
-
__decorateClass$
|
|
689
|
-
__decorateClass$
|
|
687
|
+
__publicField$3(SubmissionIntakeBinding, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
688
|
+
__decorateClass$3([tenantId()], SubmissionIntakeBinding.prototype, "tenantId", 2);
|
|
689
|
+
__decorateClass$3([field({
|
|
690
690
|
required: true,
|
|
691
691
|
type: "text"
|
|
692
692
|
})], SubmissionIntakeBinding.prototype, "intakeItemId", 2);
|
|
693
|
-
__decorateClass$
|
|
694
|
-
SubmissionIntakeBinding = __decorateClass$
|
|
693
|
+
__decorateClass$3([foreignKey("Submission", { required: true })], SubmissionIntakeBinding.prototype, "submissionId", 2);
|
|
694
|
+
SubmissionIntakeBinding = __decorateClass$3([TenantScoped({ mode: "required" }), smrt({
|
|
695
695
|
tableName: "submission_intake_bindings",
|
|
696
|
-
...closed$
|
|
696
|
+
...closed$3,
|
|
697
697
|
conflictColumns: ["tenant_id", "intake_item_id"]
|
|
698
698
|
})], SubmissionIntakeBinding);
|
|
699
699
|
var ScannedSubmission = class extends Submission {
|
|
@@ -710,15 +710,15 @@ var ScannedSubmission = class extends Submission {
|
|
|
710
710
|
setExtracted(value) {
|
|
711
711
|
this.extracted = stringifyJsonObject(value, "Extracted answers");
|
|
712
712
|
}
|
|
713
|
-
async save() {
|
|
713
|
+
async save(options) {
|
|
714
714
|
requireNonnegativeInteger(this.pageCount, "Page count");
|
|
715
|
-
return super.save();
|
|
715
|
+
return super.save(options);
|
|
716
716
|
}
|
|
717
717
|
};
|
|
718
|
-
__publicField$
|
|
719
|
-
ScannedSubmission = __decorateClass$
|
|
718
|
+
__publicField$3(ScannedSubmission, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
719
|
+
ScannedSubmission = __decorateClass$3([smrt({
|
|
720
720
|
tableName: "submissions",
|
|
721
|
-
...closed$
|
|
721
|
+
...closed$3
|
|
722
722
|
})], ScannedSubmission);
|
|
723
723
|
var ExternalCompletion = class extends Submission {
|
|
724
724
|
reportedBy = "learner";
|
|
@@ -728,27 +728,27 @@ var ExternalCompletion = class extends Submission {
|
|
|
728
728
|
super(options);
|
|
729
729
|
applyOptions(this, options);
|
|
730
730
|
}
|
|
731
|
-
async save() {
|
|
731
|
+
async save(options) {
|
|
732
732
|
requireEnum(this.reportedBy, [
|
|
733
733
|
"learner",
|
|
734
734
|
"guardian",
|
|
735
735
|
"source"
|
|
736
736
|
]);
|
|
737
737
|
requireScore(this.reportedScore, "Reported score");
|
|
738
|
-
return super.save();
|
|
738
|
+
return super.save(options);
|
|
739
739
|
}
|
|
740
740
|
};
|
|
741
|
-
__publicField$
|
|
742
|
-
__decorateClass$
|
|
743
|
-
ExternalCompletion = __decorateClass$
|
|
741
|
+
__publicField$3(ExternalCompletion, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
742
|
+
__decorateClass$3([field({ type: "decimal" })], ExternalCompletion.prototype, "reportedScore", 2);
|
|
743
|
+
ExternalCompletion = __decorateClass$3([smrt({
|
|
744
744
|
tableName: "submissions",
|
|
745
|
-
...closed$
|
|
745
|
+
...closed$3
|
|
746
746
|
})], ExternalCompletion);
|
|
747
747
|
var Attestation = class extends Submission {};
|
|
748
|
-
__publicField$
|
|
749
|
-
Attestation = __decorateClass$
|
|
748
|
+
__publicField$3(Attestation, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
749
|
+
Attestation = __decorateClass$3([smrt({
|
|
750
750
|
tableName: "submissions",
|
|
751
|
-
...closed$
|
|
751
|
+
...closed$3
|
|
752
752
|
})], Attestation);
|
|
753
753
|
var SubmissionAsset = class extends SmrtObject {
|
|
754
754
|
tenantId = "";
|
|
@@ -760,7 +760,7 @@ var SubmissionAsset = class extends SmrtObject {
|
|
|
760
760
|
super(options);
|
|
761
761
|
applyOptions(this, options);
|
|
762
762
|
}
|
|
763
|
-
async save() {
|
|
763
|
+
async save(options) {
|
|
764
764
|
await immutableIdentity(this, {
|
|
765
765
|
submission_id: this.submissionId,
|
|
766
766
|
asset_id: this.assetId,
|
|
@@ -782,15 +782,15 @@ var SubmissionAsset = class extends SmrtObject {
|
|
|
782
782
|
tenant_id: this.tenantId,
|
|
783
783
|
profile_id: asset.owner_profile_id
|
|
784
784
|
})) throw new Error("Submission assets must be owned by the learner profile");
|
|
785
|
-
return super.save();
|
|
785
|
+
return super.save(options);
|
|
786
786
|
}
|
|
787
787
|
};
|
|
788
|
-
__publicField$
|
|
789
|
-
__decorateClass$
|
|
790
|
-
__decorateClass$
|
|
791
|
-
__decorateClass$
|
|
792
|
-
__decorateClass$
|
|
793
|
-
SubmissionAsset = __decorateClass$
|
|
788
|
+
__publicField$3(SubmissionAsset, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
789
|
+
__decorateClass$3([tenantId()], SubmissionAsset.prototype, "tenantId", 2);
|
|
790
|
+
__decorateClass$3([foreignKey("Submission", { required: true })], SubmissionAsset.prototype, "submissionId", 2);
|
|
791
|
+
__decorateClass$3([crossPackageRef("@happyvertical/smrt-assets:Asset", { required: true })], SubmissionAsset.prototype, "assetId", 2);
|
|
792
|
+
__decorateClass$3([field({ required: true })], SubmissionAsset.prototype, "relationship", 2);
|
|
793
|
+
SubmissionAsset = __decorateClass$3([TenantScoped({ mode: "required" }), smrt({
|
|
794
794
|
tableName: "submission_assets",
|
|
795
795
|
conflictColumns: [
|
|
796
796
|
"tenant_id",
|
|
@@ -798,7 +798,7 @@ SubmissionAsset = __decorateClass$2([TenantScoped({ mode: "required" }), smrt({
|
|
|
798
798
|
"asset_id",
|
|
799
799
|
"relationship"
|
|
800
800
|
],
|
|
801
|
-
...closed$
|
|
801
|
+
...closed$3
|
|
802
802
|
})], SubmissionAsset);
|
|
803
803
|
var Grade = class extends SmrtObject {
|
|
804
804
|
tenantId = "";
|
|
@@ -821,7 +821,7 @@ var Grade = class extends SmrtObject {
|
|
|
821
821
|
setRubricResults(value) {
|
|
822
822
|
this.rubricResults = stringifyJsonObject(value, "Rubric results");
|
|
823
823
|
}
|
|
824
|
-
async save() {
|
|
824
|
+
async save(options) {
|
|
825
825
|
await immutableIdentity(this, { submission_id: this.submissionId });
|
|
826
826
|
requireEnum(this.graderKind, [
|
|
827
827
|
"auto",
|
|
@@ -836,27 +836,27 @@ var Grade = class extends SmrtObject {
|
|
|
836
836
|
requireScore(this.score, "Score");
|
|
837
837
|
for (const [value, label] of [[this.pointsEarned, "Points earned"], [this.pointsPossible, "Points possible"]]) if (value !== null) requireNonnegativeInteger(value, label);
|
|
838
838
|
if (this.pointsEarned !== null && this.pointsPossible !== null && this.pointsEarned > this.pointsPossible) throw new Error("Points earned cannot exceed points possible");
|
|
839
|
-
return super.save();
|
|
839
|
+
return super.save(options);
|
|
840
840
|
}
|
|
841
841
|
};
|
|
842
|
-
__publicField$
|
|
843
|
-
__decorateClass$
|
|
844
|
-
__decorateClass$
|
|
845
|
-
__decorateClass$
|
|
846
|
-
__decorateClass$
|
|
847
|
-
__decorateClass$
|
|
842
|
+
__publicField$3(Grade, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
843
|
+
__decorateClass$3([tenantId()], Grade.prototype, "tenantId", 2);
|
|
844
|
+
__decorateClass$3([foreignKey("Submission", { required: true })], Grade.prototype, "submissionId", 2);
|
|
845
|
+
__decorateClass$3([field({ required: true })], Grade.prototype, "graderKind", 2);
|
|
846
|
+
__decorateClass$3([crossPackageRef("@happyvertical/smrt-profiles:Profile", { nullable: true })], Grade.prototype, "graderProfileId", 2);
|
|
847
|
+
__decorateClass$3([field({
|
|
848
848
|
type: "decimal",
|
|
849
849
|
nullable: true
|
|
850
850
|
})], Grade.prototype, "score", 2);
|
|
851
|
-
__decorateClass$
|
|
851
|
+
__decorateClass$3([field({
|
|
852
852
|
type: "integer",
|
|
853
853
|
nullable: true
|
|
854
854
|
})], Grade.prototype, "pointsEarned", 2);
|
|
855
|
-
__decorateClass$
|
|
855
|
+
__decorateClass$3([field({
|
|
856
856
|
type: "integer",
|
|
857
857
|
nullable: true
|
|
858
858
|
})], Grade.prototype, "pointsPossible", 2);
|
|
859
|
-
Grade = __decorateClass$
|
|
859
|
+
Grade = __decorateClass$3([TenantScoped({ mode: "required" }), smrt({ ...closed$3 })], Grade);
|
|
860
860
|
//#endregion
|
|
861
861
|
//#region src/collections.ts
|
|
862
862
|
var CourseCollection = class extends SmrtCollection {
|
|
@@ -1053,6 +1053,169 @@ var CatalogService = class {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
};
|
|
1055
1055
|
//#endregion
|
|
1056
|
+
//#region src/family-intake-contracts.ts
|
|
1057
|
+
function familyIntakeScopeId(tenantId) {
|
|
1058
|
+
return `family-intake:${tenantId}`;
|
|
1059
|
+
}
|
|
1060
|
+
//#endregion
|
|
1061
|
+
//#region src/family-intake-models.ts
|
|
1062
|
+
var __defProp$2 = Object.defineProperty;
|
|
1063
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
1064
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
1065
|
+
enumerable: true,
|
|
1066
|
+
configurable: true,
|
|
1067
|
+
writable: true,
|
|
1068
|
+
value
|
|
1069
|
+
}) : obj[key] = value;
|
|
1070
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
1071
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
1072
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--) if (decorator = decorators[i]) result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1073
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
1074
|
+
return result;
|
|
1075
|
+
};
|
|
1076
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1077
|
+
var closed$2 = {
|
|
1078
|
+
api: false,
|
|
1079
|
+
mcp: false,
|
|
1080
|
+
cli: false
|
|
1081
|
+
};
|
|
1082
|
+
async function immutable(row) {
|
|
1083
|
+
if (!row.tenantId || row.id && await row.db.get(row.tableName, { id: row.id })) throw new Error("Family intake history is immutable");
|
|
1084
|
+
}
|
|
1085
|
+
function noDelete() {
|
|
1086
|
+
throw new Error("Family originals require an owning retention operation");
|
|
1087
|
+
}
|
|
1088
|
+
var FamilyIntake = class extends SmrtObject {
|
|
1089
|
+
tenantId = "";
|
|
1090
|
+
itemId = "";
|
|
1091
|
+
actorUserId = "";
|
|
1092
|
+
ownerProfileId = "";
|
|
1093
|
+
contentDigest = "";
|
|
1094
|
+
sourceJson = "{}";
|
|
1095
|
+
constructor(options = {}) {
|
|
1096
|
+
super(options);
|
|
1097
|
+
Object.assign(this, Object.fromEntries(Object.entries(options).filter(([k]) => Object.hasOwn(this, k))));
|
|
1098
|
+
}
|
|
1099
|
+
async save(options) {
|
|
1100
|
+
await immutable(this);
|
|
1101
|
+
return super.save(options);
|
|
1102
|
+
}
|
|
1103
|
+
async delete() {
|
|
1104
|
+
noDelete();
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
__publicField$2(FamilyIntake, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
1108
|
+
__decorateClass$2([tenantId()], FamilyIntake.prototype, "tenantId", 2);
|
|
1109
|
+
__decorateClass$2([crossPackageRef("@happyvertical/smrt-profiles:Profile")], FamilyIntake.prototype, "ownerProfileId", 2);
|
|
1110
|
+
__decorateClass$2([field({ type: "text" })], FamilyIntake.prototype, "sourceJson", 2);
|
|
1111
|
+
FamilyIntake = __decorateClass$2([TenantScoped({ mode: "required" }), smrt({
|
|
1112
|
+
tableName: "family_intakes",
|
|
1113
|
+
conflictColumns: ["tenant_id", "item_id"],
|
|
1114
|
+
...closed$2
|
|
1115
|
+
})], FamilyIntake);
|
|
1116
|
+
var FamilyIntakeCollection = class extends SmrtCollection {
|
|
1117
|
+
static _itemClass = FamilyIntake;
|
|
1118
|
+
};
|
|
1119
|
+
var FamilyIntakeAsset = class extends SmrtObject {
|
|
1120
|
+
tenantId = "";
|
|
1121
|
+
intakeId = "";
|
|
1122
|
+
assetId = "";
|
|
1123
|
+
name = "";
|
|
1124
|
+
mimeType = "";
|
|
1125
|
+
sha256 = "";
|
|
1126
|
+
position = 0;
|
|
1127
|
+
constructor(options = {}) {
|
|
1128
|
+
super(options);
|
|
1129
|
+
Object.assign(this, Object.fromEntries(Object.entries(options).filter(([k]) => Object.hasOwn(this, k))));
|
|
1130
|
+
}
|
|
1131
|
+
async save(options) {
|
|
1132
|
+
await immutable(this);
|
|
1133
|
+
const parent = await this.db.get("family_intakes", {
|
|
1134
|
+
id: this.intakeId,
|
|
1135
|
+
tenant_id: this.tenantId
|
|
1136
|
+
});
|
|
1137
|
+
if (!parent || !await this.db.get("assets", {
|
|
1138
|
+
id: this.assetId,
|
|
1139
|
+
tenant_id: this.tenantId,
|
|
1140
|
+
owner_profile_id: parent.owner_profile_id,
|
|
1141
|
+
access_mode: "private"
|
|
1142
|
+
})) throw new Error("Family original ownership mismatch");
|
|
1143
|
+
return super.save(options);
|
|
1144
|
+
}
|
|
1145
|
+
async delete() {
|
|
1146
|
+
noDelete();
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
__publicField$2(FamilyIntakeAsset, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
1150
|
+
__decorateClass$2([tenantId()], FamilyIntakeAsset.prototype, "tenantId", 2);
|
|
1151
|
+
__decorateClass$2([foreignKey("FamilyIntake", { required: true })], FamilyIntakeAsset.prototype, "intakeId", 2);
|
|
1152
|
+
__decorateClass$2([crossPackageRef("@happyvertical/smrt-assets:Asset")], FamilyIntakeAsset.prototype, "assetId", 2);
|
|
1153
|
+
FamilyIntakeAsset = __decorateClass$2([TenantScoped({ mode: "required" }), smrt({
|
|
1154
|
+
tableName: "family_intake_assets",
|
|
1155
|
+
conflictColumns: [
|
|
1156
|
+
"tenant_id",
|
|
1157
|
+
"intake_id",
|
|
1158
|
+
"asset_id"
|
|
1159
|
+
],
|
|
1160
|
+
...closed$2
|
|
1161
|
+
})], FamilyIntakeAsset);
|
|
1162
|
+
var FamilyIntakeAssetCollection = class extends SmrtCollection {
|
|
1163
|
+
static _itemClass = FamilyIntakeAsset;
|
|
1164
|
+
};
|
|
1165
|
+
var FamilyIntakeDecision = class extends SmrtObject {
|
|
1166
|
+
tenantId = "";
|
|
1167
|
+
intakeId = "";
|
|
1168
|
+
requestKey = "";
|
|
1169
|
+
sequence = 0;
|
|
1170
|
+
actorUserId = "";
|
|
1171
|
+
bodyJson = "{}";
|
|
1172
|
+
constructor(options = {}) {
|
|
1173
|
+
super(options);
|
|
1174
|
+
Object.assign(this, Object.fromEntries(Object.entries(options).filter(([k]) => Object.hasOwn(this, k))));
|
|
1175
|
+
}
|
|
1176
|
+
async save(options) {
|
|
1177
|
+
await immutable(this);
|
|
1178
|
+
if (!await this.db.get("family_intakes", {
|
|
1179
|
+
id: this.intakeId,
|
|
1180
|
+
tenant_id: this.tenantId
|
|
1181
|
+
})) throw new Error("Family decision ownership mismatch");
|
|
1182
|
+
return super.save(options);
|
|
1183
|
+
}
|
|
1184
|
+
async delete() {
|
|
1185
|
+
noDelete();
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
__publicField$2(FamilyIntakeDecision, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
1189
|
+
__decorateClass$2([tenantId()], FamilyIntakeDecision.prototype, "tenantId", 2);
|
|
1190
|
+
__decorateClass$2([foreignKey("FamilyIntake", { required: true })], FamilyIntakeDecision.prototype, "intakeId", 2);
|
|
1191
|
+
__decorateClass$2([field({ type: "text" })], FamilyIntakeDecision.prototype, "bodyJson", 2);
|
|
1192
|
+
FamilyIntakeDecision = __decorateClass$2([TenantScoped({ mode: "required" }), smrt({
|
|
1193
|
+
tableName: "family_intake_decisions",
|
|
1194
|
+
conflictColumns: [
|
|
1195
|
+
"tenant_id",
|
|
1196
|
+
"intake_id",
|
|
1197
|
+
"request_key"
|
|
1198
|
+
],
|
|
1199
|
+
...closed$2
|
|
1200
|
+
})], FamilyIntakeDecision);
|
|
1201
|
+
var FamilyIntakeDecisionCollection = class extends SmrtCollection {
|
|
1202
|
+
static _itemClass = FamilyIntakeDecision;
|
|
1203
|
+
};
|
|
1204
|
+
async function familyAdoptionOwner(db, photo) {
|
|
1205
|
+
const family = await db.get("family_intakes", {
|
|
1206
|
+
id: photo.family_intake_id,
|
|
1207
|
+
tenant_id: photo.tenant_id,
|
|
1208
|
+
item_id: photo.item_id,
|
|
1209
|
+
actor_user_id: photo.actor_user_id
|
|
1210
|
+
});
|
|
1211
|
+
if (!family) throw new Error("Family adoption receipt mismatch");
|
|
1212
|
+
if (!(await db.query("SELECT body_json FROM family_intake_decisions WHERE tenant_id=? AND intake_id=?", [photo.tenant_id, photo.family_intake_id])).rows.some((row) => {
|
|
1213
|
+
const body = JSON.parse(String(row.body_json));
|
|
1214
|
+
return body.kind === "adopt" && body.learnerId === photo.learner_id && body.photoIntakeId === photo.id;
|
|
1215
|
+
})) throw new Error("Family adoption decision mismatch");
|
|
1216
|
+
return String(family.owner_profile_id);
|
|
1217
|
+
}
|
|
1218
|
+
//#endregion
|
|
1056
1219
|
//#region src/workbook-contracts.ts
|
|
1057
1220
|
var WorkbookAssessmentValidationError = class extends Error {
|
|
1058
1221
|
constructor(message, reason = "invalid_assessment") {
|
|
@@ -1235,7 +1398,7 @@ var Workbook = class extends SmrtObject {
|
|
|
1235
1398
|
super(options);
|
|
1236
1399
|
optionsFor(this, options);
|
|
1237
1400
|
}
|
|
1238
|
-
async save() {
|
|
1401
|
+
async save(options) {
|
|
1239
1402
|
if (!this.tenantId.trim()) throw new Error("Workbook requires tenant");
|
|
1240
1403
|
if (!await this.db.get("learners", {
|
|
1241
1404
|
id: this.learnerId,
|
|
@@ -1250,7 +1413,7 @@ var Workbook = class extends SmrtObject {
|
|
|
1250
1413
|
edition: this.edition
|
|
1251
1414
|
})) throw new Error("Workbook identity cannot change");
|
|
1252
1415
|
if (typeof this.reviewRequired !== "boolean" || !Number.isSafeInteger(this.policyVersion) || this.policyVersion < 1) throw new Error("Invalid workbook policy");
|
|
1253
|
-
return super.save();
|
|
1416
|
+
return super.save(options);
|
|
1254
1417
|
}
|
|
1255
1418
|
};
|
|
1256
1419
|
__publicField$1(Workbook, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -1285,7 +1448,7 @@ var WorkbookActivity = class extends SmrtObject {
|
|
|
1285
1448
|
async delete() {
|
|
1286
1449
|
throw new Error("Workbook history is immutable; deliberate family deletion requires an owning retention operation");
|
|
1287
1450
|
}
|
|
1288
|
-
async save() {
|
|
1451
|
+
async save(options) {
|
|
1289
1452
|
if (!this.tenantId.trim()) throw new Error("Workbook requires tenant");
|
|
1290
1453
|
if (this.id && await this.db.get(this.tableName, { id: this.id })) throw new Error("Workbook history is immutable");
|
|
1291
1454
|
if (!["identified", "unfiled"].includes(this.captureKind)) throw new Error("Invalid workbook capture kind");
|
|
@@ -1331,7 +1494,7 @@ var WorkbookActivity = class extends SmrtObject {
|
|
|
1331
1494
|
source_ref: this.photoIntakeId
|
|
1332
1495
|
})) throw new Error("Unfiled work requires exact private technical routing");
|
|
1333
1496
|
}
|
|
1334
|
-
return super.save();
|
|
1497
|
+
return super.save(options);
|
|
1335
1498
|
}
|
|
1336
1499
|
};
|
|
1337
1500
|
__publicField$1(WorkbookActivity, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -1376,7 +1539,7 @@ var WorkbookWorkFiling = class extends SmrtObject {
|
|
|
1376
1539
|
async delete() {
|
|
1377
1540
|
throw new Error("Workbook history is immutable");
|
|
1378
1541
|
}
|
|
1379
|
-
async save() {
|
|
1542
|
+
async save(options) {
|
|
1380
1543
|
if (this.id && await this.db.get(this.tableName, { id: this.id })) throw new Error("Workbook history is immutable");
|
|
1381
1544
|
const owner = {
|
|
1382
1545
|
tenant_id: this.tenantId,
|
|
@@ -1407,7 +1570,7 @@ var WorkbookWorkFiling = class extends SmrtObject {
|
|
|
1407
1570
|
source_activity_id: this.sourceActivityId,
|
|
1408
1571
|
previous_revision_id: this.previousRevisionId
|
|
1409
1572
|
})) throw new Error("Workbook filing predecessor already superseded");
|
|
1410
|
-
return super.save();
|
|
1573
|
+
return super.save(options);
|
|
1411
1574
|
}
|
|
1412
1575
|
};
|
|
1413
1576
|
__publicField$1(WorkbookWorkFiling, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -1449,7 +1612,7 @@ var WorkbookAttempt = class extends SmrtObject {
|
|
|
1449
1612
|
async delete() {
|
|
1450
1613
|
throw new Error("Workbook history is immutable; deliberate family deletion requires an owning retention operation");
|
|
1451
1614
|
}
|
|
1452
|
-
async save() {
|
|
1615
|
+
async save(options) {
|
|
1453
1616
|
if (!this.tenantId.trim()) throw new Error("Workbook requires tenant");
|
|
1454
1617
|
if (this.id && await this.db.get(this.tableName, { id: this.id })) throw new Error("Workbook history is immutable");
|
|
1455
1618
|
if (!await this.db.get("workbook_activities", {
|
|
@@ -1481,7 +1644,7 @@ var WorkbookAttempt = class extends SmrtObject {
|
|
|
1481
1644
|
"assisted",
|
|
1482
1645
|
"unknown"
|
|
1483
1646
|
].includes(this.assistance)) throw new Error("Invalid assistance");
|
|
1484
|
-
return super.save();
|
|
1647
|
+
return super.save(options);
|
|
1485
1648
|
}
|
|
1486
1649
|
};
|
|
1487
1650
|
__publicField$1(WorkbookAttempt, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -1519,7 +1682,7 @@ var WorkbookAssessmentRevision = class extends SmrtObject {
|
|
|
1519
1682
|
async delete() {
|
|
1520
1683
|
throw new Error("Workbook history is immutable; deliberate family deletion requires an owning retention operation");
|
|
1521
1684
|
}
|
|
1522
|
-
async save() {
|
|
1685
|
+
async save(options) {
|
|
1523
1686
|
if (!this.tenantId.trim()) throw new Error("Workbook requires tenant");
|
|
1524
1687
|
if (this.id && await this.db.get(this.tableName, { id: this.id })) throw new Error("Workbook history is immutable");
|
|
1525
1688
|
validateWorkbookAssessment(JSON.parse(this.assessmentJson));
|
|
@@ -1535,7 +1698,7 @@ var WorkbookAssessmentRevision = class extends SmrtObject {
|
|
|
1535
1698
|
attempt_id: this.attemptId
|
|
1536
1699
|
})) throw new Error("Workbook reviewed source mismatch");
|
|
1537
1700
|
if (!["ai", "guardian"].includes(this.kind)) throw new Error("Invalid revision kind");
|
|
1538
|
-
return super.save();
|
|
1701
|
+
return super.save(options);
|
|
1539
1702
|
}
|
|
1540
1703
|
};
|
|
1541
1704
|
__publicField$1(WorkbookAssessmentRevision, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -1573,7 +1736,7 @@ var WorkbookFeedbackRelease = class extends SmrtObject {
|
|
|
1573
1736
|
async delete() {
|
|
1574
1737
|
throw new Error("Workbook history is immutable; deliberate family deletion requires an owning retention operation");
|
|
1575
1738
|
}
|
|
1576
|
-
async save() {
|
|
1739
|
+
async save(options) {
|
|
1577
1740
|
if (!this.tenantId.trim()) throw new Error("Workbook requires tenant");
|
|
1578
1741
|
if (this.id && await this.db.get(this.tableName, { id: this.id })) throw new Error("Workbook history is immutable");
|
|
1579
1742
|
if (!await this.db.get("workbook_attempts", {
|
|
@@ -1587,7 +1750,7 @@ var WorkbookFeedbackRelease = class extends SmrtObject {
|
|
|
1587
1750
|
learner_id: this.learnerId,
|
|
1588
1751
|
attempt_id: this.attemptId
|
|
1589
1752
|
})) throw new Error("Workbook release revision mismatch");
|
|
1590
|
-
return super.save();
|
|
1753
|
+
return super.save(options);
|
|
1591
1754
|
}
|
|
1592
1755
|
};
|
|
1593
1756
|
__publicField$1(WorkbookFeedbackRelease, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -1620,7 +1783,7 @@ var WorkbookFeedbackDelivery = class extends SmrtObject {
|
|
|
1620
1783
|
super(options);
|
|
1621
1784
|
optionsFor(this, options);
|
|
1622
1785
|
}
|
|
1623
|
-
async save() {
|
|
1786
|
+
async save(options) {
|
|
1624
1787
|
if (this.id && await this.db.get(this.tableName, { id: this.id })) throw new Error("Workbook delivery history is immutable");
|
|
1625
1788
|
if (!await this.db.get("workbook_assessment_revisions", {
|
|
1626
1789
|
id: this.revisionId,
|
|
@@ -1633,7 +1796,7 @@ var WorkbookFeedbackDelivery = class extends SmrtObject {
|
|
|
1633
1796
|
tenant_id: this.tenantId,
|
|
1634
1797
|
user_id: this.actorUserId
|
|
1635
1798
|
})) throw new Error("Workbook delivery must name own learner");
|
|
1636
|
-
return super.save();
|
|
1799
|
+
return super.save(options);
|
|
1637
1800
|
}
|
|
1638
1801
|
async delete() {
|
|
1639
1802
|
throw new Error("Workbook delivery history is immutable");
|
|
@@ -1813,8 +1976,12 @@ var LearnerService = class LearnerService {
|
|
|
1813
1976
|
this.writeTail = result.then(() => void 0, () => void 0);
|
|
1814
1977
|
return result;
|
|
1815
1978
|
}
|
|
1816
|
-
|
|
1979
|
+
/** Prevent escaped transaction-scoped services from using a released executor. */
|
|
1980
|
+
assertServiceOpen() {
|
|
1817
1981
|
if (this.transactionState === "aborting" || this.transactionState === "closed") throw new Error("Learner transaction scope is closed");
|
|
1982
|
+
}
|
|
1983
|
+
async requireActor(request, action) {
|
|
1984
|
+
this.assertServiceOpen();
|
|
1818
1985
|
const context = getCurrentTenant();
|
|
1819
1986
|
if (!context || !request.tenantId || !request.actorUserId || !request.learnerId || context.tenantId !== request.tenantId || context.userId !== request.actorUserId || context.superAdminBypass) throw new LearnerAuthorizationError();
|
|
1820
1987
|
const learner = await (await LearnerCollection.create({ db: this.db })).get({
|
|
@@ -25630,12 +25797,27 @@ var WorkbookPhotoIntake = class extends SmrtObject {
|
|
|
25630
25797
|
async delete() {
|
|
25631
25798
|
denyHistoryDeletion();
|
|
25632
25799
|
}
|
|
25800
|
+
familyIntakeId = null;
|
|
25633
25801
|
itemId = "";
|
|
25634
25802
|
actorUserId = "";
|
|
25635
25803
|
contentDigest = "";
|
|
25636
|
-
async save() {
|
|
25804
|
+
async save(options) {
|
|
25637
25805
|
await assertPhotoHistory(this);
|
|
25638
|
-
|
|
25806
|
+
if (this.familyIntakeId && !await this.db.get("family_intakes", {
|
|
25807
|
+
id: this.familyIntakeId,
|
|
25808
|
+
tenant_id: this.tenantId,
|
|
25809
|
+
item_id: this.itemId,
|
|
25810
|
+
actor_user_id: this.actorUserId
|
|
25811
|
+
})) throw new Error("Family adoption receipt mismatch");
|
|
25812
|
+
if (this.familyIntakeId) await familyAdoptionOwner(this.db, {
|
|
25813
|
+
id: String(this.id),
|
|
25814
|
+
tenant_id: this.tenantId,
|
|
25815
|
+
learner_id: this.learnerId,
|
|
25816
|
+
item_id: this.itemId,
|
|
25817
|
+
family_intake_id: this.familyIntakeId,
|
|
25818
|
+
actor_user_id: this.actorUserId
|
|
25819
|
+
});
|
|
25820
|
+
return super.save(options);
|
|
25639
25821
|
}
|
|
25640
25822
|
constructor(options = {}) {
|
|
25641
25823
|
super(options);
|
|
@@ -25645,6 +25827,7 @@ var WorkbookPhotoIntake = class extends SmrtObject {
|
|
|
25645
25827
|
__publicField(WorkbookPhotoIntake, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
25646
25828
|
__decorateClass([tenantId()], WorkbookPhotoIntake.prototype, "tenantId", 2);
|
|
25647
25829
|
__decorateClass([foreignKey("Learner", { required: true })], WorkbookPhotoIntake.prototype, "learnerId", 2);
|
|
25830
|
+
__decorateClass([foreignKey("FamilyIntake")], WorkbookPhotoIntake.prototype, "familyIntakeId", 2);
|
|
25648
25831
|
WorkbookPhotoIntake = __decorateClass([TenantScoped({ mode: "required" }), smrt({
|
|
25649
25832
|
tableName: "workbook_photo_intakes",
|
|
25650
25833
|
conflictColumns: ["tenant_id", "item_id"],
|
|
@@ -25669,7 +25852,7 @@ var WorkbookPhotoAsset = class extends SmrtObject {
|
|
|
25669
25852
|
super(options);
|
|
25670
25853
|
Object.assign(this, Object.fromEntries(Object.entries(options).filter(([key]) => Object.hasOwn(this, key))));
|
|
25671
25854
|
}
|
|
25672
|
-
async save() {
|
|
25855
|
+
async save(options) {
|
|
25673
25856
|
await assertPhotoHistory(this);
|
|
25674
25857
|
if (!await this.db.get("workbook_photo_intakes", {
|
|
25675
25858
|
id: this.intakeId,
|
|
@@ -25680,13 +25863,32 @@ var WorkbookPhotoAsset = class extends SmrtObject {
|
|
|
25680
25863
|
id: this.learnerId,
|
|
25681
25864
|
tenant_id: this.tenantId
|
|
25682
25865
|
});
|
|
25683
|
-
|
|
25866
|
+
const photo = await this.db.get("workbook_photo_intakes", {
|
|
25867
|
+
id: this.intakeId,
|
|
25868
|
+
tenant_id: this.tenantId,
|
|
25869
|
+
learner_id: this.learnerId
|
|
25870
|
+
});
|
|
25871
|
+
const family = photo?.family_intake_id ? await this.db.get("family_intakes", {
|
|
25872
|
+
id: photo.family_intake_id,
|
|
25873
|
+
tenant_id: this.tenantId,
|
|
25874
|
+
item_id: photo.item_id
|
|
25875
|
+
}) : null;
|
|
25876
|
+
if (family) await familyAdoptionOwner(this.db, photo);
|
|
25877
|
+
const borrowed = family && await this.db.get("family_intake_assets", {
|
|
25878
|
+
intake_id: family.id,
|
|
25879
|
+
tenant_id: this.tenantId,
|
|
25880
|
+
asset_id: this.assetId,
|
|
25881
|
+
sha256: this.sha256,
|
|
25882
|
+
name: this.name,
|
|
25883
|
+
mime_type: this.mimeType
|
|
25884
|
+
});
|
|
25885
|
+
if (!learner || photo?.family_intake_id && !borrowed || !await this.db.get("assets", {
|
|
25684
25886
|
id: this.assetId,
|
|
25685
25887
|
tenant_id: this.tenantId,
|
|
25686
|
-
owner_profile_id: learner.profile_id,
|
|
25888
|
+
owner_profile_id: family ? family.owner_profile_id : learner.profile_id,
|
|
25687
25889
|
access_mode: "private"
|
|
25688
25890
|
})) throw new Error("Photo original must be an owned private asset");
|
|
25689
|
-
return super.save();
|
|
25891
|
+
return super.save(options);
|
|
25690
25892
|
}
|
|
25691
25893
|
};
|
|
25692
25894
|
__publicField(WorkbookPhotoAsset, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -25721,14 +25923,14 @@ var WorkbookPhotoDecision = class extends SmrtObject {
|
|
|
25721
25923
|
super(options);
|
|
25722
25924
|
Object.assign(this, Object.fromEntries(Object.entries(options).filter(([key]) => Object.hasOwn(this, key))));
|
|
25723
25925
|
}
|
|
25724
|
-
async save() {
|
|
25926
|
+
async save(options) {
|
|
25725
25927
|
await assertPhotoHistory(this);
|
|
25726
25928
|
if (!await this.db.get("workbook_photo_intakes", {
|
|
25727
25929
|
id: this.intakeId,
|
|
25728
25930
|
tenant_id: this.tenantId,
|
|
25729
25931
|
learner_id: this.learnerId
|
|
25730
25932
|
})) throw new Error("Photo decision ownership mismatch");
|
|
25731
|
-
return super.save();
|
|
25933
|
+
return super.save(options);
|
|
25732
25934
|
}
|
|
25733
25935
|
};
|
|
25734
25936
|
__publicField(WorkbookPhotoDecision, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -25761,7 +25963,7 @@ var WorkbookContextRevision = class extends SmrtObject {
|
|
|
25761
25963
|
super(options);
|
|
25762
25964
|
Object.assign(this, Object.fromEntries(Object.entries(options).filter(([key]) => Object.hasOwn(this, key))));
|
|
25763
25965
|
}
|
|
25764
|
-
async save() {
|
|
25966
|
+
async save(options) {
|
|
25765
25967
|
await assertPhotoHistory(this);
|
|
25766
25968
|
if (!await this.db.get("workbooks", {
|
|
25767
25969
|
id: this.workbookId,
|
|
@@ -25773,7 +25975,7 @@ var WorkbookContextRevision = class extends SmrtObject {
|
|
|
25773
25975
|
tenant_id: this.tenantId,
|
|
25774
25976
|
learner_id: this.learnerId
|
|
25775
25977
|
})) throw new Error("Workbook context decision ownership mismatch");
|
|
25776
|
-
return super.save();
|
|
25978
|
+
return super.save(options);
|
|
25777
25979
|
}
|
|
25778
25980
|
};
|
|
25779
25981
|
__publicField(WorkbookContextRevision, "__smrtPackage__", "@happyvertical/smrt-education");
|
|
@@ -26928,6 +27130,28 @@ var WorkbookPhotoService = class WorkbookPhotoService extends WorkbookService {
|
|
|
26928
27130
|
createTransactionService(db) {
|
|
26929
27131
|
return new WorkbookPhotoService(db, this.authorize, this.authorizeCatalog, this.photoOptions);
|
|
26930
27132
|
}
|
|
27133
|
+
/** Only an exact adopted receipt can bridge its immutable family source scope. */
|
|
27134
|
+
async assertWorkbookPhotoScope(request, scope, itemId) {
|
|
27135
|
+
if (scope.tenantId !== request.tenantId || scope.actorId !== request.actorUserId) throw new LearnerAuthorizationError();
|
|
27136
|
+
if (scope.confidentialScopeId === request.learnerId) return;
|
|
27137
|
+
if (scope.confidentialScopeId !== `family-intake:${request.tenantId}`) throw new LearnerAuthorizationError();
|
|
27138
|
+
const view = await this.getWorkbookPhotoIntakeByItem({
|
|
27139
|
+
...request,
|
|
27140
|
+
itemId
|
|
27141
|
+
});
|
|
27142
|
+
const photo = await this.db.get("workbook_photo_intakes", {
|
|
27143
|
+
id: view.id,
|
|
27144
|
+
tenant_id: request.tenantId,
|
|
27145
|
+
learner_id: request.learnerId,
|
|
27146
|
+
item_id: itemId
|
|
27147
|
+
});
|
|
27148
|
+
if (!photo?.family_intake_id || !await this.db.get("family_intakes", {
|
|
27149
|
+
id: photo.family_intake_id,
|
|
27150
|
+
tenant_id: request.tenantId,
|
|
27151
|
+
item_id: itemId
|
|
27152
|
+
})) throw new LearnerAuthorizationError();
|
|
27153
|
+
await familyAdoptionOwner(this.db, photo);
|
|
27154
|
+
}
|
|
26931
27155
|
async authorizePhotoIntake(request) {
|
|
26932
27156
|
await this.requireActor(request, "education.learner.submit");
|
|
26933
27157
|
}
|
|
@@ -27156,18 +27380,40 @@ var WorkbookPhotoService = class WorkbookPhotoService extends WorkbookService {
|
|
|
27156
27380
|
async readWorkbookPhotoOriginal(request) {
|
|
27157
27381
|
const original = (await this.getWorkbookPhotoIntake(request)).originals.find((o) => o.assetId === request.assetId);
|
|
27158
27382
|
if (!original) throw new LearnerAuthorizationError();
|
|
27159
|
-
|
|
27383
|
+
let ownerProfileId = (await this.requireActor(request, "education.learner.read")).profileId;
|
|
27384
|
+
const photo = await this.db.get("workbook_photo_intakes", {
|
|
27385
|
+
id: request.intakeId,
|
|
27386
|
+
tenant_id: request.tenantId,
|
|
27387
|
+
learner_id: request.learnerId
|
|
27388
|
+
});
|
|
27389
|
+
if (photo?.family_intake_id) {
|
|
27390
|
+
await familyAdoptionOwner(this.db, photo);
|
|
27391
|
+
const family = await this.db.get("family_intakes", {
|
|
27392
|
+
id: photo.family_intake_id,
|
|
27393
|
+
tenant_id: request.tenantId,
|
|
27394
|
+
item_id: photo.item_id
|
|
27395
|
+
});
|
|
27396
|
+
if (!family || !await this.db.get("family_intake_assets", {
|
|
27397
|
+
tenant_id: request.tenantId,
|
|
27398
|
+
intake_id: family.id,
|
|
27399
|
+
asset_id: request.assetId,
|
|
27400
|
+
sha256: original.sha256,
|
|
27401
|
+
name: original.name,
|
|
27402
|
+
mime_type: original.mimeType
|
|
27403
|
+
})) throw new LearnerAuthorizationError();
|
|
27404
|
+
ownerProfileId = family.owner_profile_id;
|
|
27405
|
+
}
|
|
27160
27406
|
return withPrivateAssetAccess({
|
|
27161
27407
|
tenantId: request.tenantId,
|
|
27162
27408
|
actorUserId: request.actorUserId,
|
|
27163
|
-
ownerProfileId
|
|
27409
|
+
ownerProfileId,
|
|
27164
27410
|
assetIds: [request.assetId]
|
|
27165
27411
|
}, async () => {
|
|
27166
27412
|
const runtime = await this.assets();
|
|
27167
27413
|
const asset = await runtime.collection.get({
|
|
27168
27414
|
id: request.assetId,
|
|
27169
27415
|
tenantId: request.tenantId,
|
|
27170
|
-
ownerProfileId
|
|
27416
|
+
ownerProfileId
|
|
27171
27417
|
}, { cache: false });
|
|
27172
27418
|
if (asset?.accessMode !== "private") throw new LearnerAuthorizationError();
|
|
27173
27419
|
const data = await runtime.store.read(asset);
|
|
@@ -27354,6 +27600,6 @@ var WorkbookPhotoService = class WorkbookPhotoService extends WorkbookService {
|
|
|
27354
27600
|
}
|
|
27355
27601
|
};
|
|
27356
27602
|
//#endregion
|
|
27357
|
-
export {
|
|
27603
|
+
export { EnrollmentCollection as $, WorkbookFeedbackRelease as A, Exercise as At, FamilyIntakeAsset as B, WorkbookAssessmentRevision as C, Curriculum as Ct, WorkbookCollection as D, AuthoredCourse as Dt, WorkbookAttemptCollection as E, LessonProgress as Et, WorkbookAssessmentValidationError as F, Worksheet as Ft, familyIntakeScopeId as G, FamilyIntakeCollection as H, aggregateWorkbookQuestions as I, AttestationCollection as J, CatalogAuthorizationError as K, validateWorkbookAssessment as L, WorkbookWorkFiling as M, Lesson as Mt, WorkbookWorkFilingCollection as N, Reading as Nt, WorkbookFeedbackDelivery as O, Course as Ot, WORKBOOK_MATH_VOCABULARY as P, Video as Pt, CurriculumCollection as Q, workbookAggregateFeedback as R, WorkbookActivityCollection as S, LessonAsset as St, WorkbookAttempt as T, Learner as Tt, FamilyIntakeDecision as U, FamilyIntakeAssetCollection as V, FamilyIntakeDecisionCollection as W, CourseCollection as X, AuthoredCourseCollection as Y, CourseSectionCollection as Z, WorkbookWorkflowRequiredError as _, Grade as _t, WorkbookContextRevisionCollection as a, LessonAssetCollection as at, Workbook as b, SubmissionAsset as bt, WorkbookPhotoDecision as c, ReadingCollection as ct, WorkbookPhotoIntakeCollection as d, SubmissionCollection as dt, ExerciseCollection as et, validateWorkbookPhotoIdentification as f, SubmissionIntakeBindingCollection as ft, SubmissionStorageCleanupError as g, ExternalCompletion as gt, SubmissionService as h, Attestation as ht, WorkbookContextRevision as i, LearnerCollection as it, WorkbookFeedbackReleaseCollection as j, ExternalCourse as jt, WorkbookFeedbackDeliveryCollection as k, CourseSection as kt, WorkbookPhotoDecisionCollection as l, ScannedSubmissionCollection as lt, normalizeWorkbookAnswerRegions as m, WorksheetCollection as mt, preservePhotoProposal as n, ExternalCourseCollection as nt, WorkbookPhotoAsset as o, LessonCollection as ot, normalizeWorkbookObservedLayout as p, VideoCollection as pt, CatalogService as q, WorkbookService as r, GradeCollection as rt, WorkbookPhotoAssetCollection as s, LessonProgressCollection as st, WorkbookPhotoService as t, ExternalCompletionCollection as tt, WorkbookPhotoIntake as u, SubmissionAssetCollection as ut, LearnerAuthorizationError as v, ScannedSubmission as vt, WorkbookAssessmentRevisionCollection as w, Enrollment as wt, WorkbookActivity as x, SubmissionIntakeBinding as xt, LearnerService as y, Submission as yt, FamilyIntake as z };
|
|
27358
27604
|
|
|
27359
|
-
//# sourceMappingURL=workbook-photo-service-
|
|
27605
|
+
//# sourceMappingURL=workbook-photo-service-DCmqeWLd.js.map
|