@ume-group/contracts 0.2.1

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 (57) hide show
  1. package/README.md +37 -0
  2. package/dist/adserving.d.ts +150 -0
  3. package/dist/adserving.d.ts.map +1 -0
  4. package/dist/adserving.js +8 -0
  5. package/dist/campaigns.d.ts +37 -0
  6. package/dist/campaigns.d.ts.map +1 -0
  7. package/dist/campaigns.js +8 -0
  8. package/dist/gausst.d.ts +236 -0
  9. package/dist/gausst.d.ts.map +1 -0
  10. package/dist/gausst.js +307 -0
  11. package/dist/gausst.test.d.ts +2 -0
  12. package/dist/gausst.test.d.ts.map +1 -0
  13. package/dist/gausst.test.js +71 -0
  14. package/dist/index.d.ts +1531 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +1112 -0
  17. package/dist/layer2/index.d.ts +9 -0
  18. package/dist/layer2/index.d.ts.map +1 -0
  19. package/dist/layer2/index.js +10 -0
  20. package/dist/layer2/shaders.d.ts +185 -0
  21. package/dist/layer2/shaders.d.ts.map +1 -0
  22. package/dist/layer2/shaders.js +604 -0
  23. package/dist/layer2/webcam-utils.d.ts +113 -0
  24. package/dist/layer2/webcam-utils.d.ts.map +1 -0
  25. package/dist/layer2/webcam-utils.js +147 -0
  26. package/dist/layer2/webcam-utils.test.d.ts +2 -0
  27. package/dist/layer2/webcam-utils.test.d.ts.map +1 -0
  28. package/dist/layer2/webcam-utils.test.js +18 -0
  29. package/dist/layer2.d.ts +558 -0
  30. package/dist/layer2.d.ts.map +1 -0
  31. package/dist/layer2.js +376 -0
  32. package/dist/layer2.test.d.ts +2 -0
  33. package/dist/layer2.test.d.ts.map +1 -0
  34. package/dist/layer2.test.js +65 -0
  35. package/dist/perspective.d.ts +28 -0
  36. package/dist/perspective.d.ts.map +1 -0
  37. package/dist/perspective.js +157 -0
  38. package/dist/segmentation/MediaPipeSegmenter.d.ts +201 -0
  39. package/dist/segmentation/MediaPipeSegmenter.d.ts.map +1 -0
  40. package/dist/segmentation/MediaPipeSegmenter.js +434 -0
  41. package/dist/segmentation/index.d.ts +5 -0
  42. package/dist/segmentation/index.d.ts.map +1 -0
  43. package/dist/segmentation/index.js +4 -0
  44. package/dist/webcam/GarbageMatteDragManager.d.ts +63 -0
  45. package/dist/webcam/GarbageMatteDragManager.d.ts.map +1 -0
  46. package/dist/webcam/GarbageMatteDragManager.js +183 -0
  47. package/dist/webcam/WebcamStreamManager.d.ts +103 -0
  48. package/dist/webcam/WebcamStreamManager.d.ts.map +1 -0
  49. package/dist/webcam/WebcamStreamManager.js +356 -0
  50. package/dist/webcam/index.d.ts +5 -0
  51. package/dist/webcam/index.d.ts.map +1 -0
  52. package/dist/webcam/index.js +2 -0
  53. package/openapi/admetise.yaml +632 -0
  54. package/openapi/includu.yaml +621 -0
  55. package/openapi/integration.yaml +372 -0
  56. package/openapi/shared/schemas.yaml +227 -0
  57. package/package.json +53 -0
@@ -0,0 +1,372 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Includu-Admetise Integration API
4
+ description: |
5
+ API contracts for integration between Includu (content creation) and Admetise (monetization) platforms.
6
+
7
+ ## Overview
8
+ - Includu publishes content with ad slot definitions
9
+ - Admetise imports content and fills ad slots with campaigns
10
+ - Both platforms share analytics events
11
+
12
+ ## Authentication
13
+ - Public endpoints: Published manifests (read-only)
14
+ - Internal endpoints: Cloudflare service bindings (no external auth)
15
+ - Authenticated endpoints: Bearer token (platform-specific)
16
+ version: 1.0.0
17
+ contact:
18
+ name: uMe Group
19
+ url: https://ume.group
20
+ license:
21
+ name: Proprietary
22
+
23
+ servers:
24
+ - url: https://includu-api.ume-group-as.workers.dev
25
+ description: Includu API (Production)
26
+ - url: https://studio.admetise.com
27
+ description: Admetise API (Production)
28
+
29
+ tags:
30
+ - name: Includu
31
+ description: Content creation and publishing
32
+ - name: Admetise
33
+ description: Monetization and ad serving
34
+ - name: Analytics
35
+ description: Unified event tracking
36
+
37
+ paths:
38
+ # ============================================
39
+ # INCLUDU ENDPOINTS
40
+ # ============================================
41
+
42
+ /api/published/{publishId}:
43
+ get:
44
+ tags:
45
+ - Includu
46
+ summary: Get published manifest
47
+ description: |
48
+ Retrieves a published content manifest by its publish ID.
49
+ This endpoint is public and can be called by Admetise to import content.
50
+ operationId: getPublishedManifest
51
+ parameters:
52
+ - name: publishId
53
+ in: path
54
+ required: true
55
+ description: Unique publish identifier (nanoid)
56
+ schema:
57
+ type: string
58
+ example: "abc123xyz"
59
+ responses:
60
+ '200':
61
+ description: Published manifest retrieved successfully
62
+ content:
63
+ application/json:
64
+ schema:
65
+ $ref: '#/components/schemas/PublishedManifest'
66
+ '404':
67
+ description: Published content not found
68
+ content:
69
+ application/json:
70
+ schema:
71
+ $ref: '#/components/schemas/Error'
72
+
73
+ # ============================================
74
+ # ADMETISE ENDPOINTS
75
+ # ============================================
76
+
77
+ /api/configs/import:
78
+ post:
79
+ tags:
80
+ - Admetise
81
+ summary: Import content from Includu
82
+ description: |
83
+ Creates a new PlayerConfig by importing a published manifest from Includu.
84
+ Maps Includu ad slots to Admetise ad zones.
85
+ operationId: importFromIncludu
86
+ security:
87
+ - bearerAuth: []
88
+ requestBody:
89
+ required: true
90
+ content:
91
+ application/json:
92
+ schema:
93
+ $ref: '#/components/schemas/ImportRequest'
94
+ responses:
95
+ '201':
96
+ description: Content imported successfully
97
+ content:
98
+ application/json:
99
+ schema:
100
+ $ref: '#/components/schemas/ImportResponse'
101
+ '400':
102
+ description: Invalid request or Includu content not found
103
+ content:
104
+ application/json:
105
+ schema:
106
+ $ref: '#/components/schemas/Error'
107
+ '401':
108
+ description: Authentication required
109
+ content:
110
+ application/json:
111
+ schema:
112
+ $ref: '#/components/schemas/Error'
113
+
114
+ # ============================================
115
+ # ANALYTICS ENDPOINTS
116
+ # ============================================
117
+
118
+ /api/analytics/track:
119
+ post:
120
+ tags:
121
+ - Analytics
122
+ summary: Track analytics event
123
+ description: |
124
+ Records a unified analytics event from either platform.
125
+ Events are attributed to both Includu content and Admetise campaigns.
126
+ operationId: trackEvent
127
+ requestBody:
128
+ required: true
129
+ content:
130
+ application/json:
131
+ schema:
132
+ $ref: '#/components/schemas/AnalyticsEvent'
133
+ responses:
134
+ '200':
135
+ description: Event tracked successfully
136
+ content:
137
+ application/json:
138
+ schema:
139
+ type: object
140
+ properties:
141
+ success:
142
+ type: boolean
143
+ example: true
144
+ eventId:
145
+ type: string
146
+ example: "evt_abc123"
147
+ '400':
148
+ description: Invalid event data
149
+ content:
150
+ application/json:
151
+ schema:
152
+ $ref: '#/components/schemas/Error'
153
+
154
+ /api/analytics/creator/{publishId}:
155
+ get:
156
+ tags:
157
+ - Analytics
158
+ summary: Get creator analytics
159
+ description: |
160
+ Retrieves analytics for a specific published content.
161
+ Used by Includu to show creators their earnings and engagement.
162
+ operationId: getCreatorAnalytics
163
+ security:
164
+ - bearerAuth: []
165
+ parameters:
166
+ - name: publishId
167
+ in: path
168
+ required: true
169
+ schema:
170
+ type: string
171
+ - name: startDate
172
+ in: query
173
+ schema:
174
+ type: string
175
+ format: date
176
+ - name: endDate
177
+ in: query
178
+ schema:
179
+ type: string
180
+ format: date
181
+ responses:
182
+ '200':
183
+ description: Analytics retrieved successfully
184
+ content:
185
+ application/json:
186
+ schema:
187
+ $ref: '#/components/schemas/CreatorAnalytics'
188
+ '401':
189
+ description: Authentication required
190
+ '403':
191
+ description: Not authorized to view this content's analytics
192
+
193
+ components:
194
+ securitySchemes:
195
+ bearerAuth:
196
+ type: http
197
+ scheme: bearer
198
+ bearerFormat: JWT
199
+
200
+ schemas:
201
+ # Shared types — canonical definitions in shared/schemas.yaml
202
+ AdSlot:
203
+ $ref: 'shared/schemas.yaml#/components/schemas/AdSlot'
204
+ AdZone:
205
+ $ref: 'shared/schemas.yaml#/components/schemas/AdZone'
206
+ PublishedManifest:
207
+ $ref: 'shared/schemas.yaml#/components/schemas/PublishedManifest'
208
+ PublishedOverlay:
209
+ $ref: 'shared/schemas.yaml#/components/schemas/PublishedOverlay'
210
+ Error:
211
+ $ref: 'shared/schemas.yaml#/components/schemas/Error'
212
+
213
+ # ============================================
214
+ # ADMETISE TYPES
215
+ # ============================================
216
+
217
+ ImportRequest:
218
+ type: object
219
+ description: Request to import Includu content
220
+ required:
221
+ - includuPublishId
222
+ properties:
223
+ includuPublishId:
224
+ type: string
225
+ description: Includu publish ID to import
226
+ example: "abc123xyz"
227
+ name:
228
+ type: string
229
+ description: Optional name override
230
+ campaignId:
231
+ type: string
232
+ description: Campaign to associate with imported content
233
+ adTagOverrides:
234
+ type: object
235
+ description: Override ad tags by slot type
236
+ additionalProperties:
237
+ type: string
238
+ example:
239
+ preroll: "https://pubads.g.doubleclick.net/..."
240
+
241
+ ImportResponse:
242
+ type: object
243
+ description: Result of content import
244
+ required:
245
+ - configId
246
+ - name
247
+ - contentUrl
248
+ - adZones
249
+ properties:
250
+ configId:
251
+ type: string
252
+ description: Created PlayerConfig ID
253
+ name:
254
+ type: string
255
+ contentUrl:
256
+ type: string
257
+ format: uri
258
+ description: HLS stream URL from Includu
259
+ sourcePublishId:
260
+ type: string
261
+ description: Original Includu publish ID
262
+ adZones:
263
+ type: array
264
+ items:
265
+ $ref: '#/components/schemas/AdZone'
266
+ createdAt:
267
+ type: string
268
+ format: date-time
269
+
270
+ # ============================================
271
+ # ANALYTICS TYPES
272
+ # ============================================
273
+
274
+ AnalyticsEvent:
275
+ type: object
276
+ description: Unified analytics event
277
+ required:
278
+ - eventType
279
+ - source
280
+ properties:
281
+ eventType:
282
+ type: string
283
+ enum:
284
+ # Includu events
285
+ - overlayView
286
+ - overlayClick
287
+ - ctaClick
288
+ # Admetise events
289
+ - impression
290
+ - adStart
291
+ - adFirstQuartile
292
+ - adMidpoint
293
+ - adThirdQuartile
294
+ - adComplete
295
+ - adClick
296
+ - adSkip
297
+ - adError
298
+ # Playback events
299
+ - playbackStart
300
+ - playbackPause
301
+ - playbackComplete
302
+ source:
303
+ type: string
304
+ enum:
305
+ - includu
306
+ - admetise
307
+ publishId:
308
+ type: string
309
+ description: Includu content ID (for attribution)
310
+ configId:
311
+ type: string
312
+ description: Admetise config ID
313
+ zoneId:
314
+ type: string
315
+ description: Ad zone or overlay ID
316
+ sessionId:
317
+ type: string
318
+ description: Viewer session ID
319
+ metadata:
320
+ type: object
321
+ additionalProperties: true
322
+ description: Event-specific metadata
323
+
324
+ CreatorAnalytics:
325
+ type: object
326
+ description: Analytics summary for content creator
327
+ properties:
328
+ publishId:
329
+ type: string
330
+ period:
331
+ type: object
332
+ properties:
333
+ start:
334
+ type: string
335
+ format: date
336
+ end:
337
+ type: string
338
+ format: date
339
+ metrics:
340
+ type: object
341
+ properties:
342
+ views:
343
+ type: integer
344
+ description: Total video views
345
+ overlayClicks:
346
+ type: integer
347
+ description: Clicks on creator overlays
348
+ ctaClicks:
349
+ type: integer
350
+ description: CTA button clicks
351
+ adImpressions:
352
+ type: integer
353
+ description: Ad impressions served
354
+ adClicks:
355
+ type: integer
356
+ description: Clicks on ads
357
+ estimatedRevenue:
358
+ type: number
359
+ description: Estimated earnings in USD
360
+ breakdown:
361
+ type: array
362
+ items:
363
+ type: object
364
+ properties:
365
+ date:
366
+ type: string
367
+ format: date
368
+ views:
369
+ type: integer
370
+ revenue:
371
+ type: number
372
+
@@ -0,0 +1,227 @@
1
+ # Shared OpenAPI schemas used across Includu and Admetise specs
2
+ # Single source of truth — referenced via $ref from product specs
3
+
4
+ components:
5
+ schemas:
6
+ Error:
7
+ type: object
8
+ required:
9
+ - error
10
+ properties:
11
+ error:
12
+ type: string
13
+ description: Error message
14
+ code:
15
+ type: string
16
+ description: Error code
17
+ details:
18
+ type: object
19
+ additionalProperties: true
20
+
21
+ AdSlot:
22
+ type: object
23
+ description: Ad placement slot defined by content creator
24
+ required:
25
+ - id
26
+ - type
27
+ properties:
28
+ id:
29
+ type: string
30
+ description: Unique slot identifier
31
+ example: "slot_preroll_1"
32
+ type:
33
+ type: string
34
+ enum: [preroll, midroll, postroll, overlay, companion]
35
+ description: Type of ad placement
36
+ position:
37
+ type: string
38
+ enum: [top-left, top-right, bottom-left, bottom-right, center]
39
+ description: Position for overlay/companion slots
40
+ width:
41
+ type: integer
42
+ description: Slot width in pixels
43
+ example: 300
44
+ height:
45
+ type: integer
46
+ description: Slot height in pixels
47
+ example: 250
48
+ triggerFrame:
49
+ type: integer
50
+ description: Frame number for midroll trigger
51
+ example: 1440
52
+ triggerPercent:
53
+ type: number
54
+ description: Percentage of video for midroll trigger
55
+ minimum: 0
56
+ maximum: 100
57
+ example: 50
58
+ maxDuration:
59
+ type: integer
60
+ description: Maximum ad duration in seconds
61
+ example: 30
62
+ required:
63
+ type: boolean
64
+ description: Whether this slot must be filled
65
+ default: false
66
+
67
+ AdZone:
68
+ type: object
69
+ description: Ad zone in Admetise (mapped from AdSlot)
70
+ required:
71
+ - id
72
+ - type
73
+ - enabled
74
+ properties:
75
+ id:
76
+ type: string
77
+ type:
78
+ type: string
79
+ enum: [preroll, midroll, postroll, overlay, companion]
80
+ enabled:
81
+ type: boolean
82
+ position:
83
+ type: string
84
+ enum: [top-left, top-right, bottom-left, bottom-right, center]
85
+ width:
86
+ type: integer
87
+ height:
88
+ type: integer
89
+ triggerTime:
90
+ type: number
91
+ description: Trigger time in seconds (converted from frames)
92
+ triggerPercent:
93
+ type: number
94
+
95
+ PublishedOverlay:
96
+ type: object
97
+ description: Overlay defined by content creator
98
+ required:
99
+ - id
100
+ - type
101
+ - startFrame
102
+ - endFrame
103
+ - position
104
+ - content
105
+ properties:
106
+ id:
107
+ type: string
108
+ type:
109
+ type: string
110
+ enum: [text, emoji, shape, image, cta, sprite-sequence, video]
111
+ startFrame:
112
+ type: integer
113
+ endFrame:
114
+ type: integer
115
+ position:
116
+ type: object
117
+ properties:
118
+ x:
119
+ type: number
120
+ description: X position as percentage (0-100)
121
+ y:
122
+ type: number
123
+ description: Y position as percentage (0-100)
124
+ width:
125
+ type: number
126
+ height:
127
+ type: number
128
+ animation:
129
+ type: object
130
+ properties:
131
+ fadeIn:
132
+ type: integer
133
+ fadeOut:
134
+ type: integer
135
+ opacity:
136
+ type: number
137
+ content:
138
+ type: object
139
+ description: Type-specific content data
140
+
141
+ PublishedManifest:
142
+ type: object
143
+ description: Immutable published content manifest
144
+ required:
145
+ - publishId
146
+ - name
147
+ - video
148
+ - fps
149
+ - overlays
150
+ properties:
151
+ publishId:
152
+ type: string
153
+ description: Unique publish identifier
154
+ example: "abc123xyz"
155
+ name:
156
+ type: string
157
+ description: Content name
158
+ example: "My Awesome Video"
159
+ video:
160
+ type: object
161
+ required:
162
+ - hlsUrl
163
+ - duration
164
+ properties:
165
+ hlsUrl:
166
+ type: string
167
+ format: uri
168
+ description: HLS stream URL
169
+ duration:
170
+ type: number
171
+ description: Video duration in seconds
172
+ thumbnail:
173
+ type: string
174
+ format: uri
175
+ aspectRatio:
176
+ type: string
177
+ example: "16:9"
178
+ fps:
179
+ type: number
180
+ description: Frames per second
181
+ example: 24
182
+ overlays:
183
+ type: array
184
+ items:
185
+ $ref: '#/components/schemas/PublishedOverlay'
186
+ monetization:
187
+ type: object
188
+ description: Monetization configuration
189
+ properties:
190
+ enabled:
191
+ type: boolean
192
+ default: false
193
+ adSlots:
194
+ type: array
195
+ items:
196
+ $ref: '#/components/schemas/AdSlot'
197
+ revenueShare:
198
+ type: number
199
+ minimum: 0
200
+ maximum: 100
201
+ example: 70
202
+ branding:
203
+ type: object
204
+ properties:
205
+ logo:
206
+ type: string
207
+ format: uri
208
+ accentColor:
209
+ type: string
210
+ pattern: '^#[0-9A-Fa-f]{6}$'
211
+ showPoweredBy:
212
+ type: boolean
213
+ default: true
214
+ links:
215
+ type: object
216
+ properties:
217
+ player:
218
+ type: string
219
+ format: uri
220
+ embed:
221
+ type: string
222
+ format: uri
223
+ embedCode:
224
+ type: string
225
+ participate:
226
+ type: string
227
+ format: uri
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@ume-group/contracts",
3
+ "version": "0.2.1",
4
+ "description": "Cross-brand API contracts for Includu and Admetise",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./layer2": {
14
+ "types": "./dist/layer2/index.d.ts",
15
+ "import": "./dist/layer2/index.js"
16
+ },
17
+ "./segmentation": {
18
+ "types": "./dist/segmentation/index.d.ts",
19
+ "import": "./dist/segmentation/index.js"
20
+ },
21
+ "./webcam": {
22
+ "types": "./dist/webcam/index.d.ts",
23
+ "import": "./dist/webcam/index.js"
24
+ }
25
+ },
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "dev": "tsc --watch",
29
+ "test": "vitest run",
30
+ "test:coverage": "vitest run --coverage",
31
+ "prepublishOnly": "npm run build"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/uMe-Group/ume-contracts.git"
36
+ },
37
+ "publishConfig": {
38
+ "registry": "https://registry.npmjs.org",
39
+ "access": "public"
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "openapi"
44
+ ],
45
+ "dependencies": {
46
+ "@mediapipe/tasks-vision": "^0.10.32"
47
+ },
48
+ "devDependencies": {
49
+ "@vitest/coverage-v8": "^4.0.0",
50
+ "typescript": "^5.7.2",
51
+ "vitest": "^4.0.0"
52
+ }
53
+ }