@m1212e/rumble 0.16.24 → 0.16.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.
- package/out/client/generate.cjs +3 -4
- package/out/client/generate.mjs +2 -3
- package/out/client.cjs +23 -14
- package/out/client.cjs.map +1 -1
- package/out/client.d.cts.map +1 -1
- package/out/client.d.mts.map +1 -1
- package/out/client.mjs +21 -12
- package/out/client.mjs.map +1 -1
- package/out/{generate-PDRNfY6V.mjs → generate-B6JGM5pc.mjs} +2 -5
- package/out/{generate-PDRNfY6V.mjs.map → generate-B6JGM5pc.mjs.map} +1 -1
- package/out/{generate-9zSO5f7n.cjs → generate-BjPxpUd6.cjs} +8 -11
- package/out/{generate-9zSO5f7n.cjs.map → generate-BjPxpUd6.cjs.map} +1 -1
- package/out/index.cjs +13 -46
- package/out/index.cjs.map +1 -1
- package/out/index.d.cts.map +1 -1
- package/out/index.d.mts.map +1 -1
- package/out/index.mjs +7 -35
- package/out/index.mjs.map +1 -1
- package/out/{lazy-CoMVcY4X.mjs → lazy-BgeBy3-B.mjs} +2 -2
- package/out/{lazy-CoMVcY4X.mjs.map → lazy-BgeBy3-B.mjs.map} +1 -1
- package/out/{lazy-BrDkNRyV.cjs → lazy-DT--QoPa.cjs} +7 -8
- package/out/{lazy-BrDkNRyV.cjs.map → lazy-DT--QoPa.cjs.map} +1 -1
- package/package.json +25 -16
package/out/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as lazy } from "./lazy-
|
|
2
|
-
import { t as generateFromSchema } from "./generate-
|
|
1
|
+
import { t as lazy } from "./lazy-BgeBy3-B.mjs";
|
|
2
|
+
import { t as generateFromSchema } from "./generate-B6JGM5pc.mjs";
|
|
3
3
|
import { GraphQLError } from "graphql";
|
|
4
4
|
import { EnvelopArmorPlugin } from "@escape.tech/graphql-armor";
|
|
5
5
|
import { useDisableIntrospection } from "@graphql-yoga/plugin-disable-introspection";
|
|
@@ -9,7 +9,7 @@ import { capitalize, cloneDeep, debounce, merge, toMerged } from "es-toolkit";
|
|
|
9
9
|
import { createPubSub, createYoga } from "graphql-yoga";
|
|
10
10
|
import { useSofa } from "sofa-api";
|
|
11
11
|
import { One, count, relationsFilterToSQL, sql } from "drizzle-orm";
|
|
12
|
-
import { toCamelCase } from "drizzle-orm/casing";
|
|
12
|
+
import { CasingCache, toCamelCase } from "drizzle-orm/casing";
|
|
13
13
|
import { PgEnumColumn, PgTable } from "drizzle-orm/pg-core";
|
|
14
14
|
import pluralize from "pluralize";
|
|
15
15
|
import { MySqlTable } from "drizzle-orm/mysql-core";
|
|
@@ -19,7 +19,6 @@ import DrizzlePlugin from "@pothos/plugin-drizzle";
|
|
|
19
19
|
import SmartSubscriptionsPlugin, { subscribeOptionsFromIterator } from "@pothos/plugin-smart-subscriptions";
|
|
20
20
|
import TracingPlugin, { isRootField } from "@pothos/plugin-tracing";
|
|
21
21
|
import { DateResolver, DateTimeISOResolver, JSONResolver } from "graphql-scalars";
|
|
22
|
-
|
|
23
22
|
//#region lib/types/rumbleError.ts
|
|
24
23
|
/**
|
|
25
24
|
* An error that gets raised by rumble whenever something does not go according to plan.
|
|
@@ -37,7 +36,6 @@ var RumbleError = class extends Error {
|
|
|
37
36
|
* E.g. the assert helpers issue these.
|
|
38
37
|
*/
|
|
39
38
|
var RumbleErrorSafe = class extends GraphQLError {};
|
|
40
|
-
|
|
41
39
|
//#endregion
|
|
42
40
|
//#region lib/helpers/asserts.ts
|
|
43
41
|
/**
|
|
@@ -118,7 +116,6 @@ const assertFirstEntryExists = (value) => {
|
|
|
118
116
|
if (!v) throw new RumbleErrorSafe("Value not found but required (firstEntry)");
|
|
119
117
|
return v;
|
|
120
118
|
};
|
|
121
|
-
|
|
122
119
|
//#endregion
|
|
123
120
|
//#region lib/helpers/mapNullFieldsToUndefined.ts
|
|
124
121
|
/**
|
|
@@ -182,11 +179,9 @@ where: { id: user.id },
|
|
|
182
179
|
function mapNullFieldsToUndefined(obj) {
|
|
183
180
|
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, value === null ? void 0 : value]));
|
|
184
181
|
}
|
|
185
|
-
|
|
186
182
|
//#endregion
|
|
187
183
|
//#region package.json
|
|
188
|
-
var version = "0.16.
|
|
189
|
-
|
|
184
|
+
var version = "0.16.28";
|
|
190
185
|
//#endregion
|
|
191
186
|
//#region lib/helpers/mergeFilters.ts
|
|
192
187
|
function mergeFilters(filterA, filterB) {
|
|
@@ -203,7 +198,6 @@ function mergeFilters(filterA, filterB) {
|
|
|
203
198
|
with: filterA?.with || filterB?.with ? toMerged(filterA?.with ?? {}, filterB?.with ?? {}) : void 0
|
|
204
199
|
};
|
|
205
200
|
}
|
|
206
|
-
|
|
207
201
|
//#endregion
|
|
208
202
|
//#region lib/helpers/sqlTypes/types.ts
|
|
209
203
|
const intLikeSQLTypeStrings = [
|
|
@@ -268,7 +262,6 @@ function isJSONLikeSQLTypeString(sqlType) {
|
|
|
268
262
|
...jsonLikeSQLTypeStrings
|
|
269
263
|
];
|
|
270
264
|
const UnknownTypeRumbleError = (sqlType, additionalInfo) => new RumbleError(`RumbleError: Unknown SQL type '${sqlType}'. Please open an issue (https://github.com/m1212e/rumble/issues) so it can be added. (${additionalInfo})`);
|
|
271
|
-
|
|
272
265
|
//#endregion
|
|
273
266
|
//#region lib/helpers/sqlTypes/distinctValuesFromSQLType.ts
|
|
274
267
|
function createDistinctValuesFromSQLType(sqlType) {
|
|
@@ -306,7 +299,6 @@ function createDistinctValuesFromSQLType(sqlType) {
|
|
|
306
299
|
};
|
|
307
300
|
throw UnknownTypeRumbleError(sqlType, "Distinct");
|
|
308
301
|
}
|
|
309
|
-
|
|
310
302
|
//#endregion
|
|
311
303
|
//#region lib/helpers/tableHelpers.ts
|
|
312
304
|
const drizzleNameSymbol = Symbol.for("drizzle:Name");
|
|
@@ -331,7 +323,6 @@ function tableHelper({ db, table }) {
|
|
|
331
323
|
fullSchema
|
|
332
324
|
};
|
|
333
325
|
}
|
|
334
|
-
|
|
335
326
|
//#endregion
|
|
336
327
|
//#region lib/abilityBuilder.ts
|
|
337
328
|
function isDynamicQueryFilter(filter) {
|
|
@@ -438,7 +429,8 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel }) => {
|
|
|
438
429
|
return limit ?? void 0;
|
|
439
430
|
});
|
|
440
431
|
const sqlTransformedWhere = lazy(() => {
|
|
441
|
-
|
|
432
|
+
const casing = db._.session?.dialect?.casing ?? new CasingCache();
|
|
433
|
+
return filters?.where ? relationsFilterToSQL(tableSchema.foundRelation.table, filters.where, tableSchema.relations, db._.relations, casing) : void 0;
|
|
442
434
|
});
|
|
443
435
|
if (filters?.columns) return {
|
|
444
436
|
query: {
|
|
@@ -546,7 +538,6 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel }) => {
|
|
|
546
538
|
}
|
|
547
539
|
};
|
|
548
540
|
};
|
|
549
|
-
|
|
550
541
|
//#endregion
|
|
551
542
|
//#region lib/args/orderArg.ts
|
|
552
543
|
const makeDefaultName$1 = (dbName) => `${capitalize(toCamelCase(dbName.toString()))}OrderInputArgument`;
|
|
@@ -593,7 +584,6 @@ const createOrderArgImplementer = ({ db, schemaBuilder }) => {
|
|
|
593
584
|
};
|
|
594
585
|
return orderArgImplementer;
|
|
595
586
|
};
|
|
596
|
-
|
|
597
587
|
//#endregion
|
|
598
588
|
//#region lib/enum.ts
|
|
599
589
|
/**
|
|
@@ -631,7 +621,6 @@ Please ensure that you use the enum at least once as a column of a table!`);
|
|
|
631
621
|
};
|
|
632
622
|
return enumImplementer;
|
|
633
623
|
};
|
|
634
|
-
|
|
635
624
|
//#endregion
|
|
636
625
|
//#region lib/helpers/sqlTypes/mapSQLTypeToTSType.ts
|
|
637
626
|
function mapSQLTypeToGraphQLType({ sqlType, fieldName }) {
|
|
@@ -648,7 +637,6 @@ function mapSQLTypeToGraphQLType({ sqlType, fieldName }) {
|
|
|
648
637
|
if (ret !== void 0) return ret;
|
|
649
638
|
throw UnknownTypeRumbleError(sqlType, "SQL to GQL");
|
|
650
639
|
}
|
|
651
|
-
|
|
652
640
|
//#endregion
|
|
653
641
|
//#region lib/args/whereArg.ts
|
|
654
642
|
const makeDefaultName = (dbName) => `${capitalize(toCamelCase(dbName.toString()))}WhereInputArgument`;
|
|
@@ -717,7 +705,6 @@ const createWhereArgImplementer = ({ db, schemaBuilder, enumImplementer }) => {
|
|
|
717
705
|
};
|
|
718
706
|
return whereArgImplementer;
|
|
719
707
|
};
|
|
720
|
-
|
|
721
708
|
//#endregion
|
|
722
709
|
//#region lib/client/client.ts
|
|
723
710
|
const clientCreatorImplementer = ({ builtSchema }) => {
|
|
@@ -741,7 +728,6 @@ const clientCreatorImplementer = ({ builtSchema }) => {
|
|
|
741
728
|
};
|
|
742
729
|
return clientCreator;
|
|
743
730
|
};
|
|
744
|
-
|
|
745
731
|
//#endregion
|
|
746
732
|
//#region lib/context.ts
|
|
747
733
|
const createContextFunction = ({ context: makeUserContext, abilityBuilder }) => {
|
|
@@ -754,7 +740,6 @@ const createContextFunction = ({ context: makeUserContext, abilityBuilder }) =>
|
|
|
754
740
|
};
|
|
755
741
|
};
|
|
756
742
|
};
|
|
757
|
-
|
|
758
743
|
//#endregion
|
|
759
744
|
//#region lib/helpers/protoMapper.ts
|
|
760
745
|
function deepSetProto(obj, proto = Object.prototype, seen = /* @__PURE__ */ new WeakSet()) {
|
|
@@ -764,7 +749,6 @@ function deepSetProto(obj, proto = Object.prototype, seen = /* @__PURE__ */ new
|
|
|
764
749
|
Object.setPrototypeOf(obj, proto);
|
|
765
750
|
for (const key of Object.keys(obj)) deepSetProto(obj[key], proto, seen);
|
|
766
751
|
}
|
|
767
|
-
|
|
768
752
|
//#endregion
|
|
769
753
|
//#region lib/countQuery.ts
|
|
770
754
|
const createCountQueryImplementer = ({ db, schemaBuilder, whereArgImplementer, makePubSubInstance }) => {
|
|
@@ -804,7 +788,6 @@ const createCountQueryImplementer = ({ db, schemaBuilder, whereArgImplementer, m
|
|
|
804
788
|
});
|
|
805
789
|
};
|
|
806
790
|
};
|
|
807
|
-
|
|
808
791
|
//#endregion
|
|
809
792
|
//#region lib/helpers/sofaOpenAPIWebhookDocs.ts
|
|
810
793
|
const sofaOpenAPIWebhookDocs = {
|
|
@@ -890,7 +873,6 @@ const sofaOpenAPIWebhookDocs = {
|
|
|
890
873
|
}
|
|
891
874
|
} }
|
|
892
875
|
};
|
|
893
|
-
|
|
894
876
|
//#endregion
|
|
895
877
|
//#region lib/helpers/sqlTypes/mapDrizzleTypeToGraphQlType.ts
|
|
896
878
|
function buildPothosResponseTypeFromGraphQLType({ builder, sqlType, fieldName, nullable }) {
|
|
@@ -922,7 +904,6 @@ function buildPothosResponseTypeFromGraphQLType({ builder, sqlType, fieldName, n
|
|
|
922
904
|
default: throw new RumbleError(`Unsupported object type ${gqlType} for column ${fieldName}`);
|
|
923
905
|
}
|
|
924
906
|
}
|
|
925
|
-
|
|
926
907
|
//#endregion
|
|
927
908
|
//#region lib/helpers/determineDialectFromSchema.ts
|
|
928
909
|
function determineDBDialectFromSchema(schema) {
|
|
@@ -941,7 +922,6 @@ function determineDBDialectFromSchema(schema) {
|
|
|
941
922
|
function isPostgresDB(db) {
|
|
942
923
|
return determineDBDialectFromSchema(db._.relations) === "postgres";
|
|
943
924
|
}
|
|
944
|
-
|
|
945
925
|
//#endregion
|
|
946
926
|
//#region lib/search.ts
|
|
947
927
|
async function initSearchIfApplicable(input) {
|
|
@@ -987,7 +967,6 @@ function adjustQueryArgsForSearch({ search, args, tableSchema, abilities }) {
|
|
|
987
967
|
}), sql.raw(" OR "))})` }] };
|
|
988
968
|
}
|
|
989
969
|
}
|
|
990
|
-
|
|
991
970
|
//#endregion
|
|
992
971
|
//#region lib/object.ts
|
|
993
972
|
const isProbablyAConfigObject = (t) => {
|
|
@@ -1161,7 +1140,6 @@ const createObjectImplementer = ({ db, search, schemaBuilder, makePubSubInstance
|
|
|
1161
1140
|
});
|
|
1162
1141
|
};
|
|
1163
1142
|
};
|
|
1164
|
-
|
|
1165
1143
|
//#endregion
|
|
1166
1144
|
//#region lib/pubsub.ts
|
|
1167
1145
|
const SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX = "RUMBLE_SUBSCRIPTION_NOTIFICATION";
|
|
@@ -1226,7 +1204,6 @@ const createPubSubInstance = ({ subscriptions }) => {
|
|
|
1226
1204
|
makePubSubInstance
|
|
1227
1205
|
};
|
|
1228
1206
|
};
|
|
1229
|
-
|
|
1230
1207
|
//#endregion
|
|
1231
1208
|
//#region lib/query.ts
|
|
1232
1209
|
const createQueryImplementer = ({ db, schemaBuilder, search, whereArgImplementer, orderArgImplementer, makePubSubInstance }) => {
|
|
@@ -1311,7 +1288,6 @@ const createQueryImplementer = ({ db, schemaBuilder, search, whereArgImplementer
|
|
|
1311
1288
|
});
|
|
1312
1289
|
};
|
|
1313
1290
|
};
|
|
1314
|
-
|
|
1315
1291
|
//#endregion
|
|
1316
1292
|
//#region lib/args/whereArgsImplementer.ts
|
|
1317
1293
|
function implementDefaultWhereInputArgs(schemaBuilder) {
|
|
@@ -1404,11 +1380,9 @@ function implementDefaultWhereInputArgs(schemaBuilder) {
|
|
|
1404
1380
|
NOT: t.field({ type: DateWhereInputArgument })
|
|
1405
1381
|
}) });
|
|
1406
1382
|
}
|
|
1407
|
-
|
|
1408
1383
|
//#endregion
|
|
1409
1384
|
//#region lib/runtimeFiltersPlugin/filterTypes.ts
|
|
1410
1385
|
const pluginName = "RuntimeFiltersPlugin";
|
|
1411
|
-
|
|
1412
1386
|
//#endregion
|
|
1413
1387
|
//#region lib/runtimeFiltersPlugin/runtimeFiltersPlugin.ts
|
|
1414
1388
|
const applyFiltersKey = "applyFilters";
|
|
@@ -1474,7 +1448,6 @@ function registerRuntimeFiltersPlugin() {
|
|
|
1474
1448
|
registered = true;
|
|
1475
1449
|
}
|
|
1476
1450
|
}
|
|
1477
|
-
|
|
1478
1451
|
//#endregion
|
|
1479
1452
|
//#region lib/schemaBuilder.ts
|
|
1480
1453
|
const createSchemaBuilder = ({ db, disableDefaultObjects, pubsub, pothosConfig, otel }) => {
|
|
@@ -1518,7 +1491,6 @@ const createSchemaBuilder = ({ db, disableDefaultObjects, pubsub, pothosConfig,
|
|
|
1518
1491
|
if (!disableDefaultObjects?.mutation) schemaBuilder.mutationType({});
|
|
1519
1492
|
return { schemaBuilder };
|
|
1520
1493
|
};
|
|
1521
|
-
|
|
1522
1494
|
//#endregion
|
|
1523
1495
|
//#region lib/rumble.ts
|
|
1524
1496
|
const rumble = (rumbleInput) => {
|
|
@@ -1677,7 +1649,7 @@ export const db = drizzle(
|
|
|
1677
1649
|
countQuery
|
|
1678
1650
|
};
|
|
1679
1651
|
};
|
|
1680
|
-
|
|
1681
1652
|
//#endregion
|
|
1682
1653
|
export { RumbleError, RumbleErrorSafe, assertFindFirstExists, assertFirstEntryExists, mapNullFieldsToUndefined, rumble };
|
|
1654
|
+
|
|
1683
1655
|
//# sourceMappingURL=index.mjs.map
|