@lssm/example.learning-journey-platform-tour 0.0.0-canary-20251213172311
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/.turbo/turbo-build.log +19 -0
- package/CHANGELOG.md +10 -0
- package/README.md +40 -0
- package/dist/contracts/index.js +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/platform-tour.docblock.js +1 -0
- package/dist/example.js +1 -0
- package/dist/handlers/demo.handlers.js +1 -0
- package/dist/index.js +1 -0
- package/dist/presentations/index.js +1 -0
- package/dist/track.js +1 -0
- package/example.ts +1 -0
- package/package.json +54 -0
- package/src/contracts/index.test.ts +49 -0
- package/src/contracts/index.ts +122 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/platform-tour.docblock.ts +40 -0
- package/src/example.ts +27 -0
- package/src/handlers/demo.handlers.ts +50 -0
- package/src/index.ts +6 -0
- package/src/presentations/index.ts +47 -0
- package/src/track.ts +106 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +7 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
$ bun build:bundle && bun build:types
|
|
2
|
+
$ tsdown
|
|
3
|
+
[34mℹ[39m tsdown [2mv0.17.0[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
4
|
+
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/learning-journey-platform-tour/tsdown.config.js[24m
|
|
5
|
+
[34mℹ[39m entry: [34msrc/example.ts, src/index.ts, src/track.ts, src/contracts/index.ts, src/docs/index.ts, src/docs/platform-tour.docblock.ts, src/handlers/demo.handlers.ts, src/presentations/index.ts[39m
|
|
6
|
+
[34mℹ[39m target: [34mesnext[39m
|
|
7
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
8
|
+
[34mℹ[39m Build start
|
|
9
|
+
[34mℹ[39m [2mdist/[22m[1mcontracts/index.js[22m [2m2.81 kB[22m [2m│ gzip: 0.91 kB[22m
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mtrack.js[22m [2m2.18 kB[22m [2m│ gzip: 0.80 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/platform-tour.docblock.js[22m [2m1.38 kB[22m [2m│ gzip: 0.73 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m0.92 kB[22m [2m│ gzip: 0.31 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mpresentations/index.js[22m [2m0.78 kB[22m [2m│ gzip: 0.37 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1mexample.js[22m [2m0.63 kB[22m [2m│ gzip: 0.35 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[1mhandlers/demo.handlers.js[22m [2m0.45 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
17
|
+
[34mℹ[39m 8 files, total: 9.18 kB
|
|
18
|
+
[32m✔[39m Build complete in [32m69ms[39m
|
|
19
|
+
$ tsc --noEmit
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @lssm/example.learning-journey-platform-tour
|
|
2
|
+
|
|
3
|
+
## 0.0.0-canary-20251213172311
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3086383]
|
|
8
|
+
- @lssm/lib.contracts@0.0.0-canary-20251213172311
|
|
9
|
+
- @lssm/lib.schema@0.0.0-canary-20251213172311
|
|
10
|
+
- @lssm/module.learning-journey@0.0.0-canary-20251213172311
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @lssm/example.learning-journey-platform-tour
|
|
2
|
+
|
|
3
|
+
Learning Journey example that tours platform primitives.
|
|
4
|
+
|
|
5
|
+
## Track
|
|
6
|
+
|
|
7
|
+
- **Key**: `platform_primitives_tour`
|
|
8
|
+
- **Persona**: platform developer
|
|
9
|
+
- **XP**: 7 steps × 20 XP + 20 bonus
|
|
10
|
+
- **Badge**: `platform_primitives`
|
|
11
|
+
|
|
12
|
+
## Steps & Events
|
|
13
|
+
|
|
14
|
+
1. `identity_rbac` → `org.member.added`
|
|
15
|
+
2. `event_bus_audit` → `audit_log.created`
|
|
16
|
+
3. `notifications` → `notification.sent`
|
|
17
|
+
4. `jobs_scheduler` → `job.completed`
|
|
18
|
+
5. `feature_flags` → `flag.toggled`
|
|
19
|
+
6. `files_attachments` → `attachment.attached`
|
|
20
|
+
7. `usage_metering` → `usage.recorded`
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
- Import track specs:
|
|
25
|
+
`import { platformLearningTracks } from '@lssm/example.learning-journey-platform-tour/track'`
|
|
26
|
+
- Contracts/handlers for demos:
|
|
27
|
+
`import { GetPlatformTourTrack, RecordPlatformTourEvent } from '@lssm/example.learning-journey-platform-tour/contracts'`
|
|
28
|
+
`import { emitPlatformTourEvent } from '@lssm/example.learning-journey-platform-tour/handlers/demo.handlers'`
|
|
29
|
+
- Presentations (react/markdown/json targets):
|
|
30
|
+
`import { platformTourPresentations } from '@lssm/example.learning-journey-platform-tour/presentations'`
|
|
31
|
+
- Register via onboarding API:
|
|
32
|
+
- `learning.onboarding.listTracks`
|
|
33
|
+
- `learning.onboarding.getProgress`
|
|
34
|
+
- `learning.onboarding.recordEvent` wired from each module’s events
|
|
35
|
+
- Map module events (identity, audit-trail, notifications, jobs, feature-flags, files, metering) into `recordEvent`.
|
|
36
|
+
|
|
37
|
+
## Docs
|
|
38
|
+
|
|
39
|
+
- Docblock: `src/docs/platform-tour.docblock.ts`
|
|
40
|
+
- Route suggestion: `/docs/learning-journey/platform-tour`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{platformPrimitivesTourTrack as e}from"../track.js";import{ScalarTypeEnum as t,defineSchemaModel as n}from"@lssm/lib.schema";import{defineCommand as r,defineQuery as i}from"@lssm/lib.contracts";const a=[`examples.learning-journey.platform-tour`],o=n({name:`PlatformTourStep`,description:`Step metadata for platform primitives tour`,fields:{id:{type:t.String_unsecure(),isOptional:!1},title:{type:t.String_unsecure(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},completionEvent:{type:t.String_unsecure(),isOptional:!1},sourceModule:{type:t.String_unsecure(),isOptional:!0},xpReward:{type:t.Int_unsecure(),isOptional:!0},order:{type:t.Int_unsecure(),isOptional:!0}}}),s=n({name:`PlatformTourTrack`,description:`Platform primitives tour track definition`,fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},totalXp:{type:t.Int_unsecure(),isOptional:!0},completionXpBonus:{type:t.Int_unsecure(),isOptional:!0},completionBadgeKey:{type:t.String_unsecure(),isOptional:!0},streakHoursWindow:{type:t.Int_unsecure(),isOptional:!0},streakBonusXp:{type:t.Int_unsecure(),isOptional:!0},steps:{type:o,isArray:!0,isOptional:!1}}}),c=n({name:`PlatformTourTrackResponse`,description:`Response wrapper for platform tour track`,fields:{track:{type:s,isOptional:!1}}}),l=n({name:`PlatformTourRecordEventInput`,description:`Emit a demo event to advance platform tour steps`,fields:{learnerId:{type:t.String_unsecure(),isOptional:!1},eventName:{type:t.String_unsecure(),isOptional:!1},payload:{type:t.JSON(),isOptional:!0},occurredAt:{type:t.DateTime(),isOptional:!0}}}),u=n({name:`PlatformTourSuccess`,description:`Generic success response`,fields:{success:{type:t.Boolean(),isOptional:!1}}}),d=i({meta:{name:`learningJourney.platformTour.getTrack`,version:1,stability:`experimental`,owners:[...a],tags:[`learning`,`platform`,`tour`],description:`Fetch platform primitives tour track definition.`,goal:`Expose track metadata to UIs and templates.`,context:`Called by Studio/Playground to render journey steps.`},io:{input:n({name:`PlatformTourTrackInput`,description:`Track input`,fields:{}}),output:c},policy:{auth:`user`}}),f=r({meta:{name:`learningJourney.platformTour.recordEvent`,version:1,stability:`experimental`,owners:[...a],tags:[`learning`,`platform`,`tour`],description:`Record an event to advance platform tour progress.`,goal:`Advance steps via domain events in demo/sandbox contexts.`,context:`Called by handlers or demo scripts to emit step completion events.`},io:{input:l,output:u},policy:{auth:`user`}}),p={GetPlatformTourTrack:d,RecordPlatformTourEvent:f,track:e};export{d as GetPlatformTourTrack,s as PlatformTourTrackModel,f as RecordPlatformTourEvent,p as platformTourContracts};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./platform-tour.docblock.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.learning-journey.platform-tour`,title:`Learning Journey — Platform Primitives Tour`,summary:`Cross-module tour that touches identity, audit, notifications, jobs, feature flags, files, and metering.`,kind:`reference`,visibility:`public`,route:`/docs/learning-journey/platform-tour`,tags:[`learning`,`platform`,`onboarding`],body:"## Track\n- **Key**: `platform_primitives_tour`\n- **Persona**: platform developer exploring primitives\n- **Goal**: Touch each cross-cutting module once, event-driven completion\n\n## Steps & Events\n1) `identity_rbac` → `org.member.added`\n2) `event_bus_audit` → `audit_log.created`\n3) `notifications` → `notification.sent`\n4) `jobs_scheduler` → `job.completed`\n5) `feature_flags` → `flag.toggled`\n6) `files_attachments` → `attachment.attached`\n7) `usage_metering` → `usage.recorded`\n\nXP: 20 per step, 20 bonus XP upon completion.\n\n## Wiring\n- Tracks export from `@lssm/example.learning-journey-platform-tour/track`.\n- Use onboarding API to surface progress:\n - `learning.onboarding.listTracks`\n - `learning.onboarding.getProgress`\n - `learning.onboarding.recordEvent` wired from each module's event bus handlers.\n- Align event payloads with modules: identity-rbac, audit-trail, notifications, jobs, feature-flags, files, metering."}]);
|
package/dist/example.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={id:`learning-journey-platform-tour`,title:`Learning Journey — Platform Tour`,summary:`Learning journey track + contracts + presentations for a platform tour.`,tags:[`learning`,`journey`,`platform-tour`],kind:`template`,visibility:`public`,docs:{rootDocId:`docs.examples.platform-tour`,goalDocId:`docs.examples.platform-tour.goal`,usageDocId:`docs.examples.platform-tour.usage`},entrypoints:{packageName:`@lssm/example.learning-journey-platform-tour`,docs:`./docs`},surfaces:{templates:!0,sandbox:{enabled:!0,modes:[`markdown`,`playground`]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}};export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{platformPrimitivesTourTrack as e}from"../track.js";const t=[`org.member.added`,`audit_log.created`,`notification.sent`,`job.completed`,`flag.toggled`,`attachment.attached`,`usage.recorded`],n=(t,{learnerId:n,occurredAt:r=new Date,payload:i},a)=>{let o={learnerId:n,name:t,occurredAt:r,payload:i,trackId:e.id};return a?a(o):o},r=(e,r)=>t.map(t=>n(t,e,r));export{r as emitAllPlatformTourEvents,n as emitPlatformTourEvent,t as platformTourEvents};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./example.js";import{platformLearningTracks as t,platformPrimitivesTourTrack as n}from"./track.js";import"./docs/index.js";import{GetPlatformTourTrack as r,PlatformTourTrackModel as i,RecordPlatformTourEvent as a,platformTourContracts as o}from"./contracts/index.js";import{emitAllPlatformTourEvents as s,emitPlatformTourEvent as c,platformTourEvents as l}from"./handlers/demo.handlers.js";import{PlatformTourTrackPresentation as u,PlatformTourWidgetPresentation as d,platformTourPresentations as f}from"./presentations/index.js";export{r as GetPlatformTourTrack,i as PlatformTourTrackModel,u as PlatformTourTrackPresentation,d as PlatformTourWidgetPresentation,a as RecordPlatformTourEvent,s as emitAllPlatformTourEvents,c as emitPlatformTourEvent,e as example,t as platformLearningTracks,n as platformPrimitivesTourTrack,o as platformTourContracts,l as platformTourEvents,f as platformTourPresentations};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PlatformTourTrackModel as e}from"../contracts/index.js";const t={domain:`learning-journey`,owners:[`examples.learning-journey.platform-tour`],tags:[`learning`,`platform`,`tour`]},n={meta:{name:`learning.journey.platform.track`,version:1,description:`Platform primitives tour track detail`,...t},source:{type:`component`,framework:`react`,componentKey:`LearningTrackDetail`,props:e},targets:[`react`,`markdown`,`application/json`]},r={meta:{name:`learning.journey.platform.widget`,version:1,description:`Compact widget for platform tour progress`,...t},source:{type:`component`,framework:`react`,componentKey:`LearningTrackProgressWidget`},targets:[`react`]},i=[n,r];export{n as PlatformTourTrackPresentation,r as PlatformTourWidgetPresentation,i as platformTourPresentations};
|
package/dist/track.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={id:`platform_primitives_tour`,productId:`contractspec-platform`,name:`Platform Primitives Tour`,description:`Hands-on tour across identity, audit, notifications, jobs, flags, files, and metering.`,targetUserSegment:`platform_developer`,targetRole:`developer`,totalXp:140,completionRewards:{xpBonus:20,badgeKey:`platform_primitives`},steps:[{id:`identity_rbac`,title:`Create org and member`,description:`Create an org and add at least one member.`,order:1,completion:{eventName:`org.member.added`,sourceModule:`@lssm/lib.identity-rbac`},xpReward:20,metadata:{surface:`identity`}},{id:`event_bus_audit`,title:`Emit an auditable event`,description:`Emit an event that lands in the audit log.`,order:2,completion:{eventName:`audit_log.created`,sourceModule:`@lssm/module.audit-trail`},xpReward:20,metadata:{surface:`bus+audit`}},{id:`notifications`,title:`Send a notification`,description:`Send yourself a notification and verify delivery.`,order:3,completion:{eventName:`notification.sent`,sourceModule:`@lssm/module.notifications`},xpReward:20,metadata:{surface:`notifications`}},{id:`jobs_scheduler`,title:`Schedule and run a job`,description:`Schedule a background job and let it run once.`,order:4,completion:{eventName:`job.completed`,sourceModule:`@lssm/lib.jobs`},xpReward:20,metadata:{surface:`jobs`}},{id:`feature_flags`,title:`Create and toggle a feature flag`,description:`Create a feature flag and toggle it at least once.`,order:5,completion:{eventName:`flag.toggled`,sourceModule:`@lssm/lib.feature-flags`},xpReward:20,metadata:{surface:`feature-flags`}},{id:`files_attachments`,title:`Attach a file`,description:`Upload and attach a file to any entity.`,order:6,completion:{eventName:`attachment.attached`,sourceModule:`@lssm/lib.files`},xpReward:20,metadata:{surface:`files`}},{id:`usage_metering`,title:`Record usage`,description:`Emit a usage metric (regeneration, agent run, or similar).`,order:7,completion:{eventName:`usage.recorded`,sourceModule:`@lssm/lib.metering`},xpReward:20,metadata:{surface:`metering`}}],metadata:{surfacedIn:[`studio/learning`,`platform/dev-center`]}},t=[e];export{t as platformLearningTracks,e as platformPrimitivesTourTrack};
|
package/example.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './src/example';
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lssm/example.learning-journey-platform-tour",
|
|
3
|
+
"version": "0.0.0-canary-20251213172311",
|
|
4
|
+
"description": "Learning journey track covering ContractSpec platform primitives.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts",
|
|
10
|
+
"./contracts": "./src/contracts/index.ts",
|
|
11
|
+
"./docs": "./src/docs/index.ts",
|
|
12
|
+
"./docs/platform-tour.docblock": "./src/docs/platform-tour.docblock.ts",
|
|
13
|
+
"./example": "./src/example.ts",
|
|
14
|
+
"./handlers/demo.handlers": "./src/handlers/demo.handlers.ts",
|
|
15
|
+
"./presentations": "./src/presentations/index.ts",
|
|
16
|
+
"./track": "./src/track.ts",
|
|
17
|
+
"./*": "./*"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "bun build:bundle && bun build:types",
|
|
21
|
+
"build:bundle": "tsdown",
|
|
22
|
+
"build:types": "tsc --noEmit",
|
|
23
|
+
"dev": "bun build:bundle --watch",
|
|
24
|
+
"clean": "rimraf dist .turbo",
|
|
25
|
+
"lint": "bun lint:fix",
|
|
26
|
+
"lint:fix": "eslint src --fix",
|
|
27
|
+
"lint:check": "eslint src"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@lssm/lib.contracts": "workspace:*",
|
|
31
|
+
"@lssm/lib.schema": "workspace:*",
|
|
32
|
+
"@lssm/module.learning-journey": "workspace:*"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@lssm/tool.tsdown": "workspace:*",
|
|
36
|
+
"@lssm/tool.typescript": "workspace:*",
|
|
37
|
+
"tsdown": "^0.17.0",
|
|
38
|
+
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
40
|
+
"module": "./dist/index.js",
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"exports": {
|
|
43
|
+
".": "./dist/index.js",
|
|
44
|
+
"./contracts": "./dist/contracts/index.js",
|
|
45
|
+
"./docs": "./dist/docs/index.js",
|
|
46
|
+
"./docs/platform-tour.docblock": "./dist/docs/platform-tour.docblock.js",
|
|
47
|
+
"./example": "./dist/example.js",
|
|
48
|
+
"./handlers/demo.handlers": "./dist/handlers/demo.handlers.js",
|
|
49
|
+
"./presentations": "./dist/presentations/index.js",
|
|
50
|
+
"./track": "./dist/track.js",
|
|
51
|
+
"./*": "./*"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
GetPlatformTourTrack,
|
|
5
|
+
RecordPlatformTourEvent,
|
|
6
|
+
platformTourContracts,
|
|
7
|
+
} from './index';
|
|
8
|
+
import { platformPrimitivesTourTrack } from '../track';
|
|
9
|
+
import {
|
|
10
|
+
emitPlatformTourEvent,
|
|
11
|
+
platformTourEvents,
|
|
12
|
+
} from '../handlers/demo.handlers';
|
|
13
|
+
import type { PlatformEvent } from '../handlers/demo.handlers';
|
|
14
|
+
|
|
15
|
+
describe('platform tour contracts', () => {
|
|
16
|
+
it('exposes track metadata', () => {
|
|
17
|
+
expect(platformTourContracts.track.id).toBe('platform_primitives_tour');
|
|
18
|
+
expect(platformTourContracts.track.steps.length).toBeGreaterThan(0);
|
|
19
|
+
expect(GetPlatformTourTrack.meta.name).toBe(
|
|
20
|
+
'learningJourney.platformTour.getTrack'
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('allows recording events via demo handler', async () => {
|
|
25
|
+
const [step] = platformPrimitivesTourTrack.steps;
|
|
26
|
+
expect(step).toBeDefined();
|
|
27
|
+
if (!step) throw new Error('Expected at least one platform tour step');
|
|
28
|
+
|
|
29
|
+
const eventName = step.completion.eventName;
|
|
30
|
+
const isPlatformEvent = (value: string): value is PlatformEvent =>
|
|
31
|
+
platformTourEvents.includes(value as PlatformEvent);
|
|
32
|
+
|
|
33
|
+
expect(isPlatformEvent(eventName)).toBe(true);
|
|
34
|
+
if (!isPlatformEvent(eventName)) {
|
|
35
|
+
throw new Error(`Unexpected event name: ${eventName}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const result = await emitPlatformTourEvent(eventName, {
|
|
39
|
+
learnerId: 'demo-learner',
|
|
40
|
+
});
|
|
41
|
+
expect(result).toBeDefined();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('exposes record event contract', () => {
|
|
45
|
+
expect(RecordPlatformTourEvent.meta.name).toBe(
|
|
46
|
+
'learningJourney.platformTour.recordEvent'
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ScalarTypeEnum, defineSchemaModel } from '@lssm/lib.schema';
|
|
2
|
+
import { defineCommand, defineQuery } from '@lssm/lib.contracts';
|
|
3
|
+
|
|
4
|
+
import { platformPrimitivesTourTrack } from '../track';
|
|
5
|
+
|
|
6
|
+
const OWNERS = ['examples.learning-journey.platform-tour'] as const;
|
|
7
|
+
|
|
8
|
+
const StepModel = defineSchemaModel({
|
|
9
|
+
name: 'PlatformTourStep',
|
|
10
|
+
description: 'Step metadata for platform primitives tour',
|
|
11
|
+
fields: {
|
|
12
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
15
|
+
completionEvent: {
|
|
16
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
17
|
+
isOptional: false,
|
|
18
|
+
},
|
|
19
|
+
sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
20
|
+
xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
21
|
+
order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const PlatformTourTrackModel = defineSchemaModel({
|
|
26
|
+
name: 'PlatformTourTrack',
|
|
27
|
+
description: 'Platform primitives tour track definition',
|
|
28
|
+
fields: {
|
|
29
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
32
|
+
totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
33
|
+
completionXpBonus: {
|
|
34
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
35
|
+
isOptional: true,
|
|
36
|
+
},
|
|
37
|
+
completionBadgeKey: {
|
|
38
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
39
|
+
isOptional: true,
|
|
40
|
+
},
|
|
41
|
+
streakHoursWindow: {
|
|
42
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
43
|
+
isOptional: true,
|
|
44
|
+
},
|
|
45
|
+
streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
46
|
+
steps: { type: StepModel, isArray: true, isOptional: false },
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const TrackResponseModel = defineSchemaModel({
|
|
51
|
+
name: 'PlatformTourTrackResponse',
|
|
52
|
+
description: 'Response wrapper for platform tour track',
|
|
53
|
+
fields: {
|
|
54
|
+
track: { type: PlatformTourTrackModel, isOptional: false },
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const RecordDemoEventInput = defineSchemaModel({
|
|
59
|
+
name: 'PlatformTourRecordEventInput',
|
|
60
|
+
description: 'Emit a demo event to advance platform tour steps',
|
|
61
|
+
fields: {
|
|
62
|
+
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
63
|
+
eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
64
|
+
payload: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
65
|
+
occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const SuccessModel = defineSchemaModel({
|
|
70
|
+
name: 'PlatformTourSuccess',
|
|
71
|
+
description: 'Generic success response',
|
|
72
|
+
fields: {
|
|
73
|
+
success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const GetPlatformTourTrack = defineQuery({
|
|
78
|
+
meta: {
|
|
79
|
+
name: 'learningJourney.platformTour.getTrack',
|
|
80
|
+
version: 1,
|
|
81
|
+
stability: 'experimental',
|
|
82
|
+
owners: [...OWNERS],
|
|
83
|
+
tags: ['learning', 'platform', 'tour'],
|
|
84
|
+
description: 'Fetch platform primitives tour track definition.',
|
|
85
|
+
goal: 'Expose track metadata to UIs and templates.',
|
|
86
|
+
context: 'Called by Studio/Playground to render journey steps.',
|
|
87
|
+
},
|
|
88
|
+
io: {
|
|
89
|
+
input: defineSchemaModel({
|
|
90
|
+
name: 'PlatformTourTrackInput',
|
|
91
|
+
description: 'Track input',
|
|
92
|
+
fields: {},
|
|
93
|
+
}),
|
|
94
|
+
output: TrackResponseModel,
|
|
95
|
+
},
|
|
96
|
+
policy: { auth: 'user' },
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export const RecordPlatformTourEvent = defineCommand({
|
|
100
|
+
meta: {
|
|
101
|
+
name: 'learningJourney.platformTour.recordEvent',
|
|
102
|
+
version: 1,
|
|
103
|
+
stability: 'experimental',
|
|
104
|
+
owners: [...OWNERS],
|
|
105
|
+
tags: ['learning', 'platform', 'tour'],
|
|
106
|
+
description: 'Record an event to advance platform tour progress.',
|
|
107
|
+
goal: 'Advance steps via domain events in demo/sandbox contexts.',
|
|
108
|
+
context:
|
|
109
|
+
'Called by handlers or demo scripts to emit step completion events.',
|
|
110
|
+
},
|
|
111
|
+
io: {
|
|
112
|
+
input: RecordDemoEventInput,
|
|
113
|
+
output: SuccessModel,
|
|
114
|
+
},
|
|
115
|
+
policy: { auth: 'user' },
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export const platformTourContracts = {
|
|
119
|
+
GetPlatformTourTrack,
|
|
120
|
+
RecordPlatformTourEvent,
|
|
121
|
+
track: platformPrimitivesTourTrack,
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './platform-tour.docblock';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DocBlock } from '@lssm/lib.contracts/docs';
|
|
2
|
+
import { registerDocBlocks } from '@lssm/lib.contracts/docs';
|
|
3
|
+
|
|
4
|
+
const platformTourDocBlocks: DocBlock[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.learning-journey.platform-tour',
|
|
7
|
+
title: 'Learning Journey — Platform Primitives Tour',
|
|
8
|
+
summary:
|
|
9
|
+
'Cross-module tour that touches identity, audit, notifications, jobs, feature flags, files, and metering.',
|
|
10
|
+
kind: 'reference',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/learning-journey/platform-tour',
|
|
13
|
+
tags: ['learning', 'platform', 'onboarding'],
|
|
14
|
+
body: `## Track
|
|
15
|
+
- **Key**: \`platform_primitives_tour\`
|
|
16
|
+
- **Persona**: platform developer exploring primitives
|
|
17
|
+
- **Goal**: Touch each cross-cutting module once, event-driven completion
|
|
18
|
+
|
|
19
|
+
## Steps & Events
|
|
20
|
+
1) \`identity_rbac\` → \`org.member.added\`
|
|
21
|
+
2) \`event_bus_audit\` → \`audit_log.created\`
|
|
22
|
+
3) \`notifications\` → \`notification.sent\`
|
|
23
|
+
4) \`jobs_scheduler\` → \`job.completed\`
|
|
24
|
+
5) \`feature_flags\` → \`flag.toggled\`
|
|
25
|
+
6) \`files_attachments\` → \`attachment.attached\`
|
|
26
|
+
7) \`usage_metering\` → \`usage.recorded\`
|
|
27
|
+
|
|
28
|
+
XP: 20 per step, 20 bonus XP upon completion.
|
|
29
|
+
|
|
30
|
+
## Wiring
|
|
31
|
+
- Tracks export from \`@lssm/example.learning-journey-platform-tour/track\`.
|
|
32
|
+
- Use onboarding API to surface progress:
|
|
33
|
+
- \`learning.onboarding.listTracks\`
|
|
34
|
+
- \`learning.onboarding.getProgress\`
|
|
35
|
+
- \`learning.onboarding.recordEvent\` wired from each module's event bus handlers.
|
|
36
|
+
- Align event payloads with modules: identity-rbac, audit-trail, notifications, jobs, feature-flags, files, metering.`,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
registerDocBlocks(platformTourDocBlocks);
|
package/src/example.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const example = {
|
|
2
|
+
id: 'learning-journey-platform-tour',
|
|
3
|
+
title: 'Learning Journey — Platform Tour',
|
|
4
|
+
summary: 'Learning journey track + contracts + presentations for a platform tour.',
|
|
5
|
+
tags: ['learning', 'journey', 'platform-tour'],
|
|
6
|
+
kind: 'template',
|
|
7
|
+
visibility: 'public',
|
|
8
|
+
docs: {
|
|
9
|
+
rootDocId: 'docs.examples.platform-tour',
|
|
10
|
+
goalDocId: 'docs.examples.platform-tour.goal',
|
|
11
|
+
usageDocId: 'docs.examples.platform-tour.usage',
|
|
12
|
+
},
|
|
13
|
+
entrypoints: {
|
|
14
|
+
packageName: '@lssm/example.learning-journey-platform-tour',
|
|
15
|
+
docs: './docs',
|
|
16
|
+
},
|
|
17
|
+
surfaces: {
|
|
18
|
+
templates: true,
|
|
19
|
+
sandbox: { enabled: true, modes: ['markdown', 'playground'] },
|
|
20
|
+
studio: { enabled: true, installable: true },
|
|
21
|
+
mcp: { enabled: true },
|
|
22
|
+
},
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export default example;
|
|
26
|
+
|
|
27
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { platformPrimitivesTourTrack } from '../track';
|
|
2
|
+
|
|
3
|
+
interface EmitParams {
|
|
4
|
+
learnerId: string;
|
|
5
|
+
occurredAt?: Date;
|
|
6
|
+
payload?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface LearningJourneyEvent {
|
|
10
|
+
learnerId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
occurredAt: Date;
|
|
13
|
+
trackId: string;
|
|
14
|
+
payload?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type RecordEvent = (event: LearningJourneyEvent) => unknown;
|
|
18
|
+
|
|
19
|
+
export const platformTourEvents = [
|
|
20
|
+
'org.member.added',
|
|
21
|
+
'audit_log.created',
|
|
22
|
+
'notification.sent',
|
|
23
|
+
'job.completed',
|
|
24
|
+
'flag.toggled',
|
|
25
|
+
'attachment.attached',
|
|
26
|
+
'usage.recorded',
|
|
27
|
+
] as const;
|
|
28
|
+
|
|
29
|
+
export type PlatformEvent = (typeof platformTourEvents)[number];
|
|
30
|
+
|
|
31
|
+
export const emitPlatformTourEvent = (
|
|
32
|
+
eventName: PlatformEvent,
|
|
33
|
+
{ learnerId, occurredAt = new Date(), payload }: EmitParams,
|
|
34
|
+
record?: RecordEvent
|
|
35
|
+
) => {
|
|
36
|
+
const event: LearningJourneyEvent = {
|
|
37
|
+
learnerId,
|
|
38
|
+
name: eventName,
|
|
39
|
+
occurredAt,
|
|
40
|
+
payload,
|
|
41
|
+
trackId: platformPrimitivesTourTrack.id,
|
|
42
|
+
};
|
|
43
|
+
return record ? record(event) : event;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const emitAllPlatformTourEvents = (
|
|
47
|
+
params: EmitParams,
|
|
48
|
+
record?: RecordEvent
|
|
49
|
+
) =>
|
|
50
|
+
platformTourEvents.map((name) => emitPlatformTourEvent(name, params, record));
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PresentationDescriptorV2,
|
|
3
|
+
PresentationV2Meta,
|
|
4
|
+
} from '@lssm/lib.contracts';
|
|
5
|
+
import { PlatformTourTrackModel } from '../contracts';
|
|
6
|
+
|
|
7
|
+
const baseMeta: Pick<PresentationV2Meta, 'domain' | 'owners' | 'tags'> = {
|
|
8
|
+
domain: 'learning-journey',
|
|
9
|
+
owners: ['examples.learning-journey.platform-tour'],
|
|
10
|
+
tags: ['learning', 'platform', 'tour'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const PlatformTourTrackPresentation: PresentationDescriptorV2 = {
|
|
14
|
+
meta: {
|
|
15
|
+
name: 'learning.journey.platform.track',
|
|
16
|
+
version: 1,
|
|
17
|
+
description: 'Platform primitives tour track detail',
|
|
18
|
+
...baseMeta,
|
|
19
|
+
},
|
|
20
|
+
source: {
|
|
21
|
+
type: 'component',
|
|
22
|
+
framework: 'react',
|
|
23
|
+
componentKey: 'LearningTrackDetail',
|
|
24
|
+
props: PlatformTourTrackModel,
|
|
25
|
+
},
|
|
26
|
+
targets: ['react', 'markdown', 'application/json'],
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const PlatformTourWidgetPresentation: PresentationDescriptorV2 = {
|
|
30
|
+
meta: {
|
|
31
|
+
name: 'learning.journey.platform.widget',
|
|
32
|
+
version: 1,
|
|
33
|
+
description: 'Compact widget for platform tour progress',
|
|
34
|
+
...baseMeta,
|
|
35
|
+
},
|
|
36
|
+
source: {
|
|
37
|
+
type: 'component',
|
|
38
|
+
framework: 'react',
|
|
39
|
+
componentKey: 'LearningTrackProgressWidget',
|
|
40
|
+
},
|
|
41
|
+
targets: ['react'],
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const platformTourPresentations = [
|
|
45
|
+
PlatformTourTrackPresentation,
|
|
46
|
+
PlatformTourWidgetPresentation,
|
|
47
|
+
];
|
package/src/track.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { LearningJourneyTrackSpec } from '@lssm/module.learning-journey/track-spec';
|
|
2
|
+
|
|
3
|
+
export const platformPrimitivesTourTrack: LearningJourneyTrackSpec = {
|
|
4
|
+
id: 'platform_primitives_tour',
|
|
5
|
+
productId: 'contractspec-platform',
|
|
6
|
+
name: 'Platform Primitives Tour',
|
|
7
|
+
description:
|
|
8
|
+
'Hands-on tour across identity, audit, notifications, jobs, flags, files, and metering.',
|
|
9
|
+
targetUserSegment: 'platform_developer',
|
|
10
|
+
targetRole: 'developer',
|
|
11
|
+
totalXp: 140,
|
|
12
|
+
completionRewards: { xpBonus: 20, badgeKey: 'platform_primitives' },
|
|
13
|
+
steps: [
|
|
14
|
+
{
|
|
15
|
+
id: 'identity_rbac',
|
|
16
|
+
title: 'Create org and member',
|
|
17
|
+
description: 'Create an org and add at least one member.',
|
|
18
|
+
order: 1,
|
|
19
|
+
completion: {
|
|
20
|
+
eventName: 'org.member.added',
|
|
21
|
+
sourceModule: '@lssm/lib.identity-rbac',
|
|
22
|
+
},
|
|
23
|
+
xpReward: 20,
|
|
24
|
+
metadata: { surface: 'identity' },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'event_bus_audit',
|
|
28
|
+
title: 'Emit an auditable event',
|
|
29
|
+
description: 'Emit an event that lands in the audit log.',
|
|
30
|
+
order: 2,
|
|
31
|
+
completion: {
|
|
32
|
+
eventName: 'audit_log.created',
|
|
33
|
+
sourceModule: '@lssm/module.audit-trail',
|
|
34
|
+
},
|
|
35
|
+
xpReward: 20,
|
|
36
|
+
metadata: { surface: 'bus+audit' },
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'notifications',
|
|
40
|
+
title: 'Send a notification',
|
|
41
|
+
description: 'Send yourself a notification and verify delivery.',
|
|
42
|
+
order: 3,
|
|
43
|
+
completion: {
|
|
44
|
+
eventName: 'notification.sent',
|
|
45
|
+
sourceModule: '@lssm/module.notifications',
|
|
46
|
+
},
|
|
47
|
+
xpReward: 20,
|
|
48
|
+
metadata: { surface: 'notifications' },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'jobs_scheduler',
|
|
52
|
+
title: 'Schedule and run a job',
|
|
53
|
+
description: 'Schedule a background job and let it run once.',
|
|
54
|
+
order: 4,
|
|
55
|
+
completion: {
|
|
56
|
+
eventName: 'job.completed',
|
|
57
|
+
sourceModule: '@lssm/lib.jobs',
|
|
58
|
+
},
|
|
59
|
+
xpReward: 20,
|
|
60
|
+
metadata: { surface: 'jobs' },
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'feature_flags',
|
|
64
|
+
title: 'Create and toggle a feature flag',
|
|
65
|
+
description: 'Create a feature flag and toggle it at least once.',
|
|
66
|
+
order: 5,
|
|
67
|
+
completion: {
|
|
68
|
+
eventName: 'flag.toggled',
|
|
69
|
+
sourceModule: '@lssm/lib.feature-flags',
|
|
70
|
+
},
|
|
71
|
+
xpReward: 20,
|
|
72
|
+
metadata: { surface: 'feature-flags' },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'files_attachments',
|
|
76
|
+
title: 'Attach a file',
|
|
77
|
+
description: 'Upload and attach a file to any entity.',
|
|
78
|
+
order: 6,
|
|
79
|
+
completion: {
|
|
80
|
+
eventName: 'attachment.attached',
|
|
81
|
+
sourceModule: '@lssm/lib.files',
|
|
82
|
+
},
|
|
83
|
+
xpReward: 20,
|
|
84
|
+
metadata: { surface: 'files' },
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'usage_metering',
|
|
88
|
+
title: 'Record usage',
|
|
89
|
+
description: 'Emit a usage metric (regeneration, agent run, or similar).',
|
|
90
|
+
order: 7,
|
|
91
|
+
completion: {
|
|
92
|
+
eventName: 'usage.recorded',
|
|
93
|
+
sourceModule: '@lssm/lib.metering',
|
|
94
|
+
},
|
|
95
|
+
xpReward: 20,
|
|
96
|
+
metadata: { surface: 'metering' },
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
metadata: {
|
|
100
|
+
surfacedIn: ['studio/learning', 'platform/dev-center'],
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const platformLearningTracks: LearningJourneyTrackSpec[] = [
|
|
105
|
+
platformPrimitivesTourTrack,
|
|
106
|
+
];
|