@omnifyjp/omnify 5.1.0 → 5.1.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/omnify-config-schema.json +48 -0
- package/package.json +6 -6
- package/types/config.d.ts +57 -0
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
"$ref": "#/definitions/FileConfig",
|
|
64
64
|
"description": "File upload configuration for polymorphic file attachments"
|
|
65
65
|
},
|
|
66
|
+
"audit": {
|
|
67
|
+
"$ref": "#/definitions/AuditConfig",
|
|
68
|
+
"description": "Audit columns (created_by_id / updated_by_id / deleted_by_id) and audit-log history table feature (issue #94)"
|
|
69
|
+
},
|
|
66
70
|
"verbose": {
|
|
67
71
|
"type": "boolean",
|
|
68
72
|
"default": false,
|
|
@@ -101,6 +105,50 @@
|
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
},
|
|
108
|
+
"AuditConfig": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"additionalProperties": false,
|
|
111
|
+
"properties": {
|
|
112
|
+
"model": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "Schema name of the actor / user model (must have options.authenticatable: true). Required when log: true."
|
|
115
|
+
},
|
|
116
|
+
"createdBy": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"default": false,
|
|
119
|
+
"description": "Global default for the created_by_id audit column. Per-schema options.audit.createdBy overrides."
|
|
120
|
+
},
|
|
121
|
+
"updatedBy": {
|
|
122
|
+
"type": "boolean",
|
|
123
|
+
"default": false,
|
|
124
|
+
"description": "Global default for the updated_by_id audit column. Per-schema options.audit.updatedBy overrides."
|
|
125
|
+
},
|
|
126
|
+
"deletedBy": {
|
|
127
|
+
"type": "boolean",
|
|
128
|
+
"default": false,
|
|
129
|
+
"description": "Global default for the deleted_by_id audit column. Per-schema options.audit.deletedBy overrides."
|
|
130
|
+
},
|
|
131
|
+
"log": {
|
|
132
|
+
"type": "boolean",
|
|
133
|
+
"default": false,
|
|
134
|
+
"description": "Toggle the audits-history table feature globally (issue #94). Per-schema options.audit.log overrides. Records every model lifecycle event into a single polymorphic audits table."
|
|
135
|
+
},
|
|
136
|
+
"logExclude": {
|
|
137
|
+
"type": "array",
|
|
138
|
+
"items": { "type": "string" },
|
|
139
|
+
"description": "Additional sensitive columns scrubbed from old_values / new_values BEFORE audit row is written. Built-in defaults (password, remember_token, api_token, two_factor_secret, two_factor_recovery_codes) are always merged in — your list ADDS to them, never replaces."
|
|
140
|
+
},
|
|
141
|
+
"logRetention": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"pattern": "^[0-9]+[dwmy]$",
|
|
144
|
+
"description": "Prunable retention period: '90d', '12w', '6m', '1y'. Empty string keeps audits forever (no scheduled prune)."
|
|
145
|
+
},
|
|
146
|
+
"logQueue": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"description": "Laravel queue connection name for WriteAuditLog dispatch. Empty string forces synchronous dispatch — only acceptable in dev / low-traffic apps. Production should set a queue backed by a real driver (redis, sqs, etc.)."
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
104
152
|
"PackageConfig": {
|
|
105
153
|
"type": "object",
|
|
106
154
|
"properties": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnifyjp/omnify",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"description": "Schema-driven code generation for Laravel, TypeScript, and SQL",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"zod": "^3.24.0"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@omnifyjp/omnify-darwin-arm64": "5.1.
|
|
40
|
-
"@omnifyjp/omnify-darwin-x64": "5.1.
|
|
41
|
-
"@omnifyjp/omnify-linux-x64": "5.1.
|
|
42
|
-
"@omnifyjp/omnify-linux-arm64": "5.1.
|
|
43
|
-
"@omnifyjp/omnify-win32-x64": "5.1.
|
|
39
|
+
"@omnifyjp/omnify-darwin-arm64": "5.1.1",
|
|
40
|
+
"@omnifyjp/omnify-darwin-x64": "5.1.1",
|
|
41
|
+
"@omnifyjp/omnify-linux-x64": "5.1.1",
|
|
42
|
+
"@omnifyjp/omnify-linux-arm64": "5.1.1",
|
|
43
|
+
"@omnifyjp/omnify-win32-x64": "5.1.1"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -95,6 +95,61 @@ export interface CodegenConfig {
|
|
|
95
95
|
laravel?: CodegenLaravelConfig;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Audit configuration. Two related features in one block:
|
|
100
|
+
*
|
|
101
|
+
* - The `created_by_id` / `updated_by_id` / `deleted_by_id` columns
|
|
102
|
+
* auto-populated from `auth()->user()` (createdBy / updatedBy /
|
|
103
|
+
* deletedBy toggles).
|
|
104
|
+
* - The `audits` history table that records every model lifecycle
|
|
105
|
+
* event into a single polymorphic table for compliance / debugging
|
|
106
|
+
* (issue #94 — log / logExclude / logRetention / logQueue).
|
|
107
|
+
*
|
|
108
|
+
* Per-schema overrides live under `options.audit:` in each schema YAML.
|
|
109
|
+
*/
|
|
110
|
+
export interface AuditConfig {
|
|
111
|
+
/**
|
|
112
|
+
* Schema name of the actor / user model (typically `User`). Required
|
|
113
|
+
* when `log: true` because the audits row records the polymorphic
|
|
114
|
+
* `(user_type, user_id)` of the writer. The referenced schema MUST
|
|
115
|
+
* have `options.authenticatable: true`.
|
|
116
|
+
*/
|
|
117
|
+
model?: string;
|
|
118
|
+
/** Global default for the `created_by_id` audit column. */
|
|
119
|
+
createdBy?: boolean;
|
|
120
|
+
/** Global default for the `updated_by_id` audit column. */
|
|
121
|
+
updatedBy?: boolean;
|
|
122
|
+
/** Global default for the `deleted_by_id` audit column. */
|
|
123
|
+
deletedBy?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Toggle the audits-history table feature globally. Per-schema
|
|
126
|
+
* `options.audit.log` overrides. Records created / updated / deleted
|
|
127
|
+
* / restored events into a single polymorphic `audits` table.
|
|
128
|
+
*/
|
|
129
|
+
log?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Additional sensitive columns scrubbed from `old_values` /
|
|
132
|
+
* `new_values` BEFORE the audit row is built. Built-in defaults
|
|
133
|
+
* (`password`, `remember_token`, `api_token`, `two_factor_secret`,
|
|
134
|
+
* `two_factor_recovery_codes`) are always merged in — your list ADDS
|
|
135
|
+
* to them, never replaces.
|
|
136
|
+
*/
|
|
137
|
+
logExclude?: string[];
|
|
138
|
+
/**
|
|
139
|
+
* Prunable retention period (`90d` / `12w` / `6m` / `1y`). Empty
|
|
140
|
+
* string keeps audits forever (no scheduled prune). Format is
|
|
141
|
+
* validated; bad input fails generation.
|
|
142
|
+
*/
|
|
143
|
+
logRetention?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Laravel queue connection name for the WriteAuditLog job. Empty
|
|
146
|
+
* string forces synchronous dispatch — only acceptable in dev /
|
|
147
|
+
* low-traffic apps. Production should use a queue backed by a real
|
|
148
|
+
* driver (redis, sqs, etc.).
|
|
149
|
+
*/
|
|
150
|
+
logQueue?: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
98
153
|
/** External schema package configuration. */
|
|
99
154
|
export interface PackageConfig {
|
|
100
155
|
/** Path to package root (short form: auto-discovers omnify.yaml inside). */
|
|
@@ -137,6 +192,8 @@ export interface OmnifyConfig {
|
|
|
137
192
|
compoundTypes?: string[];
|
|
138
193
|
/** Code generation configuration (connection-independent). */
|
|
139
194
|
codegen?: CodegenConfig;
|
|
195
|
+
/** Audit columns + audit-log history table feature (issue #94). */
|
|
196
|
+
audit?: AuditConfig;
|
|
140
197
|
/** Package mode: stable deterministic timestamps for all Laravel migrations. Issue #60. */
|
|
141
198
|
package?: boolean;
|
|
142
199
|
/** Enable verbose output during generation. */
|