@contractspec/example.learning-journey-platform-tour 3.7.17 → 3.7.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.turbo/turbo-build.log +33 -33
  2. package/CHANGELOG.md +12 -0
  3. package/dist/browser/docs/index.js +1 -37
  4. package/dist/browser/docs/platform-tour.docblock.js +1 -37
  5. package/dist/browser/example.js +1 -34
  6. package/dist/browser/handlers/demo.handlers.js +1 -130
  7. package/dist/browser/index.js +1 -416
  8. package/dist/browser/learning-journey-platform-tour.feature.js +1 -48
  9. package/dist/browser/operations/index.js +1 -221
  10. package/dist/browser/presentations/index.js +1 -268
  11. package/dist/browser/tests/operations.test-spec.js +1 -34
  12. package/dist/browser/track.js +1 -107
  13. package/dist/docs/index.js +1 -37
  14. package/dist/docs/platform-tour.docblock.js +1 -37
  15. package/dist/example.js +1 -34
  16. package/dist/handlers/demo.handlers.js +1 -130
  17. package/dist/index.js +1 -416
  18. package/dist/learning-journey-platform-tour.feature.js +1 -48
  19. package/dist/node/docs/index.js +1 -37
  20. package/dist/node/docs/platform-tour.docblock.js +1 -37
  21. package/dist/node/example.js +1 -34
  22. package/dist/node/handlers/demo.handlers.js +1 -130
  23. package/dist/node/index.js +1 -416
  24. package/dist/node/learning-journey-platform-tour.feature.js +1 -48
  25. package/dist/node/operations/index.js +1 -221
  26. package/dist/node/presentations/index.js +1 -268
  27. package/dist/node/tests/operations.test-spec.js +1 -34
  28. package/dist/node/track.js +1 -107
  29. package/dist/operations/index.js +1 -221
  30. package/dist/presentations/index.js +1 -268
  31. package/dist/tests/operations.test-spec.js +1 -34
  32. package/dist/track.js +1 -107
  33. package/package.json +6 -6
@@ -1,130 +1 @@
1
- // src/track.ts
2
- var platformPrimitivesTourTrack = {
3
- id: "platform_primitives_tour",
4
- productId: "contractspec-platform",
5
- name: "Platform Primitives Tour",
6
- description: "Hands-on tour across identity, audit, notifications, jobs, flags, files, and metering.",
7
- targetUserSegment: "platform_developer",
8
- targetRole: "developer",
9
- totalXp: 140,
10
- completionRewards: { xpBonus: 20, badgeKey: "platform_primitives" },
11
- steps: [
12
- {
13
- id: "identity_rbac",
14
- title: "Create org and member",
15
- description: "Create an org and add at least one member.",
16
- order: 1,
17
- completion: {
18
- eventName: "org.member.added",
19
- sourceModule: "@contractspec/lib.identity-rbac"
20
- },
21
- xpReward: 20,
22
- metadata: { surface: "identity" }
23
- },
24
- {
25
- id: "event_bus_audit",
26
- title: "Emit an auditable event",
27
- description: "Emit an event that lands in the audit log.",
28
- order: 2,
29
- completion: {
30
- eventName: "audit_log.created",
31
- sourceModule: "@contractspec/module.audit-trail"
32
- },
33
- xpReward: 20,
34
- metadata: { surface: "bus+audit" }
35
- },
36
- {
37
- id: "notifications",
38
- title: "Send a notification",
39
- description: "Send yourself a notification and verify delivery.",
40
- order: 3,
41
- completion: {
42
- eventName: "notification.sent",
43
- sourceModule: "@contractspec/module.notifications"
44
- },
45
- xpReward: 20,
46
- metadata: { surface: "notifications" }
47
- },
48
- {
49
- id: "jobs_scheduler",
50
- title: "Schedule and run a job",
51
- description: "Schedule a background job and let it run once.",
52
- order: 4,
53
- completion: {
54
- eventName: "job.completed",
55
- sourceModule: "@contractspec/lib.jobs"
56
- },
57
- xpReward: 20,
58
- metadata: { surface: "jobs" }
59
- },
60
- {
61
- id: "feature_flags",
62
- title: "Create and toggle a feature flag",
63
- description: "Create a feature flag and toggle it at least once.",
64
- order: 5,
65
- completion: {
66
- eventName: "flag.toggled",
67
- sourceModule: "@contractspec/lib.feature-flags"
68
- },
69
- xpReward: 20,
70
- metadata: { surface: "feature-flags" }
71
- },
72
- {
73
- id: "files_attachments",
74
- title: "Attach a file",
75
- description: "Upload and attach a file to any entity.",
76
- order: 6,
77
- completion: {
78
- eventName: "attachment.attached",
79
- sourceModule: "@contractspec/lib.files"
80
- },
81
- xpReward: 20,
82
- metadata: { surface: "files" }
83
- },
84
- {
85
- id: "usage_metering",
86
- title: "Record usage",
87
- description: "Emit a usage metric (regeneration, agent run, or similar).",
88
- order: 7,
89
- completion: {
90
- eventName: "usage.recorded",
91
- sourceModule: "@contractspec/lib.metering"
92
- },
93
- xpReward: 20,
94
- metadata: { surface: "metering" }
95
- }
96
- ],
97
- metadata: {
98
- surfacedIn: ["studio/learning", "platform/dev-center"]
99
- }
100
- };
101
- var platformLearningTracks = [
102
- platformPrimitivesTourTrack
103
- ];
104
-
105
- // src/handlers/demo.handlers.ts
106
- var platformTourEvents = [
107
- "org.member.added",
108
- "audit_log.created",
109
- "notification.sent",
110
- "job.completed",
111
- "flag.toggled",
112
- "attachment.attached",
113
- "usage.recorded"
114
- ];
115
- var emitPlatformTourEvent = (eventName, { learnerId, occurredAt = new Date, payload }, record) => {
116
- const event = {
117
- learnerId,
118
- name: eventName,
119
- occurredAt,
120
- payload,
121
- trackId: platformPrimitivesTourTrack.id
122
- };
123
- return record ? record(event) : event;
124
- };
125
- var emitAllPlatformTourEvents = (params, record) => platformTourEvents.map((name) => emitPlatformTourEvent(name, params, record));
126
- export {
127
- platformTourEvents,
128
- emitPlatformTourEvent,
129
- emitAllPlatformTourEvents
130
- };
1
+ var r={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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/lib.metering"},xpReward:20,metadata:{surface:"metering"}}],metadata:{surfacedIn:["studio/learning","platform/dev-center"]}},s=[r];var c=["org.member.added","audit_log.created","notification.sent","job.completed","flag.toggled","attachment.attached","usage.recorded"],d=(e,{learnerId:t,occurredAt:a=new Date,payload:i},o)=>{let n={learnerId:t,name:e,occurredAt:a,payload:i,trackId:r.id};return o?o(n):n},u=(e,t)=>c.map((a)=>d(a,e,t));export{c as platformTourEvents,d as emitPlatformTourEvent,u as emitAllPlatformTourEvents};
@@ -1,416 +1 @@
1
- // src/docs/platform-tour.docblock.ts
2
- import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
3
- var platformTourDocBlocks = [
4
- {
5
- id: "docs.learning-journey.platform-tour",
6
- title: "Learning Journey — Platform Primitives Tour",
7
- summary: "Cross-module tour that touches identity, audit, notifications, jobs, feature flags, files, and metering.",
8
- kind: "reference",
9
- visibility: "public",
10
- route: "/docs/learning-journey/platform-tour",
11
- tags: ["learning", "platform", "onboarding"],
12
- body: `## Track
13
- - **Key**: \`platform_primitives_tour\`
14
- - **Persona**: platform developer exploring primitives
15
- - **Goal**: Touch each cross-cutting module once, event-driven completion
16
-
17
- ## Steps & Events
18
- 1) \`identity_rbac\` → \`org.member.added\`
19
- 2) \`event_bus_audit\` → \`audit_log.created\`
20
- 3) \`notifications\` → \`notification.sent\`
21
- 4) \`jobs_scheduler\` → \`job.completed\`
22
- 5) \`feature_flags\` → \`flag.toggled\`
23
- 6) \`files_attachments\` → \`attachment.attached\`
24
- 7) \`usage_metering\` → \`usage.recorded\`
25
-
26
- XP: 20 per step, 20 bonus XP upon completion.
27
-
28
- ## Wiring
29
- - Tracks export from \`@contractspec/example.learning-journey-platform-tour/track\`.
30
- - Use onboarding API to surface progress:
31
- - \`learning.onboarding.listTracks\`
32
- - \`learning.onboarding.getProgress\`
33
- - \`learning.onboarding.recordEvent\` wired from each module's event bus handlers.
34
- - Align event payloads with modules: identity-rbac, audit-trail, notifications, jobs, feature-flags, files, metering.`
35
- }
36
- ];
37
- registerDocBlocks(platformTourDocBlocks);
38
- // src/example.ts
39
- import { defineExample } from "@contractspec/lib.contracts-spec";
40
- var example = defineExample({
41
- meta: {
42
- key: "learning-journey-platform-tour",
43
- version: "1.0.0",
44
- title: "Learning Journey — Platform Tour",
45
- description: "Learning journey track + contracts + presentations for a platform tour.",
46
- kind: "template",
47
- visibility: "public",
48
- stability: "experimental",
49
- owners: ["@platform.core"],
50
- tags: ["learning", "journey", "platform-tour"]
51
- },
52
- docs: {
53
- rootDocId: "docs.examples.platform-tour",
54
- goalDocId: "docs.examples.platform-tour.goal",
55
- usageDocId: "docs.examples.platform-tour.usage"
56
- },
57
- entrypoints: {
58
- packageName: "@contractspec/example.learning-journey-platform-tour",
59
- docs: "./docs"
60
- },
61
- surfaces: {
62
- templates: true,
63
- sandbox: { enabled: true, modes: ["markdown", "playground"] },
64
- studio: { enabled: true, installable: true },
65
- mcp: { enabled: true }
66
- }
67
- });
68
- var example_default = example;
69
-
70
- // src/track.ts
71
- var platformPrimitivesTourTrack = {
72
- id: "platform_primitives_tour",
73
- productId: "contractspec-platform",
74
- name: "Platform Primitives Tour",
75
- description: "Hands-on tour across identity, audit, notifications, jobs, flags, files, and metering.",
76
- targetUserSegment: "platform_developer",
77
- targetRole: "developer",
78
- totalXp: 140,
79
- completionRewards: { xpBonus: 20, badgeKey: "platform_primitives" },
80
- steps: [
81
- {
82
- id: "identity_rbac",
83
- title: "Create org and member",
84
- description: "Create an org and add at least one member.",
85
- order: 1,
86
- completion: {
87
- eventName: "org.member.added",
88
- sourceModule: "@contractspec/lib.identity-rbac"
89
- },
90
- xpReward: 20,
91
- metadata: { surface: "identity" }
92
- },
93
- {
94
- id: "event_bus_audit",
95
- title: "Emit an auditable event",
96
- description: "Emit an event that lands in the audit log.",
97
- order: 2,
98
- completion: {
99
- eventName: "audit_log.created",
100
- sourceModule: "@contractspec/module.audit-trail"
101
- },
102
- xpReward: 20,
103
- metadata: { surface: "bus+audit" }
104
- },
105
- {
106
- id: "notifications",
107
- title: "Send a notification",
108
- description: "Send yourself a notification and verify delivery.",
109
- order: 3,
110
- completion: {
111
- eventName: "notification.sent",
112
- sourceModule: "@contractspec/module.notifications"
113
- },
114
- xpReward: 20,
115
- metadata: { surface: "notifications" }
116
- },
117
- {
118
- id: "jobs_scheduler",
119
- title: "Schedule and run a job",
120
- description: "Schedule a background job and let it run once.",
121
- order: 4,
122
- completion: {
123
- eventName: "job.completed",
124
- sourceModule: "@contractspec/lib.jobs"
125
- },
126
- xpReward: 20,
127
- metadata: { surface: "jobs" }
128
- },
129
- {
130
- id: "feature_flags",
131
- title: "Create and toggle a feature flag",
132
- description: "Create a feature flag and toggle it at least once.",
133
- order: 5,
134
- completion: {
135
- eventName: "flag.toggled",
136
- sourceModule: "@contractspec/lib.feature-flags"
137
- },
138
- xpReward: 20,
139
- metadata: { surface: "feature-flags" }
140
- },
141
- {
142
- id: "files_attachments",
143
- title: "Attach a file",
144
- description: "Upload and attach a file to any entity.",
145
- order: 6,
146
- completion: {
147
- eventName: "attachment.attached",
148
- sourceModule: "@contractspec/lib.files"
149
- },
150
- xpReward: 20,
151
- metadata: { surface: "files" }
152
- },
153
- {
154
- id: "usage_metering",
155
- title: "Record usage",
156
- description: "Emit a usage metric (regeneration, agent run, or similar).",
157
- order: 7,
158
- completion: {
159
- eventName: "usage.recorded",
160
- sourceModule: "@contractspec/lib.metering"
161
- },
162
- xpReward: 20,
163
- metadata: { surface: "metering" }
164
- }
165
- ],
166
- metadata: {
167
- surfacedIn: ["studio/learning", "platform/dev-center"]
168
- }
169
- };
170
- var platformLearningTracks = [
171
- platformPrimitivesTourTrack
172
- ];
173
-
174
- // src/handlers/demo.handlers.ts
175
- var platformTourEvents = [
176
- "org.member.added",
177
- "audit_log.created",
178
- "notification.sent",
179
- "job.completed",
180
- "flag.toggled",
181
- "attachment.attached",
182
- "usage.recorded"
183
- ];
184
- var emitPlatformTourEvent = (eventName, { learnerId, occurredAt = new Date, payload }, record) => {
185
- const event = {
186
- learnerId,
187
- name: eventName,
188
- occurredAt,
189
- payload,
190
- trackId: platformPrimitivesTourTrack.id
191
- };
192
- return record ? record(event) : event;
193
- };
194
- var emitAllPlatformTourEvents = (params, record) => platformTourEvents.map((name) => emitPlatformTourEvent(name, params, record));
195
-
196
- // src/learning-journey-platform-tour.feature.ts
197
- import { defineFeature } from "@contractspec/lib.contracts-spec";
198
- var LearningJourneyPlatformTourFeature = defineFeature({
199
- meta: {
200
- key: "learning-journey-platform-tour",
201
- version: "1.0.0",
202
- title: "Learning Journey: Platform Tour",
203
- description: "Platform primitives tour journey for exploring ContractSpec core features",
204
- domain: "learning-journey",
205
- owners: ["@examples.learning-journey.platform-tour"],
206
- tags: ["learning", "platform", "tour", "journey"],
207
- stability: "experimental"
208
- },
209
- operations: [
210
- { key: "learningJourney.platformTour.recordEvent", version: "1.0.0" },
211
- { key: "learningJourney.platformTour.getTrack", version: "1.0.0" }
212
- ],
213
- events: [],
214
- presentations: [
215
- { key: "learning.journey.platform.track", version: "1.0.0" },
216
- { key: "learning.journey.platform.widget", version: "1.0.0" }
217
- ],
218
- opToPresentation: [
219
- {
220
- op: { key: "learningJourney.platformTour.getTrack", version: "1.0.0" },
221
- pres: { key: "learning.journey.platform.track", version: "1.0.0" }
222
- }
223
- ],
224
- presentationsTargets: [
225
- {
226
- key: "learning.journey.platform.track",
227
- version: "1.0.0",
228
- targets: ["react", "markdown", "application/json"]
229
- },
230
- {
231
- key: "learning.journey.platform.widget",
232
- version: "1.0.0",
233
- targets: ["react"]
234
- }
235
- ],
236
- capabilities: {
237
- requires: [{ key: "identity", version: "1.0.0" }]
238
- },
239
- docs: ["docs.learning-journey.platform-tour"]
240
- });
241
-
242
- // src/operations/index.ts
243
- import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
244
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
245
- var OWNERS = ["examples.learning-journey.platform-tour"];
246
- var StepModel = defineSchemaModel({
247
- name: "PlatformTourStep",
248
- description: "Step metadata for platform primitives tour",
249
- fields: {
250
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
251
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
252
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
253
- completionEvent: {
254
- type: ScalarTypeEnum.String_unsecure(),
255
- isOptional: false
256
- },
257
- sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
258
- xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
259
- order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
260
- }
261
- });
262
- var PlatformTourTrackModel = defineSchemaModel({
263
- name: "PlatformTourTrack",
264
- description: "Platform primitives tour track definition",
265
- fields: {
266
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
267
- name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
268
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
269
- totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
270
- completionXpBonus: {
271
- type: ScalarTypeEnum.Int_unsecure(),
272
- isOptional: true
273
- },
274
- completionBadgeKey: {
275
- type: ScalarTypeEnum.String_unsecure(),
276
- isOptional: true
277
- },
278
- streakHoursWindow: {
279
- type: ScalarTypeEnum.Int_unsecure(),
280
- isOptional: true
281
- },
282
- streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
283
- steps: { type: StepModel, isArray: true, isOptional: false }
284
- }
285
- });
286
- var TrackResponseModel = defineSchemaModel({
287
- name: "PlatformTourTrackResponse",
288
- description: "Response wrapper for platform tour track",
289
- fields: {
290
- track: { type: PlatformTourTrackModel, isOptional: false }
291
- }
292
- });
293
- var RecordDemoEventInput = defineSchemaModel({
294
- name: "PlatformTourRecordEventInput",
295
- description: "Emit a demo event to advance platform tour steps",
296
- fields: {
297
- learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
298
- eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
299
- payload: { type: ScalarTypeEnum.JSON(), isOptional: true },
300
- occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
301
- }
302
- });
303
- var SuccessModel = defineSchemaModel({
304
- name: "PlatformTourSuccess",
305
- description: "Generic success response",
306
- fields: {
307
- success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
308
- }
309
- });
310
- var GetPlatformTourTrack = defineQuery({
311
- meta: {
312
- key: "learningJourney.platformTour.getTrack",
313
- version: "1.0.0",
314
- stability: "experimental",
315
- owners: [...OWNERS],
316
- tags: ["learning", "platform", "tour"],
317
- description: "Fetch platform primitives tour track definition.",
318
- goal: "Expose track metadata to UIs and templates.",
319
- context: "Called by Studio/Playground to render journey steps."
320
- },
321
- io: {
322
- input: defineSchemaModel({
323
- name: "PlatformTourTrackInput",
324
- description: "Track input",
325
- fields: {}
326
- }),
327
- output: TrackResponseModel
328
- },
329
- policy: { auth: "user" }
330
- });
331
- var RecordPlatformTourEvent = defineCommand({
332
- meta: {
333
- key: "learningJourney.platformTour.recordEvent",
334
- version: "1.0.0",
335
- stability: "experimental",
336
- owners: [...OWNERS],
337
- tags: ["learning", "platform", "tour"],
338
- description: "Record an event to advance platform tour progress.",
339
- goal: "Advance steps via domain events in demo/sandbox contexts.",
340
- context: "Called by handlers or demo scripts to emit step completion events."
341
- },
342
- io: {
343
- input: RecordDemoEventInput,
344
- output: SuccessModel
345
- },
346
- policy: { auth: "user" }
347
- });
348
- var platformTourContracts = {
349
- GetPlatformTourTrack,
350
- RecordPlatformTourEvent,
351
- track: platformPrimitivesTourTrack
352
- };
353
-
354
- // src/presentations/index.ts
355
- import {
356
- definePresentation,
357
- StabilityEnum
358
- } from "@contractspec/lib.contracts-spec";
359
- var baseMeta = {
360
- domain: "learning-journey",
361
- title: "Platform Tour",
362
- owners: ["@examples.learning-journey.platform-tour"],
363
- tags: ["learning", "platform", "tour"],
364
- stability: StabilityEnum.Experimental,
365
- goal: "Visualize platform tour progress",
366
- context: "Used in platform tour dashboard and widgets"
367
- };
368
- var PlatformTourTrackPresentation = definePresentation({
369
- meta: {
370
- key: "learning.journey.platform.track",
371
- version: "1.0.0",
372
- description: "Platform primitives tour track detail",
373
- ...baseMeta
374
- },
375
- source: {
376
- type: "component",
377
- framework: "react",
378
- componentKey: "LearningTrackDetail",
379
- props: PlatformTourTrackModel
380
- },
381
- targets: ["react", "markdown", "application/json"]
382
- });
383
- var PlatformTourWidgetPresentation = definePresentation({
384
- meta: {
385
- key: "learning.journey.platform.widget",
386
- version: "1.0.0",
387
- description: "Compact widget for platform tour progress",
388
- ...baseMeta
389
- },
390
- source: {
391
- type: "component",
392
- framework: "react",
393
- componentKey: "LearningTrackProgressWidget"
394
- },
395
- targets: ["react"]
396
- });
397
- var platformTourPresentations = [
398
- PlatformTourTrackPresentation,
399
- PlatformTourWidgetPresentation
400
- ];
401
- export {
402
- platformTourPresentations,
403
- platformTourEvents,
404
- platformTourContracts,
405
- platformPrimitivesTourTrack,
406
- platformLearningTracks,
407
- example_default as example,
408
- emitPlatformTourEvent,
409
- emitAllPlatformTourEvents,
410
- RecordPlatformTourEvent,
411
- PlatformTourWidgetPresentation,
412
- PlatformTourTrackPresentation,
413
- PlatformTourTrackModel,
414
- LearningJourneyPlatformTourFeature,
415
- GetPlatformTourTrack
416
- };
1
+ import{registerDocBlocks as l}from"@contractspec/lib.contracts-spec/docs";var f=[{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 `@contractspec/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."}];l(f);import{defineExample as p}from"@contractspec/lib.contracts-spec";var v=p({meta:{key:"learning-journey-platform-tour",version:"1.0.0",title:"Learning Journey — Platform Tour",description:"Learning journey track + contracts + presentations for a platform tour.",kind:"template",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["learning","journey","platform-tour"]},docs:{rootDocId:"docs.examples.platform-tour",goalDocId:"docs.examples.platform-tour.goal",usageDocId:"docs.examples.platform-tour.usage"},entrypoints:{packageName:"@contractspec/example.learning-journey-platform-tour",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown","playground"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),b=v;var r={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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/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:"@contractspec/lib.metering"},xpReward:20,metadata:{surface:"metering"}}],metadata:{surfacedIn:["studio/learning","platform/dev-center"]}},y=[r];var _=["org.member.added","audit_log.created","notification.sent","job.completed","flag.toggled","attachment.attached","usage.recorded"],w=(a,{learnerId:i,occurredAt:o=new Date,payload:u},d)=>{let s={learnerId:i,name:a,occurredAt:o,payload:u,trackId:r.id};return d?d(s):s},P=(a,i)=>_.map((o)=>w(o,a,i));import{defineFeature as x}from"@contractspec/lib.contracts-spec";var Z=x({meta:{key:"learning-journey-platform-tour",version:"1.0.0",title:"Learning Journey: Platform Tour",description:"Platform primitives tour journey for exploring ContractSpec core features",domain:"learning-journey",owners:["@examples.learning-journey.platform-tour"],tags:["learning","platform","tour","journey"],stability:"experimental"},operations:[{key:"learningJourney.platformTour.recordEvent",version:"1.0.0"},{key:"learningJourney.platformTour.getTrack",version:"1.0.0"}],events:[],presentations:[{key:"learning.journey.platform.track",version:"1.0.0"},{key:"learning.journey.platform.widget",version:"1.0.0"}],opToPresentation:[{op:{key:"learningJourney.platformTour.getTrack",version:"1.0.0"},pres:{key:"learning.journey.platform.track",version:"1.0.0"}}],presentationsTargets:[{key:"learning.journey.platform.track",version:"1.0.0",targets:["react","markdown","application/json"]},{key:"learning.journey.platform.widget",version:"1.0.0",targets:["react"]}],capabilities:{requires:[{key:"identity",version:"1.0.0"}]},docs:["docs.learning-journey.platform-tour"]});import{defineCommand as R,defineQuery as j}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as e,ScalarTypeEnum as t}from"@contractspec/lib.schema";var g=["examples.learning-journey.platform-tour"],L=e({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}}}),n=e({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:L,isArray:!0,isOptional:!1}}}),J=e({name:"PlatformTourTrackResponse",description:"Response wrapper for platform tour track",fields:{track:{type:n,isOptional:!1}}}),h=e({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}}}),I=e({name:"PlatformTourSuccess",description:"Generic success response",fields:{success:{type:t.Boolean(),isOptional:!1}}}),N=j({meta:{key:"learningJourney.platformTour.getTrack",version:"1.0.0",stability:"experimental",owners:[...g],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:e({name:"PlatformTourTrackInput",description:"Track input",fields:{}}),output:J},policy:{auth:"user"}}),A=R({meta:{key:"learningJourney.platformTour.recordEvent",version:"1.0.0",stability:"experimental",owners:[...g],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:h,output:I},policy:{auth:"user"}}),Q={GetPlatformTourTrack:N,RecordPlatformTourEvent:A,track:r};import{definePresentation as c,StabilityEnum as k}from"@contractspec/lib.contracts-spec";var m={domain:"learning-journey",title:"Platform Tour",owners:["@examples.learning-journey.platform-tour"],tags:["learning","platform","tour"],stability:k.Experimental,goal:"Visualize platform tour progress",context:"Used in platform tour dashboard and widgets"},C=c({meta:{key:"learning.journey.platform.track",version:"1.0.0",description:"Platform primitives tour track detail",...m},source:{type:"component",framework:"react",componentKey:"LearningTrackDetail",props:n},targets:["react","markdown","application/json"]}),U=c({meta:{key:"learning.journey.platform.widget",version:"1.0.0",description:"Compact widget for platform tour progress",...m},source:{type:"component",framework:"react",componentKey:"LearningTrackProgressWidget"},targets:["react"]}),E=[C,U];export{E as platformTourPresentations,_ as platformTourEvents,Q as platformTourContracts,r as platformPrimitivesTourTrack,y as platformLearningTracks,b as example,w as emitPlatformTourEvent,P as emitAllPlatformTourEvents,A as RecordPlatformTourEvent,U as PlatformTourWidgetPresentation,C as PlatformTourTrackPresentation,n as PlatformTourTrackModel,Z as LearningJourneyPlatformTourFeature,N as GetPlatformTourTrack};
@@ -1,48 +1 @@
1
- // src/learning-journey-platform-tour.feature.ts
2
- import { defineFeature } from "@contractspec/lib.contracts-spec";
3
- var LearningJourneyPlatformTourFeature = defineFeature({
4
- meta: {
5
- key: "learning-journey-platform-tour",
6
- version: "1.0.0",
7
- title: "Learning Journey: Platform Tour",
8
- description: "Platform primitives tour journey for exploring ContractSpec core features",
9
- domain: "learning-journey",
10
- owners: ["@examples.learning-journey.platform-tour"],
11
- tags: ["learning", "platform", "tour", "journey"],
12
- stability: "experimental"
13
- },
14
- operations: [
15
- { key: "learningJourney.platformTour.recordEvent", version: "1.0.0" },
16
- { key: "learningJourney.platformTour.getTrack", version: "1.0.0" }
17
- ],
18
- events: [],
19
- presentations: [
20
- { key: "learning.journey.platform.track", version: "1.0.0" },
21
- { key: "learning.journey.platform.widget", version: "1.0.0" }
22
- ],
23
- opToPresentation: [
24
- {
25
- op: { key: "learningJourney.platformTour.getTrack", version: "1.0.0" },
26
- pres: { key: "learning.journey.platform.track", version: "1.0.0" }
27
- }
28
- ],
29
- presentationsTargets: [
30
- {
31
- key: "learning.journey.platform.track",
32
- version: "1.0.0",
33
- targets: ["react", "markdown", "application/json"]
34
- },
35
- {
36
- key: "learning.journey.platform.widget",
37
- version: "1.0.0",
38
- targets: ["react"]
39
- }
40
- ],
41
- capabilities: {
42
- requires: [{ key: "identity", version: "1.0.0" }]
43
- },
44
- docs: ["docs.learning-journey.platform-tour"]
45
- });
46
- export {
47
- LearningJourneyPlatformTourFeature
48
- };
1
+ import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"learning-journey-platform-tour",version:"1.0.0",title:"Learning Journey: Platform Tour",description:"Platform primitives tour journey for exploring ContractSpec core features",domain:"learning-journey",owners:["@examples.learning-journey.platform-tour"],tags:["learning","platform","tour","journey"],stability:"experimental"},operations:[{key:"learningJourney.platformTour.recordEvent",version:"1.0.0"},{key:"learningJourney.platformTour.getTrack",version:"1.0.0"}],events:[],presentations:[{key:"learning.journey.platform.track",version:"1.0.0"},{key:"learning.journey.platform.widget",version:"1.0.0"}],opToPresentation:[{op:{key:"learningJourney.platformTour.getTrack",version:"1.0.0"},pres:{key:"learning.journey.platform.track",version:"1.0.0"}}],presentationsTargets:[{key:"learning.journey.platform.track",version:"1.0.0",targets:["react","markdown","application/json"]},{key:"learning.journey.platform.widget",version:"1.0.0",targets:["react"]}],capabilities:{requires:[{key:"identity",version:"1.0.0"}]},docs:["docs.learning-journey.platform-tour"]});export{j as LearningJourneyPlatformTourFeature};