@ossy/media-tasks 1.40.0 → 1.40.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/media-tasks",
3
- "version": "1.40.0",
3
+ "version": "1.40.2",
4
4
  "description": "Changestream-triggered media processing tasks (image resize, AI descriptors)",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -15,7 +15,8 @@
15
15
  "typecheck": "echo \"No TypeScript in media-tasks package\" && exit 0"
16
16
  },
17
17
  "dependencies": {
18
- "@ossy/observability": "^1.8.0"
18
+ "@ossy/observability": "^1.8.2",
19
+ "@ossy/resources": "^1.12.2"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "openai": ">=4",
@@ -31,5 +32,5 @@
31
32
  ],
32
33
  "author": "Ossy <yourfriends@ossy.se> (https://ossy.se)",
33
34
  "license": "MIT",
34
- "gitHead": "d9d31182be64a448d575da432af2830d909ad4b9"
35
+ "gitHead": "2b8745d57fee8b6c08787e2755b4df489291a5cd"
35
36
  }
@@ -1,4 +1,5 @@
1
1
  import { createLogger } from '@ossy/observability'
2
+ import { GetResource } from '@ossy/resources'
2
3
 
3
4
  const log = createLogger('media-tasks')
4
5
 
@@ -28,7 +29,7 @@ export async function run ({ event, sdk }) {
28
29
 
29
30
  log.info(`[resize-common-web] starting for resource ${resourceId}`)
30
31
 
31
- const resource = await sdk.resources.get({ id: resourceId })
32
+ const resource = await sdk.invoke(GetResource, { id: resourceId })
32
33
  const image = await fetch(resource.content.src).then((response) => response.arrayBuffer())
33
34
 
34
35
  log.info(`[resize-common-web] Resizing ${resourceId}`)
@@ -42,6 +43,7 @@ export async function run ({ event, sdk }) {
42
43
 
43
44
  log.info(`[resize-common-web] Uploading ${name} for ${resourceId}`)
44
45
  try {
46
+ // TODO: remove named version concept
45
47
  await sdk.resources.uploadNamedVersion({
46
48
  id: resourceId,
47
49
  name: name,
@@ -1,3 +1,4 @@
1
+ import { GetResource, UpdateResourceName, UpdateResourceContent } from '@ossy/resources'
1
2
  import { OpenAi } from './openai.integration.js'
2
3
 
3
4
  export const metadata = {
@@ -19,11 +20,11 @@ export const metadata = {
19
20
  export async function run ({ event, sdk }) {
20
21
  const resourceId = event.aggregateId
21
22
 
22
- const resource = await sdk.resources.get({ id: resourceId })
23
+ const resource = await sdk.invoke(GetResource, { id: resourceId })
23
24
  const visualContentDescriptors = await OpenAi.getVisualContentDescriptors(resource.content.src)
24
25
 
25
- await sdk.resources.rename({ id: resource.id, name: visualContentDescriptors.title })
26
- await sdk.resources.updateContent({
26
+ await sdk.invoke(UpdateResourceName, { id: resource.id, name: visualContentDescriptors.title })
27
+ await sdk.invoke(UpdateResourceContent, {
27
28
  id: resource.id,
28
29
  content: {
29
30
  ...resource.content,