@granular-software/sdk 0.4.26 → 0.4.28

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.
@@ -4909,9 +4909,24 @@ var Session = class {
4909
4909
  * Get domain documentation for LLMs. Returns types (preferred) or fallback.
4910
4910
  */
4911
4911
  async getDomainDocumentation() {
4912
- const types = await this.getDomainTypes();
4913
- if (types && (types.includes("export declare class") || types.includes("export async function"))) {
4914
- return types;
4912
+ const [types, docs] = await Promise.all([
4913
+ this.getDomainTypes(),
4914
+ this.getDomainDocs()
4915
+ ]);
4916
+ const normalizedTypes = types.trim();
4917
+ const normalizedDocs = docs.trim();
4918
+ if (normalizedTypes && (normalizedTypes.includes("export declare class") || normalizedTypes.includes("export async function"))) {
4919
+ if (!normalizedDocs) {
4920
+ return normalizedTypes;
4921
+ }
4922
+ return [
4923
+ normalizedTypes,
4924
+ "Generated usage notes from ./sandbox-tools docs:",
4925
+ normalizedDocs
4926
+ ].join("\n\n");
4927
+ }
4928
+ if (normalizedDocs) {
4929
+ return normalizedDocs;
4915
4930
  }
4916
4931
  const summary = await this.getDomain();
4917
4932
  return this.generateFallbackDocs(summary);
@@ -9721,10 +9736,15 @@ external_exports.union([
9721
9736
  scalarType: external_exports.string().optional()
9722
9737
  }).strict()
9723
9738
  ]);
9739
+ external_exports.union([
9740
+ external_exports.boolean(),
9741
+ external_exports.object({
9742
+ enabled: external_exports.boolean().optional(),
9743
+ phonetic: external_exports.boolean().optional()
9744
+ }).strict()
9745
+ ]);
9724
9746
  external_exports.object({
9725
- operator: external_exports.enum(
9726
- [...VALIDATION_RULE_OPERATORS]
9727
- ),
9747
+ operator: external_exports.enum([...VALIDATION_RULE_OPERATORS]),
9728
9748
  stringValue: external_exports.string().optional(),
9729
9749
  numberValue: external_exports.number().optional(),
9730
9750
  booleanValue: external_exports.boolean().optional(),
@@ -9817,12 +9837,18 @@ function collectMetamodelSummarySelections(packages) {
9817
9837
  const propertyFields = [];
9818
9838
  const methodFields = [];
9819
9839
  for (const metamodelPackage of packages) {
9820
- pushUnique(classFields, metamodelPackage.summary.selections?.classFields || []);
9840
+ pushUnique(
9841
+ classFields,
9842
+ metamodelPackage.summary.selections?.classFields || []
9843
+ );
9821
9844
  pushUnique(
9822
9845
  propertyFields,
9823
9846
  metamodelPackage.summary.selections?.propertyFields || []
9824
9847
  );
9825
- pushUnique(methodFields, metamodelPackage.summary.selections?.methodFields || []);
9848
+ pushUnique(
9849
+ methodFields,
9850
+ metamodelPackage.summary.selections?.methodFields || []
9851
+ );
9826
9852
  }
9827
9853
  return {
9828
9854
  classFields: unique(classFields),
@@ -9910,7 +9936,11 @@ function createMetamodelRegistry(metamodelPackages) {
9910
9936
  return collectMetamodelSummarySelections(packages);
9911
9937
  },
9912
9938
  applyClassSummaryReaders(rawClass, classSummary) {
9913
- return applyMetamodelSummaryReadersToClass(packages, rawClass, classSummary);
9939
+ return applyMetamodelSummaryReadersToClass(
9940
+ packages,
9941
+ rawClass,
9942
+ classSummary
9943
+ );
9914
9944
  },
9915
9945
  applyPropertySummaryReaders(rawProperty, propertySummary) {
9916
9946
  return applyMetamodelSummaryReadersToProperty(
@@ -9920,7 +9950,11 @@ function createMetamodelRegistry(metamodelPackages) {
9920
9950
  );
9921
9951
  },
9922
9952
  applyMethodSummaryReaders(rawMethod, methodSummary) {
9923
- return applyMetamodelSummaryReadersToMethod(packages, rawMethod, methodSummary);
9953
+ return applyMetamodelSummaryReadersToMethod(
9954
+ packages,
9955
+ rawMethod,
9956
+ methodSummary
9957
+ );
9924
9958
  },
9925
9959
  applyClassIR(classIR, classSummary) {
9926
9960
  return applyMetamodelClassIR(packages, classIR, classSummary);
@@ -9968,6 +10002,10 @@ function mergeClassSummaryPatch(target, patch) {
9968
10002
  }
9969
10003
  function mergePropertySummaryPatch(target, patch) {
9970
10004
  pushUnique(target.notes, patch.notes || []);
10005
+ if (patch.searchable !== void 0) target.searchable = patch.searchable;
10006
+ if (patch.searchablePhonetic !== void 0) {
10007
+ target.searchablePhonetic = patch.searchablePhonetic;
10008
+ }
9971
10009
  if (patch.required !== void 0) target.required = patch.required;
9972
10010
  if (patch.enumRule !== void 0) target.enumRule = patch.enumRule;
9973
10011
  if (patch.filterBy !== void 0) target.filterBy = patch.filterBy;
@@ -9979,9 +10017,11 @@ function mergeMethodSummaryPatch(target, patch) {
9979
10017
  if (patch.effectKey !== void 0) target.effectKey = patch.effectKey;
9980
10018
  if (patch.description !== void 0) target.description = patch.description;
9981
10019
  if (patch.inputSchema !== void 0) target.inputSchema = patch.inputSchema;
9982
- if (patch.outputSchema !== void 0) target.outputSchema = patch.outputSchema;
10020
+ if (patch.outputSchema !== void 0)
10021
+ target.outputSchema = patch.outputSchema;
9983
10022
  if (patch.metamodels !== void 0) target.metamodels = patch.metamodels;
9984
- if (patch.effectBehaviors !== void 0) target.effectBehaviors = patch.effectBehaviors;
10023
+ if (patch.effectBehaviors !== void 0)
10024
+ target.effectBehaviors = patch.effectBehaviors;
9985
10025
  if (patch.static !== void 0) target.static = patch.static;
9986
10026
  }
9987
10027
  function toPascalCase(value) {
@@ -10487,12 +10527,20 @@ function defaultFilterOperators(scalarType) {
10487
10527
  switch ((scalarType || "").toLowerCase()) {
10488
10528
  case "number":
10489
10529
  case "date":
10490
- return ["equal_to", "greater_than", "less_than", "not_null"];
10530
+ return [
10531
+ "equal_to",
10532
+ "greater_than",
10533
+ "greater_than_or_equal_to",
10534
+ "less_than",
10535
+ "less_than_or_equal_to",
10536
+ "not_null"
10537
+ ];
10491
10538
  case "boolean":
10492
- return ["equal_to", "not_null"];
10539
+ return ["equal_to", "true", "false", "not_null"];
10493
10540
  default:
10494
10541
  return [
10495
10542
  "equal_to",
10543
+ "in",
10496
10544
  "contains",
10497
10545
  "not_contains",
10498
10546
  "starts_with",
@@ -10501,16 +10549,26 @@ function defaultFilterOperators(scalarType) {
10501
10549
  ];
10502
10550
  }
10503
10551
  }
10552
+ function supportsDefaultFilterBy(scalarType) {
10553
+ return ["string", "number", "boolean", "date"].includes(
10554
+ String(scalarType || "").toLowerCase()
10555
+ );
10556
+ }
10504
10557
  function normalizeFilterByInput(filterBy, scalarType) {
10505
- if (!filterBy) return null;
10558
+ if (filterBy === false) return null;
10559
+ if (filterBy === void 0) {
10560
+ if (!supportsDefaultFilterBy(scalarType)) return null;
10561
+ return { operators: defaultFilterOperators(scalarType), scalarType };
10562
+ }
10506
10563
  if (filterBy === true) {
10507
- return { operators: defaultFilterOperators(scalarType) };
10564
+ return { operators: defaultFilterOperators(scalarType), scalarType };
10508
10565
  }
10509
10566
  if (Array.isArray(filterBy)) {
10510
- return { operators: filterBy };
10567
+ return { operators: filterBy, scalarType };
10511
10568
  }
10512
10569
  return {
10513
- operators: filterBy.operators
10570
+ operators: filterBy.operators,
10571
+ scalarType: filterBy.scalarType || scalarType
10514
10572
  };
10515
10573
  }
10516
10574
  function buildFilterByFieldMutations(fieldPath, filterBy, scalarType) {
@@ -10521,7 +10579,7 @@ function buildFilterByFieldMutations(fieldPath, filterBy, scalarType) {
10521
10579
  label: `set filterBy on ${fieldPath}`,
10522
10580
  query: `mutation { at(path: ${JSON.stringify(fieldPath)}) { set_filter_by(operators: ${JSON.stringify(
10523
10581
  normalized.operators
10524
- )}) { operators } } }`
10582
+ )}${normalized.scalarType ? `, scalar_type: ${JSON.stringify(normalized.scalarType)}` : ""}) { operators } } }`
10525
10583
  }
10526
10584
  ];
10527
10585
  }
@@ -10531,7 +10589,7 @@ var filterByMetamodelPackage = defineMetamodelPackage({
10531
10589
  fieldRows: [
10532
10590
  {
10533
10591
  key: "filterBy",
10534
- description: "Exposes filter operators for generated query surfaces. Accepts `true`, an operator array, or `{ operators, scalarType }`."
10592
+ description: "Exposes filter operators for generated query surfaces. Scalar fields are filterable by default; set `filterBy: false` to opt out, or override with `true`, an operator array, or `{ operators, scalarType }`."
10535
10593
  }
10536
10594
  ]
10537
10595
  },
@@ -10795,6 +10853,123 @@ var requiredMetamodelPackage = defineMetamodelPackage({
10795
10853
  }
10796
10854
  });
10797
10855
 
10856
+ // ../metamodel-searchable/src/index.ts
10857
+ function supportsDefaultSearchable(scalarType) {
10858
+ return String(scalarType || "").toLowerCase() === "string";
10859
+ }
10860
+ function normalizeSearchableInput(searchable, scalarType) {
10861
+ if (!supportsDefaultSearchable(scalarType)) return null;
10862
+ if (typeof searchable === "boolean" || searchable === void 0) {
10863
+ return {
10864
+ enabled: searchable !== false,
10865
+ phonetic: false
10866
+ };
10867
+ }
10868
+ const enabled = searchable.enabled !== false;
10869
+ return {
10870
+ enabled,
10871
+ phonetic: enabled && searchable.phonetic === true
10872
+ };
10873
+ }
10874
+ function buildSearchableFieldMutations(fieldPath, searchable, scalarType) {
10875
+ const normalized = normalizeSearchableInput(searchable, scalarType);
10876
+ if (normalized === null) return [];
10877
+ return [
10878
+ {
10879
+ label: `set searchable on ${fieldPath}`,
10880
+ query: `mutation { at(path: ${JSON.stringify(fieldPath)}) { set_searchable(enabled: ${normalized.enabled}, phonetic: ${normalized.phonetic}) { enabled phonetic } } }`
10881
+ }
10882
+ ];
10883
+ }
10884
+ var searchableMetamodelPackage = defineMetamodelPackage({
10885
+ id: "searchable",
10886
+ docs: {
10887
+ fieldRows: [
10888
+ {
10889
+ key: "searchable",
10890
+ description: "Controls full-text search exposure for string fields. String fields are searchable by default; set `searchable: false` to opt out, or use `searchable: { phonetic: true }` to keep the field searchable while enabling FalkorDB phonetic matching for class-wide search."
10891
+ }
10892
+ ]
10893
+ },
10894
+ graphql: {
10895
+ typeDefs: [
10896
+ `
10897
+ type SearchableMetamodel {
10898
+ model: Model!
10899
+ enabled: Boolean!
10900
+ phonetic: Boolean!
10901
+ }
10902
+
10903
+ extend type Model {
10904
+ searchable: SearchableMetamodel
10905
+ }
10906
+
10907
+ extend type ModelMutation {
10908
+ set_searchable(enabled: Boolean!, phonetic: Boolean): SearchableMetamodel
10909
+ }
10910
+ `
10911
+ ],
10912
+ createResolvers({ run }) {
10913
+ return {
10914
+ SearchableMetamodel: {
10915
+ model: (value) => value.model,
10916
+ enabled: (value) => value.enabled !== false,
10917
+ phonetic: (value) => value.phonetic === true
10918
+ },
10919
+ Model: {
10920
+ searchable: async (ant) => await run(ant.searchable())
10921
+ },
10922
+ ModelMutation: {
10923
+ set_searchable: async (ant, { enabled, phonetic }) => {
10924
+ return {
10925
+ model: await run(ant.set_searchable(enabled, phonetic === true)),
10926
+ enabled,
10927
+ phonetic: phonetic === true
10928
+ };
10929
+ }
10930
+ }
10931
+ };
10932
+ }
10933
+ },
10934
+ manifest: {
10935
+ buildFieldMutations(fieldPath, spec) {
10936
+ return buildSearchableFieldMutations(
10937
+ fieldPath,
10938
+ spec.searchable,
10939
+ spec.type
10940
+ );
10941
+ }
10942
+ },
10943
+ summary: {
10944
+ selections: {
10945
+ propertyFields: [`searchable { enabled phonetic }`]
10946
+ },
10947
+ readPropertySummary(rawProperty) {
10948
+ if (typeof rawProperty.searchable?.enabled !== "boolean") {
10949
+ return {};
10950
+ }
10951
+ return {
10952
+ searchable: rawProperty.searchable.enabled,
10953
+ searchablePhonetic: rawProperty.searchable.phonetic === true
10954
+ };
10955
+ }
10956
+ },
10957
+ domain: {
10958
+ applyToPropertyIR(propertyIR, propertySummary) {
10959
+ if (String(propertySummary.type || "").toLowerCase() !== "string" || propertySummary.searchable === false) {
10960
+ return propertyIR;
10961
+ }
10962
+ return {
10963
+ ...propertyIR,
10964
+ docs: [
10965
+ ...propertyIR.docs,
10966
+ propertySummary.searchablePhonetic ? "Searchable via `search` using FalkorDB full-text query syntax with phonetic matching enabled." : "Searchable via `search` using FalkorDB full-text query syntax."
10967
+ ]
10968
+ };
10969
+ }
10970
+ }
10971
+ });
10972
+
10798
10973
  // ../metamodel-state-machine/src/index.ts
10799
10974
  function normalizeStateMachines(values) {
10800
10975
  return (values || []).map((machine) => {
@@ -11375,6 +11550,7 @@ var DEFAULT_METAMODEL_PACKAGES = [
11375
11550
  requiredMetamodelPackage,
11376
11551
  enumMetamodelPackage,
11377
11552
  filterByMetamodelPackage,
11553
+ searchableMetamodelPackage,
11378
11554
  validationRuleMetamodelPackage,
11379
11555
  stateMachineMetamodelPackage,
11380
11556
  effectBehaviorsMetamodelPackage