@stndrds/schema 1.0.0-alpha.203 → 1.0.0-alpha.205
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/{attributes-Cy9o_xM1.d.ts → attributes-BpvQ7YKV.d.ts} +28 -7
- package/dist/{attributes-Cn0v3e37.d.mts → attributes-BykLtzP-.d.mts} +28 -7
- package/dist/{chunk-PMKCDRRO.mjs → chunk-7SSN7BXS.mjs} +49 -10
- package/dist/{chunk-MZOEL7FN.js → chunk-SJCEXYFG.js} +49 -10
- package/dist/{helpers-LCnn6DG3.d.ts → helpers-Bd-m3ygv.d.ts} +2 -2
- package/dist/{helpers-CED0HyXm.d.mts → helpers-xalb2T4E.d.mts} +2 -2
- package/dist/index.d.mts +362 -337
- package/dist/index.d.ts +362 -337
- package/dist/index.js +199 -95
- package/dist/index.mjs +129 -37
- package/dist/{types-CORdDGpb.d.mts → types-BmgBJGpl.d.mts} +1 -1
- package/dist/{types-B12E9LFe.d.ts → types-DeFxYTDc.d.ts} +1 -1
- package/dist/validation/all.d.mts +3 -3
- package/dist/validation/all.d.ts +3 -3
- package/dist/validation/all.js +10 -10
- package/dist/validation/all.mjs +3 -3
- package/dist/validation/complex/currency.d.mts +2 -2
- package/dist/validation/complex/currency.d.ts +2 -2
- package/dist/validation/complex/file.d.mts +2 -2
- package/dist/validation/complex/file.d.ts +2 -2
- package/dist/validation/complex/location.d.mts +2 -2
- package/dist/validation/complex/location.d.ts +2 -2
- package/dist/validation/complex/phone.d.mts +2 -2
- package/dist/validation/complex/phone.d.ts +2 -2
- package/dist/validation/complex/relation.d.mts +2 -2
- package/dist/validation/complex/relation.d.ts +2 -2
- package/dist/validation/complex/richtext.d.mts +2 -2
- package/dist/validation/complex/richtext.d.ts +2 -2
- package/dist/validation/complex/select.d.mts +2 -2
- package/dist/validation/complex/select.d.ts +2 -2
- package/dist/validation/complex/user.d.mts +2 -2
- package/dist/validation/complex/user.d.ts +2 -2
- package/dist/validation/computed/formula.d.mts +2 -2
- package/dist/validation/computed/formula.d.ts +2 -2
- package/dist/validation/computed/rollup.d.mts +2 -2
- package/dist/validation/computed/rollup.d.ts +2 -2
- package/dist/validation/config/index.d.mts +1 -1
- package/dist/validation/config/index.d.ts +1 -1
- package/dist/validation/core/index.d.mts +3 -3
- package/dist/validation/core/index.d.ts +3 -3
- package/dist/validation/object/index.d.mts +3 -3
- package/dist/validation/object/index.d.ts +3 -3
- package/dist/validation/object/index.js +16 -16
- package/dist/validation/object/index.mjs +3 -3
- package/dist/validation/primitives/checkbox.d.mts +2 -2
- package/dist/validation/primitives/checkbox.d.ts +2 -2
- package/dist/validation/primitives/date.d.mts +2 -2
- package/dist/validation/primitives/date.d.ts +2 -2
- package/dist/validation/primitives/number.d.mts +2 -2
- package/dist/validation/primitives/number.d.ts +2 -2
- package/dist/validation/primitives/text.d.mts +2 -2
- package/dist/validation/primitives/text.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { IconName, CountryIso3, CurrencyCode, ColorId, MimeType } from '@stndrds/constants';
|
|
2
2
|
import { Uuid } from './utils.js';
|
|
3
3
|
|
|
4
|
+
type ComputedFormulaAstNode = ComputedFormulaLiteralNode | ComputedFormulaPathNode | ComputedFormulaCallNode | ComputedFormulaBinaryNode;
|
|
5
|
+
interface ComputedFormulaLiteralNode {
|
|
6
|
+
kind: "literal";
|
|
7
|
+
value: string | number | boolean | null;
|
|
8
|
+
}
|
|
9
|
+
interface ComputedFormulaPathNode {
|
|
10
|
+
kind: "path";
|
|
11
|
+
parts: string[];
|
|
12
|
+
}
|
|
13
|
+
interface ComputedFormulaCallNode {
|
|
14
|
+
kind: "call";
|
|
15
|
+
functionName: string;
|
|
16
|
+
args: ComputedFormulaAstNode[];
|
|
17
|
+
}
|
|
18
|
+
interface ComputedFormulaBinaryNode {
|
|
19
|
+
kind: "binary";
|
|
20
|
+
operator: ComputedFormulaBinaryOperator;
|
|
21
|
+
left: ComputedFormulaAstNode;
|
|
22
|
+
right: ComputedFormulaAstNode;
|
|
23
|
+
}
|
|
24
|
+
type ComputedFormulaBinaryOperator = ">" | "<" | ">=" | "<=" | "==" | "!=" | "+" | "-" | "*" | "/";
|
|
25
|
+
declare class ComputedFormulaParseError extends Error {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
declare function parseComputedFormula(expression: string): ComputedFormulaAstNode;
|
|
29
|
+
|
|
4
30
|
type ComputedReturnType = "text" | "number" | "boolean" | "date" | "select" | "multiselect";
|
|
5
31
|
type ComputedFieldKind = "formula" | "rollup";
|
|
6
32
|
type ComputedValueType = {
|
|
@@ -51,6 +77,7 @@ interface ComputedPlan {
|
|
|
51
77
|
optionsSource?: ComputedOptionsSource;
|
|
52
78
|
targetAttributeType?: AttributeType;
|
|
53
79
|
dependenciesHash: string;
|
|
80
|
+
ast?: ComputedFormulaAstNode;
|
|
54
81
|
}
|
|
55
82
|
|
|
56
83
|
interface DocumentLayout {
|
|
@@ -371,12 +398,6 @@ interface CreateDocumentLink {
|
|
|
371
398
|
objectName: string;
|
|
372
399
|
sourceRecordId: string;
|
|
373
400
|
attributeName: string;
|
|
374
|
-
/**
|
|
375
|
-
* Optional qualifyWith properties on the record→Document edge. Currently
|
|
376
|
-
* accepted by the controller DTO but silently ignored by the service (see
|
|
377
|
-
* `DocumentService.createDocument` — there's a TODO to support this).
|
|
378
|
-
*/
|
|
379
|
-
properties?: Record<string, unknown>;
|
|
380
401
|
}
|
|
381
402
|
interface UpdateDocument {
|
|
382
403
|
title?: string;
|
|
@@ -890,4 +911,4 @@ declare function isAttributeSortable(attr: {
|
|
|
890
911
|
type: AttributeType;
|
|
891
912
|
}): boolean;
|
|
892
913
|
|
|
893
|
-
export {
|
|
914
|
+
export { type ComputedFormulaLiteralNode as $, type Attribute as A, type FormulaReturnType as B, type CurrencyAttribute as C, type DateAttribute as D, type BilateralConfig as E, type FormulaAttribute as F, type RelationTarget as G, type RollupFunction as H, type UserReferenceType as I, type MigrationDefinition as J, type AttributeGroup as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type ObjectDefinition as O, type PhoneAttribute as P, type BaseAttribute as Q, type RollupAttribute as R, type SingleRelationAttribute as S, type TextAttribute as T, type UserAttribute as U, type BuiltInTransform as V, type ComputedAttributeState as W, type ComputedFieldKind as X, type ComputedFormulaBinaryNode as Y, type ComputedFormulaBinaryOperator as Z, type ComputedFormulaCallNode as _, type FileAttribute as a, ComputedFormulaParseError as a0, type ComputedFormulaPathNode as a1, type ComputedStateStatus as a2, type CreateDocument as a3, type CreateDocumentLink as a4, type CreateDocumentSlot as a5, DEFAULT_DOCUMENT_SLOT as a6, type DateFormat as a7, type DateValue as a8, type Document as a9, hasOptions as aA, inferInverseCardinality as aB, isAttributeSortable as aC, isBilateralRelation as aD, isUniversalRelation as aE, parseComputedFormula as aF, type DocumentKind as aa, type DocumentLayoutVariant as ab, type DocumentListOptions as ac, type DocumentSlot as ad, type DocumentWithSlots as ae, type DocumentWithSubCount as af, type FolderPreset as ag, MAX_PRESET_DEPTH as ah, type NumberUnit as ai, type ObjectAttribute as aj, type ObjectRecord as ak, type OptionPropertyAttribute as al, type PresetNode as am, type PropertyAttribute as an, type PropertyType as ao, RELATION_TARGET_ANY as ap, RESERVED_ATTRIBUTE_NAMES as aq, type RecordDocuments as ar, type ReservedAttributeName as as, type RichTextAttribute as at, SYSTEM_FIELD_NAMES as au, type SlotStatus as av, type StatusGroup as aw, type SystemFieldName as ax, type UpdateDocument as ay, type UpdateDocumentSlot as az, type RelationAttribute as b, type RichtextAttribute as c, type MultiselectAttribute as d, type SelectAttribute as e, type StatusAttribute as f, type CheckboxAttribute as g, type CompletionStatus as h, type ComputedValueType as i, type ComputedReturnType as j, type AttributeType as k, type ComputedOptionsSource as l, type ComputedDependency as m, type ComputedPlan as n, type ComputedFormulaAstNode as o, type DocumentLayout as p, type Timestamps as q, type SchemaOperation as r, type LocationGranularity as s, type Location as t, type DocumentAttribute as u, type Phone as v, type Currency as w, type DocumentSlotConfig as x, type PropertySchema as y, type Option as z };
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { IconName, CountryIso3, CurrencyCode, ColorId, MimeType } from '@stndrds/constants';
|
|
2
2
|
import { Uuid } from './utils.mjs';
|
|
3
3
|
|
|
4
|
+
type ComputedFormulaAstNode = ComputedFormulaLiteralNode | ComputedFormulaPathNode | ComputedFormulaCallNode | ComputedFormulaBinaryNode;
|
|
5
|
+
interface ComputedFormulaLiteralNode {
|
|
6
|
+
kind: "literal";
|
|
7
|
+
value: string | number | boolean | null;
|
|
8
|
+
}
|
|
9
|
+
interface ComputedFormulaPathNode {
|
|
10
|
+
kind: "path";
|
|
11
|
+
parts: string[];
|
|
12
|
+
}
|
|
13
|
+
interface ComputedFormulaCallNode {
|
|
14
|
+
kind: "call";
|
|
15
|
+
functionName: string;
|
|
16
|
+
args: ComputedFormulaAstNode[];
|
|
17
|
+
}
|
|
18
|
+
interface ComputedFormulaBinaryNode {
|
|
19
|
+
kind: "binary";
|
|
20
|
+
operator: ComputedFormulaBinaryOperator;
|
|
21
|
+
left: ComputedFormulaAstNode;
|
|
22
|
+
right: ComputedFormulaAstNode;
|
|
23
|
+
}
|
|
24
|
+
type ComputedFormulaBinaryOperator = ">" | "<" | ">=" | "<=" | "==" | "!=" | "+" | "-" | "*" | "/";
|
|
25
|
+
declare class ComputedFormulaParseError extends Error {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
declare function parseComputedFormula(expression: string): ComputedFormulaAstNode;
|
|
29
|
+
|
|
4
30
|
type ComputedReturnType = "text" | "number" | "boolean" | "date" | "select" | "multiselect";
|
|
5
31
|
type ComputedFieldKind = "formula" | "rollup";
|
|
6
32
|
type ComputedValueType = {
|
|
@@ -51,6 +77,7 @@ interface ComputedPlan {
|
|
|
51
77
|
optionsSource?: ComputedOptionsSource;
|
|
52
78
|
targetAttributeType?: AttributeType;
|
|
53
79
|
dependenciesHash: string;
|
|
80
|
+
ast?: ComputedFormulaAstNode;
|
|
54
81
|
}
|
|
55
82
|
|
|
56
83
|
interface DocumentLayout {
|
|
@@ -371,12 +398,6 @@ interface CreateDocumentLink {
|
|
|
371
398
|
objectName: string;
|
|
372
399
|
sourceRecordId: string;
|
|
373
400
|
attributeName: string;
|
|
374
|
-
/**
|
|
375
|
-
* Optional qualifyWith properties on the record→Document edge. Currently
|
|
376
|
-
* accepted by the controller DTO but silently ignored by the service (see
|
|
377
|
-
* `DocumentService.createDocument` — there's a TODO to support this).
|
|
378
|
-
*/
|
|
379
|
-
properties?: Record<string, unknown>;
|
|
380
401
|
}
|
|
381
402
|
interface UpdateDocument {
|
|
382
403
|
title?: string;
|
|
@@ -890,4 +911,4 @@ declare function isAttributeSortable(attr: {
|
|
|
890
911
|
type: AttributeType;
|
|
891
912
|
}): boolean;
|
|
892
913
|
|
|
893
|
-
export {
|
|
914
|
+
export { type ComputedFormulaLiteralNode as $, type Attribute as A, type FormulaReturnType as B, type CurrencyAttribute as C, type DateAttribute as D, type BilateralConfig as E, type FormulaAttribute as F, type RelationTarget as G, type RollupFunction as H, type UserReferenceType as I, type MigrationDefinition as J, type AttributeGroup as K, type LocationAttribute as L, type MultiRelationAttribute as M, type NumberAttribute as N, type ObjectDefinition as O, type PhoneAttribute as P, type BaseAttribute as Q, type RollupAttribute as R, type SingleRelationAttribute as S, type TextAttribute as T, type UserAttribute as U, type BuiltInTransform as V, type ComputedAttributeState as W, type ComputedFieldKind as X, type ComputedFormulaBinaryNode as Y, type ComputedFormulaBinaryOperator as Z, type ComputedFormulaCallNode as _, type FileAttribute as a, ComputedFormulaParseError as a0, type ComputedFormulaPathNode as a1, type ComputedStateStatus as a2, type CreateDocument as a3, type CreateDocumentLink as a4, type CreateDocumentSlot as a5, DEFAULT_DOCUMENT_SLOT as a6, type DateFormat as a7, type DateValue as a8, type Document as a9, hasOptions as aA, inferInverseCardinality as aB, isAttributeSortable as aC, isBilateralRelation as aD, isUniversalRelation as aE, parseComputedFormula as aF, type DocumentKind as aa, type DocumentLayoutVariant as ab, type DocumentListOptions as ac, type DocumentSlot as ad, type DocumentWithSlots as ae, type DocumentWithSubCount as af, type FolderPreset as ag, MAX_PRESET_DEPTH as ah, type NumberUnit as ai, type ObjectAttribute as aj, type ObjectRecord as ak, type OptionPropertyAttribute as al, type PresetNode as am, type PropertyAttribute as an, type PropertyType as ao, RELATION_TARGET_ANY as ap, RESERVED_ATTRIBUTE_NAMES as aq, type RecordDocuments as ar, type ReservedAttributeName as as, type RichTextAttribute as at, SYSTEM_FIELD_NAMES as au, type SlotStatus as av, type StatusGroup as aw, type SystemFieldName as ax, type UpdateDocument as ay, type UpdateDocumentSlot as az, type RelationAttribute as b, type RichtextAttribute as c, type MultiselectAttribute as d, type SelectAttribute as e, type StatusAttribute as f, type CheckboxAttribute as g, type CompletionStatus as h, type ComputedValueType as i, type ComputedReturnType as j, type AttributeType as k, type ComputedOptionsSource as l, type ComputedDependency as m, type ComputedPlan as n, type ComputedFormulaAstNode as o, type DocumentLayout as p, type Timestamps as q, type SchemaOperation as r, type LocationGranularity as s, type Location as t, type DocumentAttribute as u, type Phone as v, type Currency as w, type DocumentSlotConfig as x, type PropertySchema as y, type Option as z };
|
|
@@ -2,6 +2,8 @@ import { createCheckboxValidator } from './chunk-OSSGN43B.mjs';
|
|
|
2
2
|
import { createDateValidator } from './chunk-6I2R22CX.mjs';
|
|
3
3
|
import { createNumberValidator } from './chunk-UANQJ2GH.mjs';
|
|
4
4
|
import { createTextValidator } from './chunk-NOMHDOVE.mjs';
|
|
5
|
+
import { createPhoneValidator } from './chunk-JUKLL5RJ.mjs';
|
|
6
|
+
import { createRelationValidator } from './chunk-XZ5RG2OG.mjs';
|
|
5
7
|
import { createRichtextValidator } from './chunk-QVLQPW3O.mjs';
|
|
6
8
|
import { createMultiselectValidator, createSelectValidator, createStatusValidator } from './chunk-ZDQ5AP26.mjs';
|
|
7
9
|
import { createUserValidator } from './chunk-ZDMOXF3U.mjs';
|
|
@@ -10,8 +12,6 @@ import { createRollupValidator } from './chunk-NS63SPNN.mjs';
|
|
|
10
12
|
import { createCurrencyValidator } from './chunk-AYVHMVKQ.mjs';
|
|
11
13
|
import { createFileValidator } from './chunk-QEZUDVTN.mjs';
|
|
12
14
|
import { createLocationValidator } from './chunk-YUFTHPOE.mjs';
|
|
13
|
-
import { createPhoneValidator } from './chunk-JUKLL5RJ.mjs';
|
|
14
|
-
import { createRelationValidator } from './chunk-XZ5RG2OG.mjs';
|
|
15
15
|
import { DEFAULT_VALIDATION_MESSAGES, formatZodErrors } from './chunk-HRQEZUAA.mjs';
|
|
16
16
|
import { z } from 'zod';
|
|
17
17
|
|
|
@@ -137,6 +137,7 @@ var SchemaErrorCode = {
|
|
|
137
137
|
MIGRATION_TIMEOUT: "SCHEMA_MIGRATION_TIMEOUT",
|
|
138
138
|
CHANGE_TYPE_NOT_SUPPORTED: "SCHEMA_CHANGE_TYPE_NOT_SUPPORTED",
|
|
139
139
|
// Duplicates
|
|
140
|
+
DUPLICATE: "SCHEMA_DUPLICATE",
|
|
140
141
|
DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT",
|
|
141
142
|
DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE",
|
|
142
143
|
// Concurrency
|
|
@@ -158,7 +159,48 @@ var SchemaErrorCode = {
|
|
|
158
159
|
// Schema Integrity
|
|
159
160
|
RECORD_REFERENCED: "SCHEMA_RECORD_REFERENCED",
|
|
160
161
|
ATTRIBUTE_IN_USE: "SCHEMA_ATTRIBUTE_IN_USE",
|
|
161
|
-
OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED"
|
|
162
|
+
OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED",
|
|
163
|
+
// --------------------------------------------------------------------------
|
|
164
|
+
// Platform-wide codes (runtime). This enum is the single registry of every
|
|
165
|
+
// error type across the stack; domain error classes live in their module but
|
|
166
|
+
// draw their `code` from here. Never throw a raw `Error` — pick a code below.
|
|
167
|
+
// --------------------------------------------------------------------------
|
|
168
|
+
// Configuration / wiring — a required runtime dependency is not configured
|
|
169
|
+
CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED",
|
|
170
|
+
SEARCH_ADAPTER_REQUIRED: "SEARCH_ADAPTER_REQUIRED",
|
|
171
|
+
// Invariants — internal "should never happen" assertions (programmer error)
|
|
172
|
+
INVARIANT_VIOLATION: "INVARIANT_VIOLATION",
|
|
173
|
+
// Tenant / context
|
|
174
|
+
TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING",
|
|
175
|
+
FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT",
|
|
176
|
+
// Agents
|
|
177
|
+
AGENT_UNKNOWN: "AGENT_UNKNOWN",
|
|
178
|
+
AGENT_DEPTH_EXCEEDED: "AGENT_DEPTH_EXCEEDED",
|
|
179
|
+
AGENT_COST_LIMIT_EXCEEDED: "AGENT_COST_LIMIT_EXCEEDED",
|
|
180
|
+
AGENT_TREE_COST_LIMIT_EXCEEDED: "AGENT_TREE_COST_LIMIT_EXCEEDED",
|
|
181
|
+
AGENT_SESSION_NOT_FOUND: "AGENT_SESSION_NOT_FOUND",
|
|
182
|
+
AGENT_DEFINITION_NOT_FOUND: "AGENT_DEFINITION_NOT_FOUND",
|
|
183
|
+
AGENT_RUN_CONFIG: "AGENT_RUN_CONFIG",
|
|
184
|
+
AGENT_STREAMING: "AGENT_STREAMING",
|
|
185
|
+
AGENT_MISSING_ACTOR: "AGENT_MISSING_ACTOR",
|
|
186
|
+
AGENT_INVALID_STATE: "AGENT_INVALID_STATE",
|
|
187
|
+
AGENT_COMPACTION_IMPOSSIBLE: "AGENT_COMPACTION_IMPOSSIBLE",
|
|
188
|
+
AGENT_LEASE_HELD: "AGENT_LEASE_HELD",
|
|
189
|
+
// AI / LLM
|
|
190
|
+
AI_UNKNOWN: "AI_UNKNOWN",
|
|
191
|
+
AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED",
|
|
192
|
+
AI_INVALID_USAGE: "AI_INVALID_USAGE",
|
|
193
|
+
AI_INVALID_MODEL: "AI_INVALID_MODEL",
|
|
194
|
+
AI_REPOSITORY_ERROR: "AI_REPOSITORY_ERROR",
|
|
195
|
+
AI_GENERATION_FAILED: "AI_GENERATION_FAILED",
|
|
196
|
+
// Documents — slot attach/detach operations
|
|
197
|
+
DOCUMENT_SLOT_NOT_DECLARED: "DOCUMENT_SLOT_NOT_DECLARED",
|
|
198
|
+
DOCUMENT_MIME_NOT_ACCEPTED: "DOCUMENT_MIME_NOT_ACCEPTED",
|
|
199
|
+
DOCUMENT_SLOT_ALREADY_FILLED: "DOCUMENT_SLOT_ALREADY_FILLED",
|
|
200
|
+
DOCUMENT_MULTIPLE_NOT_ALLOWED: "DOCUMENT_MULTIPLE_NOT_ALLOWED",
|
|
201
|
+
DOCUMENT_NOT_FOUND_FOR_OPERATION: "DOCUMENT_NOT_FOUND_FOR_OPERATION",
|
|
202
|
+
DOCUMENT_STORAGE_FAILED: "DOCUMENT_STORAGE_FAILED",
|
|
203
|
+
DOCUMENT_SIZE_EXCEEDED: "DOCUMENT_SIZE_EXCEEDED"
|
|
162
204
|
};
|
|
163
205
|
var SchemaError = class extends Error {
|
|
164
206
|
constructor(message, code = SchemaErrorCode.UNKNOWN, details) {
|
|
@@ -359,13 +401,10 @@ var ChangeTypeNotSupportedError = class extends SchemaError {
|
|
|
359
401
|
}
|
|
360
402
|
};
|
|
361
403
|
var DuplicateError = class extends SchemaError {
|
|
362
|
-
constructor(resourceType, resourceName) {
|
|
363
|
-
const code = resourceType === "object" ? SchemaErrorCode.DUPLICATE_OBJECT : SchemaErrorCode.DUPLICATE_ATTRIBUTE;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
code,
|
|
367
|
-
{ resourceType, resourceName }
|
|
368
|
-
);
|
|
404
|
+
constructor(resourceType, resourceName, message) {
|
|
405
|
+
const code = resourceType === "object" ? SchemaErrorCode.DUPLICATE_OBJECT : resourceType === "attribute" ? SchemaErrorCode.DUPLICATE_ATTRIBUTE : SchemaErrorCode.DUPLICATE;
|
|
406
|
+
const autoMessage = `${resourceType.charAt(0).toUpperCase()}${resourceType.slice(1)} "${resourceName}" already exists`;
|
|
407
|
+
super(message ?? autoMessage, code, { resourceType, resourceName });
|
|
369
408
|
this.name = "DuplicateError";
|
|
370
409
|
this.resourceType = resourceType;
|
|
371
410
|
this.resourceName = resourceName;
|
|
@@ -4,6 +4,8 @@ var chunk5WATIVCA_js = require('./chunk-5WATIVCA.js');
|
|
|
4
4
|
var chunkO44XVGHE_js = require('./chunk-O44XVGHE.js');
|
|
5
5
|
var chunkYIP5FJ5H_js = require('./chunk-YIP5FJ5H.js');
|
|
6
6
|
var chunkSGSGREPG_js = require('./chunk-SGSGREPG.js');
|
|
7
|
+
var chunkEBGRZUIH_js = require('./chunk-EBGRZUIH.js');
|
|
8
|
+
var chunkBV3IUMMW_js = require('./chunk-BV3IUMMW.js');
|
|
7
9
|
var chunkEW5XR2X3_js = require('./chunk-EW5XR2X3.js');
|
|
8
10
|
var chunkQWKLQRBX_js = require('./chunk-QWKLQRBX.js');
|
|
9
11
|
var chunkT6L2MUG2_js = require('./chunk-T6L2MUG2.js');
|
|
@@ -12,8 +14,6 @@ var chunkV2UA2D4E_js = require('./chunk-V2UA2D4E.js');
|
|
|
12
14
|
var chunkACKMC6FL_js = require('./chunk-ACKMC6FL.js');
|
|
13
15
|
var chunkROLWVTU3_js = require('./chunk-ROLWVTU3.js');
|
|
14
16
|
var chunkE6JUYGJX_js = require('./chunk-E6JUYGJX.js');
|
|
15
|
-
var chunkEBGRZUIH_js = require('./chunk-EBGRZUIH.js');
|
|
16
|
-
var chunkBV3IUMMW_js = require('./chunk-BV3IUMMW.js');
|
|
17
17
|
var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
|
|
18
18
|
var zod = require('zod');
|
|
19
19
|
|
|
@@ -139,6 +139,7 @@ var SchemaErrorCode = {
|
|
|
139
139
|
MIGRATION_TIMEOUT: "SCHEMA_MIGRATION_TIMEOUT",
|
|
140
140
|
CHANGE_TYPE_NOT_SUPPORTED: "SCHEMA_CHANGE_TYPE_NOT_SUPPORTED",
|
|
141
141
|
// Duplicates
|
|
142
|
+
DUPLICATE: "SCHEMA_DUPLICATE",
|
|
142
143
|
DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT",
|
|
143
144
|
DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE",
|
|
144
145
|
// Concurrency
|
|
@@ -160,7 +161,48 @@ var SchemaErrorCode = {
|
|
|
160
161
|
// Schema Integrity
|
|
161
162
|
RECORD_REFERENCED: "SCHEMA_RECORD_REFERENCED",
|
|
162
163
|
ATTRIBUTE_IN_USE: "SCHEMA_ATTRIBUTE_IN_USE",
|
|
163
|
-
OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED"
|
|
164
|
+
OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED",
|
|
165
|
+
// --------------------------------------------------------------------------
|
|
166
|
+
// Platform-wide codes (runtime). This enum is the single registry of every
|
|
167
|
+
// error type across the stack; domain error classes live in their module but
|
|
168
|
+
// draw their `code` from here. Never throw a raw `Error` — pick a code below.
|
|
169
|
+
// --------------------------------------------------------------------------
|
|
170
|
+
// Configuration / wiring — a required runtime dependency is not configured
|
|
171
|
+
CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED",
|
|
172
|
+
SEARCH_ADAPTER_REQUIRED: "SEARCH_ADAPTER_REQUIRED",
|
|
173
|
+
// Invariants — internal "should never happen" assertions (programmer error)
|
|
174
|
+
INVARIANT_VIOLATION: "INVARIANT_VIOLATION",
|
|
175
|
+
// Tenant / context
|
|
176
|
+
TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING",
|
|
177
|
+
FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT",
|
|
178
|
+
// Agents
|
|
179
|
+
AGENT_UNKNOWN: "AGENT_UNKNOWN",
|
|
180
|
+
AGENT_DEPTH_EXCEEDED: "AGENT_DEPTH_EXCEEDED",
|
|
181
|
+
AGENT_COST_LIMIT_EXCEEDED: "AGENT_COST_LIMIT_EXCEEDED",
|
|
182
|
+
AGENT_TREE_COST_LIMIT_EXCEEDED: "AGENT_TREE_COST_LIMIT_EXCEEDED",
|
|
183
|
+
AGENT_SESSION_NOT_FOUND: "AGENT_SESSION_NOT_FOUND",
|
|
184
|
+
AGENT_DEFINITION_NOT_FOUND: "AGENT_DEFINITION_NOT_FOUND",
|
|
185
|
+
AGENT_RUN_CONFIG: "AGENT_RUN_CONFIG",
|
|
186
|
+
AGENT_STREAMING: "AGENT_STREAMING",
|
|
187
|
+
AGENT_MISSING_ACTOR: "AGENT_MISSING_ACTOR",
|
|
188
|
+
AGENT_INVALID_STATE: "AGENT_INVALID_STATE",
|
|
189
|
+
AGENT_COMPACTION_IMPOSSIBLE: "AGENT_COMPACTION_IMPOSSIBLE",
|
|
190
|
+
AGENT_LEASE_HELD: "AGENT_LEASE_HELD",
|
|
191
|
+
// AI / LLM
|
|
192
|
+
AI_UNKNOWN: "AI_UNKNOWN",
|
|
193
|
+
AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED",
|
|
194
|
+
AI_INVALID_USAGE: "AI_INVALID_USAGE",
|
|
195
|
+
AI_INVALID_MODEL: "AI_INVALID_MODEL",
|
|
196
|
+
AI_REPOSITORY_ERROR: "AI_REPOSITORY_ERROR",
|
|
197
|
+
AI_GENERATION_FAILED: "AI_GENERATION_FAILED",
|
|
198
|
+
// Documents — slot attach/detach operations
|
|
199
|
+
DOCUMENT_SLOT_NOT_DECLARED: "DOCUMENT_SLOT_NOT_DECLARED",
|
|
200
|
+
DOCUMENT_MIME_NOT_ACCEPTED: "DOCUMENT_MIME_NOT_ACCEPTED",
|
|
201
|
+
DOCUMENT_SLOT_ALREADY_FILLED: "DOCUMENT_SLOT_ALREADY_FILLED",
|
|
202
|
+
DOCUMENT_MULTIPLE_NOT_ALLOWED: "DOCUMENT_MULTIPLE_NOT_ALLOWED",
|
|
203
|
+
DOCUMENT_NOT_FOUND_FOR_OPERATION: "DOCUMENT_NOT_FOUND_FOR_OPERATION",
|
|
204
|
+
DOCUMENT_STORAGE_FAILED: "DOCUMENT_STORAGE_FAILED",
|
|
205
|
+
DOCUMENT_SIZE_EXCEEDED: "DOCUMENT_SIZE_EXCEEDED"
|
|
164
206
|
};
|
|
165
207
|
var SchemaError = class extends Error {
|
|
166
208
|
constructor(message, code = SchemaErrorCode.UNKNOWN, details) {
|
|
@@ -361,13 +403,10 @@ var ChangeTypeNotSupportedError = class extends SchemaError {
|
|
|
361
403
|
}
|
|
362
404
|
};
|
|
363
405
|
var DuplicateError = class extends SchemaError {
|
|
364
|
-
constructor(resourceType, resourceName) {
|
|
365
|
-
const code = resourceType === "object" ? SchemaErrorCode.DUPLICATE_OBJECT : SchemaErrorCode.DUPLICATE_ATTRIBUTE;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
code,
|
|
369
|
-
{ resourceType, resourceName }
|
|
370
|
-
);
|
|
406
|
+
constructor(resourceType, resourceName, message) {
|
|
407
|
+
const code = resourceType === "object" ? SchemaErrorCode.DUPLICATE_OBJECT : resourceType === "attribute" ? SchemaErrorCode.DUPLICATE_ATTRIBUTE : SchemaErrorCode.DUPLICATE;
|
|
408
|
+
const autoMessage = `${resourceType.charAt(0).toUpperCase()}${resourceType.slice(1)} "${resourceName}" already exists`;
|
|
409
|
+
super(message ?? autoMessage, code, { resourceType, resourceName });
|
|
371
410
|
this.name = "DuplicateError";
|
|
372
411
|
this.resourceType = resourceType;
|
|
373
412
|
this.resourceName = resourceName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { A as Attribute, O as ObjectDefinition, h as CompletionStatus } from './attributes-
|
|
3
|
-
import { V as ValidationMessages, a as ValidationResult } from './types-
|
|
2
|
+
import { A as Attribute, O as ObjectDefinition, h as CompletionStatus } from './attributes-BpvQ7YKV.js';
|
|
3
|
+
import { V as ValidationMessages, a as ValidationResult } from './types-DeFxYTDc.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Create a Zod schema for any attribute type.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { A as Attribute, O as ObjectDefinition, h as CompletionStatus } from './attributes-
|
|
3
|
-
import { V as ValidationMessages, a as ValidationResult } from './types-
|
|
2
|
+
import { A as Attribute, O as ObjectDefinition, h as CompletionStatus } from './attributes-BykLtzP-.mjs';
|
|
3
|
+
import { V as ValidationMessages, a as ValidationResult } from './types-BmgBJGpl.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Create a Zod schema for any attribute type.
|