@stonecrop/graphql-middleware 0.8.7 → 0.8.8

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.
@@ -5,7 +5,7 @@ export { loadDoctypes, loadDoctypesFromObject, getMeta, getAllMeta, hasMeta, cle
5
5
  export type { LoadDoctypesOptions } from './registry/doctypes';
6
6
  export { registerHandler, getHandler, hasHandler, clearHandlers, registerBuiltinHandlers, builtinHandlers, } from './registry/actions';
7
7
  export { createStonecropPlugin } from './plugin/postgraphile';
8
- export type { StonecropPluginOptions } from './plugin/postgraphile';
8
+ export type { StonecropPluginOptions, StonecropInflectionConfig } from './plugin/postgraphile';
9
9
  export { StonecropClient } from './client';
10
10
  export type { StonecropClientOptions } from './client';
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,kBAAkB,EAClB,QAAQ,EACR,mBAAmB,EAGnB,SAAS,EACT,YAAY,EACZ,eAAe,EAGf,WAAW,EACX,YAAY,EACZ,gBAAgB,EAGhB,aAAa,EACb,eAAe,EACf,UAAU,EACV,YAAY,EAGZ,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EAGjB,MAAM,EACN,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,GACZ,MAAM,mBAAmB,CAAA;AAE1B,YAAY,EACX,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,GACvB,MAAM,mBAAmB,CAAA;AAG1B,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG1F,OAAO,EACN,YAAY,EACZ,sBAAsB,EACtB,OAAO,EACP,UAAU,EACV,OAAO,EACP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AAmB,EAAE,MAAM,qBAAqB,CAAA;AAG9D,OAAO,EACN,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,eAAe,GACf,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAG9F,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA"}
@@ -1,5 +1,31 @@
1
1
  import { GraphileConfig } from 'postgraphile/graphile-build';
2
2
  import { GraphQLExecutor } from '../types';
3
+ /**
4
+ * Inflection callbacks for mapping table names to GraphQL query field names.
5
+ * Override these when using a non-Amber inflection preset (e.g., V4, SimplifyInflection).
6
+ *
7
+ * Defaults match the PostGraphile Amber preset conventions.
8
+ * @public
9
+ */
10
+ export interface StonecropInflectionConfig {
11
+ /**
12
+ * Given a table name, return the GraphQL field name for fetching a single record by ID.
13
+ * @example Amber default: "sales_orders" → "salesOrderById"
14
+ * @example V4 preset: "sales_orders" → "salesOrderByRowId"
15
+ */
16
+ recordFieldName?: (tableName: string) => string;
17
+ /**
18
+ * Given a table name, return the GraphQL field name for fetching a list/connection.
19
+ * @example Amber default: "sales_orders" → "allSalesOrders"
20
+ * @example SimplifyInflection: "sales_orders" → "salesOrders"
21
+ */
22
+ connectionFieldName?: (tableName: string) => string;
23
+ /**
24
+ * Given a table name, return the GraphQL OrderBy enum type name.
25
+ * @example Amber default: "sales_orders" → "SalesOrdersOrderBy"
26
+ */
27
+ orderByTypeName?: (tableName: string) => string;
28
+ }
3
29
  /**
4
30
  * Options for creating a Stonecrop PostGraphile plugin
5
31
  * @public
@@ -7,6 +33,11 @@ import { GraphQLExecutor } from '../types';
7
33
  export interface StonecropPluginOptions {
8
34
  /** GraphQL executor for running queries/mutations */
9
35
  executor: GraphQLExecutor;
36
+ /**
37
+ * Override inflection conventions for mapping table names to GraphQL field names.
38
+ * Defaults to PostGraphile Amber preset conventions.
39
+ */
40
+ inflection?: StonecropInflectionConfig;
10
41
  }
11
42
  /**
12
43
  * Create a PostGraphile plugin that extends the GraphQL schema with Stonecrop functionality
@@ -1 +1 @@
1
- {"version":3,"file":"postgraphile.d.ts","sourceRoot":"","sources":["../../../src/plugin/postgraphile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAI5D,OAAO,KAAK,EAA8B,eAAe,EAAE,MAAM,UAAU,CAAA;AAE3E;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC,qDAAqD;IACrD,QAAQ,EAAE,eAAe,CAAA;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB,KAAG,cAAc,CAAC,MA2OtF,CAAA"}
1
+ {"version":3,"file":"postgraphile.d.ts","sourceRoot":"","sources":["../../../src/plugin/postgraphile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAI5D,OAAO,KAAK,EAA8B,eAAe,EAAE,MAAM,UAAU,CAAA;AAE3E;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;IAE/C;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;IAEnD;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAA;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACtC,qDAAqD;IACrD,QAAQ,EAAE,eAAe,CAAA;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,yBAAyB,CAAA;CACtC;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB,KAAG,cAAc,CAAC,MAyPtF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/graphql-middleware",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "graphql": "^16.12.0",
20
20
  "postgraphile": "^5.0.0-rc.7",
21
- "@stonecrop/schema": "0.8.7"
21
+ "@stonecrop/schema": "0.8.8"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@rushstack/heft": "^1.1.7",