@objectql/create 1.0.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 (110) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +28 -0
  3. package/dist/bin.js +125 -0
  4. package/package.json +27 -0
  5. package/templates/enterprise/CHANGELOG.md +140 -0
  6. package/templates/enterprise/README.md +352 -0
  7. package/templates/enterprise/__tests__/data-api.test.ts +546 -0
  8. package/templates/enterprise/__tests__/data-api.test.ts.backup +526 -0
  9. package/templates/enterprise/__tests__/metadata-api.test.ts +307 -0
  10. package/templates/enterprise/__tests__/metadata-loading.test.ts +250 -0
  11. package/templates/enterprise/jest.config.js +22 -0
  12. package/templates/enterprise/package.json +51 -0
  13. package/templates/enterprise/src/apps/erp.app.yml +4 -0
  14. package/templates/enterprise/src/core/attachment.object.yml +57 -0
  15. package/templates/enterprise/src/core/i18n/en/core.json +60 -0
  16. package/templates/enterprise/src/core/i18n/zh-CN/core.json +60 -0
  17. package/templates/enterprise/src/core/index.ts +24 -0
  18. package/templates/enterprise/src/core/organization.object.yml +78 -0
  19. package/templates/enterprise/src/core/user.object.yml +80 -0
  20. package/templates/enterprise/src/extensions/README.md +56 -0
  21. package/templates/enterprise/src/extensions/user.extension.object.yml +42 -0
  22. package/templates/enterprise/src/extensions/user.ts +26 -0
  23. package/templates/enterprise/src/index.ts +47 -0
  24. package/templates/enterprise/src/modules/crm/README.md +99 -0
  25. package/templates/enterprise/src/modules/crm/crm_account.object.yml +105 -0
  26. package/templates/enterprise/src/modules/crm/crm_contact.object.yml +103 -0
  27. package/templates/enterprise/src/modules/crm/crm_lead.object.yml +148 -0
  28. package/templates/enterprise/src/modules/crm/crm_opportunity.object.yml +128 -0
  29. package/templates/enterprise/src/modules/crm/i18n/en/crm.json +61 -0
  30. package/templates/enterprise/src/modules/crm/i18n/zh-CN/crm.json +61 -0
  31. package/templates/enterprise/src/modules/crm/index.ts +29 -0
  32. package/templates/enterprise/src/modules/finance/README.md +112 -0
  33. package/templates/enterprise/src/modules/finance/finance_budget.object.yml +108 -0
  34. package/templates/enterprise/src/modules/finance/finance_expense.object.yml +151 -0
  35. package/templates/enterprise/src/modules/finance/finance_invoice.object.yml +143 -0
  36. package/templates/enterprise/src/modules/finance/finance_payment.object.yml +96 -0
  37. package/templates/enterprise/src/modules/finance/index.ts +26 -0
  38. package/templates/enterprise/src/modules/hr/README.md +95 -0
  39. package/templates/enterprise/src/modules/hr/hr_department.object.yml +59 -0
  40. package/templates/enterprise/src/modules/hr/hr_employee.object.yml +137 -0
  41. package/templates/enterprise/src/modules/hr/hr_position.object.yml +79 -0
  42. package/templates/enterprise/src/modules/hr/hr_timesheet.object.yml +114 -0
  43. package/templates/enterprise/src/modules/hr/index.ts +26 -0
  44. package/templates/enterprise/src/modules/project/README.md +132 -0
  45. package/templates/enterprise/src/modules/project/index.ts +26 -0
  46. package/templates/enterprise/src/modules/project/project_milestone.object.yml +70 -0
  47. package/templates/enterprise/src/modules/project/project_project.object.yml +135 -0
  48. package/templates/enterprise/src/modules/project/project_task.object.yml +121 -0
  49. package/templates/enterprise/src/modules/project/project_timesheet_entry.object.yml +95 -0
  50. package/templates/enterprise/src/plugins/audit/audit.plugin.ts +23 -0
  51. package/templates/enterprise/src/plugins/audit/index.ts +6 -0
  52. package/templates/enterprise/src/plugins/audit/note.object.yml +3 -0
  53. package/templates/enterprise/src/shared/constants.ts +30 -0
  54. package/templates/enterprise/src/shared/utils.ts +54 -0
  55. package/templates/enterprise/src/shared/validators.ts +47 -0
  56. package/templates/enterprise/src/types/attachment.ts +41 -0
  57. package/templates/enterprise/src/types/crm_account.ts +61 -0
  58. package/templates/enterprise/src/types/crm_contact.ts +61 -0
  59. package/templates/enterprise/src/types/crm_lead.ts +77 -0
  60. package/templates/enterprise/src/types/crm_opportunity.ts +53 -0
  61. package/templates/enterprise/src/types/finance_budget.ts +61 -0
  62. package/templates/enterprise/src/types/finance_expense.ts +65 -0
  63. package/templates/enterprise/src/types/finance_invoice.ts +69 -0
  64. package/templates/enterprise/src/types/finance_payment.ts +49 -0
  65. package/templates/enterprise/src/types/hr_department.ts +37 -0
  66. package/templates/enterprise/src/types/hr_employee.ts +85 -0
  67. package/templates/enterprise/src/types/hr_position.ts +49 -0
  68. package/templates/enterprise/src/types/hr_timesheet.ts +57 -0
  69. package/templates/enterprise/src/types/index.ts +20 -0
  70. package/templates/enterprise/src/types/note.ts +9 -0
  71. package/templates/enterprise/src/types/organization.ts +53 -0
  72. package/templates/enterprise/src/types/project_milestone.ts +41 -0
  73. package/templates/enterprise/src/types/project_project.ts +69 -0
  74. package/templates/enterprise/src/types/project_task.ts +57 -0
  75. package/templates/enterprise/src/types/project_timesheet_entry.ts +45 -0
  76. package/templates/enterprise/src/types/user.ts +65 -0
  77. package/templates/enterprise/tsconfig.json +10 -0
  78. package/templates/enterprise/tsconfig.tsbuildinfo +1 -0
  79. package/templates/hello-world/CHANGELOG.md +33 -0
  80. package/templates/hello-world/README.md +29 -0
  81. package/templates/hello-world/package.json +24 -0
  82. package/templates/hello-world/src/index.ts +58 -0
  83. package/templates/hello-world/tsconfig.json +10 -0
  84. package/templates/starter/CHANGELOG.md +191 -0
  85. package/templates/starter/README.md +17 -0
  86. package/templates/starter/__tests__/projects-hooks-actions.test.ts +490 -0
  87. package/templates/starter/jest.config.js +22 -0
  88. package/templates/starter/package.json +51 -0
  89. package/templates/starter/src/README.pages.md +110 -0
  90. package/templates/starter/src/demo.app.yml +4 -0
  91. package/templates/starter/src/i18n/zh-CN/projects.json +22 -0
  92. package/templates/starter/src/index.ts +55 -0
  93. package/templates/starter/src/modules/kitchen-sink/kitchen_sink.data.yml +18 -0
  94. package/templates/starter/src/modules/kitchen-sink/kitchen_sink.object.yml +156 -0
  95. package/templates/starter/src/modules/projects/project_approval.workflow.yml +51 -0
  96. package/templates/starter/src/modules/projects/projects.action.ts +472 -0
  97. package/templates/starter/src/modules/projects/projects.data.yml +13 -0
  98. package/templates/starter/src/modules/projects/projects.hook.ts +339 -0
  99. package/templates/starter/src/modules/projects/projects.object.yml +148 -0
  100. package/templates/starter/src/modules/projects/projects.permission.yml +141 -0
  101. package/templates/starter/src/modules/projects/projects.validation.yml +37 -0
  102. package/templates/starter/src/modules/tasks/tasks.data.yml +23 -0
  103. package/templates/starter/src/modules/tasks/tasks.object.yml +34 -0
  104. package/templates/starter/src/modules/tasks/tasks.permission.yml +167 -0
  105. package/templates/starter/src/types/index.ts +3 -0
  106. package/templates/starter/src/types/kitchen_sink.ts +101 -0
  107. package/templates/starter/src/types/projects.ts +49 -0
  108. package/templates/starter/src/types/tasks.ts +33 -0
  109. package/templates/starter/tsconfig.json +11 -0
  110. package/templates/starter/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,108 @@
1
+ label: Budget
2
+ description: Department or project budget
3
+ icon: pie-chart-line
4
+
5
+ fields:
6
+ name:
7
+ type: text
8
+ required: true
9
+ label: Budget Name
10
+ index: true
11
+
12
+ fiscal_year:
13
+ type: number
14
+ required: true
15
+ label: Fiscal Year
16
+ index: true
17
+
18
+ period:
19
+ type: select
20
+ options:
21
+ - annual
22
+ - quarterly
23
+ - monthly
24
+ defaultValue: annual
25
+ index: true
26
+
27
+ department:
28
+ type: lookup
29
+ reference_to: hr_department
30
+ label: Department
31
+ index: true
32
+
33
+ project:
34
+ type: lookup
35
+ reference_to: project_project
36
+ label: Project
37
+ index: true
38
+
39
+ category:
40
+ type: select
41
+ options:
42
+ - travel
43
+ - meals
44
+ - office_supplies
45
+ - software
46
+ - marketing
47
+ - utilities
48
+ - rent
49
+ - training
50
+ - salaries
51
+ - other
52
+ index: true
53
+
54
+ allocated_amount:
55
+ type: currency
56
+ required: true
57
+ label: Allocated Amount
58
+
59
+ spent_amount:
60
+ type: currency
61
+ defaultValue: 0
62
+ label: Spent Amount
63
+
64
+ remaining_amount:
65
+ type: currency
66
+ label: Remaining Amount
67
+
68
+ start_date:
69
+ type: date
70
+ required: true
71
+ label: Start Date
72
+ index: true
73
+
74
+ end_date:
75
+ type: date
76
+ required: true
77
+ label: End Date
78
+
79
+ status:
80
+ type: select
81
+ options:
82
+ - draft
83
+ - active
84
+ - closed
85
+ defaultValue: draft
86
+ index: true
87
+
88
+ owner:
89
+ type: lookup
90
+ reference_to: user
91
+ label: Budget Owner
92
+
93
+ notes:
94
+ type: textarea
95
+ label: Notes
96
+
97
+ indexes:
98
+ # For fiscal year budgets
99
+ fiscal_year_period_idx:
100
+ fields: [fiscal_year, period]
101
+
102
+ # For department budgets
103
+ department_fiscal_year_idx:
104
+ fields: [department, fiscal_year]
105
+
106
+ # For date range queries
107
+ start_date_status_idx:
108
+ fields: [start_date, status]
@@ -0,0 +1,151 @@
1
+ label: Expense
2
+ description: Company expense record
3
+ icon: wallet-line
4
+
5
+ fields:
6
+ expense_number:
7
+ type: text
8
+ required: true
9
+ label: Expense Number
10
+ unique: true
11
+ index: true
12
+
13
+ employee:
14
+ type: lookup
15
+ reference_to: hr_employee
16
+ label: Employee
17
+ required: true
18
+ index: true
19
+
20
+ expense_date:
21
+ type: date
22
+ required: true
23
+ label: Expense Date
24
+ index: true
25
+
26
+ category:
27
+ type: select
28
+ options:
29
+ - travel
30
+ - meals
31
+ - office_supplies
32
+ - software
33
+ - marketing
34
+ - utilities
35
+ - rent
36
+ - training
37
+ - other
38
+ required: true
39
+ index: true
40
+
41
+ amount:
42
+ type: currency
43
+ required: true
44
+ label: Amount
45
+
46
+ currency:
47
+ type: select
48
+ options:
49
+ - USD
50
+ - EUR
51
+ - GBP
52
+ - CNY
53
+ - JPY
54
+ defaultValue: USD
55
+
56
+ merchant:
57
+ type: text
58
+ label: Merchant/Vendor
59
+
60
+ description:
61
+ type: textarea
62
+ required: true
63
+ label: Description
64
+
65
+ receipt_url:
66
+ type: file
67
+ label: Receipt Attachment
68
+
69
+ status:
70
+ type: select
71
+ options:
72
+ - draft
73
+ - submitted
74
+ - approved
75
+ - rejected
76
+ - reimbursed
77
+ defaultValue: draft
78
+ required: true
79
+ index: true
80
+
81
+ approved_by:
82
+ type: lookup
83
+ reference_to: user
84
+ label: Approved By
85
+
86
+ approved_at:
87
+ type: datetime
88
+ label: Approval Time
89
+
90
+ reimbursed_at:
91
+ type: date
92
+ label: Reimbursement Date
93
+
94
+ department:
95
+ type: lookup
96
+ reference_to: hr_department
97
+ label: Department
98
+ index: true
99
+
100
+ project:
101
+ type: lookup
102
+ reference_to: project_project
103
+ label: Related Project
104
+
105
+ indexes:
106
+ # For employee expense lookup
107
+ employee_status_idx:
108
+ fields: [employee, status]
109
+
110
+ # For category analysis
111
+ category_date_idx:
112
+ fields: [category, expense_date]
113
+
114
+ # For approval workflow
115
+ status_date_idx:
116
+ fields: [status, expense_date]
117
+
118
+ # For department budget tracking
119
+ department_category_idx:
120
+ fields: [department, category]
121
+
122
+ actions:
123
+ submit:
124
+ type: record
125
+ label: Submit for Approval
126
+ icon: send-plane-line
127
+
128
+ approve:
129
+ type: record
130
+ label: Approve Expense
131
+ icon: checkbox-circle-line
132
+
133
+ reject:
134
+ type: record
135
+ label: Reject Expense
136
+ icon: close-circle-line
137
+ params:
138
+ reason:
139
+ type: textarea
140
+ label: Rejection Reason
141
+ required: true
142
+
143
+ reimburse:
144
+ type: record
145
+ label: Mark as Reimbursed
146
+ icon: money-dollar-circle-line
147
+ params:
148
+ reimbursement_date:
149
+ type: date
150
+ label: Reimbursement Date
151
+ required: true
@@ -0,0 +1,143 @@
1
+ label: Invoice
2
+ description: Customer invoice
3
+ icon: file-text-line
4
+
5
+ fields:
6
+ invoice_number:
7
+ type: text
8
+ required: true
9
+ label: Invoice Number
10
+ unique: true
11
+ index: true
12
+
13
+ account:
14
+ type: lookup
15
+ reference_to: crm_account
16
+ label: Customer Account
17
+ required: true
18
+ index: true
19
+
20
+ invoice_date:
21
+ type: date
22
+ required: true
23
+ label: Invoice Date
24
+ index: true
25
+
26
+ due_date:
27
+ type: date
28
+ required: true
29
+ label: Due Date
30
+ index: true
31
+
32
+ subtotal:
33
+ type: currency
34
+ required: true
35
+ label: Subtotal
36
+
37
+ tax_amount:
38
+ type: currency
39
+ label: Tax Amount
40
+ defaultValue: 0
41
+
42
+ discount_amount:
43
+ type: currency
44
+ label: Discount Amount
45
+ defaultValue: 0
46
+
47
+ total_amount:
48
+ type: currency
49
+ required: true
50
+ label: Total Amount
51
+
52
+ paid_amount:
53
+ type: currency
54
+ label: Paid Amount
55
+ defaultValue: 0
56
+
57
+ balance:
58
+ type: currency
59
+ label: Balance Due
60
+
61
+ status:
62
+ type: select
63
+ options:
64
+ - draft
65
+ - sent
66
+ - partial_paid
67
+ - paid
68
+ - overdue
69
+ - cancelled
70
+ defaultValue: draft
71
+ required: true
72
+ index: true
73
+
74
+ payment_terms:
75
+ type: select
76
+ options:
77
+ - net_15
78
+ - net_30
79
+ - net_60
80
+ - net_90
81
+ - due_on_receipt
82
+ label: Payment Terms
83
+
84
+ currency:
85
+ type: select
86
+ options:
87
+ - USD
88
+ - EUR
89
+ - GBP
90
+ - CNY
91
+ - JPY
92
+ defaultValue: USD
93
+ index: true
94
+
95
+ billing_address:
96
+ type: textarea
97
+ label: Billing Address
98
+
99
+ notes:
100
+ type: textarea
101
+ label: Notes
102
+
103
+ internal_notes:
104
+ type: textarea
105
+ label: Internal Notes
106
+
107
+ indexes:
108
+ # For account invoice history
109
+ account_date_idx:
110
+ fields: [account, invoice_date]
111
+
112
+ # For payment tracking
113
+ status_due_date_idx:
114
+ fields: [status, due_date]
115
+
116
+ # For aging reports
117
+ due_date_status_idx:
118
+ fields: [due_date, status]
119
+
120
+ actions:
121
+ send:
122
+ type: record
123
+ label: Send Invoice
124
+ icon: mail-send-line
125
+ confirm_text: "Send this invoice to customer?"
126
+
127
+ mark_paid:
128
+ type: record
129
+ label: Mark as Paid
130
+ icon: checkbox-circle-line
131
+ params:
132
+ payment_date:
133
+ type: date
134
+ label: Payment Date
135
+ required: true
136
+ payment_method:
137
+ type: select
138
+ label: Payment Method
139
+ options:
140
+ - bank_transfer
141
+ - credit_card
142
+ - check
143
+ - cash
@@ -0,0 +1,96 @@
1
+ label: Payment
2
+ description: Payment transaction record
3
+ icon: money-dollar-circle-line
4
+
5
+ fields:
6
+ payment_number:
7
+ type: text
8
+ required: true
9
+ label: Payment Number
10
+ unique: true
11
+ index: true
12
+
13
+ invoice:
14
+ type: lookup
15
+ reference_to: finance_invoice
16
+ label: Related Invoice
17
+ index: true
18
+
19
+ account:
20
+ type: lookup
21
+ reference_to: crm_account
22
+ label: Customer Account
23
+ required: true
24
+ index: true
25
+
26
+ payment_date:
27
+ type: date
28
+ required: true
29
+ label: Payment Date
30
+ index: true
31
+
32
+ amount:
33
+ type: currency
34
+ required: true
35
+ label: Payment Amount
36
+
37
+ payment_method:
38
+ type: select
39
+ options:
40
+ - bank_transfer
41
+ - credit_card
42
+ - debit_card
43
+ - check
44
+ - cash
45
+ - paypal
46
+ - other
47
+ required: true
48
+ index: true
49
+
50
+ currency:
51
+ type: select
52
+ options:
53
+ - USD
54
+ - EUR
55
+ - GBP
56
+ - CNY
57
+ - JPY
58
+ defaultValue: USD
59
+
60
+ reference_number:
61
+ type: text
62
+ label: Reference/Transaction Number
63
+ index: true
64
+
65
+ status:
66
+ type: select
67
+ options:
68
+ - pending
69
+ - completed
70
+ - failed
71
+ - refunded
72
+ defaultValue: pending
73
+ required: true
74
+ index: true
75
+
76
+ processed_by:
77
+ type: lookup
78
+ reference_to: user
79
+ label: Processed By
80
+
81
+ notes:
82
+ type: textarea
83
+ label: Notes
84
+
85
+ indexes:
86
+ # For invoice payment lookup
87
+ invoice_status_idx:
88
+ fields: [invoice, status]
89
+
90
+ # For account payment history
91
+ account_date_idx:
92
+ fields: [account, payment_date]
93
+
94
+ # For payment method analysis
95
+ method_status_idx:
96
+ fields: [payment_method, status]
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Finance Module - Finance & Accounting
3
+ *
4
+ * Exports all Finance objects, actions, and hooks
5
+ */
6
+
7
+ export const FINANCE_OBJECTS = [
8
+ 'finance_invoice',
9
+ 'finance_payment',
10
+ 'finance_expense',
11
+ 'finance_budget',
12
+ ] as const;
13
+
14
+ export type FinanceObject = typeof FINANCE_OBJECTS[number];
15
+
16
+ /**
17
+ * Module metadata
18
+ */
19
+ export const FINANCE_MODULE = {
20
+ name: 'finance',
21
+ label: 'Finance & Accounting',
22
+ description: 'Manage invoices, payments, expenses, and budgets',
23
+ version: '1.0.0',
24
+ objects: FINANCE_OBJECTS,
25
+ icon: 'money-dollar-circle-line',
26
+ } as const;
@@ -0,0 +1,95 @@
1
+ # HR Module
2
+
3
+ ## Overview
4
+ The Human Resources (HR) module manages employee information, organizational structure, positions, and time tracking.
5
+
6
+ ## Objects
7
+
8
+ ### hr_employee
9
+ Core employee records with personal and employment information.
10
+
11
+ **Key Features:**
12
+ - Links to system user accounts
13
+ - Manager hierarchy
14
+ - Employment type classification
15
+ - Emergency contact information
16
+
17
+ ### hr_department
18
+ Organizational departments and teams.
19
+
20
+ **Key Features:**
21
+ - Hierarchical structure (parent-child)
22
+ - Cost center tracking
23
+ - Department manager assignment
24
+
25
+ ### hr_position
26
+ Job positions and roles within the organization.
27
+
28
+ **Key Features:**
29
+ - Position levels (entry to executive)
30
+ - Salary ranges
31
+ - Job descriptions and requirements
32
+ - Reports-to hierarchy
33
+
34
+ ### hr_timesheet
35
+ Daily employee time tracking.
36
+
37
+ **Key Features:**
38
+ - Clock in/out tracking
39
+ - Overtime calculation
40
+ - Work type classification (office/remote/field)
41
+ - Approval workflow
42
+
43
+ ## Relationships
44
+
45
+ ```
46
+ Department <--has many-- Employee
47
+ Position <--has many-- Employee
48
+ Employee <--has many-- Timesheet
49
+ Employee <--manages--> Employee (self-referencing)
50
+ ```
51
+
52
+ ## Team Ownership
53
+ **Owner:** HR Team
54
+ **Primary Contact:** hr-team@example.com
55
+
56
+ ## Dependencies
57
+ - **Core Objects:** `user` (for system access)
58
+ - **Cross-Module:** Used by `finance_expense`, `project_timesheet_entry`
59
+
60
+ ## Custom Actions
61
+ - `Timesheet.submit` - Submit timesheet for approval
62
+ - `Timesheet.approve` - Approve timesheet
63
+ - `Timesheet.reject` - Reject timesheet with reason
64
+
65
+ ## Indexes Strategy
66
+ - Composite indexes on `department + status` for roster views
67
+ - Manager indexes for org chart queries
68
+ - Date-based indexes for attendance reports
69
+
70
+ ## Usage Examples
71
+
72
+ ### Get active employees in a department
73
+ ```typescript
74
+ const employees = await app.find({
75
+ object: 'hr_employee',
76
+ filters: [
77
+ ['department', '=', deptId],
78
+ 'and',
79
+ ['status', '=', 'active']
80
+ ],
81
+ sort: [['last_name', 'asc']]
82
+ });
83
+ ```
84
+
85
+ ### Find pending timesheets for approval
86
+ ```typescript
87
+ const timesheets = await app.find({
88
+ object: 'hr_timesheet',
89
+ filters: [
90
+ ['status', '=', 'submitted'],
91
+ 'and',
92
+ ['work_date', '>=', periodStart]
93
+ ]
94
+ });
95
+ ```
@@ -0,0 +1,59 @@
1
+ label: Department
2
+ description: Organizational department
3
+ icon: building-line
4
+
5
+ fields:
6
+ name:
7
+ type: text
8
+ required: true
9
+ label: Department Name
10
+ unique: true
11
+ index: true
12
+
13
+ code:
14
+ type: text
15
+ required: true
16
+ label: Department Code
17
+ unique: true
18
+ index: true
19
+
20
+ parent_department:
21
+ type: lookup
22
+ reference_to: hr_department
23
+ label: Parent Department
24
+ index: true
25
+
26
+ manager:
27
+ type: lookup
28
+ reference_to: hr_employee
29
+ label: Department Manager
30
+
31
+ cost_center:
32
+ type: text
33
+ label: Cost Center Code
34
+ index: true
35
+
36
+ location:
37
+ type: text
38
+ label: Primary Location
39
+
40
+ description:
41
+ type: textarea
42
+ label: Description
43
+
44
+ status:
45
+ type: select
46
+ options:
47
+ - active
48
+ - inactive
49
+ defaultValue: active
50
+ index: true
51
+
52
+ indexes:
53
+ # For org tree
54
+ parent_status_idx:
55
+ fields: [parent_department, status]
56
+
57
+ # For cost center reports
58
+ cost_center_status_idx:
59
+ fields: [cost_center, status]