@synopackageland/templates 0.38.1 → 0.39.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 (72) hide show
  1. package/README.md +6 -7
  2. package/package.json +1 -1
  3. package/templates/_shared/AGENTS.md +6 -5
  4. package/templates/_shared/CLAUDE.md +2 -0
  5. package/templates/compose/dsm-package.yaml +1 -1
  6. package/templates/native-go/README.md +28 -11
  7. package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +1 -1
  8. package/templates/native-go/backend/cmd/app/main.go +9 -2
  9. package/templates/native-go/backend/go.mod +1 -1
  10. package/templates/native-go/backend/go.sum +2 -2
  11. package/templates/native-go/backend/internal/api/operations.json +5 -0
  12. package/templates/native-go/backend/internal/api/permissions.go +7 -0
  13. package/templates/native-go/backend/internal/api/permissions.json +3 -1
  14. package/templates/native-go/backend/internal/app/routes.go +2 -46
  15. package/templates/native-go/backend/internal/app/routes_test.go +4 -25
  16. package/templates/native-go/dsm-package.yaml +2 -28
  17. package/templates/native-go/examples/operations.json +112 -0
  18. package/templates/native-go/i18n/glossary.json +2 -6
  19. package/templates/native-go/i18n/messages/de.json +0 -5
  20. package/templates/native-go/i18n/messages/en.json +0 -5
  21. package/templates/native-go/i18n/messages/es.json +0 -5
  22. package/templates/native-go/i18n/messages/fr.json +0 -5
  23. package/templates/native-go/i18n/messages/it.json +0 -5
  24. package/templates/native-go/i18n/messages/ja.json +0 -5
  25. package/templates/native-go/i18n/messages/ko.json +0 -5
  26. package/templates/native-go/i18n/messages/zh-CN.json +0 -5
  27. package/templates/native-go/i18n/messages/zh-TW.json +0 -5
  28. package/templates/native-go/operations.json +27 -0
  29. package/templates/native-go/ui/app.js +0 -25
  30. package/templates/native-go-delegate/frontend/test/capability-panels.test.ts +3 -4
  31. package/templates/native-go-root-ops/frontend/test/executor-gate.test.ts +7 -6
  32. package/templates/native-go-vue/frontend/package-lock.json +4 -4
  33. package/templates/native-go-vue/frontend/package.json +1 -1
  34. package/templates/native-go-vue/frontend/src/App.vue +5 -34
  35. package/templates/native-go-vue/frontend/test/apps.test.ts +19 -25
  36. package/templates/native-go-vue/frontend/test/native-controls.test.ts +4 -1
  37. package/templates/native-go-vue/frontend/test/shell-i18n.test.ts +5 -3
  38. package/templates/native-node/README.md +27 -7
  39. package/templates/native-node/backend/app/permissions.json +3 -1
  40. package/templates/native-node/backend/package-lock.json +1 -1
  41. package/templates/native-node/backend/src/routes.ts +5 -43
  42. package/templates/native-node/backend/test/routes.test.ts +3 -23
  43. package/templates/native-node/dsm-package.yaml +3 -29
  44. package/templates/native-node/examples/operations.json +112 -0
  45. package/templates/native-node/operations.json +27 -0
  46. package/templates/native-node-delegate/operations.patch.json +20 -0
  47. package/templates/native-node-jobs/operations.patch.json +52 -0
  48. package/templates/native-node-root-ops/operations.patch.json +20 -0
  49. package/templates/native-python/README.md +27 -7
  50. package/templates/native-python/backend/app/permissions.json +3 -1
  51. package/templates/native-python/backend/app/routes.py +2 -41
  52. package/templates/native-python/backend/tests/test_routes.py +3 -19
  53. package/templates/native-python/dsm-package.yaml +3 -29
  54. package/templates/native-python/examples/operations.json +112 -0
  55. package/templates/native-python/operations.json +27 -0
  56. package/templates/native-python-delegate/operations.patch.json +20 -0
  57. package/templates/native-python-jobs/operations.patch.json +52 -0
  58. package/templates/native-python-root-ops/operations.patch.json +20 -0
  59. package/templates/native-rust/README.md +28 -8
  60. package/templates/native-rust/backend/Cargo.lock +2 -2
  61. package/templates/native-rust/backend/Cargo.toml +1 -1
  62. package/templates/native-rust/backend/permissions.json +3 -1
  63. package/templates/native-rust/backend/src/routes.rs +11 -149
  64. package/templates/native-rust/dsm-package.yaml +3 -29
  65. package/templates/native-rust/examples/operations.json +112 -0
  66. package/templates/native-rust/operations.json +27 -0
  67. package/templates/native-rust-delegate/backend/Cargo.lock +2 -2
  68. package/templates/native-rust-delegate/backend/Cargo.toml +1 -1
  69. package/templates/native-rust-delegate/backend/src/delegate.rs +7 -1
  70. package/templates/native-rust-delegate/operations.patch.json +20 -0
  71. package/templates/native-rust-jobs/operations.patch.json +52 -0
  72. package/templates/native-rust-root-ops/operations.patch.json +20 -0
@@ -0,0 +1,112 @@
1
+ {
2
+ "format": "synopkgland.api",
3
+ "version": 2,
4
+ "operations": {
5
+ "example.read": {
6
+ "summary": "Read a resource",
7
+ "ai": "read",
8
+ "cli": [
9
+ "example",
10
+ "read"
11
+ ],
12
+ "effect": "read",
13
+ "permission": "administrators",
14
+ "paramsSchema": {
15
+ "type": "object",
16
+ "additionalProperties": false
17
+ },
18
+ "resultSchema": {
19
+ "type": "object"
20
+ },
21
+ "flow": {
22
+ "type": "invoke",
23
+ "method": "example.read"
24
+ }
25
+ },
26
+ "example.preview": {
27
+ "summary": "Preview a resource change",
28
+ "ai": "preview",
29
+ "cli": [
30
+ "example",
31
+ "preview"
32
+ ],
33
+ "effect": "read",
34
+ "permission": "administrators",
35
+ "paramsSchema": {
36
+ "type": "object",
37
+ "additionalProperties": false
38
+ },
39
+ "resultSchema": {
40
+ "type": "object"
41
+ },
42
+ "flow": {
43
+ "type": "invoke",
44
+ "method": "example.preview"
45
+ }
46
+ },
47
+ "example.draft": {
48
+ "summary": "Draft a resource change for human confirmation",
49
+ "ai": "draft",
50
+ "cli": [
51
+ "example",
52
+ "draft"
53
+ ],
54
+ "effect": "write",
55
+ "permission": "administrators",
56
+ "paramsSchema": {
57
+ "type": "object",
58
+ "additionalProperties": false
59
+ },
60
+ "resultSchema": {
61
+ "type": "object"
62
+ },
63
+ "flow": {
64
+ "type": "invoke",
65
+ "method": "example.draft"
66
+ },
67
+ "preview": "example.preview"
68
+ },
69
+ "example.human": {
70
+ "summary": "Delete a resource after human review",
71
+ "ai": "human-only",
72
+ "cli": [
73
+ "example",
74
+ "human"
75
+ ],
76
+ "effect": "destructive",
77
+ "permission": "administrators",
78
+ "paramsSchema": {
79
+ "type": "object",
80
+ "additionalProperties": false
81
+ },
82
+ "resultSchema": {
83
+ "type": "object"
84
+ },
85
+ "flow": {
86
+ "type": "invoke",
87
+ "method": "example.human"
88
+ }
89
+ },
90
+ "example.hidden": {
91
+ "summary": "Read internal state",
92
+ "ai": "hidden",
93
+ "cli": [
94
+ "example",
95
+ "hidden"
96
+ ],
97
+ "effect": "read",
98
+ "permission": "administrators",
99
+ "paramsSchema": {
100
+ "type": "object",
101
+ "additionalProperties": false
102
+ },
103
+ "resultSchema": {
104
+ "type": "object"
105
+ },
106
+ "flow": {
107
+ "type": "invoke",
108
+ "method": "example.hidden"
109
+ }
110
+ }
111
+ }
112
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "format": "synopkgland.api",
3
+ "version": 2,
4
+ "operations": {
5
+ "app.status": {
6
+ "summary": "Read App status",
7
+ "ai": "read",
8
+ "cli": [
9
+ "app",
10
+ "status"
11
+ ],
12
+ "effect": "read",
13
+ "permission": "administrators",
14
+ "paramsSchema": {
15
+ "type": "object",
16
+ "additionalProperties": false
17
+ },
18
+ "resultSchema": {
19
+ "type": "object"
20
+ },
21
+ "flow": {
22
+ "type": "invoke",
23
+ "method": "app.status"
24
+ }
25
+ }
26
+ }
27
+ }
@@ -170,8 +170,8 @@ dependencies = [
170
170
 
171
171
  [[package]]
172
172
  name = "syno-pkg-land-app"
173
- version = "0.43.0"
174
- source = "git+https://github.com/synopackageland/syno-pkg-land-sdk?tag=v0.43.0#263d2a4fbab040756d406b76dd8272bca9db9707"
173
+ version = "0.47.0"
174
+ source = "git+https://github.com/synopackageland/syno-pkg-land-sdk?tag=v0.47.0#c486d2ce888248e9e68a67908810c62f968d601e"
175
175
  dependencies = [
176
176
  "libc",
177
177
  "serde",
@@ -10,7 +10,7 @@ libc = "0.2"
10
10
  serde = { version = "1", features = ["derive"] }
11
11
  serde_json = "1"
12
12
  # The SDK version is the tag; `synopkgland check` reads it from Cargo.lock.
13
- syno-pkg-land-app = { git = "https://github.com/synopackageland/syno-pkg-land-sdk", tag = "v0.43.0" }
13
+ syno-pkg-land-app = { git = "https://github.com/synopackageland/syno-pkg-land-sdk", tag = "v0.47.0" }
14
14
 
15
15
  [profile.release]
16
16
  # A handler panic becomes an "internal" reply; abort would end the App without one.
@@ -3,7 +3,7 @@
3
3
  //! executor moves it to the caller's destination with the caller's own
4
4
  //! permission, so the package never needs write access to that folder.
5
5
 
6
- use crate::routes::{Config, internal, utc_now};
6
+ use crate::routes::{Config, utc_now};
7
7
  use serde::Deserialize;
8
8
  use serde_json::{Value, json};
9
9
  use sha2::{Digest, Sha256};
@@ -12,6 +12,12 @@ use std::io::{ErrorKind, Write};
12
12
  use std::os::unix::fs::{DirBuilderExt, OpenOptionsExt};
13
13
  use syno_pkg_land_app::{App, Context, Error, Params};
14
14
 
15
+ // Log unexpected failures privately; return a stable code to the caller.
16
+ fn internal(e: impl std::fmt::Display) -> Error {
17
+ eprintln!("{e}");
18
+ Error::new("internal", "internal error")
19
+ }
20
+
15
21
  #[derive(Deserialize)]
16
22
  #[serde(deny_unknown_fields)]
17
23
  struct SaveReport {
@@ -0,0 +1,20 @@
1
+ {
2
+ "operations": {
3
+ "report.save": {
4
+ "summary": "Save an example report",
5
+ "ai": "hidden",
6
+ "effect": "write",
7
+ "permission": "authenticated",
8
+ "cli": [
9
+ "report",
10
+ "save"
11
+ ],
12
+ "paramsSchema": {},
13
+ "resultSchema": {},
14
+ "flow": {
15
+ "type": "invoke",
16
+ "method": "report.save"
17
+ }
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "operations": {
3
+ "hash.submit": {
4
+ "summary": "Start a file hash job",
5
+ "ai": "hidden",
6
+ "effect": "write",
7
+ "permission": "administrators",
8
+ "cli": [
9
+ "hash",
10
+ "submit"
11
+ ],
12
+ "paramsSchema": {},
13
+ "resultSchema": {},
14
+ "flow": {
15
+ "type": "invoke",
16
+ "method": "hash.submit"
17
+ }
18
+ },
19
+ "hash.get": {
20
+ "summary": "Read a file hash job",
21
+ "ai": "hidden",
22
+ "effect": "read",
23
+ "permission": "administrators",
24
+ "cli": [
25
+ "hash",
26
+ "get"
27
+ ],
28
+ "paramsSchema": {},
29
+ "resultSchema": {},
30
+ "flow": {
31
+ "type": "invoke",
32
+ "method": "hash.get"
33
+ }
34
+ },
35
+ "hash.cancel": {
36
+ "summary": "Cancel a file hash job",
37
+ "ai": "hidden",
38
+ "effect": "write",
39
+ "permission": "administrators",
40
+ "cli": [
41
+ "hash",
42
+ "cancel"
43
+ ],
44
+ "paramsSchema": {},
45
+ "resultSchema": {},
46
+ "flow": {
47
+ "type": "invoke",
48
+ "method": "hash.cancel"
49
+ }
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "operations": {
3
+ "whoami.run": {
4
+ "summary": "Run the approved identity operation",
5
+ "ai": "hidden",
6
+ "effect": "write",
7
+ "permission": "administrators",
8
+ "cli": [
9
+ "whoami",
10
+ "run"
11
+ ],
12
+ "paramsSchema": {},
13
+ "resultSchema": {},
14
+ "flow": {
15
+ "type": "invoke",
16
+ "method": "whoami.run"
17
+ }
18
+ }
19
+ }
20
+ }