@stndrds/schema 1.0.0-alpha.171 → 1.0.0-alpha.173
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/dist/{chunk-SS2NR6DH.mjs → chunk-U4JC7P6D.mjs} +31 -2
- package/dist/{chunk-V6DE3MXC.js → chunk-YQROI4IE.js} +31 -2
- package/dist/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +23 -7
- package/dist/index.mjs +22 -6
- package/dist/validation/all.js +2 -2
- package/dist/validation/all.mjs +1 -1
- package/dist/validation/config/index.js +4 -4
- package/dist/validation/config/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -96,7 +96,13 @@ var relationConfigSchema = baseConfigSchema.extend({
|
|
|
96
96
|
targets: z.array(relationTargetSchema).min(1),
|
|
97
97
|
cardinality: z.enum(["one", "many"]),
|
|
98
98
|
minItems: z.number().int().min(0).optional(),
|
|
99
|
-
maxItems: z.number().int().min(1).optional()
|
|
99
|
+
maxItems: z.number().int().min(1).optional(),
|
|
100
|
+
/**
|
|
101
|
+
* PropertySchema declared via `.qualifyWith()`. Pass-through; structural
|
|
102
|
+
* validation happens at the builder level — see `propertySchemaPassthrough`
|
|
103
|
+
* comment further below for the rationale.
|
|
104
|
+
*/
|
|
105
|
+
properties: z.object({ definitions: z.array(z.record(z.string(), z.unknown())) }).passthrough().optional()
|
|
100
106
|
});
|
|
101
107
|
var ratingConfigSchema = baseConfigSchema.extend({
|
|
102
108
|
max: z.number().int().min(1).optional(),
|
|
@@ -139,10 +145,33 @@ var rollupConfigSchema = baseConfigSchema.extend({
|
|
|
139
145
|
})
|
|
140
146
|
).optional()
|
|
141
147
|
});
|
|
148
|
+
var propertySchemaPassthrough = z.object({ definitions: z.array(z.record(z.string(), z.unknown())) }).passthrough();
|
|
149
|
+
var attributePassthrough = z.record(z.string(), z.unknown());
|
|
150
|
+
var documentSlotConfigPassthrough = z.object({
|
|
151
|
+
name: z.string(),
|
|
152
|
+
label: z.string().optional(),
|
|
153
|
+
description: z.string().optional(),
|
|
154
|
+
required: z.boolean().optional(),
|
|
155
|
+
acceptedMimeTypes: z.array(z.string()).optional(),
|
|
156
|
+
maxSizeBytes: z.number().optional()
|
|
157
|
+
}).passthrough();
|
|
142
158
|
var documentConfigSchema = baseConfigSchema.extend({
|
|
143
159
|
multiple: z.boolean().optional(),
|
|
144
160
|
maxDocuments: z.number().int().min(1).optional(),
|
|
145
|
-
autoProcess: z.boolean().optional()
|
|
161
|
+
autoProcess: z.boolean().optional(),
|
|
162
|
+
/**
|
|
163
|
+
* PropertySchema declared via `.qualifyWith()` on a document attribute.
|
|
164
|
+
* Drives hydration into `[{id, props}]` shape and write-time validation.
|
|
165
|
+
*/
|
|
166
|
+
properties: propertySchemaPassthrough.optional(),
|
|
167
|
+
/**
|
|
168
|
+
* Legacy per-document attribute definitions via `.attribute(...)`.
|
|
169
|
+
* Kept for backward compatibility; the builder also mirrors property-typed
|
|
170
|
+
* entries into `properties.definitions`.
|
|
171
|
+
*/
|
|
172
|
+
attributes: z.array(attributePassthrough).optional(),
|
|
173
|
+
/** File slots declared via `.slots(...)`. */
|
|
174
|
+
slots: z.array(documentSlotConfigPassthrough).optional()
|
|
146
175
|
});
|
|
147
176
|
var attributeConfigSchemas = {
|
|
148
177
|
text: textConfigSchema,
|
|
@@ -98,7 +98,13 @@ var relationConfigSchema = baseConfigSchema.extend({
|
|
|
98
98
|
targets: zod.z.array(relationTargetSchema).min(1),
|
|
99
99
|
cardinality: zod.z.enum(["one", "many"]),
|
|
100
100
|
minItems: zod.z.number().int().min(0).optional(),
|
|
101
|
-
maxItems: zod.z.number().int().min(1).optional()
|
|
101
|
+
maxItems: zod.z.number().int().min(1).optional(),
|
|
102
|
+
/**
|
|
103
|
+
* PropertySchema declared via `.qualifyWith()`. Pass-through; structural
|
|
104
|
+
* validation happens at the builder level — see `propertySchemaPassthrough`
|
|
105
|
+
* comment further below for the rationale.
|
|
106
|
+
*/
|
|
107
|
+
properties: zod.z.object({ definitions: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())) }).passthrough().optional()
|
|
102
108
|
});
|
|
103
109
|
var ratingConfigSchema = baseConfigSchema.extend({
|
|
104
110
|
max: zod.z.number().int().min(1).optional(),
|
|
@@ -141,10 +147,33 @@ var rollupConfigSchema = baseConfigSchema.extend({
|
|
|
141
147
|
})
|
|
142
148
|
).optional()
|
|
143
149
|
});
|
|
150
|
+
var propertySchemaPassthrough = zod.z.object({ definitions: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown())) }).passthrough();
|
|
151
|
+
var attributePassthrough = zod.z.record(zod.z.string(), zod.z.unknown());
|
|
152
|
+
var documentSlotConfigPassthrough = zod.z.object({
|
|
153
|
+
name: zod.z.string(),
|
|
154
|
+
label: zod.z.string().optional(),
|
|
155
|
+
description: zod.z.string().optional(),
|
|
156
|
+
required: zod.z.boolean().optional(),
|
|
157
|
+
acceptedMimeTypes: zod.z.array(zod.z.string()).optional(),
|
|
158
|
+
maxSizeBytes: zod.z.number().optional()
|
|
159
|
+
}).passthrough();
|
|
144
160
|
var documentConfigSchema = baseConfigSchema.extend({
|
|
145
161
|
multiple: zod.z.boolean().optional(),
|
|
146
162
|
maxDocuments: zod.z.number().int().min(1).optional(),
|
|
147
|
-
autoProcess: zod.z.boolean().optional()
|
|
163
|
+
autoProcess: zod.z.boolean().optional(),
|
|
164
|
+
/**
|
|
165
|
+
* PropertySchema declared via `.qualifyWith()` on a document attribute.
|
|
166
|
+
* Drives hydration into `[{id, props}]` shape and write-time validation.
|
|
167
|
+
*/
|
|
168
|
+
properties: propertySchemaPassthrough.optional(),
|
|
169
|
+
/**
|
|
170
|
+
* Legacy per-document attribute definitions via `.attribute(...)`.
|
|
171
|
+
* Kept for backward compatibility; the builder also mirrors property-typed
|
|
172
|
+
* entries into `properties.definitions`.
|
|
173
|
+
*/
|
|
174
|
+
attributes: zod.z.array(attributePassthrough).optional(),
|
|
175
|
+
/** File slots declared via `.slots(...)`. */
|
|
176
|
+
slots: zod.z.array(documentSlotConfigPassthrough).optional()
|
|
148
177
|
});
|
|
149
178
|
var attributeConfigSchemas = {
|
|
150
179
|
text: textConfigSchema,
|
package/dist/index.d.mts
CHANGED
|
@@ -4276,8 +4276,17 @@ declare class DocumentAttributeBuilder<TName extends string, TRequired extends b
|
|
|
4276
4276
|
*/
|
|
4277
4277
|
slots(configs: DocumentSlotConfig[]): this;
|
|
4278
4278
|
/**
|
|
4279
|
-
* Add a child attribute
|
|
4280
|
-
*
|
|
4279
|
+
* Add a child attribute that qualifies the record→document edge.
|
|
4280
|
+
*
|
|
4281
|
+
* Equivalent to `.qualifyWith(builder)` for a single attribute, with the
|
|
4282
|
+
* difference that the accepted type is broader (`Attribute`) and the
|
|
4283
|
+
* accumulation is mutating rather than type-tracking. When the produced
|
|
4284
|
+
* attribute is one of the `ALLOWED_PROPERTY_TYPES`, it is also pushed
|
|
4285
|
+
* onto `attribute.properties.definitions`, so hydration and validation
|
|
4286
|
+
* treat the document as qualified — same effect as `.qualifyWith()`.
|
|
4287
|
+
*
|
|
4288
|
+
* Both `attribute.attributes` and `attribute.properties` are populated to
|
|
4289
|
+
* keep backwards compatibility with consumers that read either field.
|
|
4281
4290
|
*
|
|
4282
4291
|
* @example
|
|
4283
4292
|
* document({ name: "invoices" })
|
package/dist/index.d.ts
CHANGED
|
@@ -4276,8 +4276,17 @@ declare class DocumentAttributeBuilder<TName extends string, TRequired extends b
|
|
|
4276
4276
|
*/
|
|
4277
4277
|
slots(configs: DocumentSlotConfig[]): this;
|
|
4278
4278
|
/**
|
|
4279
|
-
* Add a child attribute
|
|
4280
|
-
*
|
|
4279
|
+
* Add a child attribute that qualifies the record→document edge.
|
|
4280
|
+
*
|
|
4281
|
+
* Equivalent to `.qualifyWith(builder)` for a single attribute, with the
|
|
4282
|
+
* difference that the accepted type is broader (`Attribute`) and the
|
|
4283
|
+
* accumulation is mutating rather than type-tracking. When the produced
|
|
4284
|
+
* attribute is one of the `ALLOWED_PROPERTY_TYPES`, it is also pushed
|
|
4285
|
+
* onto `attribute.properties.definitions`, so hydration and validation
|
|
4286
|
+
* treat the document as qualified — same effect as `.qualifyWith()`.
|
|
4287
|
+
*
|
|
4288
|
+
* Both `attribute.attributes` and `attribute.properties` are populated to
|
|
4289
|
+
* keep backwards compatibility with consumers that read either field.
|
|
4281
4290
|
*
|
|
4282
4291
|
* @example
|
|
4283
4292
|
* document({ name: "invoices" })
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkFRCDMQER_js = require('./chunk-FRCDMQER.js');
|
|
4
4
|
require('./chunk-PGERPYDR.js');
|
|
5
|
-
var
|
|
5
|
+
var chunkYQROI4IE_js = require('./chunk-YQROI4IE.js');
|
|
6
6
|
var chunk64R5X3DF_js = require('./chunk-64R5X3DF.js');
|
|
7
7
|
require('./chunk-MAKSIK3P.js');
|
|
8
8
|
require('./chunk-J5HRK3WD.js');
|
|
@@ -2180,8 +2180,17 @@ var DocumentAttributeBuilder = class extends BaseAttributeBuilder {
|
|
|
2180
2180
|
return this;
|
|
2181
2181
|
}
|
|
2182
2182
|
/**
|
|
2183
|
-
* Add a child attribute
|
|
2184
|
-
*
|
|
2183
|
+
* Add a child attribute that qualifies the record→document edge.
|
|
2184
|
+
*
|
|
2185
|
+
* Equivalent to `.qualifyWith(builder)` for a single attribute, with the
|
|
2186
|
+
* difference that the accepted type is broader (`Attribute`) and the
|
|
2187
|
+
* accumulation is mutating rather than type-tracking. When the produced
|
|
2188
|
+
* attribute is one of the `ALLOWED_PROPERTY_TYPES`, it is also pushed
|
|
2189
|
+
* onto `attribute.properties.definitions`, so hydration and validation
|
|
2190
|
+
* treat the document as qualified — same effect as `.qualifyWith()`.
|
|
2191
|
+
*
|
|
2192
|
+
* Both `attribute.attributes` and `attribute.properties` are populated to
|
|
2193
|
+
* keep backwards compatibility with consumers that read either field.
|
|
2185
2194
|
*
|
|
2186
2195
|
* @example
|
|
2187
2196
|
* document({ name: "invoices" })
|
|
@@ -2189,10 +2198,17 @@ var DocumentAttributeBuilder = class extends BaseAttributeBuilder {
|
|
|
2189
2198
|
* .attribute(select({ name: "status", label: "Statut" }).options([...]))
|
|
2190
2199
|
*/
|
|
2191
2200
|
attribute(builder) {
|
|
2192
|
-
|
|
2193
|
-
|
|
2201
|
+
const built = builder.build();
|
|
2202
|
+
if (!this.attr.attributes) this.attr.attributes = [];
|
|
2203
|
+
this.attr.attributes = [...this.attr.attributes, built];
|
|
2204
|
+
if (ALLOWED_PROPERTY_TYPES.includes(built.type)) {
|
|
2205
|
+
const props = this.attr.properties ?? {
|
|
2206
|
+
definitions: []
|
|
2207
|
+
};
|
|
2208
|
+
this.attr.properties = {
|
|
2209
|
+
definitions: [...props.definitions, built]
|
|
2210
|
+
};
|
|
2194
2211
|
}
|
|
2195
|
-
this.attr.attributes = [...this.attr.attributes, builder.build()];
|
|
2196
2212
|
return this;
|
|
2197
2213
|
}
|
|
2198
2214
|
/**
|
|
@@ -5593,7 +5609,7 @@ Object.defineProperty(exports, "indexBy", {
|
|
|
5593
5609
|
});
|
|
5594
5610
|
Object.defineProperty(exports, "parseAttributeConfig", {
|
|
5595
5611
|
enumerable: true,
|
|
5596
|
-
get: function () { return
|
|
5612
|
+
get: function () { return chunkYQROI4IE_js.parseAttributeConfig; }
|
|
5597
5613
|
});
|
|
5598
5614
|
Object.defineProperty(exports, "computeRecordStatus", {
|
|
5599
5615
|
enumerable: true,
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { generateId } from './chunk-QY6QFRRV.mjs';
|
|
2
2
|
export { asTenantId, asUserId, deepEqual, generateId, indexBy } from './chunk-QY6QFRRV.mjs';
|
|
3
3
|
import './chunk-SP3PNHYF.mjs';
|
|
4
|
-
export { parseAttributeConfig } from './chunk-
|
|
4
|
+
export { parseAttributeConfig } from './chunk-U4JC7P6D.mjs';
|
|
5
5
|
import { createObjectValidator, createAttributeValidator } from './chunk-6JEQE4IP.mjs';
|
|
6
6
|
export { computeRecordStatus, createFormAttributeValidator, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from './chunk-6JEQE4IP.mjs';
|
|
7
7
|
import './chunk-TMYBEXBT.mjs';
|
|
@@ -2176,8 +2176,17 @@ var DocumentAttributeBuilder = class extends BaseAttributeBuilder {
|
|
|
2176
2176
|
return this;
|
|
2177
2177
|
}
|
|
2178
2178
|
/**
|
|
2179
|
-
* Add a child attribute
|
|
2180
|
-
*
|
|
2179
|
+
* Add a child attribute that qualifies the record→document edge.
|
|
2180
|
+
*
|
|
2181
|
+
* Equivalent to `.qualifyWith(builder)` for a single attribute, with the
|
|
2182
|
+
* difference that the accepted type is broader (`Attribute`) and the
|
|
2183
|
+
* accumulation is mutating rather than type-tracking. When the produced
|
|
2184
|
+
* attribute is one of the `ALLOWED_PROPERTY_TYPES`, it is also pushed
|
|
2185
|
+
* onto `attribute.properties.definitions`, so hydration and validation
|
|
2186
|
+
* treat the document as qualified — same effect as `.qualifyWith()`.
|
|
2187
|
+
*
|
|
2188
|
+
* Both `attribute.attributes` and `attribute.properties` are populated to
|
|
2189
|
+
* keep backwards compatibility with consumers that read either field.
|
|
2181
2190
|
*
|
|
2182
2191
|
* @example
|
|
2183
2192
|
* document({ name: "invoices" })
|
|
@@ -2185,10 +2194,17 @@ var DocumentAttributeBuilder = class extends BaseAttributeBuilder {
|
|
|
2185
2194
|
* .attribute(select({ name: "status", label: "Statut" }).options([...]))
|
|
2186
2195
|
*/
|
|
2187
2196
|
attribute(builder) {
|
|
2188
|
-
|
|
2189
|
-
|
|
2197
|
+
const built = builder.build();
|
|
2198
|
+
if (!this.attr.attributes) this.attr.attributes = [];
|
|
2199
|
+
this.attr.attributes = [...this.attr.attributes, built];
|
|
2200
|
+
if (ALLOWED_PROPERTY_TYPES.includes(built.type)) {
|
|
2201
|
+
const props = this.attr.properties ?? {
|
|
2202
|
+
definitions: []
|
|
2203
|
+
};
|
|
2204
|
+
this.attr.properties = {
|
|
2205
|
+
definitions: [...props.definitions, built]
|
|
2206
|
+
};
|
|
2190
2207
|
}
|
|
2191
|
-
this.attr.attributes = [...this.attr.attributes, builder.build()];
|
|
2192
2208
|
return this;
|
|
2193
2209
|
}
|
|
2194
2210
|
/**
|
package/dist/validation/all.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../chunk-PGERPYDR.js');
|
|
4
|
-
var
|
|
4
|
+
var chunkYQROI4IE_js = require('../chunk-YQROI4IE.js');
|
|
5
5
|
var chunk64R5X3DF_js = require('../chunk-64R5X3DF.js');
|
|
6
6
|
require('../chunk-MAKSIK3P.js');
|
|
7
7
|
require('../chunk-J5HRK3WD.js');
|
|
@@ -24,7 +24,7 @@ var chunkT225DB55_js = require('../chunk-T225DB55.js');
|
|
|
24
24
|
|
|
25
25
|
Object.defineProperty(exports, "parseAttributeConfig", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkYQROI4IE_js.parseAttributeConfig; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "computeRecordStatus", {
|
|
30
30
|
enumerable: true,
|
package/dist/validation/all.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../chunk-SP3PNHYF.mjs';
|
|
2
|
-
export { parseAttributeConfig } from '../chunk-
|
|
2
|
+
export { parseAttributeConfig } from '../chunk-U4JC7P6D.mjs';
|
|
3
3
|
export { computeRecordStatus, createFormAttributeValidator, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from '../chunk-6JEQE4IP.mjs';
|
|
4
4
|
import '../chunk-TMYBEXBT.mjs';
|
|
5
5
|
import '../chunk-4KRLCWJM.mjs';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkYQROI4IE_js = require('../../chunk-YQROI4IE.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "attributeConfigSchemas", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkYQROI4IE_js.attributeConfigSchemas; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getAttributeConfigSchema", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkYQROI4IE_js.getAttributeConfigSchema; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "parseAttributeConfig", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkYQROI4IE_js.parseAttributeConfig; }
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { attributeConfigSchemas, getAttributeConfigSchema, parseAttributeConfig } from '../../chunk-
|
|
1
|
+
export { attributeConfigSchemas, getAttributeConfigSchema, parseAttributeConfig } from '../../chunk-U4JC7P6D.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stndrds/schema",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.173",
|
|
4
4
|
"description": "Standard schema definitions and utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"expr-eval": "^2.0.2",
|
|
132
132
|
"libphonenumber-js": "^1.12.31",
|
|
133
133
|
"zod": "^4.2.1",
|
|
134
|
-
"@stndrds/constants": "1.0.0-alpha.
|
|
134
|
+
"@stndrds/constants": "1.0.0-alpha.173"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
137
|
"@types/node": "^25.0.3",
|