@ossy/app 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/cli/build.task.js CHANGED
@@ -198,14 +198,12 @@ function generateEmailStub ({ stubAbs, sourceAbs }) {
198
198
  ].join('\n')
199
199
  }
200
200
 
201
- // Actions are named command handlers. The stub re-exports `id`, `access`, and
202
- // `run` so the manifest plugin can validate them and the platform server can
203
- // invoke them at runtime.
201
+ // Actions are intent (metadata only). Implementation lives in a matching `*.task.js`.
204
202
  function generateActionStub ({ stubAbs, sourceAbs }) {
205
203
  const importPath = relImport(stubAbs, sourceAbs)
206
204
  return [
207
205
  '// Generated by @ossy/app — do not edit',
208
- `export { id, access, run } from '${importPath}'`,
206
+ `export { metadata } from '${importPath}'`,
209
207
  '',
210
208
  ].join('\n')
211
209
  }
package/cli/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import 'dotenv/config'
2
3
  import { build } from './build.task.js'
3
4
  import { start } from './start.task.js'
4
5
 
@@ -268,25 +268,19 @@ export function manifestPlugin ({ entriesByStub, srcDir, staticOutDir, configVal
268
268
  continue
269
269
  }
270
270
 
271
- // Actions are named, discoverable command handlers. The bundle exports
272
- // `id` (a unique slug), `run` (the handler function), and optionally
273
- // `access` ('public' | 'authenticated' | 'workspace', default 'authenticated').
271
+ // Actions are intent: `metadata` only (`{ id, access }`). Matching task
272
+ // with the same id holds `run` (see ADR 0003).
274
273
  if (entryInfo.kind === 'action') {
275
- const actionId = mod && mod.id
274
+ const actionId = mod?.metadata?.id
276
275
  if (typeof actionId !== 'string' || actionId.trim() === '') {
277
276
  this.error(
278
- `[@ossy/app][build] action entry ${entryInfo.sourcePath} must export a non-empty string "id"`,
279
- )
280
- }
281
- if (typeof mod.run !== 'function') {
282
- this.error(
283
- `[@ossy/app][build] action entry ${entryInfo.sourcePath} must export a "run" function`,
277
+ `[@ossy/app][build] action entry ${entryInfo.sourcePath} must export a non-empty string "metadata.id"`,
284
278
  )
285
279
  }
286
280
  if (seenActionIds.has(actionId)) {
287
281
  this.error(`[@ossy/app][build] Duplicate action id "${actionId}"`)
288
282
  }
289
- const access = mod.access ?? 'authenticated'
283
+ const access = mod.metadata?.access ?? 'authenticated'
290
284
  seenActionIds.add(actionId)
291
285
  actions.push({ id: actionId, entry: url, access, package: entryPackage(entryInfo, appPackageName) })
292
286
  continue
package/cli/start.task.js CHANGED
@@ -1,3 +1,4 @@
1
+ import 'dotenv/config'
1
2
  import path from 'node:path'
2
3
  import arg from 'arg'
3
4
  import { startServer } from '@ossy/platform/server'
@@ -13,7 +14,7 @@ export async function start (cliArgs = []) {
13
14
  const cwd = options['--cwd'] ? path.resolve(options['--cwd']) : process.cwd()
14
15
  const buildDir = options['--build-dir'] || 'build'
15
16
  const port = options['--port']
16
-
17
+
17
18
  const { lifetime } = await startServer({ cwd, buildDir, port })
18
19
  await lifetime
19
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/app",
3
- "version": "1.40.0",
3
+ "version": "1.40.2",
4
4
  "description": "",
5
5
  "source": "./src/index.js",
6
6
  "main": "./src/index.js",
@@ -42,15 +42,15 @@
42
42
  "@babel/eslint-parser": "^7.15.8",
43
43
  "@babel/preset-react": "^7.26.3",
44
44
  "@babel/register": "^7.25.9",
45
- "@ossy/design-system": "^1.40.0",
46
- "@ossy/locale": "^1.40.0",
45
+ "@ossy/design-system": "^1.40.2",
46
+ "@ossy/locale": "^1.40.2",
47
47
  "@ossy/pages": "^1.23.0",
48
- "@ossy/platform": "^1.39.0",
49
- "@ossy/router": "^1.40.0",
50
- "@ossy/router-react": "^1.40.0",
51
- "@ossy/sdk": "^1.40.0",
52
- "@ossy/sdk-react": "^1.40.0",
53
- "@ossy/themes": "^1.40.0",
48
+ "@ossy/platform": "^1.39.2",
49
+ "@ossy/router": "^1.40.2",
50
+ "@ossy/router-react": "^1.40.2",
51
+ "@ossy/sdk": "^1.40.2",
52
+ "@ossy/sdk-react": "^1.40.2",
53
+ "@ossy/themes": "^1.40.2",
54
54
  "@rollup/plugin-alias": "^6.0.0",
55
55
  "@rollup/plugin-babel": "^7.0.0",
56
56
  "@rollup/plugin-commonjs": "^29.0.0",
@@ -84,5 +84,5 @@
84
84
  "README.md",
85
85
  "tsconfig.json"
86
86
  ],
87
- "gitHead": "d9d31182be64a448d575da432af2830d909ad4b9"
87
+ "gitHead": "2b8745d57fee8b6c08787e2755b4df489291a5cd"
88
88
  }
@@ -1,5 +1,6 @@
1
1
  import React, { useState, useMemo, useCallback, useEffect } from 'react'
2
- import { useResource } from '@ossy/sdk-react'
2
+ import { updateResourceContent } from '@ossy/resources'
3
+ import { useSdk } from '@ossy/sdk-react'
3
4
  import { Overlay, Button, useTheme, View, Text } from '@ossy/design-system'
4
5
  import { DevPagesPanel } from './DevPagesPanel.jsx'
5
6
 
@@ -40,7 +41,7 @@ const ThemeSwitcher = () => {
40
41
  }
41
42
 
42
43
  export const ThemeEditor = () => {
43
- const { updateResourceContent } = useResource('PCX53TaGviq4_8KvK-VOp')
44
+ const sdk = useSdk()
44
45
  const [isEditorOpen, setIsEditorOpen] = useState(false)
45
46
  const [viewCount, setViewCount] = useState(0)
46
47
  // const [theme, temporarilyUpdateTheme] = useTheme()
@@ -72,7 +73,7 @@ export const ThemeEditor = () => {
72
73
 
73
74
  const onSaveTheme = event => {
74
75
  event.preventDefault()
75
- updateResourceContent(theme)
76
+ updateResourceContent(sdk, 'PCX53TaGviq4_8KvK-VOp', theme)
76
77
  }
77
78
 
78
79
  useEffect(() => {