@stndrds/schema 1.0.0-alpha.195 → 1.0.0-alpha.196

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/index.d.mts CHANGED
@@ -5096,6 +5096,12 @@ declare class RollupAttributeBuilder<TName extends string> extends BaseAttribute
5096
5096
  * @param options - The options array from the target attribute
5097
5097
  */
5098
5098
  targetOptions(options: Option[]): this;
5099
+ /**
5100
+ * Build the attribute, validating computed-field configuration eagerly so a
5101
+ * misconfiguration surfaces at schema-definition time (with a fix-it hint)
5102
+ * rather than as an opaque runtime 500 when the rollup is first evaluated.
5103
+ */
5104
+ build(): RollupAttribute;
5099
5105
  required(): any;
5100
5106
  optional(): any;
5101
5107
  }
package/dist/index.d.ts CHANGED
@@ -5096,6 +5096,12 @@ declare class RollupAttributeBuilder<TName extends string> extends BaseAttribute
5096
5096
  * @param options - The options array from the target attribute
5097
5097
  */
5098
5098
  targetOptions(options: Option[]): this;
5099
+ /**
5100
+ * Build the attribute, validating computed-field configuration eagerly so a
5101
+ * misconfiguration surfaces at schema-definition time (with a fix-it hint)
5102
+ * rather than as an opaque runtime 500 when the rollup is first evaluated.
5103
+ */
5104
+ build(): RollupAttribute;
5099
5105
  required(): any;
5100
5106
  optional(): any;
5101
5107
  }
package/dist/index.js CHANGED
@@ -1970,6 +1970,24 @@ var RollupAttributeBuilder = class extends BaseAttributeBuilder {
1970
1970
  this.attr.targetAttributeOptions = options;
1971
1971
  return this;
1972
1972
  }
1973
+ /**
1974
+ * Build the attribute, validating computed-field configuration eagerly so a
1975
+ * misconfiguration surfaces at schema-definition time (with a fix-it hint)
1976
+ * rather than as an opaque runtime 500 when the rollup is first evaluated.
1977
+ */
1978
+ build() {
1979
+ const fn = this.attr.function;
1980
+ const targetType = this.attr.targetAttributeType;
1981
+ if (fn === "original" && targetType !== void 0 && targetType !== "select" && targetType !== "status" && targetType !== "multiselect") {
1982
+ const relation2 = this.attr.relationAttribute ?? "relation";
1983
+ const target = this.attr.targetAttribute ?? "field";
1984
+ throw new chunkMZOEL7FN_js.SchemaError(
1985
+ `Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${targetType}") was given. To surface a plain ${targetType} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${relation2}.${target}").`,
1986
+ chunkMZOEL7FN_js.SchemaErrorCode.VALIDATION_FAILED
1987
+ );
1988
+ }
1989
+ return super.build();
1990
+ }
1973
1991
  // Override to prevent making rollups required
1974
1992
  // biome-ignore lint/suspicious/noExplicitAny: intentional override
1975
1993
  required() {
package/dist/index.mjs CHANGED
@@ -1966,6 +1966,24 @@ var RollupAttributeBuilder = class extends BaseAttributeBuilder {
1966
1966
  this.attr.targetAttributeOptions = options;
1967
1967
  return this;
1968
1968
  }
1969
+ /**
1970
+ * Build the attribute, validating computed-field configuration eagerly so a
1971
+ * misconfiguration surfaces at schema-definition time (with a fix-it hint)
1972
+ * rather than as an opaque runtime 500 when the rollup is first evaluated.
1973
+ */
1974
+ build() {
1975
+ const fn = this.attr.function;
1976
+ const targetType = this.attr.targetAttributeType;
1977
+ if (fn === "original" && targetType !== void 0 && targetType !== "select" && targetType !== "status" && targetType !== "multiselect") {
1978
+ const relation2 = this.attr.relationAttribute ?? "relation";
1979
+ const target = this.attr.targetAttribute ?? "field";
1980
+ throw new SchemaError(
1981
+ `Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${targetType}") was given. To surface a plain ${targetType} value from a related record, use a formula instead \u2014 e.g. formula({ name: "${this.attr.name}", label: "\u2026" }).expression("${relation2}.${target}").`,
1982
+ SchemaErrorCode.VALIDATION_FAILED
1983
+ );
1984
+ }
1985
+ return super.build();
1986
+ }
1969
1987
  // Override to prevent making rollups required
1970
1988
  // biome-ignore lint/suspicious/noExplicitAny: intentional override
1971
1989
  required() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stndrds/schema",
3
- "version": "1.0.0-alpha.195",
3
+ "version": "1.0.0-alpha.196",
4
4
  "description": "Standard schema definitions and utilities",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -120,7 +120,7 @@
120
120
  "@standard-schema/spec": "^1.1.0",
121
121
  "libphonenumber-js": "^1.12.31",
122
122
  "zod": "^4.2.1",
123
- "@stndrds/constants": "1.0.0-alpha.195"
123
+ "@stndrds/constants": "1.0.0-alpha.196"
124
124
  },
125
125
  "devDependencies": {
126
126
  "@types/node": "^25.0.3",