@sequenceholdings/orm 0.1.3 → 2.1.0
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/README.md +108 -38
- package/dist/authoring.cjs +128 -16
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +21 -4
- package/dist/authoring.d.ts +21 -4
- package/dist/authoring.js +128 -16
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs +83 -9
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.d.cts +47 -1
- package/dist/canonical.d.ts +47 -1
- package/dist/canonical.js +83 -10
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +816 -134
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +818 -136
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +488 -96
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +34 -2
- package/dist/compiler.d.ts +34 -2
- package/dist/compiler.js +489 -97
- package/dist/compiler.js.map +1 -1
- package/dist/index.cjs +420 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +266 -9
- package/dist/index.d.ts +266 -9
- package/dist/index.js +410 -73
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs +146 -12
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +161 -5
- package/dist/ir.d.ts +161 -5
- package/dist/ir.js +144 -13
- package/dist/ir.js.map +1 -1
- package/dist/{naming-CTvWSRTf.d.ts → naming-DCn94LJ4.d.ts} +15 -1
- package/dist/{naming-DRyinU4u.d.cts → naming-DPglwzkB.d.cts} +15 -1
- package/dist/predicate-v2.cjs +136 -11
- package/dist/predicate-v2.cjs.map +1 -1
- package/dist/predicate-v2.d.cts +3 -0
- package/dist/predicate-v2.d.ts +3 -0
- package/dist/predicate-v2.js +136 -11
- package/dist/predicate-v2.js.map +1 -1
- package/dist/sdl.cjs +460 -13
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +1 -1
- package/dist/sdl.d.ts +1 -1
- package/dist/sdl.js +459 -14
- package/dist/sdl.js.map +1 -1
- package/package.json +6 -4
- package/src/codegen-gql/preset.cjs +64 -0
- package/src/codegen-gql/server-fns.cjs +11 -6
- package/templates/orm-namespace/codegen.preset.cjs +17 -0
- package/templates/orm-namespace/codegen.ts +1 -1
- package/templates/orm-namespace/package.json +3 -0
- package/templates/orm-namespace/schema/tables.ts +1 -1
- package/templates/orm-namespace/sequence.config.ts +1 -1
package/dist/compiler.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { ClaimKey, PredIr, RootIr, InputRefKind, TableMetaIr, CompiledOperation,
|
|
|
3
3
|
import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode, GraphQLSchema, ValueNode, SelectionSetNode } from 'graphql';
|
|
4
4
|
export { DynamicInputIssue, DynamicInputResult, NormalizedBoolExp, NormalizedOnConflict, NormalizedOrderBy, NormalizedRow, ORDER_BY_DIRECTIONS, ScalarKind, allowedBoolExpOperators, allowedOps, validateAppendInput, validateBoolExpInput, validateInsertInput, validateOnConflictInput, validateOrderByInput, validateSelectColumns, validateSetInput } from './dynamic-input.cjs';
|
|
5
5
|
export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_MAX_LINK_DEPTH, ParsedPolicy, PolicyColumnInfo, PolicyCompareOp, PolicyCompileError, PolicyCompileErrorCode, PolicyLinkInfo, PolicyNode, PolicyOperand, PolicyParseError, PolicyResolver, PolicyTableInfo, assertClaimsOnlyWhen, compilePolicy, compilePredicateV2, parsePolicy, walkPolicy } from './predicate-v2.cjs';
|
|
6
|
-
export { P as PLATFORM_USER_TYPENAME, c as camelCase, e as enumTypeName, p as pascalCase } from './naming-
|
|
6
|
+
export { P as PLATFORM_USER_TYPENAME, c as camelCase, e as enumTypeName, p as pascalCase } from './naming-DPglwzkB.cjs';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
9
|
type DiagnosticSeverity = 'error' | 'warning';
|
|
@@ -109,6 +109,7 @@ declare function queryRootNames(table: string): {
|
|
|
109
109
|
select: string;
|
|
110
110
|
byPk: string;
|
|
111
111
|
aggregate: string;
|
|
112
|
+
aggregateGroups: string;
|
|
112
113
|
};
|
|
113
114
|
type MutationOp = 'insert' | 'insertOne' | 'update' | 'updateByPk' | 'delete' | 'deleteByPk';
|
|
114
115
|
declare function mutationRootNames(table: string): Record<MutationOp, string>;
|
|
@@ -132,7 +133,7 @@ declare function classifyInputType(name: string, tableByTypename: ReadonlyMap<st
|
|
|
132
133
|
*/
|
|
133
134
|
|
|
134
135
|
interface QueryRootInfo {
|
|
135
|
-
kind: 'select' | 'byPk' | 'aggregate';
|
|
136
|
+
kind: 'select' | 'byPk' | 'aggregate' | 'aggregateGroups';
|
|
136
137
|
table: string;
|
|
137
138
|
}
|
|
138
139
|
interface CrudMutationRootInfo {
|
|
@@ -348,9 +349,40 @@ declare class OperationLowerer {
|
|
|
348
349
|
lowerSelection(selectionSet: SelectionSetNode, table: string): SelectionIr;
|
|
349
350
|
/** The `{ aggregate { count sum {…} avg {…} } nodes {…} }` block shared by roots and relations. */
|
|
350
351
|
private lowerAggregateSelection;
|
|
352
|
+
/**
|
|
353
|
+
* The `{ key {…} aggregate {…} }` block of a grouped aggregate root. Same
|
|
354
|
+
* `aggregate` sub-block as the ungrouped shape (shared via
|
|
355
|
+
* `lowerAggregateFields`), but `key` replaces `nodes` — see the IR comment on
|
|
356
|
+
* `aggregateGroupsRootSchema` for why grouped roots have no `nodes`.
|
|
357
|
+
*/
|
|
358
|
+
private lowerGroupedAggregateSelection;
|
|
359
|
+
/**
|
|
360
|
+
* `key { month officer }` → the projected group columns. Every field must be
|
|
361
|
+
* one of the query's own group keys: any other column is indeterminate
|
|
362
|
+
* within a group, so selecting it is a document error rather than an
|
|
363
|
+
* arbitrary pick.
|
|
364
|
+
*/
|
|
365
|
+
private lowerGroupKeySelection;
|
|
366
|
+
/** The `count` / `sum {…}` / `avg {…}` fields inside an `aggregate { … }` block. */
|
|
367
|
+
private lowerAggregateFields;
|
|
351
368
|
lowerRoots(operation: OperationDefinitionNode, kind: 'query' | 'mutation'): RootIr[];
|
|
369
|
+
private parseAffectedRowAssertion;
|
|
352
370
|
private parseRootDirectives;
|
|
353
371
|
private lowerQueryRoot;
|
|
372
|
+
/** `<t>AggregateGroups(where:, groupBy:, limit:, offset:)` → an aggregateGroups root. */
|
|
373
|
+
private lowerAggregateGroupsRoot;
|
|
374
|
+
/**
|
|
375
|
+
* `groupBy: [{ column: startedAt, bucket: MONTH }, …]` → GroupByKeyIr[].
|
|
376
|
+
*
|
|
377
|
+
* Document-authored only: a whole-argument variable is rejected rather than
|
|
378
|
+
* becoming a §4f slot. Group keys choose which expressions reach GROUP BY,
|
|
379
|
+
* and dynamic-input.ts refuses aggregation shapes from client input on the
|
|
380
|
+
* same reasoning — `where` stays dynamic, which is what runtime filtering
|
|
381
|
+
* actually needs.
|
|
382
|
+
*/
|
|
383
|
+
private lowerGroupBy;
|
|
384
|
+
/** Like lowerLimit, but bounded by MAX_GROUPS and defaulting to it. */
|
|
385
|
+
private lowerGroupLimit;
|
|
354
386
|
/** byPk-style pk arguments: one argument per primary-key column, exactly. */
|
|
355
387
|
private lowerPkArgs;
|
|
356
388
|
private lowerMutationRoot;
|
package/dist/compiler.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ClaimKey, PredIr, RootIr, InputRefKind, TableMetaIr, CompiledOperation,
|
|
|
3
3
|
import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode, GraphQLSchema, ValueNode, SelectionSetNode } from 'graphql';
|
|
4
4
|
export { DynamicInputIssue, DynamicInputResult, NormalizedBoolExp, NormalizedOnConflict, NormalizedOrderBy, NormalizedRow, ORDER_BY_DIRECTIONS, ScalarKind, allowedBoolExpOperators, allowedOps, validateAppendInput, validateBoolExpInput, validateInsertInput, validateOnConflictInput, validateOrderByInput, validateSelectColumns, validateSetInput } from './dynamic-input.js';
|
|
5
5
|
export { CompilePolicyInput, CompilePredicateInput, POLICY_COMPARE_OPS, POLICY_MAX_LINK_DEPTH, ParsedPolicy, PolicyColumnInfo, PolicyCompareOp, PolicyCompileError, PolicyCompileErrorCode, PolicyLinkInfo, PolicyNode, PolicyOperand, PolicyParseError, PolicyResolver, PolicyTableInfo, assertClaimsOnlyWhen, compilePolicy, compilePredicateV2, parsePolicy, walkPolicy } from './predicate-v2.js';
|
|
6
|
-
export { P as PLATFORM_USER_TYPENAME, c as camelCase, e as enumTypeName, p as pascalCase } from './naming-
|
|
6
|
+
export { P as PLATFORM_USER_TYPENAME, c as camelCase, e as enumTypeName, p as pascalCase } from './naming-DCn94LJ4.js';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
9
|
type DiagnosticSeverity = 'error' | 'warning';
|
|
@@ -109,6 +109,7 @@ declare function queryRootNames(table: string): {
|
|
|
109
109
|
select: string;
|
|
110
110
|
byPk: string;
|
|
111
111
|
aggregate: string;
|
|
112
|
+
aggregateGroups: string;
|
|
112
113
|
};
|
|
113
114
|
type MutationOp = 'insert' | 'insertOne' | 'update' | 'updateByPk' | 'delete' | 'deleteByPk';
|
|
114
115
|
declare function mutationRootNames(table: string): Record<MutationOp, string>;
|
|
@@ -132,7 +133,7 @@ declare function classifyInputType(name: string, tableByTypename: ReadonlyMap<st
|
|
|
132
133
|
*/
|
|
133
134
|
|
|
134
135
|
interface QueryRootInfo {
|
|
135
|
-
kind: 'select' | 'byPk' | 'aggregate';
|
|
136
|
+
kind: 'select' | 'byPk' | 'aggregate' | 'aggregateGroups';
|
|
136
137
|
table: string;
|
|
137
138
|
}
|
|
138
139
|
interface CrudMutationRootInfo {
|
|
@@ -348,9 +349,40 @@ declare class OperationLowerer {
|
|
|
348
349
|
lowerSelection(selectionSet: SelectionSetNode, table: string): SelectionIr;
|
|
349
350
|
/** The `{ aggregate { count sum {…} avg {…} } nodes {…} }` block shared by roots and relations. */
|
|
350
351
|
private lowerAggregateSelection;
|
|
352
|
+
/**
|
|
353
|
+
* The `{ key {…} aggregate {…} }` block of a grouped aggregate root. Same
|
|
354
|
+
* `aggregate` sub-block as the ungrouped shape (shared via
|
|
355
|
+
* `lowerAggregateFields`), but `key` replaces `nodes` — see the IR comment on
|
|
356
|
+
* `aggregateGroupsRootSchema` for why grouped roots have no `nodes`.
|
|
357
|
+
*/
|
|
358
|
+
private lowerGroupedAggregateSelection;
|
|
359
|
+
/**
|
|
360
|
+
* `key { month officer }` → the projected group columns. Every field must be
|
|
361
|
+
* one of the query's own group keys: any other column is indeterminate
|
|
362
|
+
* within a group, so selecting it is a document error rather than an
|
|
363
|
+
* arbitrary pick.
|
|
364
|
+
*/
|
|
365
|
+
private lowerGroupKeySelection;
|
|
366
|
+
/** The `count` / `sum {…}` / `avg {…}` fields inside an `aggregate { … }` block. */
|
|
367
|
+
private lowerAggregateFields;
|
|
351
368
|
lowerRoots(operation: OperationDefinitionNode, kind: 'query' | 'mutation'): RootIr[];
|
|
369
|
+
private parseAffectedRowAssertion;
|
|
352
370
|
private parseRootDirectives;
|
|
353
371
|
private lowerQueryRoot;
|
|
372
|
+
/** `<t>AggregateGroups(where:, groupBy:, limit:, offset:)` → an aggregateGroups root. */
|
|
373
|
+
private lowerAggregateGroupsRoot;
|
|
374
|
+
/**
|
|
375
|
+
* `groupBy: [{ column: startedAt, bucket: MONTH }, …]` → GroupByKeyIr[].
|
|
376
|
+
*
|
|
377
|
+
* Document-authored only: a whole-argument variable is rejected rather than
|
|
378
|
+
* becoming a §4f slot. Group keys choose which expressions reach GROUP BY,
|
|
379
|
+
* and dynamic-input.ts refuses aggregation shapes from client input on the
|
|
380
|
+
* same reasoning — `where` stays dynamic, which is what runtime filtering
|
|
381
|
+
* actually needs.
|
|
382
|
+
*/
|
|
383
|
+
private lowerGroupBy;
|
|
384
|
+
/** Like lowerLimit, but bounded by MAX_GROUPS and defaulting to it. */
|
|
385
|
+
private lowerGroupLimit;
|
|
354
386
|
/** byPk-style pk arguments: one argument per primary-key column, exactly. */
|
|
355
387
|
private lowerPkArgs;
|
|
356
388
|
private lowerMutationRoot;
|