@dbsp/types 1.1.0 → 1.2.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.
@@ -44,5 +44,22 @@ type IntentBuilder<T, TRequired extends keyof T> = Pick<T, TRequired> & Partial<
44
44
  * not let callers forge the marker through the global symbol registry.
45
45
  */
46
46
  declare const NQL_INTERNAL_COMPILER_OPTIONS: unique symbol;
47
+ declare const NQL_BINDING_REF: unique symbol;
48
+ /**
49
+ * @internal Opaque marker for NQL compiler-created binding references.
50
+ *
51
+ * The brand is a module-private Symbol(), so JSON/plain object inputs cannot
52
+ * forge it by shape.
53
+ */
54
+ interface NqlBindingRef {
55
+ readonly name: string;
56
+ readonly [NQL_BINDING_REF]: true;
57
+ }
58
+ /** @internal */
59
+ declare function createNqlBindingRef(name: string): NqlBindingRef;
60
+ /** @internal */
61
+ declare function isNqlBindingRef(value: unknown): value is NqlBindingRef;
62
+ /** @internal */
63
+ declare function getNqlBindingRefName(ref: NqlBindingRef): string;
47
64
 
48
- export { type IntentBuilder, type Mutable, NQL_INTERNAL_COMPILER_OPTIONS };
65
+ export { type IntentBuilder, type Mutable, NQL_INTERNAL_COMPILER_OPTIONS, type NqlBindingRef, createNqlBindingRef, getNqlBindingRefName, isNqlBindingRef };
package/dist/internal.js CHANGED
@@ -57,6 +57,25 @@ import {
57
57
  var NQL_INTERNAL_COMPILER_OPTIONS = /* @__PURE__ */ Symbol(
58
58
  "@dbsp/nql/internalCompilerOptions"
59
59
  );
60
+ var NQL_BINDING_REF = /* @__PURE__ */ Symbol("@dbsp/nql/bindingRef");
61
+ function createNqlBindingRef(name) {
62
+ const ref = { name };
63
+ Object.defineProperty(ref, NQL_BINDING_REF, {
64
+ value: true,
65
+ enumerable: false
66
+ });
67
+ return ref;
68
+ }
69
+ function isNqlBindingRef(value) {
70
+ if (value === null || typeof value !== "object") {
71
+ return false;
72
+ }
73
+ const record = value;
74
+ return Object.hasOwn(record, NQL_BINDING_REF) && record[NQL_BINDING_REF] === true && typeof record.name === "string";
75
+ }
76
+ function getNqlBindingRefName(ref) {
77
+ return ref.name;
78
+ }
60
79
  export {
61
80
  NQL_INTERNAL_COMPILER_OPTIONS,
62
81
  NQL_SELECT_AGGREGATE_FUNCTIONS,
@@ -68,7 +87,9 @@ export {
68
87
  NQL_SELECT_WINDOW_FUNCTIONS,
69
88
  NQL_SELECT_WINDOW_FUNCTION_ALLOWLIST,
70
89
  NQL_SELECT_WINDOW_ONLY_FUNCTIONS,
90
+ createNqlBindingRef,
71
91
  getNodeIdAlias,
92
+ getNqlBindingRefName,
72
93
  isAdjacencyTraversal,
73
94
  isAggregateWindowFunction,
74
95
  isCoalesceExpression,
@@ -79,6 +100,7 @@ export {
79
100
  isFieldRef,
80
101
  isInsertIntent,
81
102
  isMutationIntent,
103
+ isNqlBindingRef,
82
104
  isNqlSelectFunctionAllowed,
83
105
  isNqlSelectScalarFunctionAllowed,
84
106
  isNqlSelectWindowFunctionAllowed,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal.ts"],"sourcesContent":["/**\n * @dbsp/types/internal - Internal type definitions\n *\n * These types are for internal use by @dbsp package implementations.\n * They are NOT part of the public API and may change without notice.\n *\n * @module @dbsp/types/internal\n * @internal\n */\n\n// Internal-only build utilities (NOT part of public API)\nexport type { IntentBuilder, Mutable } from './builders.js';\n\n/**\n * @internal Shared compiler-options marker for trusted NQL package internals.\n *\n * Deliberately uses Symbol(), not Symbol.for(), so knowing the description does\n * not let callers forge the marker through the global symbol registry.\n */\nexport const NQL_INTERNAL_COMPILER_OPTIONS: unique symbol = Symbol(\n\t'@dbsp/nql/internalCompilerOptions',\n);\n\n// Re-export all public types for convenience\nexport * from './index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,IAAM,gCAA+C;AAAA,EAC3D;AACD;","names":[]}
1
+ {"version":3,"sources":["../src/internal.ts"],"sourcesContent":["/**\n * @dbsp/types/internal - Internal type definitions\n *\n * These types are for internal use by @dbsp package implementations.\n * They are NOT part of the public API and may change without notice.\n *\n * @module @dbsp/types/internal\n * @internal\n */\n\n// Internal-only build utilities (NOT part of public API)\nexport type { IntentBuilder, Mutable } from './builders.js';\n\n/**\n * @internal Shared compiler-options marker for trusted NQL package internals.\n *\n * Deliberately uses Symbol(), not Symbol.for(), so knowing the description does\n * not let callers forge the marker through the global symbol registry.\n */\nexport const NQL_INTERNAL_COMPILER_OPTIONS: unique symbol = Symbol(\n\t'@dbsp/nql/internalCompilerOptions',\n);\n\nconst NQL_BINDING_REF = Symbol('@dbsp/nql/bindingRef');\n\n/**\n * @internal Opaque marker for NQL compiler-created binding references.\n *\n * The brand is a module-private Symbol(), so JSON/plain object inputs cannot\n * forge it by shape.\n */\nexport interface NqlBindingRef {\n\treadonly name: string;\n\treadonly [NQL_BINDING_REF]: true;\n}\n\n/** @internal */\nexport function createNqlBindingRef(name: string): NqlBindingRef {\n\tconst ref = { name } as { name: string; [NQL_BINDING_REF]?: true };\n\tObject.defineProperty(ref, NQL_BINDING_REF, {\n\t\tvalue: true,\n\t\tenumerable: false,\n\t});\n\treturn ref as NqlBindingRef;\n}\n\n/** @internal */\nexport function isNqlBindingRef(value: unknown): value is NqlBindingRef {\n\tif (value === null || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\tconst record = value as {\n\t\treadonly name?: unknown;\n\t\treadonly [NQL_BINDING_REF]?: unknown;\n\t};\n\treturn (\n\t\tObject.hasOwn(record, NQL_BINDING_REF) &&\n\t\trecord[NQL_BINDING_REF] === true &&\n\t\ttypeof record.name === 'string'\n\t);\n}\n\n/** @internal */\nexport function getNqlBindingRefName(ref: NqlBindingRef): string {\n\treturn ref.name;\n}\n\n// Re-export all public types for convenience\nexport * from './index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBO,IAAM,gCAA+C;AAAA,EAC3D;AACD;AAEA,IAAM,kBAAkB,uBAAO,sBAAsB;AAc9C,SAAS,oBAAoB,MAA6B;AAChE,QAAM,MAAM,EAAE,KAAK;AACnB,SAAO,eAAe,KAAK,iBAAiB;AAAA,IAC3C,OAAO;AAAA,IACP,YAAY;AAAA,EACb,CAAC;AACD,SAAO;AACR;AAGO,SAAS,gBAAgB,OAAwC;AACvE,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAChD,WAAO;AAAA,EACR;AACA,QAAM,SAAS;AAIf,SACC,OAAO,OAAO,QAAQ,eAAe,KACrC,OAAO,eAAe,MAAM,QAC5B,OAAO,OAAO,SAAS;AAEzB;AAGO,SAAS,qBAAqB,KAA4B;AAChE,SAAO,IAAI;AACZ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbsp/types",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Shared type definitions for the db-semantic-planner ecosystem",
5
5
  "author": "Olivier Orabona <oorabona@users.noreply.github.com>",
6
6
  "license": "MIT",