@niscorp/prism 0.2.0 → 0.2.2
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/CHANGELOG.md +41 -0
- package/DESIGN.md +2 -1
- package/DOCS.md +29 -0
- package/README.md +49 -3
- package/dist/agent.cjs +4 -756
- package/dist/agent.cjs.map +1 -1
- package/dist/agent.js +2 -2
- package/dist/chunk-26VYDHHC.cjs +784 -0
- package/dist/chunk-26VYDHHC.cjs.map +1 -0
- package/dist/{chunk-BRIXDNJQ.js → chunk-O3OJAQWA.js} +3 -3
- package/dist/chunk-O3OJAQWA.js.map +1 -0
- package/dist/chunk-V426VIRI.cjs +1168 -0
- package/dist/chunk-V426VIRI.cjs.map +1 -0
- package/dist/{chunk-3GAYBBNH.js → chunk-VC4PRB4H.js} +21 -4
- package/dist/chunk-VC4PRB4H.js.map +1 -0
- package/dist/chunk-W32JXP33.cjs +147 -0
- package/dist/chunk-W32JXP33.cjs.map +1 -0
- package/dist/{chunk-3PYQITGE.js → chunk-XRK55NPE.js} +3 -3
- package/dist/{chunk-3PYQITGE.js.map → chunk-XRK55NPE.js.map} +1 -1
- package/dist/examples/index.cjs +1543 -0
- package/dist/examples/index.cjs.map +1 -0
- package/dist/examples/index.d.cts +26 -0
- package/dist/examples/index.d.ts +26 -0
- package/dist/examples/index.js +1540 -0
- package/dist/examples/index.js.map +1 -0
- package/dist/index.cjs +190 -2048
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -82
- package/dist/index.d.ts +5 -82
- package/dist/index.js +5 -5
- package/dist/migrations/index.cjs +7 -1775
- package/dist/migrations/index.cjs.map +1 -1
- package/dist/migrations/index.d.cts +3 -2
- package/dist/migrations/index.d.ts +3 -2
- package/dist/migrations/index.js +3 -18
- package/dist/migrations/index.js.map +1 -1
- package/dist/profiles-C6r-x-Vj.d.cts +83 -0
- package/dist/profiles-C6r-x-Vj.d.ts +83 -0
- package/dist/transform-DcVcOBzQ.d.cts +3 -0
- package/dist/transform-DcVcOBzQ.d.ts +3 -0
- package/package.json +19 -8
- package/dist/chunk-3GAYBBNH.js.map +0 -1
- package/dist/chunk-BRIXDNJQ.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,80 +1,9 @@
|
|
|
1
|
+
import { J as JsonValue, L as Limits, R as Result, C as CompileOptions, a as CompiledIr, b as JsonObject, V as ValidationResult, O as OpKey } from './profiles-C6r-x-Vj.cjs';
|
|
2
|
+
export { D as DEFAULT_LIMITS, E as EvalContext, c as JsonPrimitive, M as MAPPING_OPS, N as NodeSchema, d as OP_KEYS, e as OptimizationStats, f as ValidationIssue } from './profiles-C6r-x-Vj.cjs';
|
|
1
3
|
import { C as Config } from './config.schema-vy-_YxHP.cjs';
|
|
2
4
|
export { a as ConfigSchema } from './config.schema-vy-_YxHP.cjs';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Limits = {
|
|
6
|
-
maxSteps: number;
|
|
7
|
-
maxStringLength: number;
|
|
8
|
-
maxValues: number;
|
|
9
|
-
};
|
|
10
|
-
declare const DEFAULT_LIMITS: Limits;
|
|
11
|
-
type Budget = {
|
|
12
|
-
readonly limits: Limits;
|
|
13
|
-
steps: number;
|
|
14
|
-
readonly sizes: WeakMap<object, number>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
18
|
-
type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
|
|
19
|
-
type JsonObject = {
|
|
20
|
-
[key: string]: JsonValue;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type EvalContext = {
|
|
24
|
-
readonly source: JsonValue;
|
|
25
|
-
readonly vars: Record<string, JsonValue>;
|
|
26
|
-
readonly budget?: Budget;
|
|
27
|
-
};
|
|
28
|
-
type Result<T> = {
|
|
29
|
-
ok: true;
|
|
30
|
-
data: T;
|
|
31
|
-
} | {
|
|
32
|
-
ok: false;
|
|
33
|
-
error: Error;
|
|
34
|
-
};
|
|
35
|
-
type CompileOptions = {
|
|
36
|
-
name?: string;
|
|
37
|
-
version?: string;
|
|
38
|
-
};
|
|
39
|
-
type OptimizationStats = {
|
|
40
|
-
refsInlined: number;
|
|
41
|
-
handlersAttached: number;
|
|
42
|
-
constantsFolded: number;
|
|
43
|
-
};
|
|
44
|
-
type CompiledIr = {
|
|
45
|
-
irVersion: 1;
|
|
46
|
-
compiler: {
|
|
47
|
-
name: string;
|
|
48
|
-
version: string;
|
|
49
|
-
};
|
|
50
|
-
meta: {
|
|
51
|
-
name?: string;
|
|
52
|
-
createdAt: string;
|
|
53
|
-
fingerprint: string;
|
|
54
|
-
stats: {
|
|
55
|
-
nodeCount: number;
|
|
56
|
-
opCount: Record<string, number>;
|
|
57
|
-
maxDepth: number;
|
|
58
|
-
optimizations: OptimizationStats;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
tables: {
|
|
62
|
-
paths: string[];
|
|
63
|
-
strings: string[];
|
|
64
|
-
};
|
|
65
|
-
core: unknown;
|
|
66
|
-
};
|
|
67
|
-
type ValidationIssue = {
|
|
68
|
-
path: (string | number)[];
|
|
69
|
-
message: string;
|
|
70
|
-
};
|
|
71
|
-
type ValidationResult = {
|
|
72
|
-
ok: true;
|
|
73
|
-
data: unknown;
|
|
74
|
-
} | {
|
|
75
|
-
ok: false;
|
|
76
|
-
issues: ValidationIssue[];
|
|
77
|
-
};
|
|
5
|
+
export { p as prismTransform } from './transform-DcVcOBzQ.cjs';
|
|
6
|
+
import 'zod';
|
|
78
7
|
|
|
79
8
|
declare const evaluate: (config: Config, source: JsonValue, limits?: Partial<Limits>) => JsonValue;
|
|
80
9
|
declare const evaluateSafe: (config: Config, source: JsonValue, limits?: Partial<Limits>) => Result<JsonValue>;
|
|
@@ -85,12 +14,6 @@ declare const execute: (ir: CompiledIr, source: JsonObject, limits?: Partial<Lim
|
|
|
85
14
|
|
|
86
15
|
declare const validate: (config: unknown) => ValidationResult;
|
|
87
16
|
|
|
88
|
-
declare const OP_KEYS: readonly ["$ref", "$const", "$var", "$get", "$with", "$map", "$filter", "$reduce", "$slice", "$flatten", "$unique", "$sortBy", "$add", "$sub", "$mul", "$div", "$round", "$fill", "$join", "$toString", "$interpolate", "$trim", "$lower", "$upper", "$split", "$replace", "$eq", "$neq", "$gt", "$gte", "$lt", "$lte", "$empty", "$startsWith", "$endsWith", "$contains", "$not", "$and", "$or", "$merge", "$coalesce", "$case", "$entriesOf", "$keyBy", "$groupBy", "$keys", "$values", "$fromEntries", "$pick", "$omit", "$type", "$length", "$date", "$dateAdd", "$dateDiff", "$localeDate", "$localeMoney", "$localeNumber", "$sum", "$avg", "$count", "$min", "$max", "$pluck", "$take", "$drop", "$match", "$flatMap", "$has", "$renameKeys", "$update", "$assert", "$walk"];
|
|
89
|
-
declare const NodeSchema: z.ZodType<unknown>;
|
|
90
|
-
|
|
91
|
-
type OpKey = (typeof OP_KEYS)[number];
|
|
92
|
-
declare const MAPPING_OPS: readonly OpKey[];
|
|
93
|
-
|
|
94
17
|
type JsonSchemaTarget = 'draft-2020-12' | 'draft-7' | 'draft-4';
|
|
95
18
|
declare const getNodeJsonSchema: (target?: JsonSchemaTarget) => object;
|
|
96
19
|
declare const getConfigJsonSchema: (target?: JsonSchemaTarget) => object;
|
|
@@ -119,4 +42,4 @@ declare class PrismError extends Error {
|
|
|
119
42
|
constructor(message: string, code: ErrorCode, context?: PrismErrorContext);
|
|
120
43
|
}
|
|
121
44
|
|
|
122
|
-
export {
|
|
45
|
+
export { CompileOptions, CompiledIr, Config, ErrorCode, JsonObject, type JsonSchemaTarget, JsonValue, Limits, OpKey, PrismError, type PrismErrorContext, Result, ValidationResult, compile, evaluate, evaluateSafe, execute, getConfigJsonSchema, getNodeJsonSchema, getProfileJsonSchema, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,80 +1,9 @@
|
|
|
1
|
+
import { J as JsonValue, L as Limits, R as Result, C as CompileOptions, a as CompiledIr, b as JsonObject, V as ValidationResult, O as OpKey } from './profiles-C6r-x-Vj.js';
|
|
2
|
+
export { D as DEFAULT_LIMITS, E as EvalContext, c as JsonPrimitive, M as MAPPING_OPS, N as NodeSchema, d as OP_KEYS, e as OptimizationStats, f as ValidationIssue } from './profiles-C6r-x-Vj.js';
|
|
1
3
|
import { C as Config } from './config.schema-vy-_YxHP.js';
|
|
2
4
|
export { a as ConfigSchema } from './config.schema-vy-_YxHP.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Limits = {
|
|
6
|
-
maxSteps: number;
|
|
7
|
-
maxStringLength: number;
|
|
8
|
-
maxValues: number;
|
|
9
|
-
};
|
|
10
|
-
declare const DEFAULT_LIMITS: Limits;
|
|
11
|
-
type Budget = {
|
|
12
|
-
readonly limits: Limits;
|
|
13
|
-
steps: number;
|
|
14
|
-
readonly sizes: WeakMap<object, number>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type JsonPrimitive = string | number | boolean | null;
|
|
18
|
-
type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
|
|
19
|
-
type JsonObject = {
|
|
20
|
-
[key: string]: JsonValue;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type EvalContext = {
|
|
24
|
-
readonly source: JsonValue;
|
|
25
|
-
readonly vars: Record<string, JsonValue>;
|
|
26
|
-
readonly budget?: Budget;
|
|
27
|
-
};
|
|
28
|
-
type Result<T> = {
|
|
29
|
-
ok: true;
|
|
30
|
-
data: T;
|
|
31
|
-
} | {
|
|
32
|
-
ok: false;
|
|
33
|
-
error: Error;
|
|
34
|
-
};
|
|
35
|
-
type CompileOptions = {
|
|
36
|
-
name?: string;
|
|
37
|
-
version?: string;
|
|
38
|
-
};
|
|
39
|
-
type OptimizationStats = {
|
|
40
|
-
refsInlined: number;
|
|
41
|
-
handlersAttached: number;
|
|
42
|
-
constantsFolded: number;
|
|
43
|
-
};
|
|
44
|
-
type CompiledIr = {
|
|
45
|
-
irVersion: 1;
|
|
46
|
-
compiler: {
|
|
47
|
-
name: string;
|
|
48
|
-
version: string;
|
|
49
|
-
};
|
|
50
|
-
meta: {
|
|
51
|
-
name?: string;
|
|
52
|
-
createdAt: string;
|
|
53
|
-
fingerprint: string;
|
|
54
|
-
stats: {
|
|
55
|
-
nodeCount: number;
|
|
56
|
-
opCount: Record<string, number>;
|
|
57
|
-
maxDepth: number;
|
|
58
|
-
optimizations: OptimizationStats;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
tables: {
|
|
62
|
-
paths: string[];
|
|
63
|
-
strings: string[];
|
|
64
|
-
};
|
|
65
|
-
core: unknown;
|
|
66
|
-
};
|
|
67
|
-
type ValidationIssue = {
|
|
68
|
-
path: (string | number)[];
|
|
69
|
-
message: string;
|
|
70
|
-
};
|
|
71
|
-
type ValidationResult = {
|
|
72
|
-
ok: true;
|
|
73
|
-
data: unknown;
|
|
74
|
-
} | {
|
|
75
|
-
ok: false;
|
|
76
|
-
issues: ValidationIssue[];
|
|
77
|
-
};
|
|
5
|
+
export { p as prismTransform } from './transform-DcVcOBzQ.js';
|
|
6
|
+
import 'zod';
|
|
78
7
|
|
|
79
8
|
declare const evaluate: (config: Config, source: JsonValue, limits?: Partial<Limits>) => JsonValue;
|
|
80
9
|
declare const evaluateSafe: (config: Config, source: JsonValue, limits?: Partial<Limits>) => Result<JsonValue>;
|
|
@@ -85,12 +14,6 @@ declare const execute: (ir: CompiledIr, source: JsonObject, limits?: Partial<Lim
|
|
|
85
14
|
|
|
86
15
|
declare const validate: (config: unknown) => ValidationResult;
|
|
87
16
|
|
|
88
|
-
declare const OP_KEYS: readonly ["$ref", "$const", "$var", "$get", "$with", "$map", "$filter", "$reduce", "$slice", "$flatten", "$unique", "$sortBy", "$add", "$sub", "$mul", "$div", "$round", "$fill", "$join", "$toString", "$interpolate", "$trim", "$lower", "$upper", "$split", "$replace", "$eq", "$neq", "$gt", "$gte", "$lt", "$lte", "$empty", "$startsWith", "$endsWith", "$contains", "$not", "$and", "$or", "$merge", "$coalesce", "$case", "$entriesOf", "$keyBy", "$groupBy", "$keys", "$values", "$fromEntries", "$pick", "$omit", "$type", "$length", "$date", "$dateAdd", "$dateDiff", "$localeDate", "$localeMoney", "$localeNumber", "$sum", "$avg", "$count", "$min", "$max", "$pluck", "$take", "$drop", "$match", "$flatMap", "$has", "$renameKeys", "$update", "$assert", "$walk"];
|
|
89
|
-
declare const NodeSchema: z.ZodType<unknown>;
|
|
90
|
-
|
|
91
|
-
type OpKey = (typeof OP_KEYS)[number];
|
|
92
|
-
declare const MAPPING_OPS: readonly OpKey[];
|
|
93
|
-
|
|
94
17
|
type JsonSchemaTarget = 'draft-2020-12' | 'draft-7' | 'draft-4';
|
|
95
18
|
declare const getNodeJsonSchema: (target?: JsonSchemaTarget) => object;
|
|
96
19
|
declare const getConfigJsonSchema: (target?: JsonSchemaTarget) => object;
|
|
@@ -119,4 +42,4 @@ declare class PrismError extends Error {
|
|
|
119
42
|
constructor(message: string, code: ErrorCode, context?: PrismErrorContext);
|
|
120
43
|
}
|
|
121
44
|
|
|
122
|
-
export {
|
|
45
|
+
export { CompileOptions, CompiledIr, Config, ErrorCode, JsonObject, type JsonSchemaTarget, JsonValue, Limits, OpKey, PrismError, type PrismErrorContext, Result, ValidationResult, compile, evaluate, evaluateSafe, execute, getConfigJsonSchema, getNodeJsonSchema, getProfileJsonSchema, validate };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { MAPPING_OPS, getConfigJsonSchema, getNodeJsonSchema, getProfileJsonSchema } from './chunk-
|
|
2
|
-
import { PrismError, ErrorCode, explainIssues, desugar, primeJsonPathCache, createBudget, evaluateNode, measure, parseJsonPath, opConst, opRef, opVar, opGet, opWith, opMap, opFilter, opReduce, opSlice, opFlatten, opUnique, opSortBy, opAdd, opSub, opMul, opDiv, opRound, opJoin, opToString, opInterpolate, opFill, opTrim, opLower, opUpper, opSplit, opReplace, opEq, opNeq, opGt, opGte, opLt, opLte, opEmpty, opStartsWith, opEndsWith, opContains, opNot, opAnd, opOr, opMerge, opCoalesce, opCase, opEntriesOf, opKeyBy, opGroupBy, opKeys, opValues, opFromEntries, opPick, opOmit, opType, opLength, opHas, opRenameKeys, opUpdate, opAssert, opWalk, opDate, opDateAdd, opDateDiff, opLocaleDate, opLocaleMoney, opLocaleNumber } from './chunk-
|
|
3
|
-
export { DEFAULT_LIMITS, ErrorCode, PrismError, evaluate, evaluateSafe } from './chunk-
|
|
4
|
-
import { ConfigSchema, isJsonObject, isConstNode, isRefNode, isVarNode, isGetNode, isWithNode, isMapNode, isFilterNode, isReduceNode, isSliceNode, isFlattenNode, isUniqueNode, isSortByNode, isAddNode, isSubNode, isMulNode, isDivNode, isRoundNode, isJoinNode, isToStringNode, isInterpolateNode, isFillNode, isTrimNode, isLowerNode, isUpperNode, isSplitNode, isReplaceNode, isEqNode, isNeqNode, isGtNode, isGteNode, isLtNode, isLteNode, isEmptyNode, isStartsWithNode, isEndsWithNode, isContainsNode, isNotNode, isAndNode, isOrNode, isMergeNode, isCoalesceNode, isCaseNode, isEntriesOfNode, isKeyByNode, isGroupByNode, isKeysNode, isValuesNode, isFromEntriesNode, isPickNode, isOmitNode, isTypeNode, isLengthNode, isHasNode, isRenameKeysNode, isUpdateNode, isAssertNode, isWalkNode, isDateNode, isDateAddNode, isDateDiffNode, isLocaleDateNode, isLocaleMoneyNode, isLocaleNumberNode } from './chunk-
|
|
5
|
-
export { ConfigSchema, NodeSchema } from './chunk-
|
|
1
|
+
export { MAPPING_OPS, getConfigJsonSchema, getNodeJsonSchema, getProfileJsonSchema } from './chunk-XRK55NPE.js';
|
|
2
|
+
import { PrismError, ErrorCode, explainIssues, desugar, primeJsonPathCache, createBudget, evaluateNode, measure, parseJsonPath, opConst, opRef, opVar, opGet, opWith, opMap, opFilter, opReduce, opSlice, opFlatten, opUnique, opSortBy, opAdd, opSub, opMul, opDiv, opRound, opJoin, opToString, opInterpolate, opFill, opTrim, opLower, opUpper, opSplit, opReplace, opEq, opNeq, opGt, opGte, opLt, opLte, opEmpty, opStartsWith, opEndsWith, opContains, opNot, opAnd, opOr, opMerge, opCoalesce, opCase, opEntriesOf, opKeyBy, opGroupBy, opKeys, opValues, opFromEntries, opPick, opOmit, opType, opLength, opHas, opRenameKeys, opUpdate, opAssert, opWalk, opDate, opDateAdd, opDateDiff, opLocaleDate, opLocaleMoney, opLocaleNumber } from './chunk-VC4PRB4H.js';
|
|
3
|
+
export { DEFAULT_LIMITS, ErrorCode, PrismError, evaluate, evaluateSafe, prismTransform } from './chunk-VC4PRB4H.js';
|
|
4
|
+
import { ConfigSchema, isJsonObject, isConstNode, isRefNode, isVarNode, isGetNode, isWithNode, isMapNode, isFilterNode, isReduceNode, isSliceNode, isFlattenNode, isUniqueNode, isSortByNode, isAddNode, isSubNode, isMulNode, isDivNode, isRoundNode, isJoinNode, isToStringNode, isInterpolateNode, isFillNode, isTrimNode, isLowerNode, isUpperNode, isSplitNode, isReplaceNode, isEqNode, isNeqNode, isGtNode, isGteNode, isLtNode, isLteNode, isEmptyNode, isStartsWithNode, isEndsWithNode, isContainsNode, isNotNode, isAndNode, isOrNode, isMergeNode, isCoalesceNode, isCaseNode, isEntriesOfNode, isKeyByNode, isGroupByNode, isKeysNode, isValuesNode, isFromEntriesNode, isPickNode, isOmitNode, isTypeNode, isLengthNode, isHasNode, isRenameKeysNode, isUpdateNode, isAssertNode, isWalkNode, isDateNode, isDateAddNode, isDateDiffNode, isLocaleDateNode, isLocaleMoneyNode, isLocaleNumberNode } from './chunk-O3OJAQWA.js';
|
|
5
|
+
export { ConfigSchema, NodeSchema, OP_KEYS } from './chunk-O3OJAQWA.js';
|
|
6
6
|
import { exceedsDepth, depthRefusal } from '@niscorp/strata';
|
|
7
7
|
|
|
8
8
|
// src/engine/optimize.ts
|