@oondemand/create-central-oon 0.4.20 → 0.4.21

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": "@oondemand/create-central-oon",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/oondemand/oon-platform.git",
@@ -4,59 +4,314 @@
4
4
  "title": "Oon Central App Manifest",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": ["schemaVersion", "id", "name", "slug", "appKind", "modules", "capabilities", "compatibility"],
7
+ "required": [
8
+ "schemaVersion",
9
+ "id",
10
+ "name",
11
+ "slug",
12
+ "appKind",
13
+ "modules",
14
+ "capabilities",
15
+ "compatibility"
16
+ ],
8
17
  "properties": {
9
- "$schema": { "type": "string" },
10
- "schemaVersion": { "const": 1 },
11
- "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
12
- "name": { "type": "string", "minLength": 1 },
13
- "slug": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$" },
14
- "appKind": { "enum": ["root-central", "member-central", "portal-cockpit"] },
15
- "tenancyModel": { "enum": ["none", "single_tenant", "multi_tenant"] },
16
- "availability": { "enum": ["system", "common", "licensed"] },
17
- "accessMode": { "enum": ["tenant_members", "explicit_users"] },
18
- "authorizationMode": { "enum": ["none", "rbac"] },
18
+ "$schema": {
19
+ "type": "string"
20
+ },
21
+ "schemaVersion": {
22
+ "const": 1
23
+ },
24
+ "id": {
25
+ "type": "string",
26
+ "pattern": "^[a-z0-9][a-z0-9._-]*$"
27
+ },
28
+ "name": {
29
+ "type": "string",
30
+ "minLength": 1
31
+ },
32
+ "slug": {
33
+ "type": "string",
34
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
35
+ },
36
+ "appKind": {
37
+ "enum": [
38
+ "root-central",
39
+ "member-central",
40
+ "portal-cockpit"
41
+ ]
42
+ },
43
+ "tenancyModel": {
44
+ "enum": [
45
+ "none",
46
+ "single_tenant",
47
+ "multi_tenant"
48
+ ]
49
+ },
50
+ "availability": {
51
+ "enum": [
52
+ "system",
53
+ "common",
54
+ "licensed"
55
+ ]
56
+ },
57
+ "accessMode": {
58
+ "enum": [
59
+ "tenant_members",
60
+ "explicit_users",
61
+ "authenticated_users"
62
+ ]
63
+ },
64
+ "authorizationMode": {
65
+ "enum": [
66
+ "none",
67
+ "rbac"
68
+ ]
69
+ },
19
70
  "accessPolicy": {
20
- "enum": ["tenant_members", "explicit_users", "rbac"],
71
+ "enum": [
72
+ "tenant_members",
73
+ "explicit_users",
74
+ "rbac"
75
+ ],
21
76
  "description": "Compatibilidade legada. Novos manifestos devem usar accessMode e authorizationMode."
22
77
  },
23
- "deploymentMode": { "enum": ["singleton", "shared", "dedicated", "hybrid"] },
78
+ "deploymentMode": {
79
+ "enum": [
80
+ "singleton",
81
+ "shared",
82
+ "dedicated",
83
+ "hybrid"
84
+ ]
85
+ },
24
86
  "auth": {
25
87
  "type": "object",
26
88
  "additionalProperties": false,
27
89
  "properties": {
28
- "sessionScope": { "const": "ecosystem" }
90
+ "sessionScope": {
91
+ "const": "ecosystem"
92
+ }
29
93
  }
30
94
  },
31
95
  "modules": {
32
96
  "type": "object",
33
97
  "additionalProperties": false,
34
98
  "properties": {
35
- "collections": { "type": "boolean" }, "documents": { "type": "boolean" }, "pipelines": { "type": "boolean" },
36
- "integrations": { "type": "boolean" }, "omie": { "type": "boolean" }, "assistants": { "type": "boolean" }, "currencies": { "type": "boolean" }
99
+ "collections": {
100
+ "type": "boolean"
101
+ },
102
+ "documents": {
103
+ "type": "boolean"
104
+ },
105
+ "pipelines": {
106
+ "type": "boolean"
107
+ },
108
+ "integrations": {
109
+ "type": "boolean"
110
+ },
111
+ "omie": {
112
+ "type": "boolean"
113
+ },
114
+ "assistants": {
115
+ "type": "boolean"
116
+ },
117
+ "currencies": {
118
+ "type": "boolean"
119
+ }
120
+ }
121
+ },
122
+ "capabilities": {
123
+ "type": "array",
124
+ "uniqueItems": true,
125
+ "items": {
126
+ "type": "string",
127
+ "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9][a-z0-9-]*)+$"
37
128
  }
38
129
  },
39
- "capabilities": { "type": "array", "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[._:-][a-z0-9][a-z0-9-]*)+$" } },
40
130
  "compatibility": {
41
- "type": "object", "additionalProperties": false, "required": ["core"],
42
- "properties": { "core": { "type": "object", "additionalProperties": false, "required": ["minVersion"], "properties": {
43
- "minVersion": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]+)?$" },
44
- "maxVersionExclusive": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]+)?$" }
45
- } } }
46
- },
47
- "activation": { "type": "object", "additionalProperties": false, "properties": {
48
- "enabled": { "type": "boolean" }, "configurationVersion": { "type": "integer", "minimum": 1 }, "fields": { "type": "array" }
49
- } },
50
- "rbac": { "type": "object", "additionalProperties": false, "required": ["roles"], "properties": {
51
- "permissions": { "type": "array", "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z][a-z0-9-]*(?:\\.[a-z][a-z0-9-]*)+$" } },
52
- "invitationTtlHours": { "type": "integer", "minimum": 1, "maximum": 720 },
53
- "roles": { "type": "array", "minItems": 1, "items": { "type": "object", "additionalProperties": false, "required": ["code", "name", "permissions"], "properties": {
54
- "code": { "type": "string", "pattern": "^[a-z][a-z0-9_-]*$" }, "name": { "type": "string", "minLength": 1 },
55
- "description": { "type": "string" }, "admin": { "type": "boolean" },
56
- "permissions": { "type": "array", "uniqueItems": true, "items": { "anyOf": [
57
- { "const": "*" }, { "type": "string", "pattern": "^[a-z][a-z0-9-]*(?:\\.[a-z][a-z0-9-]*)+$" }
58
- ] } }
59
- } } }
60
- } }
61
- }
131
+ "type": "object",
132
+ "additionalProperties": false,
133
+ "required": [
134
+ "core"
135
+ ],
136
+ "properties": {
137
+ "core": {
138
+ "type": "object",
139
+ "additionalProperties": false,
140
+ "required": [
141
+ "minVersion"
142
+ ],
143
+ "properties": {
144
+ "minVersion": {
145
+ "type": "string",
146
+ "pattern": "^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]+)?$"
147
+ },
148
+ "maxVersionExclusive": {
149
+ "type": "string",
150
+ "pattern": "^\\d+\\.\\d+\\.\\d+(?:[-+][0-9A-Za-z.-]+)?$"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ },
156
+ "activation": {
157
+ "type": "object",
158
+ "additionalProperties": false,
159
+ "properties": {
160
+ "enabled": {
161
+ "type": "boolean"
162
+ },
163
+ "configurationVersion": {
164
+ "type": "integer",
165
+ "minimum": 1
166
+ },
167
+ "fields": {
168
+ "type": "array"
169
+ }
170
+ }
171
+ },
172
+ "rbac": {
173
+ "type": "object",
174
+ "additionalProperties": false,
175
+ "required": [
176
+ "roles"
177
+ ],
178
+ "properties": {
179
+ "permissions": {
180
+ "type": "array",
181
+ "uniqueItems": true,
182
+ "items": {
183
+ "type": "string",
184
+ "pattern": "^[a-z][a-z0-9-]*(?:\\.[a-z][a-z0-9-]*)+$"
185
+ }
186
+ },
187
+ "invitationTtlHours": {
188
+ "type": "integer",
189
+ "minimum": 1,
190
+ "maximum": 720
191
+ },
192
+ "roles": {
193
+ "type": "array",
194
+ "minItems": 1,
195
+ "items": {
196
+ "type": "object",
197
+ "additionalProperties": false,
198
+ "required": [
199
+ "code",
200
+ "name",
201
+ "permissions"
202
+ ],
203
+ "properties": {
204
+ "code": {
205
+ "type": "string",
206
+ "pattern": "^[a-z][a-z0-9_-]*$"
207
+ },
208
+ "name": {
209
+ "type": "string",
210
+ "minLength": 1
211
+ },
212
+ "description": {
213
+ "type": "string"
214
+ },
215
+ "admin": {
216
+ "type": "boolean"
217
+ },
218
+ "permissions": {
219
+ "type": "array",
220
+ "uniqueItems": true,
221
+ "items": {
222
+ "anyOf": [
223
+ {
224
+ "const": "*"
225
+ },
226
+ {
227
+ "type": "string",
228
+ "pattern": "^[a-z][a-z0-9-]*(?:\\.[a-z][a-z0-9-]*)+$"
229
+ }
230
+ ]
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }
238
+ },
239
+ "allOf": [
240
+ {
241
+ "if": {
242
+ "properties": {
243
+ "accessMode": {
244
+ "const": "authenticated_users"
245
+ }
246
+ },
247
+ "required": [
248
+ "accessMode"
249
+ ]
250
+ },
251
+ "then": {
252
+ "required": [
253
+ "tenancyModel",
254
+ "availability",
255
+ "authorizationMode",
256
+ "deploymentMode"
257
+ ],
258
+ "properties": {
259
+ "tenancyModel": {
260
+ "const": "none"
261
+ },
262
+ "availability": {
263
+ "const": "common"
264
+ },
265
+ "authorizationMode": {
266
+ "const": "rbac"
267
+ },
268
+ "deploymentMode": {
269
+ "const": "singleton"
270
+ }
271
+ }
272
+ }
273
+ },
274
+ {
275
+ "if": {
276
+ "properties": {
277
+ "tenancyModel": {
278
+ "const": "none"
279
+ }
280
+ },
281
+ "required": [
282
+ "tenancyModel"
283
+ ]
284
+ },
285
+ "then": {
286
+ "properties": {
287
+ "accessMode": {
288
+ "not": {
289
+ "const": "tenant_members"
290
+ }
291
+ }
292
+ }
293
+ }
294
+ },
295
+ {
296
+ "if": {
297
+ "properties": {
298
+ "tenancyModel": {
299
+ "const": "single_tenant"
300
+ }
301
+ },
302
+ "required": [
303
+ "tenancyModel"
304
+ ]
305
+ },
306
+ "then": {
307
+ "properties": {
308
+ "deploymentMode": {
309
+ "not": {
310
+ "const": "shared"
311
+ }
312
+ }
313
+ }
314
+ }
315
+ }
316
+ ]
62
317
  }
@@ -63,6 +63,8 @@ function fallbackValidateAppManifest(manifest) {
63
63
  const optionalDimensions = {
64
64
  tenancyModel: ["none", "single_tenant", "multi_tenant"],
65
65
  availability: ["system", "common", "licensed"],
66
+ accessMode: ["tenant_members", "explicit_users", "authenticated_users"],
67
+ authorizationMode: ["none", "rbac"],
66
68
  deploymentMode: ["singleton", "shared", "dedicated", "hybrid"],
67
69
  };
68
70
  for (const [key, allowed] of Object.entries(optionalDimensions)) {
@@ -70,6 +72,36 @@ function fallbackValidateAppManifest(manifest) {
70
72
  throw new Error(`${key} deve ser um de: ${allowed.join(", ")}.`);
71
73
  }
72
74
  }
75
+
76
+ const defaults = {
77
+ "root-central": { tenancyModel: "none", availability: "system", accessMode: "explicit_users", authorizationMode: "rbac", deploymentMode: "singleton" },
78
+ "member-central": { tenancyModel: "single_tenant", availability: "licensed", accessMode: "explicit_users", authorizationMode: "rbac", deploymentMode: "dedicated" },
79
+ "portal-cockpit": { tenancyModel: "multi_tenant", availability: "common", accessMode: "tenant_members", authorizationMode: "none", deploymentMode: "shared" },
80
+ }[manifest.appKind] || {};
81
+ const legacy = {
82
+ tenant_members: { accessMode: "tenant_members", authorizationMode: "none" },
83
+ explicit_users: { accessMode: "explicit_users", authorizationMode: "none" },
84
+ rbac: { accessMode: "explicit_users", authorizationMode: "rbac" },
85
+ }[manifest.accessPolicy] || {};
86
+ const dimensions = {
87
+ tenancyModel: manifest.tenancyModel || defaults.tenancyModel,
88
+ availability: manifest.availability || defaults.availability,
89
+ accessMode: manifest.accessMode || legacy.accessMode || defaults.accessMode,
90
+ authorizationMode: manifest.authorizationMode || legacy.authorizationMode || defaults.authorizationMode,
91
+ deploymentMode: manifest.deploymentMode || defaults.deploymentMode,
92
+ };
93
+ if (dimensions.tenancyModel === "none" && dimensions.accessMode === "tenant_members") {
94
+ throw new Error("accessMode tenant_members exige uma aplicação tenant-aware.");
95
+ }
96
+ if (dimensions.accessMode === "authenticated_users") {
97
+ const expected = { tenancyModel: "none", availability: "common", authorizationMode: "rbac", deploymentMode: "singleton" };
98
+ for (const [key, value] of Object.entries(expected)) {
99
+ if (dimensions[key] !== value) throw new Error(`authenticated_users exige ${key}=${value}.`);
100
+ }
101
+ }
102
+ if (dimensions.tenancyModel === "single_tenant" && dimensions.deploymentMode === "shared") {
103
+ throw new Error("single_tenant não pode usar deploymentMode=shared; use dedicated.");
104
+ }
73
105
  }
74
106
 
75
107
  function validateAppManifest(root, manifest) {
@@ -12,6 +12,6 @@
12
12
  "deploy": "oonCore-back deploy"
13
13
  },
14
14
  "dependencies": {
15
- "@oondemand/oon-core-back": "^0.4.20"
15
+ "@oondemand/oon-core-back": "^0.4.21"
16
16
  }
17
17
  }
@@ -11,7 +11,7 @@
11
11
  "sync:metadata": "oonCore-front sync:metadata"
12
12
  },
13
13
  "dependencies": {
14
- "@oondemand/oon-core-front": "^0.4.20",
14
+ "@oondemand/oon-core-front": "^0.4.21",
15
15
  "@chakra-ui/react": "^3.13.0",
16
16
  "@emotion/react": "^11.14.0",
17
17
  "@tanstack/react-query": "^5.65.0",
@@ -12,6 +12,6 @@
12
12
  "dev:frontend": "npm run dev --prefix frontend"
13
13
  },
14
14
  "devDependencies": {
15
- "@oondemand/create-central-oon": "0.4.20"
15
+ "@oondemand/create-central-oon": "0.4.21"
16
16
  }
17
17
  }