@carbonorm/carbonnode 3.9.2 → 3.9.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonorm/carbonnode",
3
- "version": "3.9.2",
3
+ "version": "3.9.3",
4
4
  "browser": "dist/index.umd.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1342,7 +1342,7 @@ export const TABLES = {
1342
1342
  };
1343
1343
  export const C6 = {
1344
1344
  ...C6Constants,
1345
- C6VERSION: '3.9.2',
1345
+ C6VERSION: '3.9.3',
1346
1346
  IMPORT: async (tableName) => {
1347
1347
  tableName = tableName.toLowerCase();
1348
1348
  // if tableName is not a key in the TABLES object then throw an error
@@ -2009,7 +2009,7 @@ export type RestTableInterfaces = iActor
2009
2009
 
2010
2010
  export const C6 : iC6Object<RestTableInterfaces> = {
2011
2011
  ...C6Constants,
2012
- C6VERSION: '3.9.2',
2012
+ C6VERSION: '3.9.3',
2013
2013
  IMPORT: async (tableName: string) : Promise<iDynamicApiImport> => {
2014
2014
 
2015
2015
  tableName = tableName.toLowerCase();
@@ -383,6 +383,27 @@ describe('SQL Builders - Complex SELECTs', () => {
383
383
  expect(params).toEqual({ param0: 10, param1: 20 });
384
384
  });
385
385
 
386
+ it('orders by distance to ST_GeomFromText(WKT, 4326) using PARAM for WKT', () => {
387
+ const config = buildParcelConfig();
388
+
389
+ const qb = new SelectQueryBuilder(config as any, {
390
+ [C6C.SELECT]: [Property_Units.UNIT_ID],
391
+ [C6C.PAGINATION]: {
392
+ [C6C.LIMIT]: 10,
393
+ [C6C.ORDER]: {
394
+ [C6C.ST_DISTANCE_SPHERE]: [
395
+ Property_Units.LOCATION,
396
+ [C6C.ST_GEOMFROMTEXT, [[C6C.PARAM, 'POINT(-104.8967729 39.3976764)'], 4326]],
397
+ ],
398
+ },
399
+ },
400
+ } as any, false);
401
+
402
+ const { sql, params } = qb.build(Property_Units.TABLE_NAME);
403
+ expect(sql).toContain('ORDER BY ST_Distance_Sphere(property_units.location, ST_GEOMFROMTEXT(?, 4326))');
404
+ expect(params.slice(-1)[0]).toBe('POINT(-104.8967729 39.3976764)');
405
+ });
406
+
386
407
  it('leaves normal table joins unaffected', () => {
387
408
  const config = buildTestConfig();
388
409