@contractspec/module.learning-journey 1.44.0 → 1.45.0
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/contracts/models.d.ts +118 -118
- package/dist/contracts/onboarding.d.ts +4 -4
- package/dist/contracts/onboarding.js +5 -5
- package/dist/contracts/onboarding.js.map +1 -1
- package/dist/contracts/operations.js +5 -5
- package/dist/contracts/operations.js.map +1 -1
- package/dist/entities/index.d.ts +605 -605
- package/dist/entities/learner.d.ts +192 -192
- package/dist/entities/onboarding.d.ts +165 -165
- package/dist/events.d.ts +213 -213
- package/dist/events.js +16 -16
- package/dist/events.js.map +1 -1
- package/dist/learning-journey.feature.js +29 -29
- package/dist/learning-journey.feature.js.map +1 -1
- package/package.json +13 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding.js","names":[],"sources":["../../src/contracts/onboarding.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nimport { SuccessOutput } from './models';\nimport { LEARNING_JOURNEY_OWNERS } from './shared';\n\nconst OnboardingStepConditionModel = defineSchemaModel({\n name: 'OnboardingStepCondition',\n description: 'Structured completion condition for onboarding steps.',\n fields: {\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventVersion: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n payloadFilter: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nexport const OnboardingStepModel = defineSchemaModel({\n name: 'OnboardingStep',\n description: 'Declarative onboarding step definition.',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n instructions: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n helpUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completionEvent: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n completionCondition: {\n type: OnboardingStepConditionModel,\n isOptional: true,\n },\n xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n canSkip: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n actionUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actionLabel: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nexport const OnboardingTrackModel = defineSchemaModel({\n name: 'OnboardingTrack',\n description: 'Onboarding track metadata and steps.',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetUserSegment: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n targetRole: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n canSkip: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n completionXpBonus: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n completionBadgeKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n streakHoursWindow: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n steps: { type: OnboardingStepModel, isArray: true, isOptional: false },\n },\n});\n\nexport const OnboardingStepProgressModel = defineSchemaModel({\n name: 'OnboardingStepProgress',\n description: 'Progress for a specific onboarding step.',\n fields: {\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n xpEarned: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n triggeringEvent: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n eventPayload: { type: ScalarTypeEnum.JSON(), isOptional: true },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nexport const OnboardingProgressModel = defineSchemaModel({\n name: 'OnboardingProgress',\n description: 'Aggregated progress for an onboarding track.',\n fields: {\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n isCompleted: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n xpEarned: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n lastActivityAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n steps: {\n type: OnboardingStepProgressModel,\n isArray: true,\n isOptional: true,\n },\n },\n});\n\nconst ListOnboardingTracksInput = defineSchemaModel({\n name: 'ListOnboardingTracksInput',\n description: 'Filters for listing onboarding tracks.',\n fields: {\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n trackIds: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n includeProgress: {\n type: ScalarTypeEnum.Boolean(),\n isOptional: true,\n },\n },\n});\n\nconst ListOnboardingTracksOutput = defineSchemaModel({\n name: 'ListOnboardingTracksOutput',\n description: 'Available onboarding tracks with optional progress.',\n fields: {\n tracks: { type: OnboardingTrackModel, isArray: true, isOptional: false },\n progress: {\n type: OnboardingProgressModel,\n isArray: true,\n isOptional: true,\n },\n },\n});\n\nconst GetOnboardingProgressInput = defineSchemaModel({\n name: 'GetOnboardingProgressInput',\n description: 'Input for fetching onboarding progress for a track.',\n fields: {\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst RecordOnboardingEventInput = defineSchemaModel({\n name: 'RecordOnboardingEventInput',\n description:\n 'Record a domain event to advance onboarding progress via completion conditions.',\n fields: {\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventVersion: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n eventPayload: { type: ScalarTypeEnum.JSON(), isOptional: true },\n occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nexport const ListOnboardingTracksContract = defineQuery({\n meta: {\n key: 'learning.onboarding.listTracks',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'onboarding', 'journey'],\n description: 'List onboarding tracks available to a learner or product.',\n goal: 'Expose track catalog for UI/API surfaces.',\n context: 'Called when showing onboarding/learning journey catalog.',\n },\n io: {\n input: ListOnboardingTracksInput,\n output: ListOnboardingTracksOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\nexport const GetOnboardingProgressContract = defineQuery({\n meta: {\n key: 'learning.onboarding.getProgress',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'onboarding', 'journey'],\n description: 'Fetch onboarding progress for a specific track.',\n goal: 'Display learner progress and remaining steps.',\n context: 'Called when rendering a track detail or widget.',\n },\n io: {\n input: GetOnboardingProgressInput,\n output: OnboardingProgressModel,\n },\n policy: {\n auth: 'user',\n },\n});\n\nexport const RecordOnboardingEventContract = defineCommand({\n meta: {\n key: 'learning.onboarding.recordEvent',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'onboarding', 'events'],\n description:\n 'Record a domain event to evaluate onboarding step completion conditions.',\n goal: 'Advance onboarding automatically from product events.',\n context:\n 'Called by event bus handlers when relevant product events fire (e.g., deal.created).',\n },\n io: {\n input: RecordOnboardingEventInput,\n output: SuccessOutput,\n errors: {\n TRACK_NOT_FOUND: {\n description: 'Track not found for event routing',\n http: 404,\n gqlCode: 'TRACK_NOT_FOUND',\n when: 'Track ID or routing context is invalid',\n },\n STEP_NOT_FOUND: {\n description: 'Step not found for completion condition',\n http: 404,\n gqlCode: 'STEP_NOT_FOUND',\n when: 'No step matches the incoming event',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;;;AAMA,MAAM,+BAA+B,kBAAkB;CACrD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,cAAc;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EACvE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EAC1E,eAAe;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EACjE;CACF,CAAC;AAEF,MAAa,sBAAsB,kBAAkB;CACnD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,cAAc;G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AK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM;GAAC;GAAY;GAAc;GAAU;EAC3C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;AAEF,MAAa,gCAAgC,YAAY;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM;GAAC;GAAY;GAAc;GAAU;EAC3C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;AAEF,MAAa,gCAAgC,cAAc;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM;GAAC;GAAY;GAAc;GAAS;EAC1C,aACE;EACF,MAAM;EACN,SACE;EACH;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,iBAAiB;IACf,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,gBAAgB;IACd,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"onboarding.js","names":[],"sources":["../../src/contracts/onboarding.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nimport { SuccessOutput } from './models';\nimport { LEARNING_JOURNEY_OWNERS } from './shared';\n\nconst OnboardingStepConditionModel = defineSchemaModel({\n name: 'OnboardingStepCondition',\n description: 'Structured completion condition for onboarding steps.',\n fields: {\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventVersion: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n payloadFilter: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nexport const OnboardingStepModel = defineSchemaModel({\n name: 'OnboardingStep',\n description: 'Declarative onboarding step definition.',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n instructions: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n helpUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n completionEvent: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n completionCondition: {\n type: OnboardingStepConditionModel,\n isOptional: true,\n },\n xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n canSkip: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n actionUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n actionLabel: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n },\n});\n\nexport const OnboardingTrackModel = defineSchemaModel({\n name: 'OnboardingTrack',\n description: 'Onboarding track metadata and steps.',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n targetUserSegment: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n targetRole: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isActive: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n isRequired: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n canSkip: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n completionXpBonus: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n completionBadgeKey: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n streakHoursWindow: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n },\n streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSON(), isOptional: true },\n steps: { type: OnboardingStepModel, isArray: true, isOptional: false },\n },\n});\n\nexport const OnboardingStepProgressModel = defineSchemaModel({\n name: 'OnboardingStepProgress',\n description: 'Progress for a specific onboarding step.',\n fields: {\n stepId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n xpEarned: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n triggeringEvent: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n eventPayload: { type: ScalarTypeEnum.JSON(), isOptional: true },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nexport const OnboardingProgressModel = defineSchemaModel({\n name: 'OnboardingProgress',\n description: 'Aggregated progress for an onboarding track.',\n fields: {\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n isCompleted: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n xpEarned: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n lastActivityAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n steps: {\n type: OnboardingStepProgressModel,\n isArray: true,\n isOptional: true,\n },\n },\n});\n\nconst ListOnboardingTracksInput = defineSchemaModel({\n name: 'ListOnboardingTracksInput',\n description: 'Filters for listing onboarding tracks.',\n fields: {\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n trackIds: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n includeProgress: {\n type: ScalarTypeEnum.Boolean(),\n isOptional: true,\n },\n },\n});\n\nconst ListOnboardingTracksOutput = defineSchemaModel({\n name: 'ListOnboardingTracksOutput',\n description: 'Available onboarding tracks with optional progress.',\n fields: {\n tracks: { type: OnboardingTrackModel, isArray: true, isOptional: false },\n progress: {\n type: OnboardingProgressModel,\n isArray: true,\n isOptional: true,\n },\n },\n});\n\nconst GetOnboardingProgressInput = defineSchemaModel({\n name: 'GetOnboardingProgressInput',\n description: 'Input for fetching onboarding progress for a track.',\n fields: {\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst RecordOnboardingEventInput = defineSchemaModel({\n name: 'RecordOnboardingEventInput',\n description:\n 'Record a domain event to advance onboarding progress via completion conditions.',\n fields: {\n learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n trackId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n eventVersion: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n eventPayload: { type: ScalarTypeEnum.JSON(), isOptional: true },\n occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\nexport const ListOnboardingTracksContract = defineQuery({\n meta: {\n key: 'learning.onboarding.listTracks',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'onboarding', 'journey'],\n description: 'List onboarding tracks available to a learner or product.',\n goal: 'Expose track catalog for UI/API surfaces.',\n context: 'Called when showing onboarding/learning journey catalog.',\n },\n io: {\n input: ListOnboardingTracksInput,\n output: ListOnboardingTracksOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\nexport const GetOnboardingProgressContract = defineQuery({\n meta: {\n key: 'learning.onboarding.getProgress',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'onboarding', 'journey'],\n description: 'Fetch onboarding progress for a specific track.',\n goal: 'Display learner progress and remaining steps.',\n context: 'Called when rendering a track detail or widget.',\n },\n io: {\n input: GetOnboardingProgressInput,\n output: OnboardingProgressModel,\n },\n policy: {\n auth: 'user',\n },\n});\n\nexport const RecordOnboardingEventContract = defineCommand({\n meta: {\n key: 'learning.onboarding.recordEvent',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'onboarding', 'events'],\n description:\n 'Record a domain event to evaluate onboarding step completion conditions.',\n goal: 'Advance onboarding automatically from product events.',\n context:\n 'Called by event bus handlers when relevant product events fire (e.g., deal.created).',\n },\n io: {\n input: RecordOnboardingEventInput,\n output: SuccessOutput,\n errors: {\n TRACK_NOT_FOUND: {\n description: 'Track not found for event routing',\n http: 404,\n gqlCode: 'TRACK_NOT_FOUND',\n when: 'Track ID or routing context is invalid',\n },\n STEP_NOT_FOUND: {\n description: 'Step not found for completion condition',\n http: 404,\n gqlCode: 'STEP_NOT_FOUND',\n when: 'No step matches the incoming event',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;;;AAMA,MAAM,+BAA+B,kBAAkB;CACrD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EAC1E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EA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CAAC"}
|
|
@@ -9,7 +9,7 @@ import { defineCommand, defineQuery } from "@contractspec/lib.contracts";
|
|
|
9
9
|
const EnrollInCourseContract = defineCommand({
|
|
10
10
|
meta: {
|
|
11
11
|
key: "learning.enroll",
|
|
12
|
-
version: 1,
|
|
12
|
+
version: "1.0.0",
|
|
13
13
|
stability: "stable",
|
|
14
14
|
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
15
15
|
tags: ["learning", "enrollment"],
|
|
@@ -43,7 +43,7 @@ const EnrollInCourseContract = defineCommand({
|
|
|
43
43
|
const CompleteLessonContract = defineCommand({
|
|
44
44
|
meta: {
|
|
45
45
|
key: "learning.completeLesson",
|
|
46
|
-
version: 1,
|
|
46
|
+
version: "1.0.0",
|
|
47
47
|
stability: "stable",
|
|
48
48
|
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
49
49
|
tags: ["learning", "progress"],
|
|
@@ -77,7 +77,7 @@ const CompleteLessonContract = defineCommand({
|
|
|
77
77
|
const SubmitCardReviewContract = defineCommand({
|
|
78
78
|
meta: {
|
|
79
79
|
key: "learning.submitCardReview",
|
|
80
|
-
version: 1,
|
|
80
|
+
version: "1.0.0",
|
|
81
81
|
stability: "stable",
|
|
82
82
|
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
83
83
|
tags: ["learning", "flashcards"],
|
|
@@ -111,7 +111,7 @@ const SubmitCardReviewContract = defineCommand({
|
|
|
111
111
|
const GetDueCardsContract = defineQuery({
|
|
112
112
|
meta: {
|
|
113
113
|
key: "learning.getDueCards",
|
|
114
|
-
version: 1,
|
|
114
|
+
version: "1.0.0",
|
|
115
115
|
stability: "stable",
|
|
116
116
|
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
117
117
|
tags: ["learning", "flashcards"],
|
|
@@ -131,7 +131,7 @@ const GetDueCardsContract = defineQuery({
|
|
|
131
131
|
const GetLearnerDashboardContract = defineQuery({
|
|
132
132
|
meta: {
|
|
133
133
|
key: "learning.getDashboard",
|
|
134
|
-
version: 1,
|
|
134
|
+
version: "1.0.0",
|
|
135
135
|
stability: "stable",
|
|
136
136
|
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
137
137
|
tags: ["learning", "dashboard"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","names":[],"sources":["../../src/contracts/operations.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nimport {\n CompleteLessonInput,\n EnrollInCourseInput,\n EnrollmentModel,\n GetDueCardsInput,\n GetDueCardsOutput,\n GetLearnerDashboardInput,\n LearnerDashboardModel,\n SubmitCardReviewInput,\n SuccessOutput,\n} from './models';\nimport { LEARNING_JOURNEY_OWNERS } from './shared';\n\n/**\n * Enroll in a course.\n */\nexport const EnrollInCourseContract = defineCommand({\n meta: {\n key: 'learning.enroll',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'enrollment'],\n description: 'Enroll in a course.',\n goal: 'Start learning a new course.',\n context: 'Called when a learner wants to start a course.',\n },\n io: {\n input: EnrollInCourseInput,\n output: EnrollmentModel,\n errors: {\n COURSE_NOT_FOUND: {\n description: 'Course does not exist',\n http: 404,\n gqlCode: 'COURSE_NOT_FOUND',\n when: 'Course ID is invalid',\n },\n ALREADY_ENROLLED: {\n description: 'Already enrolled in course',\n http: 409,\n gqlCode: 'ALREADY_ENROLLED',\n when: 'Learner is already enrolled',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Complete a lesson.\n */\nexport const CompleteLessonContract = defineCommand({\n meta: {\n key: 'learning.completeLesson',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'progress'],\n description: 'Mark a lesson as completed.',\n goal: 'Record lesson completion and earn XP.',\n context: 'Called when a learner finishes a lesson.',\n },\n io: {\n input: CompleteLessonInput,\n output: SuccessOutput,\n errors: {\n LESSON_NOT_FOUND: {\n description: 'Lesson does not exist',\n http: 404,\n gqlCode: 'LESSON_NOT_FOUND',\n when: 'Lesson ID is invalid',\n },\n NOT_ENROLLED: {\n description: 'Not enrolled in course',\n http: 403,\n gqlCode: 'NOT_ENROLLED',\n when: 'Learner is not enrolled in the course',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Submit a card review.\n */\nexport const SubmitCardReviewContract = defineCommand({\n meta: {\n key: 'learning.submitCardReview',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'flashcards'],\n description: 'Submit a flashcard review.',\n goal: 'Record review and update SRS schedule.',\n context: 'Called when reviewing flashcards.',\n },\n io: {\n input: SubmitCardReviewInput,\n output: SuccessOutput,\n errors: {\n CARD_NOT_FOUND: {\n description: 'Card does not exist',\n http: 404,\n gqlCode: 'CARD_NOT_FOUND',\n when: 'Card ID is invalid',\n },\n INVALID_RATING: {\n description: 'Invalid rating',\n http: 400,\n gqlCode: 'INVALID_RATING',\n when: 'Rating must be AGAIN, HARD, GOOD, or EASY',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Get cards due for review.\n */\nexport const GetDueCardsContract = defineQuery({\n meta: {\n key: 'learning.getDueCards',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'flashcards'],\n description: 'Get flashcards due for review.',\n goal: 'Get the next batch of cards to review.',\n context: 'Called when starting a review session.',\n },\n io: {\n input: GetDueCardsInput,\n output: GetDueCardsOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Get learner dashboard.\n */\nexport const GetLearnerDashboardContract = defineQuery({\n meta: {\n key: 'learning.getDashboard',\n version: 1,\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'dashboard'],\n description: 'Get learner dashboard data.',\n goal: 'Display learner progress and stats.',\n context: 'Called when viewing the learning dashboard.',\n },\n io: {\n input: GetLearnerDashboardInput,\n output: LearnerDashboardModel,\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;;;;;AAkBA,MAAa,yBAAyB,cAAc;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM,CAAC,YAAY,aAAa;EAChC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,kBAAkB;IAChB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,kBAAkB;IAChB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,cAAc;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM,CAAC,YAAY,WAAW;EAC9B,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,kBAAkB;IAChB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,cAAc;IACZ,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;;;;AAKF,MAAa,2BAA2B,cAAc;CACpD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM,CAAC,YAAY,aAAa;EAChC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,gBAAgB;IACd,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,gBAAgB;IACd,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;;;;AAKF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM,CAAC,YAAY,aAAa;EAChC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;;;;AAKF,MAAa,8BAA8B,YAAY;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM,CAAC,YAAY,YAAY;EAC/B,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"operations.js","names":[],"sources":["../../src/contracts/operations.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@contractspec/lib.contracts';\n\nimport {\n CompleteLessonInput,\n EnrollInCourseInput,\n EnrollmentModel,\n GetDueCardsInput,\n GetDueCardsOutput,\n GetLearnerDashboardInput,\n LearnerDashboardModel,\n SubmitCardReviewInput,\n SuccessOutput,\n} from './models';\nimport { LEARNING_JOURNEY_OWNERS } from './shared';\n\n/**\n * Enroll in a course.\n */\nexport const EnrollInCourseContract = defineCommand({\n meta: {\n key: 'learning.enroll',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'enrollment'],\n description: 'Enroll in a course.',\n goal: 'Start learning a new course.',\n context: 'Called when a learner wants to start a course.',\n },\n io: {\n input: EnrollInCourseInput,\n output: EnrollmentModel,\n errors: {\n COURSE_NOT_FOUND: {\n description: 'Course does not exist',\n http: 404,\n gqlCode: 'COURSE_NOT_FOUND',\n when: 'Course ID is invalid',\n },\n ALREADY_ENROLLED: {\n description: 'Already enrolled in course',\n http: 409,\n gqlCode: 'ALREADY_ENROLLED',\n when: 'Learner is already enrolled',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Complete a lesson.\n */\nexport const CompleteLessonContract = defineCommand({\n meta: {\n key: 'learning.completeLesson',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'progress'],\n description: 'Mark a lesson as completed.',\n goal: 'Record lesson completion and earn XP.',\n context: 'Called when a learner finishes a lesson.',\n },\n io: {\n input: CompleteLessonInput,\n output: SuccessOutput,\n errors: {\n LESSON_NOT_FOUND: {\n description: 'Lesson does not exist',\n http: 404,\n gqlCode: 'LESSON_NOT_FOUND',\n when: 'Lesson ID is invalid',\n },\n NOT_ENROLLED: {\n description: 'Not enrolled in course',\n http: 403,\n gqlCode: 'NOT_ENROLLED',\n when: 'Learner is not enrolled in the course',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Submit a card review.\n */\nexport const SubmitCardReviewContract = defineCommand({\n meta: {\n key: 'learning.submitCardReview',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'flashcards'],\n description: 'Submit a flashcard review.',\n goal: 'Record review and update SRS schedule.',\n context: 'Called when reviewing flashcards.',\n },\n io: {\n input: SubmitCardReviewInput,\n output: SuccessOutput,\n errors: {\n CARD_NOT_FOUND: {\n description: 'Card does not exist',\n http: 404,\n gqlCode: 'CARD_NOT_FOUND',\n when: 'Card ID is invalid',\n },\n INVALID_RATING: {\n description: 'Invalid rating',\n http: 400,\n gqlCode: 'INVALID_RATING',\n when: 'Rating must be AGAIN, HARD, GOOD, or EASY',\n },\n },\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Get cards due for review.\n */\nexport const GetDueCardsContract = defineQuery({\n meta: {\n key: 'learning.getDueCards',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'flashcards'],\n description: 'Get flashcards due for review.',\n goal: 'Get the next batch of cards to review.',\n context: 'Called when starting a review session.',\n },\n io: {\n input: GetDueCardsInput,\n output: GetDueCardsOutput,\n },\n policy: {\n auth: 'user',\n },\n});\n\n/**\n * Get learner dashboard.\n */\nexport const GetLearnerDashboardContract = defineQuery({\n meta: {\n key: 'learning.getDashboard',\n version: '1.0.0',\n stability: 'stable',\n owners: [...LEARNING_JOURNEY_OWNERS],\n tags: ['learning', 'dashboard'],\n description: 'Get learner dashboard data.',\n goal: 'Display learner progress and stats.',\n context: 'Called when viewing the learning dashboard.',\n },\n io: {\n input: GetLearnerDashboardInput,\n output: LearnerDashboardModel,\n },\n policy: {\n auth: 'user',\n },\n});\n"],"mappings":";;;;;;;;AAkBA,MAAa,yBAAyB,cAAc;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM,CAAC,YAAY,aAAa;EAChC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,kBAAkB;IAChB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,kBAAkB;IAChB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,cAAc;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,wBAAwB;EACpC,MAAM,CAAC,YAAY,WAAW;EAC9B,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ;GACN,kBAAkB;IAChB,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACD,cAAc;IACZ,aAAa;IACb,MAAM;IACN,SAAS;IACT,MAAM;IACP;GACF;EACF;CACD,QAAQ,EACN,MAAM,QACP;CACF,CAAC;;;;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