@constructive-io/graphql-query 2.4.5 → 2.4.6
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/README.md +5 -22
- package/ast.js +3 -4
- package/esm/ast.js +3 -4
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -151,9 +151,14 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
|
|
|
151
151
|
|
|
152
152
|
## Related Constructive Tooling
|
|
153
153
|
|
|
154
|
+
### 📦 Package Management
|
|
155
|
+
|
|
156
|
+
* [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
|
|
157
|
+
|
|
154
158
|
### 🧪 Testing
|
|
155
159
|
|
|
156
160
|
* [pgsql-test](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-test): **📊 Isolated testing environments** with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
|
|
161
|
+
* [pgsql-seed](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-seed): **🌱 PostgreSQL seeding utilities** for CSV, JSON, SQL data loading, and pgpm deployment.
|
|
157
162
|
* [supabase-test](https://github.com/constructive-io/constructive/tree/main/postgres/supabase-test): **🧪 Supabase-native test harness** preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
|
|
158
163
|
* [graphile-test](https://github.com/constructive-io/constructive/tree/main/graphile/graphile-test): **🔐 Authentication mocking** for Graphile-focused test helpers and emulating row-level security contexts.
|
|
159
164
|
* [pg-query-context](https://github.com/constructive-io/constructive/tree/main/postgres/pg-query-context): **🔒 Session context injection** to add session-local context (e.g., `SET LOCAL`) into queries—ideal for setting `role`, `jwt.claims`, and other session settings.
|
|
@@ -167,28 +172,6 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
|
|
|
167
172
|
* [@pgsql/types](https://www.npmjs.com/package/@pgsql/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
|
|
168
173
|
* [@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
|
|
169
174
|
|
|
170
|
-
### 🚀 API & Dev Tools
|
|
171
|
-
|
|
172
|
-
* [@constructive-io/graphql-server](https://github.com/constructive-io/constructive/tree/main/graphql/server): **⚡ Express-based API server** powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
|
|
173
|
-
* [@constructive-io/graphql-explorer](https://github.com/constructive-io/constructive/tree/main/graphql/explorer): **🔎 Visual API explorer** with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.
|
|
174
|
-
|
|
175
|
-
### 🔁 Streaming & Uploads
|
|
176
|
-
|
|
177
|
-
* [etag-hash](https://github.com/constructive-io/constructive/tree/main/streaming/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
|
|
178
|
-
* [etag-stream](https://github.com/constructive-io/constructive/tree/main/streaming/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
|
|
179
|
-
* [uuid-hash](https://github.com/constructive-io/constructive/tree/main/streaming/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
|
|
180
|
-
* [uuid-stream](https://github.com/constructive-io/constructive/tree/main/streaming/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
|
|
181
|
-
* [@constructive-io/s3-streamer](https://github.com/constructive-io/constructive/tree/main/streaming/s3-streamer): **📤 Direct S3 streaming** for large files with support for metadata injection and content validation.
|
|
182
|
-
* [@constructive-io/upload-names](https://github.com/constructive-io/constructive/tree/main/streaming/upload-names): **📂 Collision-resistant filenames** utility for structured and unique file names for uploads.
|
|
183
|
-
|
|
184
|
-
### 🧰 CLI & Codegen
|
|
185
|
-
|
|
186
|
-
* [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
|
|
187
|
-
* [@constructive-io/cli](https://github.com/constructive-io/constructive/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing Constructive projects—supports database scaffolding, migrations, seeding, code generation, and automation.
|
|
188
|
-
* [@constructive-io/graphql-codegen](https://github.com/constructive-io/constructive/tree/main/graphql/codegen): **✨ GraphQL code generation** (types, operations, SDK) from schema/endpoint introspection.
|
|
189
|
-
* [@constructive-io/query-builder](https://github.com/constructive-io/constructive/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
|
|
190
|
-
* [@constructive-io/graphql-query](https://github.com/constructive-io/constructive/tree/main/graphql/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
|
|
191
|
-
|
|
192
175
|
## Credits
|
|
193
176
|
|
|
194
177
|
**🛠 Built by the [Constructive](https://constructive.io) team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on [GitHub](https://github.com/constructive-io).**
|
package/ast.js
CHANGED
|
@@ -41,7 +41,6 @@ exports.deleteOne = exports.patchOne = exports.createOne = exports.getOne = expo
|
|
|
41
41
|
exports.getSelections = getSelections;
|
|
42
42
|
const t = __importStar(require("gql-ast"));
|
|
43
43
|
const inflection_1 = __importDefault(require("inflection"));
|
|
44
|
-
const pluralize_1 = __importDefault(require("pluralize"));
|
|
45
44
|
const custom_ast_1 = require("./custom-ast");
|
|
46
45
|
const isObject = val => val !== null && typeof val === 'object';
|
|
47
46
|
const NON_MUTABLE_PROPS = ['createdAt', 'createdBy', 'updatedAt', 'updatedBy'];
|
|
@@ -346,7 +345,7 @@ const createOne = ({ mutationName, operationName, mutation, selection }) => {
|
|
|
346
345
|
console.log('no input field for mutation for' + mutationName);
|
|
347
346
|
return;
|
|
348
347
|
}
|
|
349
|
-
const modelName = inflection_1.default.camelize([
|
|
348
|
+
const modelName = inflection_1.default.camelize([inflection_1.default.singularize(mutation.model)].join('_'), true);
|
|
350
349
|
const allAttrs = objectToArray(mutation.properties.input.properties[modelName].properties);
|
|
351
350
|
const attrs = allAttrs.filter((field) => !NON_MUTABLE_PROPS.includes(field.name));
|
|
352
351
|
const variableDefinitions = getCreateVariablesAst(attrs);
|
|
@@ -389,7 +388,7 @@ const patchOne = ({ mutationName, operationName, mutation, selection }) => {
|
|
|
389
388
|
console.log('no input field for mutation for' + mutationName);
|
|
390
389
|
return;
|
|
391
390
|
}
|
|
392
|
-
const modelName = inflection_1.default.camelize([
|
|
391
|
+
const modelName = inflection_1.default.camelize([inflection_1.default.singularize(mutation.model)].join('_'), true);
|
|
393
392
|
const allAttrs = objectToArray(mutation.properties.input.properties['patch']?.properties || {});
|
|
394
393
|
const patchAttrs = allAttrs.filter((prop) => !NON_MUTABLE_PROPS.includes(prop.name));
|
|
395
394
|
const patchByAttrs = objectToArray(mutation.properties.input.properties).filter((n) => n.name !== 'patch');
|
|
@@ -440,7 +439,7 @@ const deleteOne = ({ mutationName, operationName, mutation }) => {
|
|
|
440
439
|
console.log('no input field for mutation for' + mutationName);
|
|
441
440
|
return;
|
|
442
441
|
}
|
|
443
|
-
const modelName = inflection_1.default.camelize([
|
|
442
|
+
const modelName = inflection_1.default.camelize([inflection_1.default.singularize(mutation.model)].join('_'), true);
|
|
444
443
|
const deleteAttrs = objectToArray(mutation.properties.input.properties);
|
|
445
444
|
const variableDefinitions = deleteAttrs.map((field) => {
|
|
446
445
|
const { name: fieldName, type: fieldType, isNotNull, isArray, isArrayNotNull } = field;
|
package/esm/ast.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as t from 'gql-ast';
|
|
3
3
|
import inflection from 'inflection';
|
|
4
|
-
import plz from 'pluralize';
|
|
5
4
|
import { getCustomAst, isIntervalType } from './custom-ast';
|
|
6
5
|
const isObject = val => val !== null && typeof val === 'object';
|
|
7
6
|
const NON_MUTABLE_PROPS = ['createdAt', 'createdBy', 'updatedAt', 'updatedBy'];
|
|
@@ -303,7 +302,7 @@ export const createOne = ({ mutationName, operationName, mutation, selection })
|
|
|
303
302
|
console.log('no input field for mutation for' + mutationName);
|
|
304
303
|
return;
|
|
305
304
|
}
|
|
306
|
-
const modelName = inflection.camelize([
|
|
305
|
+
const modelName = inflection.camelize([inflection.singularize(mutation.model)].join('_'), true);
|
|
307
306
|
const allAttrs = objectToArray(mutation.properties.input.properties[modelName].properties);
|
|
308
307
|
const attrs = allAttrs.filter((field) => !NON_MUTABLE_PROPS.includes(field.name));
|
|
309
308
|
const variableDefinitions = getCreateVariablesAst(attrs);
|
|
@@ -345,7 +344,7 @@ export const patchOne = ({ mutationName, operationName, mutation, selection }) =
|
|
|
345
344
|
console.log('no input field for mutation for' + mutationName);
|
|
346
345
|
return;
|
|
347
346
|
}
|
|
348
|
-
const modelName = inflection.camelize([
|
|
347
|
+
const modelName = inflection.camelize([inflection.singularize(mutation.model)].join('_'), true);
|
|
349
348
|
const allAttrs = objectToArray(mutation.properties.input.properties['patch']?.properties || {});
|
|
350
349
|
const patchAttrs = allAttrs.filter((prop) => !NON_MUTABLE_PROPS.includes(prop.name));
|
|
351
350
|
const patchByAttrs = objectToArray(mutation.properties.input.properties).filter((n) => n.name !== 'patch');
|
|
@@ -395,7 +394,7 @@ export const deleteOne = ({ mutationName, operationName, mutation }) => {
|
|
|
395
394
|
console.log('no input field for mutation for' + mutationName);
|
|
396
395
|
return;
|
|
397
396
|
}
|
|
398
|
-
const modelName = inflection.camelize([
|
|
397
|
+
const modelName = inflection.camelize([inflection.singularize(mutation.model)].join('_'), true);
|
|
399
398
|
const deleteAttrs = objectToArray(mutation.properties.input.properties);
|
|
400
399
|
const variableDefinitions = deleteAttrs.map((field) => {
|
|
401
400
|
const { name: fieldName, type: fieldType, isNotNull, isArray, isArrayNotNull } = field;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-query",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.6",
|
|
4
4
|
"description": "Constructive GraphQL Query",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"main": "index.js",
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
"ajv": "^7.0.4",
|
|
33
33
|
"gql-ast": "^2.4.5",
|
|
34
34
|
"graphql": "15.10.1",
|
|
35
|
-
"inflection": "1.12.0"
|
|
36
|
-
"pluralize": "8.0.0"
|
|
35
|
+
"inflection": "1.12.0"
|
|
37
36
|
},
|
|
38
37
|
"keywords": [
|
|
39
38
|
"query",
|
|
@@ -45,5 +44,5 @@
|
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"makage": "^0.1.9"
|
|
47
46
|
},
|
|
48
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "bec3240e4e0f93b8edb386734eeb560403f574da"
|
|
49
48
|
}
|