@famgia/omnify-laravel 0.0.126 β 0.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@famgia/omnify-laravel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.131",
|
|
4
4
|
"description": "Laravel migration and TypeScript type generator for omnify-schema",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,11 +24,6 @@
|
|
|
24
24
|
"stubs",
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@famgia/omnify-types": "0.0.115",
|
|
29
|
-
"@famgia/omnify-atlas": "0.0.111",
|
|
30
|
-
"@famgia/omnify-core": "0.0.117"
|
|
31
|
-
},
|
|
32
27
|
"scripts": {
|
|
33
28
|
"build": "tsup",
|
|
34
29
|
"clean": "rm -rf dist",
|
|
@@ -37,5 +32,10 @@
|
|
|
37
32
|
"lint": "eslint src",
|
|
38
33
|
"typecheck": "tsc --noEmit",
|
|
39
34
|
"postinstall": "node scripts/postinstall.js"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@famgia/omnify-types": "workspace:*",
|
|
38
|
+
"@famgia/omnify-core": "workspace:*",
|
|
39
|
+
"@famgia/omnify-atlas": "workspace:*"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
|
@@ -371,3 +371,76 @@ status:
|
|
|
371
371
|
status:
|
|
372
372
|
type: PostStatus # Reference enum schema
|
|
373
373
|
```
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## π Partial Schema (External Package Connection)
|
|
378
|
+
|
|
379
|
+
When referencing schemas from external packages that aren't loaded:
|
|
380
|
+
|
|
381
|
+
```yaml
|
|
382
|
+
# schemas/stubs/User.yaml
|
|
383
|
+
# Create stub to connect to external User schema
|
|
384
|
+
name: User
|
|
385
|
+
kind: partial
|
|
386
|
+
target: User # Same name = standalone schema
|
|
387
|
+
|
|
388
|
+
properties:
|
|
389
|
+
email:
|
|
390
|
+
type: Email
|
|
391
|
+
displayName:
|
|
392
|
+
ja: γ‘γΌγ«
|
|
393
|
+
en: Email
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Now you can use `User` in relationships:
|
|
397
|
+
|
|
398
|
+
```yaml
|
|
399
|
+
# schemas/blog/Post.yaml
|
|
400
|
+
author:
|
|
401
|
+
type: User # β
Works! User exists as partial
|
|
402
|
+
relation: belongsTo
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Extend Package Schema
|
|
406
|
+
|
|
407
|
+
```yaml
|
|
408
|
+
# schemas/extensions/User.yaml
|
|
409
|
+
name: User
|
|
410
|
+
kind: partial
|
|
411
|
+
target: User # Extend the User schema
|
|
412
|
+
|
|
413
|
+
properties:
|
|
414
|
+
# Add custom properties
|
|
415
|
+
avatar_url:
|
|
416
|
+
type: String
|
|
417
|
+
nullable: true
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## π¦ Register Schemas from Laravel Package
|
|
423
|
+
|
|
424
|
+
In your package's ServiceProvider:
|
|
425
|
+
|
|
426
|
+
```php
|
|
427
|
+
use App\Support\Omnify;
|
|
428
|
+
|
|
429
|
+
public function boot(): void
|
|
430
|
+
{
|
|
431
|
+
if (class_exists(Omnify::class)) {
|
|
432
|
+
Omnify::registerSchemaPath(
|
|
433
|
+
path: __DIR__ . '/../../schemas',
|
|
434
|
+
namespace: 'your-package'
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Export paths before generate:
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
php artisan omnify:sync
|
|
444
|
+
# Then
|
|
445
|
+
npx omnify generate
|
|
446
|
+
```
|