rapida-partner 1.19.1 → 2.1.0

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 (93) hide show
  1. package/README.md +73 -43
  2. package/index.ts +87 -13
  3. package/package.json +2 -2
  4. package/src/controllers/ts_project_to_json_project.ts +12 -11
  5. package/src/enums/form.enum.ts +3 -0
  6. package/src/examples/components/forms/actor.form.ts +57 -5
  7. package/src/examples/components/forms/character.form.ts +6 -1
  8. package/src/examples/components/forms/company.form.ts +9 -5
  9. package/src/examples/components/forms/movie.form.ts +21 -5
  10. package/src/examples/components/forms/movieEpisode.form.ts +10 -5
  11. package/src/examples/components/forms/movieGenre.form.ts +6 -1
  12. package/src/examples/components/forms/person.form.ts +9 -14
  13. package/src/examples/components/forms/project.form.ts +295 -0
  14. package/src/examples/components/forms/taskWithProject.form.ts +310 -0
  15. package/src/examples/components/lists/actor.list.ts +15 -9
  16. package/src/examples/components/lists/character.list.ts +13 -7
  17. package/src/examples/components/lists/movie.list.ts +104 -24
  18. package/src/examples/components/lists/movieEpisode.list.ts +17 -11
  19. package/src/examples/components/lists/movieGenre.list.ts +12 -6
  20. package/src/examples/components/lists/project.list.ts +78 -0
  21. package/src/examples/components/lists/taskWithProject.list.ts +202 -0
  22. package/src/examples/components/tables/character.table.ts +40 -0
  23. package/src/examples/modules/character.ts +1 -0
  24. package/src/examples/modules/project.ts +18 -0
  25. package/src/examples/projects/assets/images/favicon/android-chrome-192x192.png +0 -0
  26. package/src/examples/projects/assets/images/favicon/android-chrome-512x512.png +0 -0
  27. package/src/examples/projects/assets/images/favicon/apple-touch-icon.png +0 -0
  28. package/src/examples/projects/assets/images/favicon/favicon-16x16.png +0 -0
  29. package/src/examples/projects/assets/images/favicon/favicon-32x32.png +0 -0
  30. package/src/examples/projects/assets/images/favicon/favicon.ico +0 -0
  31. package/src/examples/projects/assets/images/logo.png +0 -0
  32. package/src/examples/projects/movieBackoffice.ts +62 -62
  33. package/src/interfaces/ai-agent.interface.ts +179 -0
  34. package/src/interfaces/condition.interface.ts +0 -1
  35. package/src/interfaces/data-chart.interface.ts +74 -56
  36. package/src/interfaces/data-table.interface.ts +43 -0
  37. package/src/interfaces/form-array.interface.ts +1 -0
  38. package/src/interfaces/form-autocomplete.interface.ts +1 -0
  39. package/src/interfaces/form-checkbox.interface.ts +27 -0
  40. package/src/interfaces/form-contract.interface.ts +12 -2
  41. package/src/interfaces/form-file.interface.ts +2 -1
  42. package/src/interfaces/form-input.interface.ts +18 -3
  43. package/src/interfaces/form-radio.interface.ts +27 -0
  44. package/src/interfaces/form-select.interface.ts +1 -1
  45. package/src/interfaces/form.interface.ts +13 -4
  46. package/src/interfaces/kanban.interface.ts +82 -0
  47. package/src/interfaces/list.interface.ts +15 -1
  48. package/src/interfaces/notification.interface.ts +27 -0
  49. package/src/interfaces/project-backend.interface.ts +61 -2
  50. package/src/interfaces/project-repositories.interface.ts +18 -0
  51. package/src/interfaces/project-style.interface.ts +15 -96
  52. package/src/interfaces/project.interface.ts +52 -5
  53. package/src/interfaces/record-reminder.interface.ts +14 -0
  54. package/src/interfaces/trusted-caller.interface.ts +21 -0
  55. package/src/schemas/ai-agent-config.ref.json +232 -0
  56. package/src/schemas/backend.ref.json +87 -1
  57. package/src/schemas/component-one-of.ref.json +4 -1
  58. package/src/schemas/data-chart.ref.json +3 -0
  59. package/src/schemas/data-table.ref.json +24 -0
  60. package/src/schemas/form-array.ref.json +3 -0
  61. package/src/schemas/form-autocomplete.ref.json +6 -0
  62. package/src/schemas/form-checkbox.ref.json +73 -0
  63. package/src/schemas/form-contract-request.ref.json +1 -0
  64. package/src/schemas/form-contract.ref.json +2 -1
  65. package/src/schemas/form-file.ref.json +4 -0
  66. package/src/schemas/form-input.ref.json +8 -2
  67. package/src/schemas/form-one-of.ref.json +4 -2
  68. package/src/schemas/form-public-contract.ref.json +16 -5
  69. package/src/schemas/form-radio.ref.json +73 -0
  70. package/src/schemas/form-switch.ref.json +3 -12
  71. package/src/schemas/form.ref.json +14 -50
  72. package/src/schemas/frontend.ref.json +26 -1
  73. package/src/schemas/kanban.ref.json +259 -0
  74. package/src/schemas/list.ref.json +65 -313
  75. package/src/schemas/module.ref.json +3 -0
  76. package/src/schemas/notification-condition.ref.json +20 -0
  77. package/src/schemas/notification-recipients.ref.json +31 -0
  78. package/src/schemas/notification.ref.json +65 -0
  79. package/src/schemas/project-repositories.ref.json +19 -0
  80. package/src/schemas/project-style.ref.json +28 -12
  81. package/src/schemas/project.schema.json +115 -4
  82. package/src/schemas/record-reminder.ref.json +41 -0
  83. package/src/schemas/send-message.ref.json +33 -0
  84. package/src/schemas/trusted-caller.ref.json +28 -0
  85. package/src/schemas/types-datatype.ref.json +1 -0
  86. package/src/utils/json.ts +3 -11
  87. package/src/utils/path.ts +22 -27
  88. package/rapidaObject.json +0 -1
  89. package/src/constants/secrets/database.ts +0 -1
  90. package/src/constants/secrets/others.ts +0 -3
  91. package/src/constants/secrets/storage.ts +0 -1
  92. package/src/schemas/project-style-theme.ref.json +0 -98
  93. package/src/utils/env.ts +0 -9
@@ -14,7 +14,14 @@
14
14
  },
15
15
  "skeleton": {
16
16
  "type": "string",
17
- "enum": ["backoffice", "marketplace", "landingPage", "socialNetwork"]
17
+ "enum": [
18
+ "backoffice",
19
+ "marketplace",
20
+ "landingPage",
21
+ "socialNetwork",
22
+ "service",
23
+ "aiAgent"
24
+ ]
18
25
  },
19
26
  "flows": {
20
27
  "type": "object",
@@ -26,7 +33,13 @@
26
33
  "type": "boolean"
27
34
  },
28
35
  "invitation": {
29
- "type": "boolean"
36
+ "type": "object",
37
+ "properties": {
38
+ "mainUserEmail": {
39
+ "type": "string"
40
+ }
41
+ },
42
+ "required": ["mainUserEmail"]
30
43
  },
31
44
  "registration": {
32
45
  "type": "boolean"
@@ -41,6 +54,14 @@
41
54
  "$ref": "form.ref.json"
42
55
  }
43
56
  }
57
+ },
58
+ "registrationMethod": {
59
+ "type": "string",
60
+ "enum": ["link", "code"]
61
+ },
62
+ "resetPasswordMethod": {
63
+ "type": "string",
64
+ "enum": ["link", "code"]
44
65
  }
45
66
  }
46
67
  },
@@ -51,10 +72,76 @@
51
72
  "$ref": "business-rules.ref.json"
52
73
  },
53
74
  "frontend": {
54
- "$ref": "frontend.ref.json"
75
+ "type": "array",
76
+ "items": {
77
+ "$ref": "frontend.ref.json"
78
+ }
55
79
  },
56
80
  "backend": {
57
- "$ref": "backend.ref.json"
81
+ "type": "array",
82
+ "items": {
83
+ "$ref": "backend.ref.json"
84
+ }
85
+ },
86
+ "deepseekIntegration": {
87
+ "type": "array",
88
+ "items": {
89
+ "type": "object",
90
+ "properties": {
91
+ "apiKey": {
92
+ "type": "string"
93
+ },
94
+ "service": {
95
+ "type": "string",
96
+ "enum": ["embedding", "chat", "custom", "cost"]
97
+ }
98
+ },
99
+ "required": ["apiKey", "service"]
100
+ }
101
+ },
102
+ "openaiIntegration": {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "object",
106
+ "properties": {
107
+ "apiKey": {
108
+ "type": "string"
109
+ },
110
+ "service": {
111
+ "type": "string",
112
+ "enum": ["embedding", "chat", "custom", "cost", "transcription"]
113
+ }
114
+ },
115
+ "required": ["apiKey", "service"]
116
+ }
117
+ },
118
+ "mongodbIntegration": {
119
+ "type": "array",
120
+ "items": {
121
+ "type": "object",
122
+ "properties": {
123
+ "accountPublicKey": {
124
+ "type": "string"
125
+ },
126
+ "accountPrivateKey": {
127
+ "type": "string"
128
+ },
129
+ "organizationId": {
130
+ "type": "string"
131
+ },
132
+ "groupId": {
133
+ "type": "string"
134
+ },
135
+ "processId": {
136
+ "type": "string"
137
+ },
138
+ "service": {
139
+ "type": "string",
140
+ "enum": ["embedding", "chat", "custom", "cost"]
141
+ }
142
+ },
143
+ "required": ["service"]
144
+ }
58
145
  },
59
146
  "e2e": {
60
147
  "$ref": "e2e.ref.json"
@@ -64,6 +151,30 @@
64
151
  },
65
152
  "flowChart": {
66
153
  "$ref": "form-flowchart.ref.json"
154
+ },
155
+ "aiAgentConfig": {
156
+ "$ref": "ai-agent-config.ref.json"
157
+ },
158
+ "notifications": {
159
+ "type": "array",
160
+ "items": {
161
+ "$ref": "notification.ref.json"
162
+ }
163
+ },
164
+ "styles": {
165
+ "type": "array",
166
+ "items": {
167
+ "$ref": "project-style.ref.json"
168
+ }
169
+ },
170
+ "dashboard": {
171
+ "type": "array",
172
+ "items": {
173
+ "$ref": "component-one-of.ref.json"
174
+ }
175
+ },
176
+ "repositories": {
177
+ "$ref": "project-repositories.ref.json"
67
178
  }
68
179
  },
69
180
  "required": ["id", "title", "description", "skeleton"]
@@ -0,0 +1,41 @@
1
+ {
2
+ "$id": "record-reminder.ref.json",
3
+ "type": "object",
4
+ "properties": {
5
+ "id": {
6
+ "type": "string"
7
+ },
8
+ "title": {
9
+ "type": "string"
10
+ },
11
+ "message": {
12
+ "type": "string"
13
+ },
14
+ "contractId": {
15
+ "type": "string"
16
+ },
17
+ "dateField": {
18
+ "type": "string"
19
+ },
20
+ "timeField": {
21
+ "type": "string"
22
+ },
23
+ "offsetDays": {
24
+ "type": "number"
25
+ },
26
+ "condition": {
27
+ "type": "array",
28
+ "items": {
29
+ "$ref": "notification-condition.ref.json"
30
+ }
31
+ },
32
+ "recipients": {
33
+ "$ref": "notification-recipients.ref.json"
34
+ },
35
+ "removeAfterNotify": {
36
+ "type": "boolean"
37
+ }
38
+ },
39
+ "required": ["id", "title", "message", "contractId", "dateField", "recipients"],
40
+ "additionalProperties": false
41
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$id": "send-message.ref.json",
3
+ "type": "object",
4
+ "properties": {
5
+ "type": {
6
+ "enum": ["email", "whatsapp", "sms", "discord", "teams", "push"]
7
+ },
8
+ "actions": {
9
+ "enum": ["create", "update", "delete"]
10
+ },
11
+ "to": {
12
+ "type": "object",
13
+ "properties": {
14
+ "field": {
15
+ "type": "string"
16
+ },
17
+ "property": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "required": ["field"],
22
+ "additionalProperties": false
23
+ },
24
+ "subject": {
25
+ "type": "string"
26
+ },
27
+ "message": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "required": ["type", "actions", "to", "message"],
32
+ "additionalProperties": false
33
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$id": "trusted-caller.ref.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "type": "object",
5
+ "properties": {
6
+ "id": { "type": "string" },
7
+ "issuer": {
8
+ "type": "string",
9
+ "description": "Expected value of the JWT 'iss' claim."
10
+ },
11
+ "jwksUri": {
12
+ "type": "string",
13
+ "format": "uri",
14
+ "description": "JWKS URL where the caller publishes its public key(s)."
15
+ },
16
+ "audience": {
17
+ "type": "string",
18
+ "description": "Expected value of the JWT 'aud' claim, identifying this backend."
19
+ },
20
+ "algorithms": {
21
+ "type": "array",
22
+ "items": { "type": "string", "enum": ["RS256", "ES256"] },
23
+ "minItems": 1
24
+ }
25
+ },
26
+ "required": ["id", "issuer", "jwksUri", "audience"],
27
+ "additionalProperties": false
28
+ }
@@ -21,6 +21,7 @@
21
21
  "clob",
22
22
  "nclob",
23
23
  "decimal",
24
+ "currency",
24
25
  "numeric",
25
26
  "integer",
26
27
  "float",
package/src/utils/json.ts CHANGED
@@ -18,37 +18,29 @@ const getJsonFile = (filePath: string): any => {
18
18
  };
19
19
 
20
20
  const validateProjectJson = (
21
- jsonProjectInstance: any,
21
+ jsonProjectInstance: any, // agora espera-se um objeto JS
22
22
  jsonSchemaName: string
23
23
  ): boolean => {
24
24
  try {
25
- const jsonSchemaInstance = getJsonFile(
26
- `${schemasPath}/${jsonSchemaName}.schema.json`
27
- );
28
-
25
+ const jsonSchemaInstance = getJsonFile(`${schemasPath}/${jsonSchemaName}.schema.json`);
29
26
  if (!jsonSchemaInstance) {
30
27
  throw new Error(`Schema ${jsonSchemaName} not found`);
31
28
  }
32
29
 
33
30
  const refs: string[] = [];
34
- const jsonProjectObject = JSON.parse(jsonProjectInstance);
35
-
36
31
  groupJsonSchemaRefs(jsonSchemaInstance, refs);
37
-
38
32
  if (refs.length > 0) {
39
33
  addRefsToSchema(refs);
40
34
  }
41
35
 
42
36
  const validate = ajv.compile(jsonSchemaInstance);
43
- const valid = validate(jsonProjectObject);
37
+ const valid = validate(jsonProjectInstance); // valida o objeto recebido
44
38
 
45
39
  if (!valid) {
46
40
  console.info(validate.errors);
47
41
  return false;
48
42
  }
49
-
50
43
  console.info("Project JSON is valid");
51
-
52
44
  return true;
53
45
  } catch (error: any) {
54
46
  console.error(error);
package/src/utils/path.ts CHANGED
@@ -1,43 +1,38 @@
1
- import * as chp from 'child_process';
1
+ import * as chp from "child_process";
2
+ import * as path from "path";
2
3
 
3
- import * as path from 'path';
4
- import { rootPath } from './env';
4
+ // Compute root path dynamically from current file location (two levels up from src/utils)
5
+ const rootPath = path.resolve(__dirname, "../..");
5
6
 
6
- /**
7
- * Apps paths
8
- */
9
- const appsPath = path.join(rootPath!, 'rapida-apps');
10
- const examplesPath = path.join(rootPath!, 'src', 'examples');
11
- const modelsPath = path.join(rootPath!, 'src', 'models');
12
- const schemasPath = path.join(rootPath!, 'src', 'schemas');
13
- const scriptsPath = path.join(rootPath!, 'src', 'scripts');
7
+ const appsPath = path.join(rootPath, "rapida-apps");
8
+ const examplesPath = path.join(rootPath, "src", "examples");
9
+ const modelsPath = path.join(rootPath, "src", "models");
10
+ const schemasPath = path.join(rootPath, "src", "schemas");
11
+ const scriptsPath = path.join(rootPath, "src", "scripts");
14
12
 
15
- /**
16
- * Rapida's paths
17
- */
18
13
  const frontendFrameworkStructuresPath = path.join(
19
- rootPath!,
20
- 'models',
21
- 'frontend',
22
- 'json',
23
- 'frontend-framework-structures'
14
+ rootPath,
15
+ "models",
16
+ "frontend",
17
+ "json",
18
+ "frontend-framework-structures",
24
19
  );
25
20
  const backendFrameworkStructuresPath = path.join(
26
- rootPath!,
27
- 'models',
28
- 'backend',
29
- 'json',
30
- 'backend-framework-structures'
21
+ rootPath,
22
+ "models",
23
+ "backend",
24
+ "json",
25
+ "backend-framework-structures",
31
26
  );
32
27
 
33
28
  const doesDirectoryExist = (directoryPath: string): boolean => {
34
29
  try {
35
- chp.execSync(`ls ${directoryPath}`, { stdio: 'ignore' });
30
+ chp.execSync(`ls ${directoryPath}`, { stdio: "ignore" });
36
31
  return true;
37
32
  } catch (error) {
38
33
  return false;
39
34
  }
40
- }
35
+ };
41
36
 
42
37
  export {
43
38
  appsPath,
@@ -47,5 +42,5 @@ export {
47
42
  scriptsPath,
48
43
  frontendFrameworkStructuresPath,
49
44
  backendFrameworkStructuresPath,
50
- doesDirectoryExist
45
+ doesDirectoryExist,
51
46
  };