@atscript/core 0.1.92 → 0.1.93
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.cjs +15 -0
- package/dist/index.d.ts +10 -1
- package/dist/index.mjs +14 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5569,6 +5569,19 @@ function hasNavPropAnnotation(prop) {
|
|
|
5569
5569
|
if (!prop.annotations) return false;
|
|
5570
5570
|
return prop.annotations.some((a) => a.name === "db.rel.to" || a.name === "db.rel.from" || a.name === "db.rel.via");
|
|
5571
5571
|
}
|
|
5572
|
+
/**
|
|
5573
|
+
* Annotations that make an interface a DB entity — a table, or a managed view.
|
|
5574
|
+
* `@db.view.for` alone declares a managed view (`@db.view`, the name, is
|
|
5575
|
+
* optional), so codegen (`__flat` / `__ownProps`), the `asc db sync` inventory
|
|
5576
|
+
* and `DbSpace.get()` in `@atscript/db` all share this one rule.
|
|
5577
|
+
*/ const DB_ENTITY_ANNOTATIONS = [
|
|
5578
|
+
"db.table",
|
|
5579
|
+
"db.view",
|
|
5580
|
+
"db.view.for"
|
|
5581
|
+
];
|
|
5582
|
+
/** AST side of {@link DB_ENTITY_ANNOTATIONS}: whether a node carries a DB-entity annotation. */ function isDbEntityNode(node) {
|
|
5583
|
+
return !!node.annotations?.some((a) => DB_ENTITY_ANNOTATIONS.some((name) => name === a.name));
|
|
5584
|
+
}
|
|
5572
5585
|
function isPhantomNode(doc, def) {
|
|
5573
5586
|
if (!def) return false;
|
|
5574
5587
|
if (isPrimitive(def) && def.config.type === "phantom") return true;
|
|
@@ -5796,6 +5809,7 @@ exports.AnnotationSpec = AnnotationSpec;
|
|
|
5796
5809
|
exports.AtscriptDoc = AtscriptDoc;
|
|
5797
5810
|
exports.AtscriptRepo = AtscriptRepo;
|
|
5798
5811
|
exports.BuildRepo = BuildRepo;
|
|
5812
|
+
exports.DB_ENTITY_ANNOTATIONS = DB_ENTITY_ANNOTATIONS;
|
|
5799
5813
|
exports.DEFAULT_FORMAT = DEFAULT_FORMAT;
|
|
5800
5814
|
exports.PluginManager = PluginManager;
|
|
5801
5815
|
exports.SemanticAnnotateNode = SemanticAnnotateNode;
|
|
@@ -5836,6 +5850,7 @@ exports.isArray = isArray;
|
|
|
5836
5850
|
exports.isBareId = isBareId;
|
|
5837
5851
|
exports.isBareSpecifier = isBareSpecifier;
|
|
5838
5852
|
exports.isConst = isConst;
|
|
5853
|
+
exports.isDbEntityNode = isDbEntityNode;
|
|
5839
5854
|
exports.isGroup = isGroup;
|
|
5840
5855
|
exports.isImport = isImport;
|
|
5841
5856
|
exports.isInterface = isInterface;
|
package/dist/index.d.ts
CHANGED
|
@@ -1069,6 +1069,15 @@ interface TFlattenOptions {
|
|
|
1069
1069
|
*/
|
|
1070
1070
|
declare function flattenInterfaceNode(doc: AtscriptDoc, node: SemanticInterfaceNode, options?: TFlattenOptions): Map<string, TFlatFieldDescriptor>;
|
|
1071
1071
|
declare function hasNavPropAnnotation(prop: SemanticPropNode): boolean;
|
|
1072
|
+
/**
|
|
1073
|
+
* Annotations that make an interface a DB entity — a table, or a managed view.
|
|
1074
|
+
* `@db.view.for` alone declares a managed view (`@db.view`, the name, is
|
|
1075
|
+
* optional), so codegen (`__flat` / `__ownProps`), the `asc db sync` inventory
|
|
1076
|
+
* and `DbSpace.get()` in `@atscript/db` all share this one rule.
|
|
1077
|
+
*/
|
|
1078
|
+
declare const DB_ENTITY_ANNOTATIONS: readonly ["db.table", "db.view", "db.view.for"];
|
|
1079
|
+
/** AST side of {@link DB_ENTITY_ANNOTATIONS}: whether a node carries a DB-entity annotation. */
|
|
1080
|
+
declare function isDbEntityNode(node: SemanticNode): boolean;
|
|
1072
1081
|
declare function isPhantomNode(doc: AtscriptDoc, def?: SemanticNode): boolean;
|
|
1073
1082
|
|
|
1074
1083
|
interface TQueryScope {
|
|
@@ -1120,5 +1129,5 @@ type TQueryCursorContext = {
|
|
|
1120
1129
|
*/
|
|
1121
1130
|
declare function analyzeQueryCursorContext(textBeforeCursor: string): TQueryCursorContext;
|
|
1122
1131
|
|
|
1123
|
-
export { $n, AnnotationSpec, AtscriptDoc, AtscriptRepo, BuildRepo, DEFAULT_FORMAT, PluginManager, SemanticAnnotateNode, SemanticArrayNode, SemanticConstNode, SemanticGroup, SemanticImportNode, SemanticInterfaceNode, SemanticNode, SemanticPrimitiveNode, SemanticPropNode, SemanticQueryComparisonNode, SemanticQueryFieldRefNode, SemanticQueryLogicalNode, SemanticQueryNode, SemanticQueryValueListNode, SemanticQueryValueNode, SemanticRefNode, SemanticStructureNode, SemanticTupleNode, SemanticTypeNode, Token, analyzeQueryCursorContext, build, clearResolveBareCache, createAtscriptPlugin, defineConfig, fileUriToPath, flattenInterfaceNode, getFieldsForType, getQueryCompletionScope, getQueryScope, getRelPath, hasNavPropAnnotation, isAnnotate, isAnnotationSpec, isArray, isBareId, isBareSpecifier, isConst, isGroup, isImport, isInterface, isPhantomNode, isPrimitive, isProp, isQueryComparison, isQueryFieldRef, isQueryLogical, isRef, isStructure, isTuple, isType, loadConfig, loadTsConfig, parseBareSpecifier, resolveAnnotation, resolveAtscriptFromPath, resolveBareSpecifier, resolveConfigFile, resolveQueryFieldRef };
|
|
1132
|
+
export { $n, AnnotationSpec, AtscriptDoc, AtscriptRepo, BuildRepo, DB_ENTITY_ANNOTATIONS, DEFAULT_FORMAT, PluginManager, SemanticAnnotateNode, SemanticArrayNode, SemanticConstNode, SemanticGroup, SemanticImportNode, SemanticInterfaceNode, SemanticNode, SemanticPrimitiveNode, SemanticPropNode, SemanticQueryComparisonNode, SemanticQueryFieldRefNode, SemanticQueryLogicalNode, SemanticQueryNode, SemanticQueryValueListNode, SemanticQueryValueNode, SemanticRefNode, SemanticStructureNode, SemanticTupleNode, SemanticTypeNode, Token, analyzeQueryCursorContext, build, clearResolveBareCache, createAtscriptPlugin, defineConfig, fileUriToPath, flattenInterfaceNode, getFieldsForType, getQueryCompletionScope, getQueryScope, getRelPath, hasNavPropAnnotation, isAnnotate, isAnnotationSpec, isArray, isBareId, isBareSpecifier, isConst, isDbEntityNode, isGroup, isImport, isInterface, isPhantomNode, isPrimitive, isProp, isQueryComparison, isQueryFieldRef, isQueryLogical, isRef, isStructure, isTuple, isType, loadConfig, loadTsConfig, parseBareSpecifier, resolveAnnotation, resolveAtscriptFromPath, resolveBareSpecifier, resolveConfigFile, resolveQueryFieldRef };
|
|
1124
1133
|
export type { SemanticQueryExprNode, TAnnotationArgument, TAnnotationSpecConfig, TAnnotationTokens, TAnnotationsTree, TAtscriptConfig, TAtscriptConfigInput, TAtscriptConfigOutput, TAtscriptDocConfig, TAtscriptPlugin, TAtscriptRenderFormat, TDbConfig, TDbConfigDeclarative, TFlatFieldDescriptor, TFlattenOptions, TMessages, TNodeEntity, TOutput, TOutputWithSource, TPluginManagers, TPluginOutput, TPrimitiveAnnotationArg, TPrimitiveAnnotationArgs, TPrimitiveAnnotationValue, TPrimitiveBaseConfig, TPrimitiveConfig, TPrimitiveTypeArray, TPrimitiveTypeComplex, TPrimitiveTypeDef, TPrimitiveTypeFinal, TPrimitiveTypeFinalOptional, TPrimitiveTypeObject, TQueryCursorContext, TQueryLogicalOperator, TQueryOperator, TQueryScope, TSemanticToken };
|
package/dist/index.mjs
CHANGED
|
@@ -5538,6 +5538,19 @@ function hasNavPropAnnotation(prop) {
|
|
|
5538
5538
|
if (!prop.annotations) return false;
|
|
5539
5539
|
return prop.annotations.some((a) => a.name === "db.rel.to" || a.name === "db.rel.from" || a.name === "db.rel.via");
|
|
5540
5540
|
}
|
|
5541
|
+
/**
|
|
5542
|
+
* Annotations that make an interface a DB entity — a table, or a managed view.
|
|
5543
|
+
* `@db.view.for` alone declares a managed view (`@db.view`, the name, is
|
|
5544
|
+
* optional), so codegen (`__flat` / `__ownProps`), the `asc db sync` inventory
|
|
5545
|
+
* and `DbSpace.get()` in `@atscript/db` all share this one rule.
|
|
5546
|
+
*/ const DB_ENTITY_ANNOTATIONS = [
|
|
5547
|
+
"db.table",
|
|
5548
|
+
"db.view",
|
|
5549
|
+
"db.view.for"
|
|
5550
|
+
];
|
|
5551
|
+
/** AST side of {@link DB_ENTITY_ANNOTATIONS}: whether a node carries a DB-entity annotation. */ function isDbEntityNode(node) {
|
|
5552
|
+
return !!node.annotations?.some((a) => DB_ENTITY_ANNOTATIONS.some((name) => name === a.name));
|
|
5553
|
+
}
|
|
5541
5554
|
function isPhantomNode(doc, def) {
|
|
5542
5555
|
if (!def) return false;
|
|
5543
5556
|
if (isPrimitive(def) && def.config.type === "phantom") return true;
|
|
@@ -5760,4 +5773,4 @@ function walkArrayElement(doc, arrayNode, prefix, parentOptional, flatMap, stack
|
|
|
5760
5773
|
}
|
|
5761
5774
|
|
|
5762
5775
|
//#endregion
|
|
5763
|
-
export { $n, AnnotationSpec, AtscriptDoc, AtscriptRepo, BuildRepo, DEFAULT_FORMAT, PluginManager, SemanticAnnotateNode, SemanticArrayNode, SemanticConstNode, SemanticGroup, SemanticImportNode, SemanticInterfaceNode, SemanticNode, SemanticPrimitiveNode, SemanticPropNode, SemanticQueryComparisonNode, SemanticQueryFieldRefNode, SemanticQueryLogicalNode, SemanticQueryNode, SemanticQueryValueListNode, SemanticQueryValueNode, SemanticRefNode, SemanticStructureNode, SemanticTupleNode, SemanticTypeNode, Token, analyzeQueryCursorContext, build, clearResolveBareCache, createAtscriptPlugin, defineConfig, fileUriToPath, flattenInterfaceNode, getFieldsForType, getQueryCompletionScope, getQueryScope, getRelPath, hasNavPropAnnotation, isAnnotate, isAnnotationSpec, isArray, isBareId, isBareSpecifier, isConst, isGroup, isImport, isInterface, isPhantomNode, isPrimitive, isProp, isQueryComparison, isQueryFieldRef, isQueryLogical, isRef, isStructure, isTuple, isType, loadConfig, loadTsConfig, parseBareSpecifier, resolveAnnotation, resolveAtscriptFromPath, resolveBareSpecifier, resolveConfigFile, resolveQueryFieldRef };
|
|
5776
|
+
export { $n, AnnotationSpec, AtscriptDoc, AtscriptRepo, BuildRepo, DB_ENTITY_ANNOTATIONS, DEFAULT_FORMAT, PluginManager, SemanticAnnotateNode, SemanticArrayNode, SemanticConstNode, SemanticGroup, SemanticImportNode, SemanticInterfaceNode, SemanticNode, SemanticPrimitiveNode, SemanticPropNode, SemanticQueryComparisonNode, SemanticQueryFieldRefNode, SemanticQueryLogicalNode, SemanticQueryNode, SemanticQueryValueListNode, SemanticQueryValueNode, SemanticRefNode, SemanticStructureNode, SemanticTupleNode, SemanticTypeNode, Token, analyzeQueryCursorContext, build, clearResolveBareCache, createAtscriptPlugin, defineConfig, fileUriToPath, flattenInterfaceNode, getFieldsForType, getQueryCompletionScope, getQueryScope, getRelPath, hasNavPropAnnotation, isAnnotate, isAnnotationSpec, isArray, isBareId, isBareSpecifier, isConst, isDbEntityNode, isGroup, isImport, isInterface, isPhantomNode, isPrimitive, isProp, isQueryComparison, isQueryFieldRef, isQueryLogical, isRef, isStructure, isTuple, isType, loadConfig, loadTsConfig, parseBareSpecifier, resolveAnnotation, resolveAtscriptFromPath, resolveBareSpecifier, resolveConfigFile, resolveQueryFieldRef };
|