graphile-plugin-utils 1.0.1 → 1.1.2

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/esm/index.js CHANGED
@@ -3,3 +3,4 @@
3
3
  export { getQueryBuilder } from './query-builder';
4
4
  // pg-resource introspection helpers (connection-filter / pg-aggregates)
5
5
  export { isComputedScalarAttributeResource } from './pg-resources';
6
+ export { JSON_SCHEMA_SCALARS, PG_TYPE_SCALARS } from './scalar-maps';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Generic scalar mapping tables.
3
+ *
4
+ * Map source type names — Postgres types and JSON Schema types — to GraphQL
5
+ * scalar names. They carry no plugin-specific logic, so they live here as
6
+ * shared internals rather than co-located with any one plugin's derivation
7
+ * code.
8
+ */
9
+ /** Postgres type → GraphQL scalar name. */
10
+ export const PG_TYPE_SCALARS = {
11
+ uuid: 'UUID',
12
+ text: 'String',
13
+ int: 'Int',
14
+ boolean: 'Boolean',
15
+ numeric: 'BigFloat',
16
+ jsonb: 'JSON',
17
+ timestamptz: 'Datetime'
18
+ };
19
+ /** JSON Schema type → GraphQL scalar name. */
20
+ export const JSON_SCHEMA_SCALARS = {
21
+ string: 'String',
22
+ integer: 'Int',
23
+ number: 'Float',
24
+ boolean: 'Boolean',
25
+ object: 'JSON',
26
+ null: 'JSON'
27
+ };
package/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { getQueryBuilder } from './query-builder';
2
2
  export { isComputedScalarAttributeResource } from './pg-resources';
3
+ export type { GraphQLScalarName } from './scalar-maps';
4
+ export { JSON_SCHEMA_SCALARS, PG_TYPE_SCALARS } from './scalar-maps';
package/index.js CHANGED
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
  // Shared internals for Constructive PostGraphile v5 plugins.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isComputedScalarAttributeResource = exports.getQueryBuilder = void 0;
4
+ exports.PG_TYPE_SCALARS = exports.JSON_SCHEMA_SCALARS = exports.isComputedScalarAttributeResource = exports.getQueryBuilder = void 0;
5
5
  // PgCondition → PgSelectQueryBuilder walker (search / BM25 / pgvector)
6
6
  var query_builder_1 = require("./query-builder");
7
7
  Object.defineProperty(exports, "getQueryBuilder", { enumerable: true, get: function () { return query_builder_1.getQueryBuilder; } });
8
8
  // pg-resource introspection helpers (connection-filter / pg-aggregates)
9
9
  var pg_resources_1 = require("./pg-resources");
10
10
  Object.defineProperty(exports, "isComputedScalarAttributeResource", { enumerable: true, get: function () { return pg_resources_1.isComputedScalarAttributeResource; } });
11
+ var scalar_maps_1 = require("./scalar-maps");
12
+ Object.defineProperty(exports, "JSON_SCHEMA_SCALARS", { enumerable: true, get: function () { return scalar_maps_1.JSON_SCHEMA_SCALARS; } });
13
+ Object.defineProperty(exports, "PG_TYPE_SCALARS", { enumerable: true, get: function () { return scalar_maps_1.PG_TYPE_SCALARS; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-plugin-utils",
3
- "version": "1.0.1",
3
+ "version": "1.1.2",
4
4
  "description": "Shared internals for Constructive PostGraphile v5 plugins - PgCondition query-builder walker and pg-resource introspection helpers",
5
5
  "author": "Constructive <developers@constructive.io>",
6
6
  "homepage": "https://github.com/constructive-io/constructive",
@@ -51,5 +51,5 @@
51
51
  "pg-sql2": "5.0.1",
52
52
  "postgraphile": "5.0.3"
53
53
  },
54
- "gitHead": "cd21f62bb64bdc7f4f40f6cef6af73f8f1c8f8dc"
54
+ "gitHead": "08741ce3a6897192c2dbc7d1da48b9f456ffb59f"
55
55
  }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Generic scalar mapping tables.
3
+ *
4
+ * Map source type names — Postgres types and JSON Schema types — to GraphQL
5
+ * scalar names. They carry no plugin-specific logic, so they live here as
6
+ * shared internals rather than co-located with any one plugin's derivation
7
+ * code.
8
+ */
9
+ /** GraphQL scalar type names produced by the mapping tables below. */
10
+ export type GraphQLScalarName = 'String' | 'Int' | 'Float' | 'Boolean' | 'UUID' | 'Datetime' | 'BigFloat' | 'JSON';
11
+ /** Postgres type → GraphQL scalar name. */
12
+ export declare const PG_TYPE_SCALARS: Record<string, GraphQLScalarName>;
13
+ /** JSON Schema type → GraphQL scalar name. */
14
+ export declare const JSON_SCHEMA_SCALARS: Record<string, GraphQLScalarName>;
package/scalar-maps.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * Generic scalar mapping tables.
4
+ *
5
+ * Map source type names — Postgres types and JSON Schema types — to GraphQL
6
+ * scalar names. They carry no plugin-specific logic, so they live here as
7
+ * shared internals rather than co-located with any one plugin's derivation
8
+ * code.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.JSON_SCHEMA_SCALARS = exports.PG_TYPE_SCALARS = void 0;
12
+ /** Postgres type → GraphQL scalar name. */
13
+ exports.PG_TYPE_SCALARS = {
14
+ uuid: 'UUID',
15
+ text: 'String',
16
+ int: 'Int',
17
+ boolean: 'Boolean',
18
+ numeric: 'BigFloat',
19
+ jsonb: 'JSON',
20
+ timestamptz: 'Datetime'
21
+ };
22
+ /** JSON Schema type → GraphQL scalar name. */
23
+ exports.JSON_SCHEMA_SCALARS = {
24
+ string: 'String',
25
+ integer: 'Int',
26
+ number: 'Float',
27
+ boolean: 'Boolean',
28
+ object: 'JSON',
29
+ null: 'JSON'
30
+ };