@orchestr-sh/orchestr 1.11.0 → 1.11.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.
- package/CHANGELOG.md +18 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +274 -0
- package/dist/Console/orchestr.cjs +2 -0
- package/dist/Console/orchestr.d.cts +1 -0
- package/dist/Console/orchestr.d.mts +1 -0
- package/dist/Console/orchestr.mjs +3 -0
- package/dist/Console/orchestr.mjs.map +1 -0
- package/dist/Events/Dispatcher.d.cts +1 -1
- package/dist/Events/Dispatcher.d.mts +1 -1
- package/dist/Events/EventServiceProvider.d.cts +1 -1
- package/dist/Events/EventServiceProvider.d.mts +1 -1
- package/dist/Events/index.cjs +1 -0
- package/dist/Events/index.d.cts +7 -0
- package/dist/Events/index.d.mts +7 -0
- package/dist/Events/index.mjs +1 -0
- package/dist/Facades/Event.d.cts +1 -1
- package/dist/Facades/Event.d.mts +1 -1
- package/dist/Facades/Route.d.cts +1 -1
- package/dist/Facades/Route.d.mts +1 -1
- package/dist/Facades/index.cjs +1 -0
- package/dist/Facades/index.d.cts +9 -0
- package/dist/Facades/index.d.mts +9 -0
- package/dist/Facades/index.mjs +1 -0
- package/dist/Foundation/Config/ConfigServiceProvider.d.cts +1 -1
- package/dist/Foundation/Config/ConfigServiceProvider.d.mts +1 -1
- package/dist/Foundation/Http/FormRequest.d.cts +1 -1
- package/dist/Foundation/Http/FormRequest.d.mts +1 -1
- package/dist/Routing/Route.d.cts +1 -1
- package/dist/Routing/Route.d.mts +1 -1
- package/dist/Routing/Router.d.cts +1 -1
- package/dist/Routing/Router.d.mts +1 -1
- package/dist/Support/Testing/Fakes/EventFake.d.cts +1 -1
- package/dist/Support/Testing/Fakes/EventFake.d.mts +1 -1
- package/dist/index.d.cts +19 -19
- package/dist/index.d.mts +19 -19
- package/docs/events-typescript-usage.md +126 -0
- package/docs/future-improvements.md +49 -0
- package/docs/validation.md +201 -0
- package/package.json +53 -19
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## [1.11.1](https://github.com/orchestr-sh/orchestr/compare/v1.11.0...v1.11.1) (2026-04-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* commit message for release ([#24](https://github.com/orchestr-sh/orchestr/issues/24)) ([accef91](https://github.com/orchestr-sh/orchestr/commit/accef91c66616ebf9e83874b00bb59e46f8fc6ac))
|
|
7
|
+
|
|
8
|
+
# [1.11.0](https://github.com/orchestr-sh/orchestr/compare/v1.10.0...v1.11.0) (2026-04-07)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* release workflow ([#21](https://github.com/orchestr-sh/orchestr/issues/21)) ([9bad22d](https://github.com/orchestr-sh/orchestr/commit/9bad22d8dd96407f24d80e16695d7162c0497425))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* tsdown, typescript 6 ([#17](https://github.com/orchestr-sh/orchestr/issues/17)) ([54581fe](https://github.com/orchestr-sh/orchestr/commit/54581fe8bd6c47d385fa7f61e59fde73fa0a030f))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We are committed to providing a welcoming and inspiring community for all. We pledge to make participation in our community a harassment-free experience regardless of age, body size, caste, disability, ethnicity, gender identity and expression, level of experience, family status, gender, marital status, military or veteran status, national origin, personal appearance, race, religion, sex, sexual orientation, socioeconomic status, or any other dimension of diversity.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to creating a positive environment include:
|
|
10
|
+
|
|
11
|
+
- Using welcoming and inclusive language
|
|
12
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
13
|
+
- Giving and gracefully accepting constructive criticism
|
|
14
|
+
- Focusing on what is best for the community
|
|
15
|
+
- Showing empathy towards other community members
|
|
16
|
+
- Demonstrating patience and understanding
|
|
17
|
+
|
|
18
|
+
Examples of unacceptable behavior include:
|
|
19
|
+
|
|
20
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
21
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
|
22
|
+
- Public or private harassment
|
|
23
|
+
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
24
|
+
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
25
|
+
- Violence, threats of violence, or violent language directed against another person
|
|
26
|
+
- Deliberate intimidation or stalking
|
|
27
|
+
- Advocating for, or encouraging, any of the above behaviors
|
|
28
|
+
|
|
29
|
+
## Enforcement
|
|
30
|
+
|
|
31
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
32
|
+
|
|
33
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
34
|
+
|
|
35
|
+
### Reporting Violations
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement. All complaints will be reviewed and investigated promptly and fairly.
|
|
38
|
+
|
|
39
|
+
If you witness or experience unacceptable behavior, please report it by opening an issue or contacting the maintainers directly.
|
|
40
|
+
|
|
41
|
+
## Attribution
|
|
42
|
+
|
|
43
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Contributing to Orchestr
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Orchestr! We welcome contributions from the community. This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
Be respectful, inclusive, and constructive in all interactions with other contributors and maintainers.
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- Node.js >= 22.0.0
|
|
14
|
+
- npm or preferred package manager
|
|
15
|
+
- TypeScript knowledge
|
|
16
|
+
|
|
17
|
+
### Setup Development Environment
|
|
18
|
+
|
|
19
|
+
1. Fork the repository on GitHub
|
|
20
|
+
2. Clone your fork locally:
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/your-username/orchestr.git
|
|
23
|
+
cd orchestr
|
|
24
|
+
```
|
|
25
|
+
3. Add upstream remote:
|
|
26
|
+
```bash
|
|
27
|
+
git remote add upstream https://github.com/orchestr-sh/orchestr.git
|
|
28
|
+
```
|
|
29
|
+
4. Install dependencies:
|
|
30
|
+
```bash
|
|
31
|
+
npm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Development Workflow
|
|
35
|
+
|
|
36
|
+
### Building
|
|
37
|
+
|
|
38
|
+
Build the TypeScript code:
|
|
39
|
+
```bash
|
|
40
|
+
npm run build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Testing
|
|
44
|
+
|
|
45
|
+
Run the test suite:
|
|
46
|
+
```bash
|
|
47
|
+
npm test # Run tests once
|
|
48
|
+
npm run test:watch # Watch mode
|
|
49
|
+
npm run test:coverage # With coverage report
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Linting & Formatting
|
|
53
|
+
|
|
54
|
+
The project uses **oxlint** and **Prettier** for code quality. Run before committing:
|
|
55
|
+
```bash
|
|
56
|
+
npm run lint # Lint and auto-fix
|
|
57
|
+
npm run format # Format code
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Validate without changes:
|
|
61
|
+
```bash
|
|
62
|
+
npm run test:lint # Check linting
|
|
63
|
+
npm run format:check # Check formatting
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Type Checking
|
|
67
|
+
|
|
68
|
+
Verify TypeScript types:
|
|
69
|
+
```bash
|
|
70
|
+
npm run test:types
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Making Changes
|
|
74
|
+
|
|
75
|
+
### Create a Branch
|
|
76
|
+
|
|
77
|
+
Create a feature or fix branch from `main`:
|
|
78
|
+
```bash
|
|
79
|
+
git checkout -b feature/your-feature-name
|
|
80
|
+
# or
|
|
81
|
+
git checkout -b fix/your-bug-fix
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Use descriptive branch names (e.g., `feature/queue-batching`, `fix/cache-expiry`).
|
|
85
|
+
|
|
86
|
+
### Write Code
|
|
87
|
+
|
|
88
|
+
- Follow the existing code style and patterns
|
|
89
|
+
- Use TypeScript with proper type annotations
|
|
90
|
+
- Keep changes focused and atomic
|
|
91
|
+
- Add tests for new functionality
|
|
92
|
+
- Update documentation if needed
|
|
93
|
+
|
|
94
|
+
### Commit Guidelines
|
|
95
|
+
|
|
96
|
+
Write clear, concise commit messages:
|
|
97
|
+
|
|
98
|
+
- Use present tense: "Add feature" not "Added feature"
|
|
99
|
+
- Be descriptive: "feat: add job batching to queue system" not "update"
|
|
100
|
+
- Be in the format `<type>[scope?][!]: Add job batching to queue system`
|
|
101
|
+
- Start with a conventional commit type from the allowed type list
|
|
102
|
+
- Breaking changes should include `!` after the allowed commit type e.g. `fix!:`
|
|
103
|
+
|
|
104
|
+
Example:
|
|
105
|
+
```
|
|
106
|
+
feat: add queue job batching
|
|
107
|
+
|
|
108
|
+
- Implement PendingBatch class for grouped job execution
|
|
109
|
+
- Add batch callback support (then/catch/finally)
|
|
110
|
+
- Include integration tests for batch workflows
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Revert
|
|
114
|
+
|
|
115
|
+
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
|
116
|
+
|
|
117
|
+
#### Type
|
|
118
|
+
|
|
119
|
+
The type must be one of the following:
|
|
120
|
+
|
|
121
|
+
| Type | Description |
|
|
122
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------- |
|
|
123
|
+
| **build** | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) |
|
|
124
|
+
| **chore** | Routine maintenance tasks that do not directly impact the functionality of the application |
|
|
125
|
+
| **ci** | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) |
|
|
126
|
+
| **docs** | Documentation only changes |
|
|
127
|
+
| **feat** | A new feature |
|
|
128
|
+
| **fix** | A bug fix |
|
|
129
|
+
| **perf** | A code change that improves performance |
|
|
130
|
+
| **refactor** | A code change that neither fixes a bug nor adds a feature |
|
|
131
|
+
| **style** | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
|
|
132
|
+
| **test** | Adding missing tests or correcting existing tests |
|
|
133
|
+
|
|
134
|
+
### Git Hooks
|
|
135
|
+
This project uses **husky** to automatically perform tasks during the git hook events.
|
|
136
|
+
|
|
137
|
+
#### Pre-commit
|
|
138
|
+
- **lint-staged** to automatically lint and format staged files. Ensure your code passes these checks before committing.
|
|
139
|
+
|
|
140
|
+
#### Commit-msg
|
|
141
|
+
- **commitlint** to automatically check your commit messages follow our CONTRIBUTING guidelines around conventional commits.
|
|
142
|
+
|
|
143
|
+
## Testing
|
|
144
|
+
|
|
145
|
+
### Writing Tests
|
|
146
|
+
|
|
147
|
+
- Place tests in the tests directory
|
|
148
|
+
- Use descriptive test names
|
|
149
|
+
- Test both success and failure paths
|
|
150
|
+
- Keep tests focused and independent
|
|
151
|
+
|
|
152
|
+
Example structure:
|
|
153
|
+
```typescript
|
|
154
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
155
|
+
|
|
156
|
+
describe('MyFeature', () => {
|
|
157
|
+
beforeEach(() => {
|
|
158
|
+
// Setup
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('should do something', () => {
|
|
162
|
+
// Test code
|
|
163
|
+
expect(result).toBe(expected);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('should handle error cases', () => {
|
|
167
|
+
// Error test
|
|
168
|
+
expect(() => {
|
|
169
|
+
// code that throws
|
|
170
|
+
}).toThrow();
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Pull Request Process
|
|
176
|
+
|
|
177
|
+
1. **Update your branch** with latest upstream changes:
|
|
178
|
+
```bash
|
|
179
|
+
git fetch upstream
|
|
180
|
+
git rebase upstream/main
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
2. **Push to your fork**:
|
|
184
|
+
```bash
|
|
185
|
+
git push origin your-branch-name
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
3. **Create a Pull Request** on GitHub with:
|
|
189
|
+
- Clear title describing the change
|
|
190
|
+
- Description explaining what and why
|
|
191
|
+
- Reference any related issues (#123)
|
|
192
|
+
- Screenshots or examples if applicable
|
|
193
|
+
|
|
194
|
+
4. **PR Description Template**:
|
|
195
|
+
```
|
|
196
|
+
## Description
|
|
197
|
+
Brief description of changes.
|
|
198
|
+
|
|
199
|
+
## Related Issues
|
|
200
|
+
Closes #123
|
|
201
|
+
|
|
202
|
+
## Type of Change
|
|
203
|
+
- [ ] Bug fix (non-breaking)
|
|
204
|
+
- [ ] New feature (non-breaking)
|
|
205
|
+
- [ ] Breaking change
|
|
206
|
+
- [ ] Documentation update
|
|
207
|
+
|
|
208
|
+
## Testing
|
|
209
|
+
- [ ] Tests pass locally
|
|
210
|
+
- [ ] Added/updated tests
|
|
211
|
+
- [ ] Linting passes
|
|
212
|
+
|
|
213
|
+
## Checklist
|
|
214
|
+
- [ ] Code follows style guidelines
|
|
215
|
+
- [ ] Comments added for complex logic
|
|
216
|
+
- [ ] Documentation updated
|
|
217
|
+
- [ ] No new warnings generated
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
5. **Review Process**:
|
|
221
|
+
- Address feedback promptly
|
|
222
|
+
- Request re-review after making changes
|
|
223
|
+
- Discuss disagreements respectfully
|
|
224
|
+
- All checks must pass (tests, linting, type checking)
|
|
225
|
+
|
|
226
|
+
## Architecture & Patterns
|
|
227
|
+
|
|
228
|
+
Orchestr follows Laravel's architecture patterns. Familiarize yourself with:
|
|
229
|
+
|
|
230
|
+
- **Service Providers**: Extend `ServiceProvider`, implement `register()` and `boot()`
|
|
231
|
+
- **Managers**: Connection managers using the manager pattern (DatabaseManager, QueueManager, CacheManager)
|
|
232
|
+
- **Facades**: Static interfaces via `Facade` base class using Proxy forwarding
|
|
233
|
+
- **Commands**: Extend `Command` with `signature`, `description`, `handle()`
|
|
234
|
+
- **Events**: System event dispatcher with listeners and subscribers
|
|
235
|
+
|
|
236
|
+
See README.md and docs/ for detailed patterns.
|
|
237
|
+
|
|
238
|
+
## Documentation
|
|
239
|
+
|
|
240
|
+
- Update README.md for user-facing changes
|
|
241
|
+
- Add inline comments for complex logic
|
|
242
|
+
- Document public APIs with JSDoc
|
|
243
|
+
- Update docs/ folder if adding major features
|
|
244
|
+
|
|
245
|
+
## Reporting Issues
|
|
246
|
+
|
|
247
|
+
### Bug Reports
|
|
248
|
+
|
|
249
|
+
Include:
|
|
250
|
+
- Node.js and npm versions
|
|
251
|
+
- Orchestr version
|
|
252
|
+
- Minimal reproduction code
|
|
253
|
+
- Expected vs actual behavior
|
|
254
|
+
- Relevant error messages
|
|
255
|
+
|
|
256
|
+
### Feature Requests
|
|
257
|
+
|
|
258
|
+
Include:
|
|
259
|
+
- Clear use case and motivation
|
|
260
|
+
- Proposed API/interface
|
|
261
|
+
- Examples of how it would be used
|
|
262
|
+
- Any alternatives considered
|
|
263
|
+
|
|
264
|
+
## Questions?
|
|
265
|
+
|
|
266
|
+
- Check existing issues and discussions
|
|
267
|
+
- Ask in pull request comments
|
|
268
|
+
- Open a GitHub discussion for questions
|
|
269
|
+
|
|
270
|
+
## License
|
|
271
|
+
|
|
272
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
273
|
+
|
|
274
|
+
Thank you for helping make Orchestr better! 🎉
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../Foundation/Application.cjs`),t=require(`./ConsoleKernel.cjs`),n=require(`./Commands/MigrateCommand.cjs`),r=require(`./Commands/MigrateRollbackCommand.cjs`),i=require(`./Commands/MigrateResetCommand.cjs`),a=require(`./Commands/MigrateRefreshCommand.cjs`),o=require(`./Commands/MigrateFreshCommand.cjs`),s=require(`./Commands/MigrateStatusCommand.cjs`),c=require(`./Commands/MakeMigrationCommand.cjs`),l=require(`./Commands/SeedCommand.cjs`),u=require(`./Commands/MakeSeederCommand.cjs`),d=require(`./Commands/MakeEventCommand.cjs`),f=require(`./Commands/MakeListenerCommand.cjs`),p=require(`./Commands/MakeControllerCommand.cjs`),m=require(`./Commands/EventListCommand.cjs`),h=require(`./Commands/EventCacheCommand.cjs`),g=require(`./Commands/EventClearCommand.cjs`),_=require(`./Commands/DeployLoginCommand.cjs`),v=require(`./Commands/DeployInitCommand.cjs`),y=require(`./Commands/DeployServerCommand.cjs`),b=require(`./Commands/DeployCommand.cjs`),x=require(`./Commands/DeployStatusCommand.cjs`),S=require(`./Commands/DeployEnvCommand.cjs`),C=require(`./Commands/DeployRollbackCommand.cjs`),w=require(`./Commands/DeployProvisionCommand.cjs`),T=new e.Application;new class extends t.ConsoleKernel{registerCommands(){this.registerMany([new n.MigrateCommand(this.app),new r.MigrateRollbackCommand(this.app),new i.MigrateResetCommand(this.app),new a.MigrateRefreshCommand(this.app),new o.MigrateFreshCommand(this.app),new s.MigrateStatusCommand(this.app),new c.MakeMigrationCommand(this.app),new l.SeedCommand(this.app),new u.MakeSeederCommand(this.app),new d.MakeEventCommand(this.app),new f.MakeListenerCommand(this.app),new p.MakeControllerCommand(this.app),new m.EventListCommand(this.app),new h.EventCacheCommand(this.app),new g.EventClearCommand(this.app),new _.DeployLoginCommand,new v.DeployInitCommand,new y.DeployServerCommand,new b.DeployCommand,new x.DeployStatusCommand,new S.DeployEnvCommand,new C.DeployRollbackCommand,new w.DeployProvisionCommand])}}(T).run().catch(e=>{console.error(e),process.exit(1)});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{Application as e}from"../Foundation/Application.mjs";import{ConsoleKernel as t}from"./ConsoleKernel.mjs";import{MigrateCommand as n}from"./Commands/MigrateCommand.mjs";import{MigrateRollbackCommand as r}from"./Commands/MigrateRollbackCommand.mjs";import{MigrateResetCommand as i}from"./Commands/MigrateResetCommand.mjs";import{MigrateRefreshCommand as a}from"./Commands/MigrateRefreshCommand.mjs";import{MigrateFreshCommand as o}from"./Commands/MigrateFreshCommand.mjs";import{MigrateStatusCommand as s}from"./Commands/MigrateStatusCommand.mjs";import{MakeMigrationCommand as c}from"./Commands/MakeMigrationCommand.mjs";import{SeedCommand as l}from"./Commands/SeedCommand.mjs";import{MakeSeederCommand as u}from"./Commands/MakeSeederCommand.mjs";import{MakeEventCommand as d}from"./Commands/MakeEventCommand.mjs";import{MakeListenerCommand as f}from"./Commands/MakeListenerCommand.mjs";import{MakeControllerCommand as p}from"./Commands/MakeControllerCommand.mjs";import{EventListCommand as m}from"./Commands/EventListCommand.mjs";import{EventCacheCommand as h}from"./Commands/EventCacheCommand.mjs";import{EventClearCommand as g}from"./Commands/EventClearCommand.mjs";import{DeployLoginCommand as _}from"./Commands/DeployLoginCommand.mjs";import{DeployInitCommand as v}from"./Commands/DeployInitCommand.mjs";import{DeployServerCommand as y}from"./Commands/DeployServerCommand.mjs";import{DeployCommand as b}from"./Commands/DeployCommand.mjs";import{DeployStatusCommand as x}from"./Commands/DeployStatusCommand.mjs";import{DeployEnvCommand as S}from"./Commands/DeployEnvCommand.mjs";import{DeployRollbackCommand as C}from"./Commands/DeployRollbackCommand.mjs";import{DeployProvisionCommand as w}from"./Commands/DeployProvisionCommand.mjs";const T=new e;new class extends t{registerCommands(){this.registerMany([new n(this.app),new r(this.app),new i(this.app),new a(this.app),new o(this.app),new s(this.app),new c(this.app),new l(this.app),new u(this.app),new d(this.app),new f(this.app),new p(this.app),new m(this.app),new h(this.app),new g(this.app),new _,new v,new y,new b,new x,new S,new C,new w])}}(T).run().catch(e=>{console.error(e),process.exit(1)});export{};
|
|
3
|
+
//# sourceMappingURL=orchestr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestr.mjs","names":[],"sources":["../../src/Console/orchestr.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Orchestr CLI\n *\n * Command-line interface for Orchestr\n */\n\nimport { Application } from '@/Foundation/Application';\nimport { DeployCommand } from './Commands/DeployCommand';\nimport { DeployEnvCommand } from './Commands/DeployEnvCommand';\nimport { DeployInitCommand } from './Commands/DeployInitCommand';\nimport { DeployLoginCommand } from './Commands/DeployLoginCommand';\nimport { DeployProvisionCommand } from './Commands/DeployProvisionCommand';\nimport { DeployRollbackCommand } from './Commands/DeployRollbackCommand';\nimport { DeployServerCommand } from './Commands/DeployServerCommand';\nimport { DeployStatusCommand } from './Commands/DeployStatusCommand';\nimport { EventCacheCommand } from './Commands/EventCacheCommand';\nimport { EventClearCommand } from './Commands/EventClearCommand';\nimport { EventListCommand } from './Commands/EventListCommand';\nimport { MakeControllerCommand } from './Commands/MakeControllerCommand';\nimport { MakeEventCommand } from './Commands/MakeEventCommand';\nimport { MakeListenerCommand } from './Commands/MakeListenerCommand';\nimport { MakeMigrationCommand } from './Commands/MakeMigrationCommand';\nimport { MakeSeederCommand } from './Commands/MakeSeederCommand';\nimport { MigrateCommand } from './Commands/MigrateCommand';\nimport { MigrateFreshCommand } from './Commands/MigrateFreshCommand';\nimport { MigrateRefreshCommand } from './Commands/MigrateRefreshCommand';\nimport { MigrateResetCommand } from './Commands/MigrateResetCommand';\nimport { MigrateRollbackCommand } from './Commands/MigrateRollbackCommand';\nimport { MigrateStatusCommand } from './Commands/MigrateStatusCommand';\nimport { SeedCommand } from './Commands/SeedCommand';\nimport { ConsoleKernel } from './ConsoleKernel';\n\n// Create application instance\nconst app = new Application();\n\n// Create console kernel\nclass OrchestrKernel extends ConsoleKernel {\n protected registerCommands(): void {\n // Register migration commands\n this.registerMany([\n new MigrateCommand(this.app),\n new MigrateRollbackCommand(this.app),\n new MigrateResetCommand(this.app),\n new MigrateRefreshCommand(this.app),\n new MigrateFreshCommand(this.app),\n new MigrateStatusCommand(this.app),\n new MakeMigrationCommand(this.app),\n new SeedCommand(this.app),\n new MakeSeederCommand(this.app),\n new MakeEventCommand(this.app),\n new MakeListenerCommand(this.app),\n new MakeControllerCommand(this.app),\n new EventListCommand(this.app),\n new EventCacheCommand(this.app),\n new EventClearCommand(this.app),\n // Deploy commands\n new DeployLoginCommand(),\n new DeployInitCommand(),\n new DeployServerCommand(),\n new DeployCommand(),\n new DeployStatusCommand(),\n new DeployEnvCommand(),\n new DeployRollbackCommand(),\n new DeployProvisionCommand(),\n ]);\n }\n}\n\n// Run the CLI\nconst kernel = new OrchestrKernel(app);\nkernel.run().catch((error) => {\n console.error(error);\n process.exit(1);\n});\n"],"mappings":";itDAkCA,MAAM,EAAM,IAAI,EAoCD,IAjCf,cAA6B,CAAc,CACzC,kBAAmC,CAEjC,KAAK,aAAa,CAChB,IAAI,EAAe,KAAK,IAAI,CAC5B,IAAI,EAAuB,KAAK,IAAI,CACpC,IAAI,EAAoB,KAAK,IAAI,CACjC,IAAI,EAAsB,KAAK,IAAI,CACnC,IAAI,EAAoB,KAAK,IAAI,CACjC,IAAI,EAAqB,KAAK,IAAI,CAClC,IAAI,EAAqB,KAAK,IAAI,CAClC,IAAI,EAAY,KAAK,IAAI,CACzB,IAAI,EAAkB,KAAK,IAAI,CAC/B,IAAI,EAAiB,KAAK,IAAI,CAC9B,IAAI,EAAoB,KAAK,IAAI,CACjC,IAAI,EAAsB,KAAK,IAAI,CACnC,IAAI,EAAiB,KAAK,IAAI,CAC9B,IAAI,EAAkB,KAAK,IAAI,CAC/B,IAAI,EAAkB,KAAK,IAAI,CAE/B,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,IAAI,EACL,CAAC,GAK4B,EAAI,CAC/B,KAAK,CAAC,MAAO,GAAU,CAC5B,QAAQ,MAAM,EAAM,CACpB,QAAQ,KAAK,EAAE,EACf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Container } from "../Container/Container.cjs";
|
|
2
1
|
import { Event } from "./Event.cjs";
|
|
2
|
+
import { Container } from "../Container/Container.cjs";
|
|
3
3
|
import { EventListener, EventSubscriber } from "./types.cjs";
|
|
4
4
|
import { DispatcherContract } from "./Contracts/Dispatcher.cjs";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Container } from "../Container/Container.mjs";
|
|
2
1
|
import { Event } from "./Event.mjs";
|
|
2
|
+
import { Container } from "../Container/Container.mjs";
|
|
3
3
|
import { EventListener, EventSubscriber } from "./types.mjs";
|
|
4
4
|
import { DispatcherContract } from "./Contracts/Dispatcher.mjs";
|
|
5
5
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./Concerns/Dispatchable.cjs`),t=require(`./Event.cjs`),n=require(`./Dispatcher.cjs`),r=require(`./EventServiceProvider.cjs`);exports.Dispatchable=e.Dispatchable,exports.Dispatcher=n.Dispatcher,exports.Event=t.Event,exports.EventServiceProvider=r.EventServiceProvider,exports.applyDispatchable=e.applyDispatchable;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Event, EventClass } from "./Event.cjs";
|
|
2
|
+
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./types.cjs";
|
|
3
|
+
import { DispatcherContract } from "./Contracts/Dispatcher.cjs";
|
|
4
|
+
import { Dispatcher } from "./Dispatcher.cjs";
|
|
5
|
+
import { EventServiceProvider } from "./EventServiceProvider.cjs";
|
|
6
|
+
import { Dispatchable, applyDispatchable } from "./Concerns/Dispatchable.cjs";
|
|
7
|
+
export { Dispatchable, Dispatcher, type DispatcherContract, Event, type EventClass, type EventListener, type EventPayload, EventServiceProvider, type EventSubscriber, type ListenerClosure, type ListenerInterface, type QueuedListener, applyDispatchable };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Event, EventClass } from "./Event.mjs";
|
|
2
|
+
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./types.mjs";
|
|
3
|
+
import { DispatcherContract } from "./Contracts/Dispatcher.mjs";
|
|
4
|
+
import { Dispatcher } from "./Dispatcher.mjs";
|
|
5
|
+
import { EventServiceProvider } from "./EventServiceProvider.mjs";
|
|
6
|
+
import { Dispatchable, applyDispatchable } from "./Concerns/Dispatchable.mjs";
|
|
7
|
+
export { Dispatchable, Dispatcher, type DispatcherContract, Event, type EventClass, type EventListener, type EventPayload, EventServiceProvider, type EventSubscriber, type ListenerClosure, type ListenerInterface, type QueuedListener, applyDispatchable };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Dispatchable as e,applyDispatchable as t}from"./Concerns/Dispatchable.mjs";import{Event as n}from"./Event.mjs";import{Dispatcher as r}from"./Dispatcher.mjs";import{EventServiceProvider as i}from"./EventServiceProvider.mjs";export{e as Dispatchable,r as Dispatcher,n as Event,i as EventServiceProvider,t as applyDispatchable};
|
package/dist/Facades/Event.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Facade } from "../Support/Facade.cjs";
|
|
2
1
|
import { Event as Event$1 } from "../Events/Event.cjs";
|
|
3
2
|
import { EventListener } from "../Events/types.cjs";
|
|
4
3
|
import { Dispatcher } from "../Events/Dispatcher.cjs";
|
|
4
|
+
import { Facade } from "../Support/Facade.cjs";
|
|
5
5
|
import { EventFake } from "../Support/Testing/Fakes/EventFake.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/Facades/Event.d.ts
|
package/dist/Facades/Event.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Facade } from "../Support/Facade.mjs";
|
|
2
1
|
import { Event as Event$1 } from "../Events/Event.mjs";
|
|
3
2
|
import { EventListener } from "../Events/types.mjs";
|
|
4
3
|
import { Dispatcher } from "../Events/Dispatcher.mjs";
|
|
4
|
+
import { Facade } from "../Support/Facade.mjs";
|
|
5
5
|
import { EventFake } from "../Support/Testing/Fakes/EventFake.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/Facades/Event.d.ts
|
package/dist/Facades/Route.d.cts
CHANGED
package/dist/Facades/Route.d.mts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./Route.cjs`),t=require(`./Config.cjs`),n=require(`../Support/Testing/Fakes/EventFake.cjs`),r=require(`./Event.cjs`),i=require(`./Queue.cjs`),a=require(`./Bus.cjs`),o=require(`./Cache.cjs`),s=require(`./DB.cjs`);exports.Bus=a.Bus,exports.Cache=o.Cache,exports.Config=t.Config,exports.DB=s.DB,exports.Event=r.Event,exports.EventFake=n.EventFake,exports.Queue=i.Queue,exports.Route=e.Route;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config } from "./Config.cjs";
|
|
2
|
+
import { DB } from "./DB.cjs";
|
|
3
|
+
import { Route } from "./Route.cjs";
|
|
4
|
+
import { EventFake } from "../Support/Testing/Fakes/EventFake.cjs";
|
|
5
|
+
import { Event } from "./Event.cjs";
|
|
6
|
+
import { Queue } from "./Queue.cjs";
|
|
7
|
+
import { Bus } from "./Bus.cjs";
|
|
8
|
+
import { Cache } from "./Cache.cjs";
|
|
9
|
+
export { Bus, Cache, Config, DB, Event, EventFake, Queue, Route };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Config } from "./Config.mjs";
|
|
2
|
+
import { DB } from "./DB.mjs";
|
|
3
|
+
import { Route } from "./Route.mjs";
|
|
4
|
+
import { EventFake } from "../Support/Testing/Fakes/EventFake.mjs";
|
|
5
|
+
import { Event } from "./Event.mjs";
|
|
6
|
+
import { Queue } from "./Queue.mjs";
|
|
7
|
+
import { Bus } from "./Bus.mjs";
|
|
8
|
+
import { Cache } from "./Cache.mjs";
|
|
9
|
+
export { Bus, Cache, Config, DB, Event, EventFake, Queue, Route };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Route as e}from"./Route.mjs";import{Config as t}from"./Config.mjs";import{EventFake as n}from"../Support/Testing/Fakes/EventFake.mjs";import{Event as r}from"./Event.mjs";import{Queue as i}from"./Queue.mjs";import{Bus as a}from"./Bus.mjs";import{Cache as o}from"./Cache.mjs";import{DB as s}from"./DB.mjs";export{a as Bus,o as Cache,t as Config,s as DB,r as Event,n as EventFake,i as Queue,e as Route};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Request } from "../../Routing/Request.cjs";
|
|
2
1
|
import { Response } from "../../Routing/Response.cjs";
|
|
2
|
+
import { Request } from "../../Routing/Request.cjs";
|
|
3
3
|
import { ValidationRules, Validator } from "./Validator.cjs";
|
|
4
4
|
import { ValidationException } from "./ValidationException.cjs";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Request } from "../../Routing/Request.mjs";
|
|
2
1
|
import { Response } from "../../Routing/Response.mjs";
|
|
2
|
+
import { Request } from "../../Routing/Request.mjs";
|
|
3
3
|
import { ValidationRules, Validator } from "./Validator.mjs";
|
|
4
4
|
import { ValidationException } from "./ValidationException.mjs";
|
|
5
5
|
|
package/dist/Routing/Route.d.cts
CHANGED
package/dist/Routing/Route.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Application } from "../Foundation/Application.cjs";
|
|
2
|
-
import { Request } from "./Request.cjs";
|
|
3
2
|
import { Response } from "./Response.cjs";
|
|
4
3
|
import { HttpMethod, Middleware, Route, RouteAction } from "./Route.cjs";
|
|
4
|
+
import { Request } from "./Request.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/Routing/Router.d.ts
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Application } from "../Foundation/Application.mjs";
|
|
2
|
-
import { Request } from "./Request.mjs";
|
|
3
2
|
import { Response } from "./Response.mjs";
|
|
4
3
|
import { HttpMethod, Middleware, Route, RouteAction } from "./Route.mjs";
|
|
4
|
+
import { Request } from "./Request.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/Routing/Router.d.ts
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Container } from "../../../Container/Container.cjs";
|
|
2
1
|
import { Event } from "../../../Events/Event.cjs";
|
|
2
|
+
import { Container } from "../../../Container/Container.cjs";
|
|
3
3
|
import { EventListener } from "../../../Events/types.cjs";
|
|
4
4
|
import { DispatcherContract } from "../../../Events/Contracts/Dispatcher.cjs";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Container } from "../../../Container/Container.mjs";
|
|
2
1
|
import { Event } from "../../../Events/Event.mjs";
|
|
2
|
+
import { Container } from "../../../Container/Container.mjs";
|
|
3
3
|
import { EventListener } from "../../../Events/types.mjs";
|
|
4
4
|
import { DispatcherContract } from "../../../Events/Contracts/Dispatcher.mjs";
|
|
5
5
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
+
import { Event, EventClass } from "./Events/Event.cjs";
|
|
1
2
|
import { Abstract, Binding, Concrete, Container } from "./Container/Container.cjs";
|
|
2
|
-
import {
|
|
3
|
+
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.cjs";
|
|
4
|
+
import { DispatcherContract } from "./Events/Contracts/Dispatcher.cjs";
|
|
5
|
+
import { Dispatcher } from "./Events/Dispatcher.cjs";
|
|
3
6
|
import { Application } from "./Foundation/Application.cjs";
|
|
4
|
-
import {
|
|
7
|
+
import { ServiceProvider } from "./Foundation/ServiceProvider.cjs";
|
|
8
|
+
import { EventServiceProvider } from "./Events/EventServiceProvider.cjs";
|
|
9
|
+
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.cjs";
|
|
10
|
+
import { Config as Config$1 } from "./Foundation/Config/Config.cjs";
|
|
11
|
+
import { Facade } from "./Support/Facade.cjs";
|
|
12
|
+
import { Config } from "./Facades/Config.cjs";
|
|
13
|
+
import { DB } from "./Facades/DB.cjs";
|
|
5
14
|
import { CookieOptions, Response } from "./Routing/Response.cjs";
|
|
6
15
|
import { HttpMethod, Middleware, Route as Route$1, RouteAction } from "./Routing/Route.cjs";
|
|
16
|
+
import { Request } from "./Routing/Request.cjs";
|
|
7
17
|
import { Router } from "./Routing/Router.cjs";
|
|
8
|
-
import { Kernel } from "./Foundation/Http/Kernel.cjs";
|
|
9
|
-
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.cjs";
|
|
10
|
-
import { ValidationException } from "./Foundation/Http/ValidationException.cjs";
|
|
11
|
-
import { FormRequest } from "./Foundation/Http/FormRequest.cjs";
|
|
12
|
-
import { Rule } from "./Foundation/Http/Rule.cjs";
|
|
13
|
-
import { Config as Config$1 } from "./Foundation/Config/Config.cjs";
|
|
14
|
-
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.cjs";
|
|
15
|
-
import { Controller } from "./Routing/Controller.cjs";
|
|
16
|
-
import { Facade } from "./Support/Facade.cjs";
|
|
17
18
|
import { Route } from "./Facades/Route.cjs";
|
|
18
|
-
import { Config } from "./Facades/Config.cjs";
|
|
19
|
-
import { Event, EventClass } from "./Events/Event.cjs";
|
|
20
|
-
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.cjs";
|
|
21
|
-
import { DispatcherContract } from "./Events/Contracts/Dispatcher.cjs";
|
|
22
|
-
import { Dispatcher } from "./Events/Dispatcher.cjs";
|
|
23
19
|
import { Event as Event$1 } from "./Facades/Event.cjs";
|
|
24
20
|
import { PendingDispatch } from "./Queue/PendingDispatch.cjs";
|
|
25
21
|
import { JobMiddleware } from "./Queue/Middleware/JobMiddleware.cjs";
|
|
@@ -40,6 +36,13 @@ import { TaggedCache } from "./Cache/Tags/TaggedCache.cjs";
|
|
|
40
36
|
import { Repository } from "./Cache/Repository.cjs";
|
|
41
37
|
import { CacheConfig, CacheManager, StoreConfig, StoreFactory } from "./Cache/CacheManager.cjs";
|
|
42
38
|
import { Cache } from "./Facades/Cache.cjs";
|
|
39
|
+
import { Kernel } from "./Foundation/Http/Kernel.cjs";
|
|
40
|
+
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.cjs";
|
|
41
|
+
import { ValidationException } from "./Foundation/Http/ValidationException.cjs";
|
|
42
|
+
import { FormRequest } from "./Foundation/Http/FormRequest.cjs";
|
|
43
|
+
import { Rule } from "./Foundation/Http/Rule.cjs";
|
|
44
|
+
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.cjs";
|
|
45
|
+
import { Controller } from "./Routing/Controller.cjs";
|
|
43
46
|
import { ViewEngine } from "./View/Engines/ViewEngine.cjs";
|
|
44
47
|
import { TemplateEngine, TemplateEngineResolver } from "./View/Engines/TemplateEngine.cjs";
|
|
45
48
|
import { View } from "./View/View.cjs";
|
|
@@ -60,7 +63,6 @@ import { Connection } from "./Database/Connection.cjs";
|
|
|
60
63
|
import { DatabaseConnectionConfig, DatabaseManager, DatabaseManagerConfig } from "./Database/DatabaseManager.cjs";
|
|
61
64
|
import { Expression, raw } from "./Database/Query/Expression.cjs";
|
|
62
65
|
import { DrizzleAdapter } from "./Database/Adapters/DrizzleAdapter.cjs";
|
|
63
|
-
import { DB } from "./Facades/DB.cjs";
|
|
64
66
|
import { EnsembleCollection } from "./Database/Ensemble/EnsembleCollection.cjs";
|
|
65
67
|
import { Relation } from "./Database/Ensemble/Relations/Relation.cjs";
|
|
66
68
|
import { HasOne } from "./Database/Ensemble/Relations/HasOne.cjs";
|
|
@@ -142,8 +144,6 @@ import { DeployEnvCommand } from "./Console/Commands/DeployEnvCommand.cjs";
|
|
|
142
144
|
import { DeployRollbackCommand } from "./Console/Commands/DeployRollbackCommand.cjs";
|
|
143
145
|
import { DeployProvisionCommand } from "./Console/Commands/DeployProvisionCommand.cjs";
|
|
144
146
|
import { ProvisionOptions, Provisioner } from "./Deploy/Provisioner.cjs";
|
|
145
|
-
import { EventServiceProvider } from "./Events/EventServiceProvider.cjs";
|
|
146
|
-
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.cjs";
|
|
147
147
|
import { ModelEvent } from "./Database/Ensemble/Events/ModelEvent.cjs";
|
|
148
148
|
import { ModelRetrieved } from "./Database/Ensemble/Events/ModelRetrieved.cjs";
|
|
149
149
|
import { ModelCreating } from "./Database/Ensemble/Events/ModelCreating.cjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
+
import { Event, EventClass } from "./Events/Event.mjs";
|
|
1
2
|
import { Abstract, Binding, Concrete, Container } from "./Container/Container.mjs";
|
|
2
|
-
import {
|
|
3
|
+
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.mjs";
|
|
4
|
+
import { DispatcherContract } from "./Events/Contracts/Dispatcher.mjs";
|
|
5
|
+
import { Dispatcher } from "./Events/Dispatcher.mjs";
|
|
3
6
|
import { Application } from "./Foundation/Application.mjs";
|
|
4
|
-
import {
|
|
7
|
+
import { ServiceProvider } from "./Foundation/ServiceProvider.mjs";
|
|
8
|
+
import { EventServiceProvider } from "./Events/EventServiceProvider.mjs";
|
|
9
|
+
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.mjs";
|
|
10
|
+
import { Config as Config$1 } from "./Foundation/Config/Config.mjs";
|
|
11
|
+
import { Facade } from "./Support/Facade.mjs";
|
|
12
|
+
import { Config } from "./Facades/Config.mjs";
|
|
13
|
+
import { DB } from "./Facades/DB.mjs";
|
|
5
14
|
import { CookieOptions, Response } from "./Routing/Response.mjs";
|
|
6
15
|
import { HttpMethod, Middleware, Route as Route$1, RouteAction } from "./Routing/Route.mjs";
|
|
16
|
+
import { Request } from "./Routing/Request.mjs";
|
|
7
17
|
import { Router } from "./Routing/Router.mjs";
|
|
8
|
-
import { Kernel } from "./Foundation/Http/Kernel.mjs";
|
|
9
|
-
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.mjs";
|
|
10
|
-
import { ValidationException } from "./Foundation/Http/ValidationException.mjs";
|
|
11
|
-
import { FormRequest } from "./Foundation/Http/FormRequest.mjs";
|
|
12
|
-
import { Rule } from "./Foundation/Http/Rule.mjs";
|
|
13
|
-
import { Config as Config$1 } from "./Foundation/Config/Config.mjs";
|
|
14
|
-
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.mjs";
|
|
15
|
-
import { Controller } from "./Routing/Controller.mjs";
|
|
16
|
-
import { Facade } from "./Support/Facade.mjs";
|
|
17
18
|
import { Route } from "./Facades/Route.mjs";
|
|
18
|
-
import { Config } from "./Facades/Config.mjs";
|
|
19
|
-
import { Event, EventClass } from "./Events/Event.mjs";
|
|
20
|
-
import { EventListener, EventPayload, EventSubscriber, ListenerClosure, ListenerInterface, QueuedListener } from "./Events/types.mjs";
|
|
21
|
-
import { DispatcherContract } from "./Events/Contracts/Dispatcher.mjs";
|
|
22
|
-
import { Dispatcher } from "./Events/Dispatcher.mjs";
|
|
23
19
|
import { Event as Event$1 } from "./Facades/Event.mjs";
|
|
24
20
|
import { PendingDispatch } from "./Queue/PendingDispatch.mjs";
|
|
25
21
|
import { JobMiddleware } from "./Queue/Middleware/JobMiddleware.mjs";
|
|
@@ -40,6 +36,13 @@ import { TaggedCache } from "./Cache/Tags/TaggedCache.mjs";
|
|
|
40
36
|
import { Repository } from "./Cache/Repository.mjs";
|
|
41
37
|
import { CacheConfig, CacheManager, StoreConfig, StoreFactory } from "./Cache/CacheManager.mjs";
|
|
42
38
|
import { Cache } from "./Facades/Cache.mjs";
|
|
39
|
+
import { Kernel } from "./Foundation/Http/Kernel.mjs";
|
|
40
|
+
import { ValidationRule, ValidationRuleObject, ValidationRules, Validator } from "./Foundation/Http/Validator.mjs";
|
|
41
|
+
import { ValidationException } from "./Foundation/Http/ValidationException.mjs";
|
|
42
|
+
import { FormRequest } from "./Foundation/Http/FormRequest.mjs";
|
|
43
|
+
import { Rule } from "./Foundation/Http/Rule.mjs";
|
|
44
|
+
import { ConfigServiceProvider } from "./Foundation/Config/ConfigServiceProvider.mjs";
|
|
45
|
+
import { Controller } from "./Routing/Controller.mjs";
|
|
43
46
|
import { ViewEngine } from "./View/Engines/ViewEngine.mjs";
|
|
44
47
|
import { TemplateEngine, TemplateEngineResolver } from "./View/Engines/TemplateEngine.mjs";
|
|
45
48
|
import { View } from "./View/View.mjs";
|
|
@@ -60,7 +63,6 @@ import { Connection } from "./Database/Connection.mjs";
|
|
|
60
63
|
import { DatabaseConnectionConfig, DatabaseManager, DatabaseManagerConfig } from "./Database/DatabaseManager.mjs";
|
|
61
64
|
import { Expression, raw } from "./Database/Query/Expression.mjs";
|
|
62
65
|
import { DrizzleAdapter } from "./Database/Adapters/DrizzleAdapter.mjs";
|
|
63
|
-
import { DB } from "./Facades/DB.mjs";
|
|
64
66
|
import { EnsembleCollection } from "./Database/Ensemble/EnsembleCollection.mjs";
|
|
65
67
|
import { Relation } from "./Database/Ensemble/Relations/Relation.mjs";
|
|
66
68
|
import { HasOne } from "./Database/Ensemble/Relations/HasOne.mjs";
|
|
@@ -142,8 +144,6 @@ import { DeployEnvCommand } from "./Console/Commands/DeployEnvCommand.mjs";
|
|
|
142
144
|
import { DeployRollbackCommand } from "./Console/Commands/DeployRollbackCommand.mjs";
|
|
143
145
|
import { DeployProvisionCommand } from "./Console/Commands/DeployProvisionCommand.mjs";
|
|
144
146
|
import { ProvisionOptions, Provisioner } from "./Deploy/Provisioner.mjs";
|
|
145
|
-
import { EventServiceProvider } from "./Events/EventServiceProvider.mjs";
|
|
146
|
-
import { Dispatchable, applyDispatchable } from "./Events/Concerns/Dispatchable.mjs";
|
|
147
147
|
import { ModelEvent } from "./Database/Ensemble/Events/ModelEvent.mjs";
|
|
148
148
|
import { ModelRetrieved } from "./Database/Ensemble/Events/ModelRetrieved.mjs";
|
|
149
149
|
import { ModelCreating } from "./Database/Ensemble/Events/ModelCreating.mjs";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Events TypeScript Usage Guide
|
|
2
|
+
|
|
3
|
+
## Problem: TypeScript doesn't recognize static dispatch methods
|
|
4
|
+
|
|
5
|
+
When you create an event class that extends `Event`, TypeScript may not automatically recognize the static `dispatch()`, `dispatchIf()`, `dispatchUnless()`, and `until()` methods that are added by the Dispatchable mixin.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Event } from '@orchestr-sh/orchestr';
|
|
9
|
+
|
|
10
|
+
class UserRegistered extends Event {
|
|
11
|
+
constructor(public user: User) {
|
|
12
|
+
super();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// TypeScript error: Property 'dispatch' does not exist on type 'typeof UserRegistered'
|
|
17
|
+
UserRegistered.dispatch(user);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Solution 1: Use type assertion (Quick Fix)
|
|
21
|
+
|
|
22
|
+
The simplest solution is to cast your event class to the `EventClass` type:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { Event, type EventClass } from '@orchestr-sh/orchestr';
|
|
26
|
+
|
|
27
|
+
class UserRegistered extends Event {
|
|
28
|
+
constructor(public user: User) {
|
|
29
|
+
super();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Cast to EventClass to get proper typing
|
|
34
|
+
const UserRegisteredEvent = UserRegistered as EventClass<UserRegistered>;
|
|
35
|
+
|
|
36
|
+
// Now TypeScript recognizes the static methods
|
|
37
|
+
UserRegisteredEvent.dispatch(user);
|
|
38
|
+
UserRegisteredEvent.dispatchIf(condition, user);
|
|
39
|
+
UserRegisteredEvent.dispatchUnless(condition, user);
|
|
40
|
+
await UserRegisteredEvent.until(user);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Solution 2: Use Event facade (Recommended)
|
|
44
|
+
|
|
45
|
+
The recommended approach is to use the Event facade for dispatching. You can import it in two ways:
|
|
46
|
+
|
|
47
|
+
**Option A: Subpath import (cleaner)**
|
|
48
|
+
```typescript
|
|
49
|
+
import { Event } from '@orchestr-sh/orchestr/Facades';
|
|
50
|
+
|
|
51
|
+
class UserRegistered extends Event {
|
|
52
|
+
constructor(public user: User) {
|
|
53
|
+
super();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Dispatch through the facade - fully typed
|
|
58
|
+
Event.dispatch(new UserRegistered(user));
|
|
59
|
+
Event.dispatchIf(condition, new UserRegistered(user));
|
|
60
|
+
Event.dispatchUnless(condition, new UserRegistered(user));
|
|
61
|
+
await Event.until(new UserRegistered(user));
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Option B: Named import from main package**
|
|
65
|
+
```typescript
|
|
66
|
+
import { EventFacade } from '@orchestr-sh/orchestr';
|
|
67
|
+
|
|
68
|
+
// Use EventFacade to avoid naming conflict with Event base class
|
|
69
|
+
EventFacade.dispatch(new UserRegistered(user));
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Solution 3: Export with proper typing
|
|
73
|
+
|
|
74
|
+
Export your event classes with the proper type in your event files:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// UserRegistered.ts
|
|
78
|
+
import { Event, type EventClass } from '@orchestr-sh/orchestr';
|
|
79
|
+
|
|
80
|
+
class UserRegisteredClass extends Event {
|
|
81
|
+
constructor(public user: User) {
|
|
82
|
+
super();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Export with proper typing
|
|
87
|
+
export const UserRegistered = UserRegisteredClass as EventClass<UserRegisteredClass>;
|
|
88
|
+
export type UserRegistered = InstanceType<typeof UserRegistered>;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Then use it elsewhere:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { UserRegistered } from './Events/UserRegistered';
|
|
95
|
+
|
|
96
|
+
// Full TypeScript support
|
|
97
|
+
UserRegistered.dispatch(user);
|
|
98
|
+
UserRegistered.dispatchIf(condition, user);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Why This Happens
|
|
102
|
+
|
|
103
|
+
The static methods (`dispatch`, `dispatchIf`, etc.) are added to the Event class at runtime by the `applyDispatchable()` function, which uses JavaScript's `Object.defineProperty`. TypeScript's type system doesn't automatically detect these runtime-added methods.
|
|
104
|
+
|
|
105
|
+
The `EventClass<T>` type helper provides the correct type information to TypeScript, telling it that these static methods exist on your event class.
|
|
106
|
+
|
|
107
|
+
## Best Practice Recommendation
|
|
108
|
+
|
|
109
|
+
For most use cases, we recommend **Solution 2** (using the Event facade):
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
Event.dispatch(new UserRegistered(user));
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
This approach:
|
|
116
|
+
- ✅ Has full TypeScript support out of the box
|
|
117
|
+
- ✅ Is more explicit and easier to understand
|
|
118
|
+
- ✅ Works consistently across all event classes
|
|
119
|
+
- ✅ Follows Laravel's recommended pattern
|
|
120
|
+
- ✅ Makes testing easier (Event.fake() works seamlessly)
|
|
121
|
+
|
|
122
|
+
Reserve the static class methods for cases where you want the syntactic sugar:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
UserRegistered.dispatch(user); // Shorter, but requires type casting
|
|
126
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Future Improvements
|
|
2
|
+
|
|
3
|
+
## Traits Refactoring (Deferred)
|
|
4
|
+
|
|
5
|
+
**Goal:** Refactor all mixins to use `@orchestr-sh/traits` for better PHP-like syntax and automatic TypeScript support.
|
|
6
|
+
|
|
7
|
+
### Current Mixins to Migrate
|
|
8
|
+
1. **Dispatchable** (Events) - Low risk, good starting point
|
|
9
|
+
2. **HasDynamicRelations** (Ensemble) - Medium risk, uses Proxies
|
|
10
|
+
3. **HasRelationships** (Ensemble) - High risk, core ORM functionality
|
|
11
|
+
|
|
12
|
+
### Benefits
|
|
13
|
+
- Eliminate need for `EventClass` type helper
|
|
14
|
+
- More PHP-like trait syntax
|
|
15
|
+
- Better TypeScript inference
|
|
16
|
+
- Cleaner, more maintainable code
|
|
17
|
+
|
|
18
|
+
### Prerequisites Before Starting
|
|
19
|
+
1. ✅ Validate `@orchestr-sh/traits` handles:
|
|
20
|
+
- Static methods (e.g., `Dispatchable.dispatch()`)
|
|
21
|
+
- Property conflicts between traits
|
|
22
|
+
- Interaction with existing decorators (@DynamicRelation)
|
|
23
|
+
- Proxy objects (HasDynamicRelations)
|
|
24
|
+
2. ✅ Create POC with Dispatchable trait only
|
|
25
|
+
3. ✅ Verify test coverage is sufficient to catch regressions
|
|
26
|
+
4. ✅ Gather user feedback on current DX - is this actually a pain point?
|
|
27
|
+
|
|
28
|
+
### Migration Strategy (When Ready)
|
|
29
|
+
**Phase 1:** Dispatchable trait (lowest risk)
|
|
30
|
+
- Migrate Events/Concerns/Dispatchable to use traits
|
|
31
|
+
- Ship and validate in production
|
|
32
|
+
- Measure DX improvement
|
|
33
|
+
|
|
34
|
+
**Phase 2:** HasDynamicRelations (if Phase 1 succeeds)
|
|
35
|
+
- More complex due to Proxy usage
|
|
36
|
+
- Test thoroughly with all relationship types
|
|
37
|
+
|
|
38
|
+
**Phase 3:** HasRelationships (highest risk, save for last)
|
|
39
|
+
- Core ORM functionality
|
|
40
|
+
- Affects all models and relationships
|
|
41
|
+
- Extensive testing required
|
|
42
|
+
|
|
43
|
+
### Decision: Deferred
|
|
44
|
+
**Reason:** Current implementation is production-ready (9.9/10 code review). The TypeScript typing issue has documented workarounds. No user pain point driving this change. Premature to refactor stable code.
|
|
45
|
+
|
|
46
|
+
**Revisit when:**
|
|
47
|
+
- Users report DX friction with current approach
|
|
48
|
+
- `@orchestr-sh/traits` is proven in production
|
|
49
|
+
- We have capacity for the migration effort
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Validation Usage
|
|
2
|
+
|
|
3
|
+
This guide shows how to validate request data using the Validator and the Rule builder. It covers defining rules, conditional logic, arrays, dates, numbers, networks and files, plus customizing error messages.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
- Create a Validator with input data and a rules object.
|
|
8
|
+
- Use the Rule builder to compose rule instances.
|
|
9
|
+
- Call `validate()` to run rules; read `errors()` for messages.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Validator } from '@/Foundation/Http/Validator';
|
|
13
|
+
import { Rule } from '@/Foundation/Http/Rule';
|
|
14
|
+
|
|
15
|
+
const data = { email: 'user@example.com', age: 18 };
|
|
16
|
+
const rules = {
|
|
17
|
+
email: [Rule.required(), Rule.email()],
|
|
18
|
+
age: [Rule.required(), Rule.integer(), Rule.min(18)],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const v = new Validator(data, rules);
|
|
22
|
+
const ok = await v.validate(); // true/false
|
|
23
|
+
const errs = v.errors(); // { email?: string[], age?: string[] }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Rule Builder
|
|
27
|
+
|
|
28
|
+
Use `Rule.*()` methods to construct validation rules. Every call returns a rule object. Common examples:
|
|
29
|
+
|
|
30
|
+
- Presence: `required()`, `present()`, `filled()`, `nullable()`, `sometimes()`
|
|
31
|
+
- Strings: `string()`, `alpha()`, `alphaNum()`, `alphaDash()`, `lowercase()`, `uppercase()`, `ascii()`
|
|
32
|
+
- Patterns: `regex(/.../)`, `notRegex(/.../)`, `email()`, `json()`
|
|
33
|
+
- Numbers: `numeric()`, `integer()`, `decimal(places?)`, `min(n)`, `max(n)`, `between(min,max)`, `size(n)`
|
|
34
|
+
- Digits: `digits(n)`, `digitsBetween(min,max)`, `minDigits(n)`, `maxDigits(n)`, `multipleOf(n)`
|
|
35
|
+
- Comparison: `gt(fieldOrValue)`, `gte(fieldOrValue)`, `lt(fieldOrValue)`, `lte(fieldOrValue)`
|
|
36
|
+
- Arrays: `array()`, `distinct()`, `in([...])`, `notIn([...])`, `inArray(field)`
|
|
37
|
+
- Dates: `date()`, `dateEquals(date)`, `after(dateOrField)`, `afterOrEqual(...)`, `before(...)`, `beforeOrEqual(...)`
|
|
38
|
+
- Network: `url()`, `activeUrl()`, `ip()`, `ipv4()`, `ipv6()`, `macAddress()`, `uuid()`, `timezone()`
|
|
39
|
+
- Files: `file()`, `image()`, `mimetypes([...])`, `mimes([...])`
|
|
40
|
+
- Conditionals: `accepted()`, `acceptedIf(field,val)`, `declined()`, `declinedIf(field,val)`
|
|
41
|
+
|
|
42
|
+
## Conditional Presence
|
|
43
|
+
|
|
44
|
+
Require a field based on other inputs:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const rules = {
|
|
48
|
+
type: [Rule.required(), Rule.string()],
|
|
49
|
+
cc: [Rule.requiredIf('type', 'card')], // required when type == 'card'
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Other variants:
|
|
54
|
+
|
|
55
|
+
- `requiredUnless(field, val)`
|
|
56
|
+
- `requiredWith(...fields)`
|
|
57
|
+
- `requiredWithAll(...fields)`
|
|
58
|
+
- `requiredWithout(...fields)`
|
|
59
|
+
- `requiredWithoutAll(...fields)`
|
|
60
|
+
|
|
61
|
+
Prohibited variants:
|
|
62
|
+
|
|
63
|
+
- `prohibited()`
|
|
64
|
+
- `prohibitedIf(field, val)`
|
|
65
|
+
- `prohibitedUnless(field, val)`
|
|
66
|
+
- `prohibits(...fields)` (current field prohibits the listed fields)
|
|
67
|
+
|
|
68
|
+
## Starts/Ends With
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
const rules = {
|
|
72
|
+
slug: [Rule.startsWith(['user']), Rule.endsWith(['admin'])],
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Comparisons
|
|
77
|
+
|
|
78
|
+
Compare against another field or literal:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const rules = {
|
|
82
|
+
max: [Rule.gt('min')], // max > min
|
|
83
|
+
threshold: [Rule.gte(10)], // threshold >= 10
|
|
84
|
+
};
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Arrays
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const rules = {
|
|
91
|
+
tags: [Rule.array(), Rule.distinct()],
|
|
92
|
+
choice: [Rule.inArray('choices')],
|
|
93
|
+
status: [Rule.in(['open', 'closed'])],
|
|
94
|
+
};
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Dates
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const rules = {
|
|
101
|
+
start: [Rule.date(), Rule.after('2020-01-01')],
|
|
102
|
+
end: [Rule.date(), Rule.afterOrEqual('start')],
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Files
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
const rules = {
|
|
110
|
+
avatar: [Rule.file(), Rule.image(), Rule.mimes(['png','jpg'])],
|
|
111
|
+
doc: [Rule.file(), Rule.mimetypes(['application/pdf'])],
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Custom Messages
|
|
116
|
+
|
|
117
|
+
Pass per-field messages via the Validator:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
const messages = {
|
|
121
|
+
'email.required': 'Email is required',
|
|
122
|
+
'email.email': 'Email must be valid',
|
|
123
|
+
};
|
|
124
|
+
const v = new Validator(data, rules, messages);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Rule classes may also provide tailored messages when they are invokable; otherwise messages fall back to defaults.
|
|
128
|
+
|
|
129
|
+
## Form Requests
|
|
130
|
+
|
|
131
|
+
Encapsulate validation by extending `FormRequest`. Define `rules()` and `messages()` then call `validated()`:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { FormRequest } from '@/Foundation/Http/FormRequest';
|
|
135
|
+
import { Rule } from '@/Foundation/Http/Rule';
|
|
136
|
+
|
|
137
|
+
class CreateUserRequest extends FormRequest {
|
|
138
|
+
rules() {
|
|
139
|
+
return {
|
|
140
|
+
email: [Rule.required(), Rule.email()],
|
|
141
|
+
password: [Rule.required(), Rule.string(), Rule.min(8)],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
messages() {
|
|
145
|
+
return {
|
|
146
|
+
'password.min': 'Password must be at least 8 characters',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Use it in your controller/handler to validate and access sanitized inputs.
|
|
153
|
+
|
|
154
|
+
## Auth Validation
|
|
155
|
+
|
|
156
|
+
Some rules interact with authentication and require app-specific wiring:
|
|
157
|
+
|
|
158
|
+
- current_password
|
|
159
|
+
- Recognized as a token; by default it passes until you connect it to your auth system.
|
|
160
|
+
- Use as a string rule:
|
|
161
|
+
```ts
|
|
162
|
+
const rules = { current_password: 'current_password' };
|
|
163
|
+
```
|
|
164
|
+
- Integration options:
|
|
165
|
+
- Prefer user identity checks in `FormRequest.authorize()`.
|
|
166
|
+
- Or provide a custom invokable rule that verifies the password:
|
|
167
|
+
```ts
|
|
168
|
+
import { BaseRule } from '@/Foundation/Http/Rules';
|
|
169
|
+
import { Auth } from '@/Auth'; // your auth API
|
|
170
|
+
class CurrentPasswordRule extends BaseRule {
|
|
171
|
+
constructor() { super('current_password'); this.invokable = true; }
|
|
172
|
+
async passes(_attr: string, value: any): Promise<boolean> {
|
|
173
|
+
const user = Auth.user();
|
|
174
|
+
if (!user) return false;
|
|
175
|
+
return Auth.verify(user, String(value));
|
|
176
|
+
}
|
|
177
|
+
messageFor(attribute: string) { return `The ${attribute} is incorrect.`; }
|
|
178
|
+
}
|
|
179
|
+
const rules = { current_password: [new CurrentPasswordRule()] };
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- password
|
|
183
|
+
- Builder: `Rule.password()`; enforcement is application-defined.
|
|
184
|
+
- Recommended: express policy via built-in tokens (`string|min|max|confirmed|regex`) or a custom invokable rule that centralizes password policy checks.
|
|
185
|
+
|
|
186
|
+
- can:ability
|
|
187
|
+
- Builder: `Rule.can('update-post')` returns a token.
|
|
188
|
+
- Recommended: perform authorization in `FormRequest.authorize()`; use validation for data constraints. If you need field-level gating, implement an invokable rule that queries your Gate/Policy and returns an error message when unauthorized.
|
|
189
|
+
|
|
190
|
+
## Error Handling
|
|
191
|
+
|
|
192
|
+
- `validate()` returns `true/false`
|
|
193
|
+
- `errors()` returns a map of field → error messages
|
|
194
|
+
- Throw `ValidationException` or handle manually depending on your flow
|
|
195
|
+
|
|
196
|
+
## Tips
|
|
197
|
+
|
|
198
|
+
- Chain rules in arrays to compose complex constraints
|
|
199
|
+
- Prefer field comparisons (gt/gte/lt/lte) for relational checks
|
|
200
|
+
- Use conditional presence for dynamic forms
|
|
201
|
+
- Keep messages clear and domain-specific for better UX
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchestr-sh/orchestr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.11.
|
|
4
|
+
"version": "1.11.1",
|
|
5
5
|
"description": "A 1:1 Laravel replica in TypeScript - Brings Laravel's elegant syntax and architecture to Node.js",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -24,19 +24,57 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"bin": {
|
|
27
|
-
"orchestr": "dist/Console/orchestr.
|
|
27
|
+
"orchestr": "dist/Console/orchestr.mjs"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"docs",
|
|
32
|
+
"CODE_OF_CONDUCT.md",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"CONTRIBUTING.md",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"README.md"
|
|
33
37
|
],
|
|
34
38
|
"release": {
|
|
35
39
|
"branches": [
|
|
36
40
|
"main"
|
|
37
41
|
],
|
|
38
42
|
"plugins": [
|
|
39
|
-
|
|
43
|
+
[
|
|
44
|
+
"@semantic-release/commit-analyzer",
|
|
45
|
+
{
|
|
46
|
+
"releaseRules": [
|
|
47
|
+
{
|
|
48
|
+
"type": "build",
|
|
49
|
+
"release": "patch"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "ci",
|
|
53
|
+
"release": "patch"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"type": "chore",
|
|
57
|
+
"release": "patch"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "docs",
|
|
61
|
+
"release": "patch"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "refactor",
|
|
65
|
+
"release": "patch"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"type": "style",
|
|
69
|
+
"release": "patch"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"type": "test",
|
|
73
|
+
"release": "patch"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
],
|
|
40
78
|
"@semantic-release/release-notes-generator",
|
|
41
79
|
[
|
|
42
80
|
"@semantic-release/changelog",
|
|
@@ -46,21 +84,17 @@
|
|
|
46
84
|
],
|
|
47
85
|
"@semantic-release/npm",
|
|
48
86
|
[
|
|
49
|
-
"@semantic-release/
|
|
87
|
+
"@semantic-release/git",
|
|
50
88
|
{
|
|
51
89
|
"assets": [
|
|
52
|
-
"dist",
|
|
53
|
-
"docs",
|
|
54
90
|
"package.json",
|
|
55
91
|
"package-lock.json",
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"LICENSE",
|
|
60
|
-
"README.md"
|
|
61
|
-
]
|
|
92
|
+
"CHANGELOG.md"
|
|
93
|
+
],
|
|
94
|
+
"message": "chore(version): release ${nextRelease.version} [skip ci]"
|
|
62
95
|
}
|
|
63
|
-
]
|
|
96
|
+
],
|
|
97
|
+
"@semantic-release/github"
|
|
64
98
|
]
|
|
65
99
|
},
|
|
66
100
|
"commitlint": {
|
|
@@ -114,7 +148,7 @@
|
|
|
114
148
|
},
|
|
115
149
|
"homepage": "https://github.com/orchestr-sh/orchestr#readme",
|
|
116
150
|
"engines": {
|
|
117
|
-
"node": ">=22.
|
|
151
|
+
"node": ">=22.14.0"
|
|
118
152
|
},
|
|
119
153
|
"dependencies": {
|
|
120
154
|
"drizzle-orm": ">=0.30.0",
|
|
@@ -128,9 +162,9 @@
|
|
|
128
162
|
"@vitest/coverage-v8": "^4.1.2",
|
|
129
163
|
"husky": "^9.1.7",
|
|
130
164
|
"lint-staged": "^16.4.0",
|
|
131
|
-
"oxfmt": "^0.
|
|
132
|
-
"oxlint": "^1.
|
|
133
|
-
"oxlint-tsgolint": "^0.
|
|
165
|
+
"oxfmt": "^0.44.0",
|
|
166
|
+
"oxlint": "^1.59.0",
|
|
167
|
+
"oxlint-tsgolint": "^0.20.0",
|
|
134
168
|
"tsdown": "^0.21.7",
|
|
135
169
|
"tsx": "^4.21.0",
|
|
136
170
|
"typescript": "^6.0.2",
|