@citolab/qti-backend-firebase 0.0.3

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.
Files changed (111) hide show
  1. package/LICENSE.md +674 -0
  2. package/dist/api/app-specific/base/application-specific-base.d.ts +45 -0
  3. package/dist/api/app-specific/base/application-specific-base.d.ts.map +1 -0
  4. package/dist/api/app-specific/base/application-specific-base.js +503 -0
  5. package/dist/api/app-specific/base/application-specific-base.js.map +1 -0
  6. package/dist/api/app-specific/base/cheerio-helper.d.ts +5 -0
  7. package/dist/api/app-specific/base/cheerio-helper.d.ts.map +1 -0
  8. package/dist/api/app-specific/base/cheerio-helper.js +16 -0
  9. package/dist/api/app-specific/base/cheerio-helper.js.map +1 -0
  10. package/dist/api/app-specific/baseImplementation.d.ts +6 -0
  11. package/dist/api/app-specific/baseImplementation.d.ts.map +1 -0
  12. package/dist/api/app-specific/baseImplementation.js +11 -0
  13. package/dist/api/app-specific/baseImplementation.js.map +1 -0
  14. package/dist/api/app-specific/index.d.ts +4 -0
  15. package/dist/api/app-specific/index.d.ts.map +1 -0
  16. package/dist/api/app-specific/index.js +4 -0
  17. package/dist/api/app-specific/index.js.map +1 -0
  18. package/dist/api/app-specific/interface/IApplicationSpecific.d.ts +31 -0
  19. package/dist/api/app-specific/interface/IApplicationSpecific.d.ts.map +1 -0
  20. package/dist/api/app-specific/interface/IApplicationSpecific.js +2 -0
  21. package/dist/api/app-specific/interface/IApplicationSpecific.js.map +1 -0
  22. package/dist/api/app-specific/specific.d.ts +1 -0
  23. package/dist/api/app-specific/specific.d.ts.map +1 -0
  24. package/dist/api/app-specific/specific.js +31 -0
  25. package/dist/api/app-specific/specific.js.map +1 -0
  26. package/dist/api/index.d.ts +3 -0
  27. package/dist/api/index.d.ts.map +1 -0
  28. package/dist/api/index.js +15 -0
  29. package/dist/api/index.js.map +1 -0
  30. package/dist/api/qti-data.d.ts +4 -0
  31. package/dist/api/qti-data.d.ts.map +1 -0
  32. package/dist/api/qti-data.js +622 -0
  33. package/dist/api/qti-data.js.map +1 -0
  34. package/dist/api/qti-resources.d.ts +4 -0
  35. package/dist/api/qti-resources.d.ts.map +1 -0
  36. package/dist/api/qti-resources.js +348 -0
  37. package/dist/api/qti-resources.js.map +1 -0
  38. package/dist/api/qti-teacher.d.ts +6 -0
  39. package/dist/api/qti-teacher.d.ts.map +1 -0
  40. package/dist/api/qti-teacher.js +807 -0
  41. package/dist/api/qti-teacher.js.map +1 -0
  42. package/dist/api/qti-tools.d.ts +3 -0
  43. package/dist/api/qti-tools.d.ts.map +1 -0
  44. package/dist/api/qti-tools.js +450 -0
  45. package/dist/api/qti-tools.js.map +1 -0
  46. package/dist/console.d.ts +2 -0
  47. package/dist/console.d.ts.map +1 -0
  48. package/dist/console.js +30 -0
  49. package/dist/console.js.map +1 -0
  50. package/dist/express-test.d.ts +2 -0
  51. package/dist/express-test.d.ts.map +1 -0
  52. package/dist/express-test.js +19 -0
  53. package/dist/express-test.js.map +1 -0
  54. package/dist/helpers/ci-bootstap.d.ts +4 -0
  55. package/dist/helpers/ci-bootstap.d.ts.map +1 -0
  56. package/dist/helpers/ci-bootstap.js +96 -0
  57. package/dist/helpers/ci-bootstap.js.map +1 -0
  58. package/dist/helpers/database.d.ts +110 -0
  59. package/dist/helpers/database.d.ts.map +1 -0
  60. package/dist/helpers/database.js +151 -0
  61. package/dist/helpers/database.js.map +1 -0
  62. package/dist/helpers/db.d.ts +3 -0
  63. package/dist/helpers/db.d.ts.map +1 -0
  64. package/dist/helpers/db.js +10 -0
  65. package/dist/helpers/db.js.map +1 -0
  66. package/dist/helpers/endpoint-helpers.d.ts +33 -0
  67. package/dist/helpers/endpoint-helpers.d.ts.map +1 -0
  68. package/dist/helpers/endpoint-helpers.js +149 -0
  69. package/dist/helpers/endpoint-helpers.js.map +1 -0
  70. package/dist/helpers/firebase.d.ts +7 -0
  71. package/dist/helpers/firebase.d.ts.map +1 -0
  72. package/dist/helpers/firebase.js +15 -0
  73. package/dist/helpers/firebase.js.map +1 -0
  74. package/dist/helpers/index.d.ts +11 -0
  75. package/dist/helpers/index.d.ts.map +1 -0
  76. package/dist/helpers/index.js +11 -0
  77. package/dist/helpers/index.js.map +1 -0
  78. package/dist/helpers/local-helpers.d.ts +2 -0
  79. package/dist/helpers/local-helpers.d.ts.map +1 -0
  80. package/dist/helpers/local-helpers.js +11 -0
  81. package/dist/helpers/local-helpers.js.map +1 -0
  82. package/dist/helpers/logic.d.ts +73 -0
  83. package/dist/helpers/logic.d.ts.map +1 -0
  84. package/dist/helpers/logic.js +759 -0
  85. package/dist/helpers/logic.js.map +1 -0
  86. package/dist/helpers/package-upload.d.ts +16 -0
  87. package/dist/helpers/package-upload.d.ts.map +1 -0
  88. package/dist/helpers/package-upload.js +160 -0
  89. package/dist/helpers/package-upload.js.map +1 -0
  90. package/dist/helpers/package.d.ts +32 -0
  91. package/dist/helpers/package.d.ts.map +1 -0
  92. package/dist/helpers/package.js +373 -0
  93. package/dist/helpers/package.js.map +1 -0
  94. package/dist/helpers/request-headers.d.ts +27 -0
  95. package/dist/helpers/request-headers.d.ts.map +1 -0
  96. package/dist/helpers/request-headers.js +144 -0
  97. package/dist/helpers/request-headers.js.map +1 -0
  98. package/dist/helpers/storage.d.ts +10 -0
  99. package/dist/helpers/storage.d.ts.map +1 -0
  100. package/dist/helpers/storage.js +132 -0
  101. package/dist/helpers/storage.js.map +1 -0
  102. package/dist/helpers/utils.d.ts +42 -0
  103. package/dist/helpers/utils.d.ts.map +1 -0
  104. package/dist/helpers/utils.js +228 -0
  105. package/dist/helpers/utils.js.map +1 -0
  106. package/dist/main.d.ts +2 -0
  107. package/dist/main.d.ts.map +1 -0
  108. package/dist/main.js +14 -0
  109. package/dist/main.js.map +1 -0
  110. package/package.json +101 -0
  111. package/readme.md +11 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseImplementation.js","sourceRoot":"","sources":["../../../src/api/app-specific/baseImplementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,OAAO,kBAAmB,SAAQ,uBAAuB;IAC7D,EAAE,GAAG,MAAM,CAAC;IAEZ,YAAY,EAAW;QACrB,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export * from "./interface/IApplicationSpecific";
2
+ export * from "./base/application-specific-base";
3
+ export * from "./base/cheerio-helper";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/app-specific/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./interface/IApplicationSpecific";
2
+ export * from "./base/application-specific-base";
3
+ export * from "./base/cheerio-helper";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/app-specific/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { SessionInfoTeacher, StudentAppSessionInfo, ExtendedTestContext, AssessmentInfo, SessionStateType } from "@citolab/qti-api";
2
+ import { ItemContext } from "@citolab/qti-components/exports/item.context.js";
3
+ import { DATABASE } from "../../../helpers/database";
4
+ export interface IApplicationSpecific {
5
+ id: string;
6
+ db: DATABASE;
7
+ packageAsQti: boolean;
8
+ xmlFromDatabase: boolean;
9
+ getCodeByUserId: (userId: string, assessmentId: string) => Promise<string>;
10
+ getInitialSessionState: (assessmentInfo: AssessmentInfo) => SessionStateType;
11
+ createSessionInfoForStudent: (config: {
12
+ userId: string;
13
+ assessmentId?: string;
14
+ identification?: string;
15
+ metadata?: unknown;
16
+ }) => Promise<StudentAppSessionInfo>;
17
+ getSessionInfoForStudent: (userId: string, assessmentId?: string, identification?: string) => Promise<StudentAppSessionInfo | null>;
18
+ getAssessmentInfo: (assessmentId: string, studentCode?: string) => Promise<AssessmentInfo>;
19
+ convertPackageAndAddToDatabase: (packageLocation: string, assetUrl: string, extraInfo?: {
20
+ assessmentId?: string;
21
+ prefixAssessmentId?: string;
22
+ packageId?: string;
23
+ packageName?: string;
24
+ addToPractice?: boolean;
25
+ }) => Promise<AssessmentInfo[]>;
26
+ updateItemStats(teacherId: string, assessmentId: string, studentId: string, itemContext: ItemContext[], target: "teacher" | "reviewer", batch: FirebaseFirestore.WriteBatch): Promise<void>;
27
+ updateStudentStats(code: string, assessmentId: string, teacherId: string, testContext: ExtendedTestContext, batch: FirebaseFirestore.WriteBatch): Promise<void>;
28
+ testContextToTeacher: (code: string, assessmentId: string, testContext: ExtendedTestContext, batch: FirebaseFirestore.WriteBatch) => Promise<void>;
29
+ updatePlannedSession: (teacherId: string, code: string, updatedSession: SessionInfoTeacher, batch: FirebaseFirestore.WriteBatch) => Promise<void>;
30
+ }
31
+ //# sourceMappingURL=IApplicationSpecific.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IApplicationSpecific.d.ts","sourceRoot":"","sources":["../../../../src/api/app-specific/interface/IApplicationSpecific.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,QAAQ,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IAC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,CAAC;IAEjB,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,mBAAmB,EAChC,KAAK,EAAE,iBAAiB,CAAC,UAAU,GAClC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB,oBAAoB,EAAE,CACpB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,mBAAmB,EAChC,KAAK,EAAE,iBAAiB,CAAC,UAAU,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB,oBAAoB,EAAE,CACpB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,kBAAkB,EAClC,KAAK,EAAE,iBAAiB,CAAC,UAAU,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IApplicationSpecific.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IApplicationSpecific.js","sourceRoot":"","sources":["../../../../src/api/app-specific/interface/IApplicationSpecific.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=specific.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specific.d.ts","sourceRoot":"","sources":["../../../src/api/app-specific/specific.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // import { BaseImplementation } from "./baseImplementation";
3
+ // import { IApplicationSpecific } from "./interface/IApplicationSpecific";
4
+ // // Registry for application-specific implementations
5
+ // const implementationRegistry = new Map<string, IApplicationSpecific>();
6
+ // /**
7
+ // * Allows consumers to register their custom implementations.
8
+ // * @param applicationId - The unique identifier for the application.
9
+ // * @param implementation - The implementation logic for the application.
10
+ // */
11
+ // export const registerImplementation = (
12
+ // applicationId: string,
13
+ // implementation: IApplicationSpecific
14
+ // ): void => {
15
+ // implementationRegistry.set(applicationId, implementation);
16
+ // };
17
+ // /**
18
+ // * Retrieves the specific implementation for the given application ID.
19
+ // * @param applicationId - The unique identifier for the application.
20
+ // * @returns The application-specific implementation.
21
+ // */
22
+ // export const getSpecificImplementation = (
23
+ // applicationId: string
24
+ // ): IApplicationSpecific => {
25
+ // const implementation = implementationRegistry.get(applicationId);
26
+ // if (implementation) {
27
+ // return implementation;
28
+ // }
29
+ // return new BaseImplementation(applicationId); // Default implementation
30
+ // };
31
+ //# sourceMappingURL=specific.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specific.js","sourceRoot":"","sources":["../../../src/api/app-specific/specific.ts"],"names":[],"mappings":";AAAA,6DAA6D;AAC7D,2EAA2E;AAE3E,uDAAuD;AACvD,0EAA0E;AAE1E,MAAM;AACN,gEAAgE;AAChE,uEAAuE;AACvE,2EAA2E;AAC3E,MAAM;AACN,0CAA0C;AAC1C,2BAA2B;AAC3B,yCAAyC;AACzC,eAAe;AACf,+DAA+D;AAC/D,KAAK;AAEL,MAAM;AACN,yEAAyE;AACzE,uEAAuE;AACvE,uDAAuD;AACvD,MAAM;AACN,6CAA6C;AAC7C,0BAA0B;AAC1B,+BAA+B;AAC/B,sEAAsE;AACtE,0BAA0B;AAC1B,6BAA6B;AAC7B,MAAM;AACN,4EAA4E;AAC5E,KAAK"}
@@ -0,0 +1,3 @@
1
+ declare const app: import("express-serve-static-core").Express;
2
+ export default app;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,GAAG,6CAAY,CAAC;AAStB,eAAe,GAAG,CAAC"}
@@ -0,0 +1,15 @@
1
+ import cors from 'cors';
2
+ import express from 'express';
3
+ import { addQtiDataEndpoints } from './qti-data';
4
+ import { addQtiResourcesEndpoint } from './qti-resources';
5
+ import { addQtiTeacherEndpoints } from './qti-teacher';
6
+ // EXAMPLE EXPRESS SERVER SETUP
7
+ const app = express();
8
+ app.use(cors({ origin: true }));
9
+ app.use(express.json());
10
+ // qti endpoints
11
+ addQtiResourcesEndpoint(app);
12
+ addQtiDataEndpoints(app);
13
+ addQtiTeacherEndpoints(app);
14
+ export default app;
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,+BAA+B;AAE/B,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;AACtB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAChC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAExB,gBAAgB;AAChB,uBAAuB,CAAC,GAAG,CAAC,CAAC;AAC7B,mBAAmB,CAAC,GAAG,CAAC,CAAC;AACzB,sBAAsB,CAAC,GAAG,CAAC,CAAC;AAE5B,eAAe,GAAG,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Express } from "express";
2
+ import { IApplicationSpecific } from "./app-specific";
3
+ export declare function addQtiDataEndpoints(app: Express, specificImplementation?: IApplicationSpecific): void;
4
+ //# sourceMappingURL=qti-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qti-data.d.ts","sourceRoot":"","sources":["../../src/api/qti-data.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAY,MAAM,SAAS,CAAC;AAiB5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,EACZ,sBAAsB,GAAE,oBAA+C,QA4wBxE"}