@timeback/core 0.2.1-beta.20260314155353 → 0.2.1-beta.20260315040428
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-wvs4tg34.js → chunk-87h1b7ca.js} +19 -2
- package/dist/{chunk-k030r9e8.js → chunk-qt3x4rwv.js} +14 -0
- package/dist/client.d.ts +13 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/index.js +223 -29
- package/dist/utils.js +2 -2
- package/package.json +2 -1
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
validateNonEmptyString,
|
|
8
8
|
validateUuid,
|
|
9
9
|
validateWithSchema
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-qt3x4rwv.js";
|
|
11
11
|
|
|
12
12
|
// ../edubridge/src/utils.ts
|
|
13
13
|
var log = createScopedLogger("edubridge");
|
|
@@ -1869,6 +1869,23 @@ var QtiLessonFeedbackInput = z11.object({
|
|
|
1869
1869
|
lessonId: NonEmptyString,
|
|
1870
1870
|
humanApproved: z11.boolean().optional()
|
|
1871
1871
|
}).strict();
|
|
1872
|
+
// ../../types/src/zod/reporting.ts
|
|
1873
|
+
import { z as z12 } from "zod/v4";
|
|
1874
|
+
var ReportingAuthMode = z12.enum(["creator_only", "same_org", "all_orgs"]);
|
|
1875
|
+
var ReportingSavedQueryId = z12.string().uuid();
|
|
1876
|
+
var ReportingUserEmail = z12.email();
|
|
1877
|
+
var ReportingQueryInput = z12.object({
|
|
1878
|
+
sql: NonEmptyString
|
|
1879
|
+
});
|
|
1880
|
+
var PersistReportingQueryInput = z12.object({
|
|
1881
|
+
endpointName: NonEmptyString,
|
|
1882
|
+
sql: NonEmptyString,
|
|
1883
|
+
authMode: ReportingAuthMode,
|
|
1884
|
+
description: NonEmptyString.optional()
|
|
1885
|
+
});
|
|
1886
|
+
var RemoveReportingQueryInput = z12.object({
|
|
1887
|
+
endpointId: ReportingSavedQueryId
|
|
1888
|
+
});
|
|
1872
1889
|
// ../edubridge/src/resources/analytics.ts
|
|
1873
1890
|
class AnalyticsResource {
|
|
1874
1891
|
transport;
|
|
@@ -2133,4 +2150,4 @@ function createEdubridgeClient(registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
|
2133
2150
|
|
|
2134
2151
|
// ../edubridge/src/client.ts
|
|
2135
2152
|
var EdubridgeClient = createEdubridgeClient();
|
|
2136
|
-
export { ActivityCompletedInput, TimeSpentInput, CaliperEnvelopeInput, CaliperSendEventsInput, CaliperListEventsParams, QuestionSeenInput, QuestionAnsweredInput, QuestionGradedInput, WebhookCreateInput, WebhookUpdateInput, WebhookFilterCreateInput, WebhookFilterUpdateInput, CasePackageInput, ClrCredentialInput, OneRosterUserCreateInput, OneRosterCourseCreateInput, OneRosterClassCreateInput, OneRosterEnrollmentCreateInput, OneRosterCategoryCreateInput, OneRosterLineItemCreateInput, OneRosterResultCreateInput, OneRosterScoreScaleCreateInput, OneRosterAssessmentLineItemCreateInput, OneRosterAssessmentResultCreateInput, OneRosterOrgCreateInput, OneRosterSchoolCreateInput, OneRosterAcademicSessionCreateInput, OneRosterComponentResourceCreateInput, OneRosterCourseComponentCreateInput, OneRosterEnrollInput, OneRosterAgentInput, OneRosterCredentialInput, OneRosterDemographicsCreateInput, OneRosterResourceCreateInput, OneRosterCourseStructureInput, OneRosterBulkResultsInput, PowerPathCreateExternalPlacementTestInput, PowerPathCreateExternalTestOutInput, PowerPathCreateInternalTestInput, PowerPathCreateNewAttemptInput, PowerPathFinalStudentAssessmentResponseInput, PowerPathLessonPlansCreateInput, PowerPathLessonPlanOperationsInput, PowerPathLessonPlanUpdateStudentItemResponseInput, PowerPathMakeExternalTestAssignmentInput, PowerPathPlacementResetUserPlacementInput, PowerPathResetAttemptInput, PowerPathScreeningResetSessionInput, PowerPathScreeningAssignTestInput, PowerPathTestAssignmentsCreateInput, PowerPathTestAssignmentsUpdateInput, PowerPathTestAssignmentsBulkInput, PowerPathTestAssignmentsImportInput, PowerPathTestAssignmentsListParams, PowerPathTestAssignmentsAdminParams, PowerPathUpdateStudentQuestionResponseInput, PowerPathGetAssessmentProgressParams, PowerPathGetNextQuestionParams, PowerPathGetAttemptsParams, PowerPathTestOutParams, PowerPathImportExternalTestAssignmentResultsParams, PowerPathPlacementQueryParams, PowerPathMakeExternalStudentTestOutAssignmentInput, PowerPathRenderConfigUpsertInput, PowerPathSyllabusQueryParams, QtiAssessmentItemXmlCreateInput, QtiAssessmentItemJsonCreateInput, QtiAssessmentItemCreateInput, QtiAssessmentItemUpdateInput, QtiAssessmentItemProcessResponseInput, QtiAssessmentItemRef, QtiAssessmentSection, QtiTestPart, QtiReorderItemsInput, QtiAssessmentTestMetadataUpdateInput, QtiAssessmentTestCreateInput, QtiAssessmentTestUpdateInput, QtiStimulusCreateInput, QtiStimulusUpdateInput, QtiValidateInput, QtiValidateBatchInput, QtiLessonFeedbackInput, aggregateActivityMetrics, EdubridgeClient };
|
|
2153
|
+
export { ActivityCompletedInput, TimeSpentInput, CaliperEnvelopeInput, CaliperSendEventsInput, CaliperListEventsParams, QuestionSeenInput, QuestionAnsweredInput, QuestionGradedInput, WebhookCreateInput, WebhookUpdateInput, WebhookFilterCreateInput, WebhookFilterUpdateInput, CasePackageInput, ClrCredentialInput, OneRosterUserCreateInput, OneRosterCourseCreateInput, OneRosterClassCreateInput, OneRosterEnrollmentCreateInput, OneRosterCategoryCreateInput, OneRosterLineItemCreateInput, OneRosterResultCreateInput, OneRosterScoreScaleCreateInput, OneRosterAssessmentLineItemCreateInput, OneRosterAssessmentResultCreateInput, OneRosterOrgCreateInput, OneRosterSchoolCreateInput, OneRosterAcademicSessionCreateInput, OneRosterComponentResourceCreateInput, OneRosterCourseComponentCreateInput, OneRosterEnrollInput, OneRosterAgentInput, OneRosterCredentialInput, OneRosterDemographicsCreateInput, OneRosterResourceCreateInput, OneRosterCourseStructureInput, OneRosterBulkResultsInput, PowerPathCreateExternalPlacementTestInput, PowerPathCreateExternalTestOutInput, PowerPathCreateInternalTestInput, PowerPathCreateNewAttemptInput, PowerPathFinalStudentAssessmentResponseInput, PowerPathLessonPlansCreateInput, PowerPathLessonPlanOperationsInput, PowerPathLessonPlanUpdateStudentItemResponseInput, PowerPathMakeExternalTestAssignmentInput, PowerPathPlacementResetUserPlacementInput, PowerPathResetAttemptInput, PowerPathScreeningResetSessionInput, PowerPathScreeningAssignTestInput, PowerPathTestAssignmentsCreateInput, PowerPathTestAssignmentsUpdateInput, PowerPathTestAssignmentsBulkInput, PowerPathTestAssignmentsImportInput, PowerPathTestAssignmentsListParams, PowerPathTestAssignmentsAdminParams, PowerPathUpdateStudentQuestionResponseInput, PowerPathGetAssessmentProgressParams, PowerPathGetNextQuestionParams, PowerPathGetAttemptsParams, PowerPathTestOutParams, PowerPathImportExternalTestAssignmentResultsParams, PowerPathPlacementQueryParams, PowerPathMakeExternalStudentTestOutAssignmentInput, PowerPathRenderConfigUpsertInput, PowerPathSyllabusQueryParams, QtiAssessmentItemXmlCreateInput, QtiAssessmentItemJsonCreateInput, QtiAssessmentItemCreateInput, QtiAssessmentItemUpdateInput, QtiAssessmentItemProcessResponseInput, QtiAssessmentItemRef, QtiAssessmentSection, QtiTestPart, QtiReorderItemsInput, QtiAssessmentTestMetadataUpdateInput, QtiAssessmentTestCreateInput, QtiAssessmentTestUpdateInput, QtiStimulusCreateInput, QtiStimulusUpdateInput, QtiValidateInput, QtiValidateBatchInput, QtiLessonFeedbackInput, ReportingUserEmail, ReportingQueryInput, PersistReportingQueryInput, aggregateActivityMetrics, EdubridgeClient };
|
|
@@ -644,6 +644,13 @@ var BEYONDAI_PATHS = {
|
|
|
644
644
|
webhookFilterUpdate: "/webhook-filters/{id}",
|
|
645
645
|
webhookFilterDelete: "/webhook-filters/{id}",
|
|
646
646
|
webhookFiltersByWebhook: "/webhook-filters/webhook/{webhookId}"
|
|
647
|
+
},
|
|
648
|
+
reporting: {
|
|
649
|
+
mcp: "/lambda/mcp/reporting",
|
|
650
|
+
savedQueryExecute: "/lambda/reporting/saved-queries/{id}",
|
|
651
|
+
adminGroupCheck: "/lambda/mcp/admin/users/{email}/group",
|
|
652
|
+
adminGroupAdd: "/lambda/mcp/admin/users/{email}/group",
|
|
653
|
+
adminGroupRemove: "/lambda/mcp/admin/users/{email}/group"
|
|
647
654
|
}
|
|
648
655
|
};
|
|
649
656
|
var LEARNWITHAI_PATHS = {
|
|
@@ -660,6 +667,7 @@ var LEARNWITHAI_PATHS = {
|
|
|
660
667
|
resources: "/resources/1.0"
|
|
661
668
|
},
|
|
662
669
|
webhooks: null,
|
|
670
|
+
reporting: null,
|
|
663
671
|
edubridge: null,
|
|
664
672
|
powerpath: null,
|
|
665
673
|
clr: null,
|
|
@@ -688,6 +696,7 @@ function resolvePathProfiles(pathProfile, customPaths) {
|
|
|
688
696
|
caliper: customPaths?.caliper ?? basePaths.caliper,
|
|
689
697
|
oneroster: customPaths?.oneroster ?? basePaths.oneroster,
|
|
690
698
|
webhooks: customPaths?.webhooks ?? basePaths.webhooks,
|
|
699
|
+
reporting: customPaths?.reporting ?? basePaths.reporting,
|
|
691
700
|
edubridge: customPaths?.edubridge ?? basePaths.edubridge,
|
|
692
701
|
powerpath: customPaths?.powerpath ?? basePaths.powerpath,
|
|
693
702
|
clr: customPaths?.clr ?? basePaths.clr,
|
|
@@ -749,6 +758,10 @@ class TimebackProvider {
|
|
|
749
758
|
baseUrl: platformEndpoints.caliper[env],
|
|
750
759
|
authUrl: this.authUrl
|
|
751
760
|
},
|
|
761
|
+
reporting: {
|
|
762
|
+
baseUrl: platformEndpoints.api[env],
|
|
763
|
+
authUrl: this.authUrl
|
|
764
|
+
},
|
|
752
765
|
qti: {
|
|
753
766
|
baseUrl: platformEndpoints.qti[env],
|
|
754
767
|
authUrl: this.authUrl
|
|
@@ -766,6 +779,7 @@ class TimebackProvider {
|
|
|
766
779
|
case: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
767
780
|
caliper: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
768
781
|
webhooks: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
782
|
+
reporting: { baseUrl: config.baseUrl, authUrl: this.authUrl },
|
|
769
783
|
qti: { baseUrl: config.baseUrl, authUrl: this.authUrl }
|
|
770
784
|
};
|
|
771
785
|
} else if (isServicesConfig(config)) {
|
package/dist/client.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { AuthCheckResult, TimebackProvider } from '@timeback/internal-clien
|
|
|
6
6
|
import type { OneRosterClientInstance } from '@timeback/oneroster';
|
|
7
7
|
import type { PowerPathClientInstance } from '@timeback/powerpath';
|
|
8
8
|
import type { QtiClientInstance } from '@timeback/qti';
|
|
9
|
+
import type { ReportingClientInstance } from '@timeback/reporting';
|
|
9
10
|
import type { WebhooksClientInstance } from '@timeback/webhooks';
|
|
10
11
|
import type { TimebackClientConfig } from './types/index';
|
|
11
12
|
/**
|
|
@@ -20,6 +21,7 @@ import type { TimebackClientConfig } from './types/index';
|
|
|
20
21
|
* - **OneRoster**: Rostering and gradebook data
|
|
21
22
|
* - **Edubridge**: Simplified enrollments and analytics
|
|
22
23
|
* - **Caliper**: Learning analytics events
|
|
24
|
+
* - **Reporting**: Ad-hoc queries and saved reporting endpoints
|
|
23
25
|
* - **QTI**: Assessment content management
|
|
24
26
|
* - **PowerPath**: Placement tests, lesson plans, and assessments
|
|
25
27
|
* - **CLR**: Comprehensive Learner Record credentials
|
|
@@ -83,6 +85,7 @@ export declare class TimebackClient {
|
|
|
83
85
|
private _powerpath?;
|
|
84
86
|
private _clr?;
|
|
85
87
|
private _case?;
|
|
88
|
+
private _reporting?;
|
|
86
89
|
private _webhooks?;
|
|
87
90
|
/**
|
|
88
91
|
* Creates a new Timeback client.
|
|
@@ -162,6 +165,16 @@ export declare class TimebackClient {
|
|
|
162
165
|
* @throws {Error} If client has been closed or service not configured
|
|
163
166
|
*/
|
|
164
167
|
get case(): CaseClientInstance;
|
|
168
|
+
/**
|
|
169
|
+
* Reporting API client for reporting queries and saved reporting endpoints.
|
|
170
|
+
*
|
|
171
|
+
* Lazily initialized on first access. Shares OAuth tokens with other
|
|
172
|
+
* sub-clients through the provider.
|
|
173
|
+
*
|
|
174
|
+
* @returns The Reporting client instance
|
|
175
|
+
* @throws {Error} If client has been closed or service not configured
|
|
176
|
+
*/
|
|
177
|
+
get reporting(): ReportingClientInstance;
|
|
165
178
|
/**
|
|
166
179
|
* Webhooks API client for managing webhook registrations and filters.
|
|
167
180
|
*
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,qBAAa,cAAc;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkB;IAC3C,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,QAAQ,CAAC,CAAuB;IACxC,OAAO,CAAC,IAAI,CAAC,CAAmB;IAChC,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,IAAI,CAAC,CAAmB;IAChC,OAAO,CAAC,KAAK,CAAC,CAAoB;IAClC,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,SAAS,CAAC,CAAwB;IAE1C;;;;;;OAMG;IACH,YAAY,MAAM,CAAC,EAAE,oBAAoB,EAUxC;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,OAAO,IAAI,qBAAqB,CASnC;IAED;;;;;;;;OAQG;IACH,IAAI,GAAG,IAAI,iBAAiB,CAS3B;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,GAAG,IAAI,iBAAiB,CAS3B;IAED;;;;;;;;OAQG;IACH,IAAI,IAAI,IAAI,kBAAkB,CAS7B;IAED;;;;;;;;OAQG;IACH,IAAI,SAAS,IAAI,uBAAuB,CASvC;IAED;;;;;;;;OAQG;IACH,IAAI,QAAQ,IAAI,sBAAsB,CASrC;IAMD;;;;;;;;OAQG;IACH,SAAS,IAAI,OAAO,CAAC,eAAe,CAAC,CAGpC;IAED;;;;;;;OAOG;IACH,KAAK,IAAI,IAAI,CAgBZ;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;;;OAIG;IACH,WAAW,IAAI,gBAAgB,CAE9B;IAED;;OAEG;IACH,OAAO,CAAC,UAAU;IAMlB;;;OAGG;IACH,OAAO,CAAC,aAAa;CAgBrB"}
|
package/dist/errors.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
OneRosterSchoolCreateInput,
|
|
29
29
|
OneRosterScoreScaleCreateInput,
|
|
30
30
|
OneRosterUserCreateInput,
|
|
31
|
+
PersistReportingQueryInput,
|
|
31
32
|
PowerPathCreateExternalPlacementTestInput,
|
|
32
33
|
PowerPathCreateExternalTestOutInput,
|
|
33
34
|
PowerPathCreateInternalTestInput,
|
|
@@ -77,12 +78,14 @@ import {
|
|
|
77
78
|
QuestionAnsweredInput,
|
|
78
79
|
QuestionGradedInput,
|
|
79
80
|
QuestionSeenInput,
|
|
81
|
+
ReportingQueryInput,
|
|
82
|
+
ReportingUserEmail,
|
|
80
83
|
TimeSpentInput,
|
|
81
84
|
WebhookCreateInput,
|
|
82
85
|
WebhookFilterCreateInput,
|
|
83
86
|
WebhookFilterUpdateInput,
|
|
84
87
|
WebhookUpdateInput
|
|
85
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-87h1b7ca.js";
|
|
86
89
|
import {
|
|
87
90
|
ApiError,
|
|
88
91
|
BaseTransport,
|
|
@@ -108,7 +111,7 @@ import {
|
|
|
108
111
|
validateUuid,
|
|
109
112
|
validateWithSchema,
|
|
110
113
|
whereToFilter
|
|
111
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-qt3x4rwv.js";
|
|
112
115
|
import {
|
|
113
116
|
CALIPER_DATA_VERSION,
|
|
114
117
|
CALIPER_ENV_VARS,
|
|
@@ -3642,6 +3645,187 @@ function createQtiClient(registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
|
3642
3645
|
|
|
3643
3646
|
// ../qti/src/client.ts
|
|
3644
3647
|
var QtiClient = createQtiClient();
|
|
3648
|
+
// ../reporting/src/constants.ts
|
|
3649
|
+
var REPORTING_ENV_VARS = {
|
|
3650
|
+
baseUrl: ["TIMEBACK_API_BASE_URL", "TIMEBACK_BASE_URL", "REPORTING_BASE_URL"],
|
|
3651
|
+
authUrl: ["TIMEBACK_API_AUTH_URL", "TIMEBACK_AUTH_URL", "REPORTING_TOKEN_URL"],
|
|
3652
|
+
clientId: ["TIMEBACK_API_CLIENT_ID", "TIMEBACK_CLIENT_ID", "REPORTING_CLIENT_ID"],
|
|
3653
|
+
clientSecret: [
|
|
3654
|
+
"TIMEBACK_API_CLIENT_SECRET",
|
|
3655
|
+
"TIMEBACK_CLIENT_SECRET",
|
|
3656
|
+
"REPORTING_CLIENT_SECRET"
|
|
3657
|
+
]
|
|
3658
|
+
};
|
|
3659
|
+
|
|
3660
|
+
// ../reporting/src/lib/resolve.ts
|
|
3661
|
+
function resolveToProvider8(config, registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
3662
|
+
return resolveToProvider(config, REPORTING_ENV_VARS, registry);
|
|
3663
|
+
}
|
|
3664
|
+
|
|
3665
|
+
// ../reporting/src/utils.ts
|
|
3666
|
+
var log7 = createScopedLogger("reporting");
|
|
3667
|
+
|
|
3668
|
+
// ../reporting/src/lib/transport.ts
|
|
3669
|
+
class Transport7 extends BaseTransport {
|
|
3670
|
+
paths;
|
|
3671
|
+
constructor(config) {
|
|
3672
|
+
super({ config, logger: log7 });
|
|
3673
|
+
this.paths = config.paths;
|
|
3674
|
+
}
|
|
3675
|
+
async callTool(name, args) {
|
|
3676
|
+
const response = await this.request(this.paths.mcp, {
|
|
3677
|
+
method: "POST",
|
|
3678
|
+
body: {
|
|
3679
|
+
jsonrpc: "2.0",
|
|
3680
|
+
id: crypto.randomUUID(),
|
|
3681
|
+
method: "tools/call",
|
|
3682
|
+
params: {
|
|
3683
|
+
name,
|
|
3684
|
+
arguments: args
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
});
|
|
3688
|
+
if (response.error) {
|
|
3689
|
+
throw new ApiError(response.error.message, 500, response.error.data ?? response.error);
|
|
3690
|
+
}
|
|
3691
|
+
const rawContent = response.result?.content?.[0]?.text;
|
|
3692
|
+
if (!rawContent) {
|
|
3693
|
+
throw new ApiError("Missing reporting MCP result content", 500, response);
|
|
3694
|
+
}
|
|
3695
|
+
let payload;
|
|
3696
|
+
try {
|
|
3697
|
+
payload = JSON.parse(rawContent);
|
|
3698
|
+
} catch {
|
|
3699
|
+
throw new ApiError("Invalid reporting MCP response payload", 500, {
|
|
3700
|
+
body: rawContent
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
const hasToolError = response.result?.isError === true || typeof payload === "object" && payload !== null && "isError" in payload && payload.isError === true;
|
|
3704
|
+
if (hasToolError) {
|
|
3705
|
+
const message = typeof payload === "object" && payload !== null && "error" in payload && typeof payload.error === "string" ? payload.error : `Reporting MCP tool failed: ${name}`;
|
|
3706
|
+
throw new ApiError(message, 500, payload);
|
|
3707
|
+
}
|
|
3708
|
+
return payload;
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3712
|
+
// ../reporting/src/resources/admin.ts
|
|
3713
|
+
class AdminResource {
|
|
3714
|
+
transport;
|
|
3715
|
+
constructor(transport) {
|
|
3716
|
+
this.transport = transport;
|
|
3717
|
+
}
|
|
3718
|
+
checkGroupMembership(email) {
|
|
3719
|
+
const validEmail = validateWithSchema(ReportingUserEmail, email, "reporting email");
|
|
3720
|
+
log7.debug("Checking reporting group membership", { email: validEmail });
|
|
3721
|
+
const path = this.transport.paths.adminGroupCheck.replace("{email}", encodeURIComponent(validEmail));
|
|
3722
|
+
return this.transport.request(path);
|
|
3723
|
+
}
|
|
3724
|
+
addToGroup(email) {
|
|
3725
|
+
const validEmail = validateWithSchema(ReportingUserEmail, email, "reporting email");
|
|
3726
|
+
log7.debug("Adding user to reporting group", { email: validEmail });
|
|
3727
|
+
const path = this.transport.paths.adminGroupAdd.replace("{email}", encodeURIComponent(validEmail));
|
|
3728
|
+
return this.transport.request(path, { method: "POST" });
|
|
3729
|
+
}
|
|
3730
|
+
removeFromGroup(email) {
|
|
3731
|
+
const validEmail = validateWithSchema(ReportingUserEmail, email, "reporting email");
|
|
3732
|
+
log7.debug("Removing user from reporting group", { email: validEmail });
|
|
3733
|
+
const path = this.transport.paths.adminGroupRemove.replace("{email}", encodeURIComponent(validEmail));
|
|
3734
|
+
return this.transport.request(path, { method: "DELETE" });
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
// ../reporting/src/resources/queries.ts
|
|
3738
|
+
class QueriesResource {
|
|
3739
|
+
transport;
|
|
3740
|
+
constructor(transport) {
|
|
3741
|
+
this.transport = transport;
|
|
3742
|
+
}
|
|
3743
|
+
run(sql) {
|
|
3744
|
+
const input = validateWithSchema(ReportingQueryInput, { sql }, "reporting query");
|
|
3745
|
+
log7.debug("Running reporting query");
|
|
3746
|
+
return this.transport.callTool("getData", input);
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
// ../reporting/src/resources/saved-queries.ts
|
|
3750
|
+
class SavedQueriesResource {
|
|
3751
|
+
transport;
|
|
3752
|
+
constructor(transport) {
|
|
3753
|
+
this.transport = transport;
|
|
3754
|
+
}
|
|
3755
|
+
execute(id) {
|
|
3756
|
+
validateUuid(id, "savedQueryId");
|
|
3757
|
+
log7.debug("Executing saved reporting query", { id });
|
|
3758
|
+
const path = this.transport.paths.savedQueryExecute.replace("{id}", encodeURIComponent(id));
|
|
3759
|
+
return this.transport.request(path);
|
|
3760
|
+
}
|
|
3761
|
+
create(input) {
|
|
3762
|
+
const payload = validateWithSchema(PersistReportingQueryInput, input, "saved reporting query");
|
|
3763
|
+
log7.debug("Creating saved reporting query", { endpointName: payload.endpointName });
|
|
3764
|
+
return this.transport.callTool("persistQueryToAPI", payload);
|
|
3765
|
+
}
|
|
3766
|
+
list() {
|
|
3767
|
+
log7.debug("Listing saved reporting queries");
|
|
3768
|
+
return this.transport.callTool("listApiEndpoints", {});
|
|
3769
|
+
}
|
|
3770
|
+
remove(id) {
|
|
3771
|
+
validateUuid(id, "savedQueryId");
|
|
3772
|
+
log7.debug("Removing saved reporting query", { id });
|
|
3773
|
+
return this.transport.callTool("removeApiEndpoint", {
|
|
3774
|
+
endpointId: id
|
|
3775
|
+
});
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
// ../reporting/src/factory.ts
|
|
3779
|
+
function createReportingClient(registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
3780
|
+
return class ReportingClient {
|
|
3781
|
+
transport;
|
|
3782
|
+
_provider;
|
|
3783
|
+
queries;
|
|
3784
|
+
savedQueries;
|
|
3785
|
+
admin;
|
|
3786
|
+
constructor(config = {}) {
|
|
3787
|
+
const resolved = resolveToProvider8(config, registry);
|
|
3788
|
+
if (resolved.mode === "transport") {
|
|
3789
|
+
this.transport = resolved.transport;
|
|
3790
|
+
log7.info("Client initialized with custom transport");
|
|
3791
|
+
} else {
|
|
3792
|
+
const { provider } = resolved;
|
|
3793
|
+
const { baseUrl, paths } = provider.getEndpointWithPaths("reporting");
|
|
3794
|
+
const tokenProvider = provider.getTokenProvider("reporting");
|
|
3795
|
+
if (!tokenProvider) {
|
|
3796
|
+
throw new Error("Reporting API requires authentication");
|
|
3797
|
+
}
|
|
3798
|
+
this._provider = provider;
|
|
3799
|
+
this.transport = new Transport7({
|
|
3800
|
+
baseUrl,
|
|
3801
|
+
tokenProvider,
|
|
3802
|
+
timeout: provider.timeout,
|
|
3803
|
+
paths
|
|
3804
|
+
});
|
|
3805
|
+
log7.info("Client initialized", {
|
|
3806
|
+
platform: provider.platform,
|
|
3807
|
+
env: provider.env,
|
|
3808
|
+
baseUrl
|
|
3809
|
+
});
|
|
3810
|
+
}
|
|
3811
|
+
this.queries = new QueriesResource(this.transport);
|
|
3812
|
+
this.savedQueries = new SavedQueriesResource(this.transport);
|
|
3813
|
+
this.admin = new AdminResource(this.transport);
|
|
3814
|
+
}
|
|
3815
|
+
getTransport() {
|
|
3816
|
+
return this.transport;
|
|
3817
|
+
}
|
|
3818
|
+
checkAuth() {
|
|
3819
|
+
if (!this._provider) {
|
|
3820
|
+
throw new Error("Cannot check auth: client initialized with custom transport");
|
|
3821
|
+
}
|
|
3822
|
+
return this._provider.checkAuth();
|
|
3823
|
+
}
|
|
3824
|
+
};
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
// ../reporting/src/client.ts
|
|
3828
|
+
var ReportingClient = createReportingClient();
|
|
3645
3829
|
// ../webhooks/src/constants.ts
|
|
3646
3830
|
var WEBHOOKS_ENV_VARS = {
|
|
3647
3831
|
baseUrl: ["TIMEBACK_API_BASE_URL", "TIMEBACK_BASE_URL", "WEBHOOKS_BASE_URL"],
|
|
@@ -3655,18 +3839,18 @@ var WEBHOOKS_ENV_VARS = {
|
|
|
3655
3839
|
};
|
|
3656
3840
|
|
|
3657
3841
|
// ../webhooks/src/lib/resolve.ts
|
|
3658
|
-
function
|
|
3842
|
+
function resolveToProvider9(config, registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
3659
3843
|
return resolveToProvider(config, WEBHOOKS_ENV_VARS, registry);
|
|
3660
3844
|
}
|
|
3661
3845
|
|
|
3662
3846
|
// ../webhooks/src/utils.ts
|
|
3663
|
-
var
|
|
3847
|
+
var log8 = createScopedLogger("webhooks");
|
|
3664
3848
|
|
|
3665
3849
|
// ../webhooks/src/lib/transport.ts
|
|
3666
|
-
class
|
|
3850
|
+
class Transport8 extends BaseTransport {
|
|
3667
3851
|
paths;
|
|
3668
3852
|
constructor(config) {
|
|
3669
|
-
super({ config, logger:
|
|
3853
|
+
super({ config, logger: log8 });
|
|
3670
3854
|
this.paths = config.paths;
|
|
3671
3855
|
}
|
|
3672
3856
|
}
|
|
@@ -3682,13 +3866,13 @@ class WebhooksResource {
|
|
|
3682
3866
|
if (sensor) {
|
|
3683
3867
|
params.sensor = sensor;
|
|
3684
3868
|
}
|
|
3685
|
-
|
|
3869
|
+
log8.debug("Listing webhooks", { sensor });
|
|
3686
3870
|
const response = await this.transport.request(this.transport.paths.webhookList, { params });
|
|
3687
3871
|
return response.webhooks;
|
|
3688
3872
|
}
|
|
3689
3873
|
async get(id) {
|
|
3690
3874
|
validateNonEmptyString(id, "webhookId");
|
|
3691
|
-
|
|
3875
|
+
log8.debug("Getting webhook", { id });
|
|
3692
3876
|
const path = this.transport.paths.webhookGet.replace("{id}", encodeURIComponent(id));
|
|
3693
3877
|
const response = await this.transport.request(path);
|
|
3694
3878
|
if (!response.webhook) {
|
|
@@ -3698,15 +3882,15 @@ class WebhooksResource {
|
|
|
3698
3882
|
}
|
|
3699
3883
|
async create(input) {
|
|
3700
3884
|
validateWithSchema(WebhookCreateInput, input, "webhook");
|
|
3701
|
-
|
|
3885
|
+
log8.debug("Creating webhook", { name: input.name });
|
|
3702
3886
|
const response = await this.transport.request(this.transport.paths.webhookCreate, { method: "POST", body: input });
|
|
3703
|
-
|
|
3887
|
+
log8.info("Webhook created", { id: response.webhook.id, name: response.webhook.name });
|
|
3704
3888
|
return response.webhook;
|
|
3705
3889
|
}
|
|
3706
3890
|
async update(id, input) {
|
|
3707
3891
|
validateNonEmptyString(id, "webhookId");
|
|
3708
3892
|
validateWithSchema(WebhookUpdateInput, input, "webhook");
|
|
3709
|
-
|
|
3893
|
+
log8.debug("Updating webhook", { id });
|
|
3710
3894
|
const path = this.transport.paths.webhookUpdate.replace("{id}", encodeURIComponent(id));
|
|
3711
3895
|
const response = await this.transport.request(path, {
|
|
3712
3896
|
method: "PUT",
|
|
@@ -3716,32 +3900,32 @@ class WebhooksResource {
|
|
|
3716
3900
|
}
|
|
3717
3901
|
async delete(id) {
|
|
3718
3902
|
validateNonEmptyString(id, "webhookId");
|
|
3719
|
-
|
|
3903
|
+
log8.debug("Deleting webhook", { id });
|
|
3720
3904
|
const path = this.transport.paths.webhookDelete.replace("{id}", encodeURIComponent(id));
|
|
3721
3905
|
const response = await this.transport.request(path, {
|
|
3722
3906
|
method: "DELETE"
|
|
3723
3907
|
});
|
|
3724
|
-
|
|
3908
|
+
log8.info("Webhook deleted", { id });
|
|
3725
3909
|
return response;
|
|
3726
3910
|
}
|
|
3727
3911
|
async activate(id) {
|
|
3728
3912
|
validateNonEmptyString(id, "webhookId");
|
|
3729
|
-
|
|
3913
|
+
log8.debug("Activating webhook", { id });
|
|
3730
3914
|
const path = this.transport.paths.webhookActivate.replace("{id}", encodeURIComponent(id));
|
|
3731
3915
|
const response = await this.transport.request(path, {
|
|
3732
3916
|
method: "PUT"
|
|
3733
3917
|
});
|
|
3734
|
-
|
|
3918
|
+
log8.info("Webhook activated", { id });
|
|
3735
3919
|
return response.webhook;
|
|
3736
3920
|
}
|
|
3737
3921
|
async deactivate(id) {
|
|
3738
3922
|
validateNonEmptyString(id, "webhookId");
|
|
3739
|
-
|
|
3923
|
+
log8.debug("Deactivating webhook", { id });
|
|
3740
3924
|
const path = this.transport.paths.webhookDeactivate.replace("{id}", encodeURIComponent(id));
|
|
3741
3925
|
const response = await this.transport.request(path, {
|
|
3742
3926
|
method: "PUT"
|
|
3743
3927
|
});
|
|
3744
|
-
|
|
3928
|
+
log8.info("Webhook deactivated", { id });
|
|
3745
3929
|
return response.webhook;
|
|
3746
3930
|
}
|
|
3747
3931
|
}
|
|
@@ -3752,13 +3936,13 @@ class WebhookFiltersResource {
|
|
|
3752
3936
|
this.transport = transport;
|
|
3753
3937
|
}
|
|
3754
3938
|
async list() {
|
|
3755
|
-
|
|
3939
|
+
log8.debug("Listing webhook filters");
|
|
3756
3940
|
const response = await this.transport.request(this.transport.paths.webhookFilterList);
|
|
3757
3941
|
return response.filters;
|
|
3758
3942
|
}
|
|
3759
3943
|
async get(id) {
|
|
3760
3944
|
validateNonEmptyString(id, "webhookFilterId");
|
|
3761
|
-
|
|
3945
|
+
log8.debug("Getting webhook filter", { id });
|
|
3762
3946
|
const path = this.transport.paths.webhookFilterGet.replace("{id}", encodeURIComponent(id));
|
|
3763
3947
|
const response = await this.transport.request(path);
|
|
3764
3948
|
if (!response.filter) {
|
|
@@ -3768,25 +3952,25 @@ class WebhookFiltersResource {
|
|
|
3768
3952
|
}
|
|
3769
3953
|
async listByWebhook(webhookId) {
|
|
3770
3954
|
validateNonEmptyString(webhookId, "webhookId");
|
|
3771
|
-
|
|
3955
|
+
log8.debug("Listing webhook filters by webhook", { webhookId });
|
|
3772
3956
|
const path = this.transport.paths.webhookFiltersByWebhook.replace("{webhookId}", encodeURIComponent(webhookId));
|
|
3773
3957
|
const response = await this.transport.request(path);
|
|
3774
3958
|
return response.filters;
|
|
3775
3959
|
}
|
|
3776
3960
|
async create(input) {
|
|
3777
3961
|
validateWithSchema(WebhookFilterCreateInput, input, "webhook filter");
|
|
3778
|
-
|
|
3962
|
+
log8.debug("Creating webhook filter", {
|
|
3779
3963
|
webhookId: input.webhookId,
|
|
3780
3964
|
filterKey: input.filterKey
|
|
3781
3965
|
});
|
|
3782
3966
|
const response = await this.transport.request(this.transport.paths.webhookFilterCreate, { method: "POST", body: input });
|
|
3783
|
-
|
|
3967
|
+
log8.info("Webhook filter created", { webhookId: input.webhookId });
|
|
3784
3968
|
return response.filter;
|
|
3785
3969
|
}
|
|
3786
3970
|
async update(id, input) {
|
|
3787
3971
|
validateNonEmptyString(id, "webhookFilterId");
|
|
3788
3972
|
validateWithSchema(WebhookFilterUpdateInput, input, "webhook filter");
|
|
3789
|
-
|
|
3973
|
+
log8.debug("Updating webhook filter", { id });
|
|
3790
3974
|
const path = this.transport.paths.webhookFilterUpdate.replace("{id}", encodeURIComponent(id));
|
|
3791
3975
|
const response = await this.transport.request(path, {
|
|
3792
3976
|
method: "PUT",
|
|
@@ -3796,12 +3980,12 @@ class WebhookFiltersResource {
|
|
|
3796
3980
|
}
|
|
3797
3981
|
async delete(id) {
|
|
3798
3982
|
validateNonEmptyString(id, "webhookFilterId");
|
|
3799
|
-
|
|
3983
|
+
log8.debug("Deleting webhook filter", { id });
|
|
3800
3984
|
const path = this.transport.paths.webhookFilterDelete.replace("{id}", encodeURIComponent(id));
|
|
3801
3985
|
const response = await this.transport.request(path, {
|
|
3802
3986
|
method: "DELETE"
|
|
3803
3987
|
});
|
|
3804
|
-
|
|
3988
|
+
log8.info("Webhook filter deleted", { id });
|
|
3805
3989
|
return response;
|
|
3806
3990
|
}
|
|
3807
3991
|
}
|
|
@@ -3813,10 +3997,10 @@ function createWebhooksClient(registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
|
3813
3997
|
webhooks;
|
|
3814
3998
|
webhookFilters;
|
|
3815
3999
|
constructor(config = {}) {
|
|
3816
|
-
const resolved =
|
|
4000
|
+
const resolved = resolveToProvider9(config, registry);
|
|
3817
4001
|
if (resolved.mode === "transport") {
|
|
3818
4002
|
this.transport = resolved.transport;
|
|
3819
|
-
|
|
4003
|
+
log8.info("Client initialized with custom transport");
|
|
3820
4004
|
} else {
|
|
3821
4005
|
const { provider } = resolved;
|
|
3822
4006
|
const { baseUrl, paths } = provider.getEndpointWithPaths("webhooks");
|
|
@@ -3825,13 +4009,13 @@ function createWebhooksClient(registry = DEFAULT_PROVIDER_REGISTRY) {
|
|
|
3825
4009
|
throw new Error("Webhooks API requires authentication");
|
|
3826
4010
|
}
|
|
3827
4011
|
this._provider = provider;
|
|
3828
|
-
this.transport = new
|
|
4012
|
+
this.transport = new Transport8({
|
|
3829
4013
|
baseUrl,
|
|
3830
4014
|
tokenProvider,
|
|
3831
4015
|
timeout: provider.timeout,
|
|
3832
4016
|
paths
|
|
3833
4017
|
});
|
|
3834
|
-
|
|
4018
|
+
log8.info("Client initialized", {
|
|
3835
4019
|
platform: provider.platform,
|
|
3836
4020
|
env: provider.env,
|
|
3837
4021
|
baseUrl
|
|
@@ -3885,6 +4069,7 @@ class TimebackClient {
|
|
|
3885
4069
|
_powerpath;
|
|
3886
4070
|
_clr;
|
|
3887
4071
|
_case;
|
|
4072
|
+
_reporting;
|
|
3888
4073
|
_webhooks;
|
|
3889
4074
|
constructor(config) {
|
|
3890
4075
|
const resolved = resolveToProvider(config ?? {}, TIMEBACK_ENV_VARS);
|
|
@@ -3949,6 +4134,14 @@ class TimebackClient {
|
|
|
3949
4134
|
}
|
|
3950
4135
|
return this._case;
|
|
3951
4136
|
}
|
|
4137
|
+
get reporting() {
|
|
4138
|
+
this.assertOpen();
|
|
4139
|
+
this.assertService("reporting");
|
|
4140
|
+
if (!this._reporting) {
|
|
4141
|
+
this._reporting = new ReportingClient({ provider: this.provider });
|
|
4142
|
+
}
|
|
4143
|
+
return this._reporting;
|
|
4144
|
+
}
|
|
3952
4145
|
get webhooks() {
|
|
3953
4146
|
this.assertOpen();
|
|
3954
4147
|
this.assertService("webhooks");
|
|
@@ -3973,6 +4166,7 @@ class TimebackClient {
|
|
|
3973
4166
|
this._powerpath = undefined;
|
|
3974
4167
|
this._clr = undefined;
|
|
3975
4168
|
this._case = undefined;
|
|
4169
|
+
this._reporting = undefined;
|
|
3976
4170
|
this._webhooks = undefined;
|
|
3977
4171
|
this._closed = true;
|
|
3978
4172
|
}
|
package/dist/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timeback/core",
|
|
3
|
-
"version": "0.2.1-beta.
|
|
3
|
+
"version": "0.2.1-beta.20260315040428",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"@timeback/oneroster": "0.2.0",
|
|
47
47
|
"@timeback/powerpath": "0.2.0",
|
|
48
48
|
"@timeback/qti": "0.2.0",
|
|
49
|
+
"@timeback/reporting": "0.1.0",
|
|
49
50
|
"@timeback/webhooks": "0.2.0",
|
|
50
51
|
"@types/bun": "latest",
|
|
51
52
|
"esbuild": "^0.27.3"
|