@m1212e/rumble 0.27.0 → 0.27.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/README.md +94 -70
- package/out/client/generate.cjs +1 -1
- package/out/client/generate.d.cts +0 -2
- package/out/client/generate.d.cts.map +1 -1
- package/out/client/generate.d.mts +0 -2
- package/out/client/generate.d.mts.map +1 -1
- package/out/client/generate.mjs +1 -2
- package/out/client.cjs +7 -14
- package/out/client.cjs.map +1 -1
- package/out/client.d.cts +19 -28
- package/out/client.d.cts.map +1 -1
- package/out/client.d.mts +19 -28
- package/out/client.d.mts.map +1 -1
- package/out/client.mjs +7 -14
- package/out/client.mjs.map +1 -1
- package/out/{generate-D0CKBths.cjs → generate-Btr_u0Lr.cjs} +4 -7
- package/out/{generate-D0CKBths.cjs.map → generate-Btr_u0Lr.cjs.map} +1 -1
- package/out/{generate-BySnFVve.mjs → generate-Dzf2klR2.mjs} +4 -7
- package/out/{generate-BySnFVve.mjs.map → generate-Dzf2klR2.mjs.map} +1 -1
- package/out/index.cjs +56 -110
- package/out/index.cjs.map +1 -1
- package/out/index.d.cts +10 -300
- package/out/index.d.cts.map +1 -1
- package/out/index.d.mts +10 -300
- package/out/index.d.mts.map +1 -1
- package/out/index.mjs +55 -108
- package/out/index.mjs.map +1 -1
- package/package.json +15 -12
package/out/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,8 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
const require_generate = require("./generate-D0CKBths.cjs");
|
|
23
|
+
const require_generate = require("./generate-Btr_u0Lr.cjs");
|
|
25
24
|
let drizzle_orm = require("drizzle-orm");
|
|
26
25
|
let graphql = require("graphql");
|
|
27
26
|
let es_toolkit = require("es-toolkit");
|
|
@@ -52,7 +51,7 @@ let dataloader = require("dataloader");
|
|
|
52
51
|
dataloader = __toESM(dataloader, 1);
|
|
53
52
|
let zod = require("zod");
|
|
54
53
|
let libphonenumber_js = require("libphonenumber-js");
|
|
55
|
-
|
|
54
|
+
// lib/types/rumbleError.ts
|
|
56
55
|
/**
|
|
57
56
|
* An error that gets raised by rumble whenever something does not go according to plan.
|
|
58
57
|
* Mostly internals, configuration errors or other unexpected things.
|
|
@@ -69,8 +68,7 @@ var RumbleError = class extends Error {
|
|
|
69
68
|
* E.g. the assert helpers issue these.
|
|
70
69
|
*/
|
|
71
70
|
var RumbleErrorSafe = class extends graphql.GraphQLError {};
|
|
72
|
-
|
|
73
|
-
//#region lib/helpers/tableHelpers.ts
|
|
71
|
+
// lib/helpers/tableHelpers.ts
|
|
74
72
|
const indexCache = /* @__PURE__ */ new WeakMap();
|
|
75
73
|
function buildIndex(db) {
|
|
76
74
|
const byTsName = /* @__PURE__ */ new Map();
|
|
@@ -139,8 +137,7 @@ function tableHelper({ db, table }) {
|
|
|
139
137
|
foundRelation: entry.foundRelation
|
|
140
138
|
};
|
|
141
139
|
}
|
|
142
|
-
|
|
143
|
-
//#region lib/helpers/mergeFilters.ts
|
|
140
|
+
// lib/helpers/mergeFilters.ts
|
|
144
141
|
const EmptyFilter$1 = Symbol.for("drizzle:EmptyFilter");
|
|
145
142
|
/**
|
|
146
143
|
* Normalizes drizzle-orm's `EmptyFilter` sentinel to `undefined` so it's
|
|
@@ -184,8 +181,7 @@ function mergeFilters(filterA, filterB, mode = "AND") {
|
|
|
184
181
|
with: mergeRecords(filterA?.with, filterB?.with)
|
|
185
182
|
};
|
|
186
183
|
}
|
|
187
|
-
|
|
188
|
-
//#region lib/helpers/sanitizeFilterValue.ts
|
|
184
|
+
// lib/helpers/sanitizeFilterValue.ts
|
|
189
185
|
const EmptyFilter = Symbol.for("drizzle:EmptyFilter");
|
|
190
186
|
function isPlainObject(value) {
|
|
191
187
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -198,8 +194,7 @@ function sanitizeFilterValue(value) {
|
|
|
198
194
|
if (isPlainObject(value)) return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, sanitizeFilterValue(entry)]));
|
|
199
195
|
return value;
|
|
200
196
|
}
|
|
201
|
-
|
|
202
|
-
//#region lib/abilityBuilder/keys.ts
|
|
197
|
+
// lib/abilityBuilder/keys.ts
|
|
203
198
|
const ACTION_FLAG_KEY = "__rumble_action";
|
|
204
199
|
const columnFlagKey = (group) => `__rumble_columns_${group}`;
|
|
205
200
|
const columnMaskKey = Symbol.for("rumble:columnMask");
|
|
@@ -207,8 +202,7 @@ const columnVisibilityKey = Symbol.for("rumble:columnVisibility");
|
|
|
207
202
|
const guardInputKey = Symbol.for("rumble:guardInput");
|
|
208
203
|
const resolvedFilterKey = Symbol.for("rumble:resolvedFilter");
|
|
209
204
|
const requestStateKey = Symbol.for("rumble:requestState");
|
|
210
|
-
|
|
211
|
-
//#region lib/abilityBuilder/requestState.ts
|
|
205
|
+
// lib/abilityBuilder/requestState.ts
|
|
212
206
|
function createRequestState() {
|
|
213
207
|
return {
|
|
214
208
|
masked: /* @__PURE__ */ new WeakMap(),
|
|
@@ -223,8 +217,7 @@ function attachRequestState(abilities, state) {
|
|
|
223
217
|
function requestStateOf(abilities) {
|
|
224
218
|
return abilities?.[requestStateKey];
|
|
225
219
|
}
|
|
226
|
-
|
|
227
|
-
//#region lib/abilityBuilder/columnMask.ts
|
|
220
|
+
// lib/abilityBuilder/columnMask.ts
|
|
228
221
|
function referencesRelation(filter, relations) {
|
|
229
222
|
if (!filter || typeof filter !== "object") return false;
|
|
230
223
|
return Object.entries(filter).some(([key, value]) => {
|
|
@@ -414,8 +407,7 @@ function createColumnMasker({ actions }, tables) {
|
|
|
414
407
|
columnsHidden
|
|
415
408
|
};
|
|
416
409
|
}
|
|
417
|
-
|
|
418
|
-
//#region lib/helpers/sqlTypes/types.ts
|
|
410
|
+
// lib/helpers/sqlTypes/types.ts
|
|
419
411
|
/**
|
|
420
412
|
* Strips parameter suffixes like `(256)`, `(10,2)` and timezone modifiers
|
|
421
413
|
* (`with time zone`, `without time zone`) from raw getSQLType() output so
|
|
@@ -522,8 +514,7 @@ function isBytesSQLTypeString(sqlType) {
|
|
|
522
514
|
return bytesSQLTypeStrings.includes(sqlType);
|
|
523
515
|
}
|
|
524
516
|
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})`);
|
|
525
|
-
|
|
526
|
-
//#region lib/helpers/sqlTypes/distinctValuesFromSQLType.ts
|
|
517
|
+
// lib/helpers/sqlTypes/distinctValuesFromSQLType.ts
|
|
527
518
|
function createDistinctValuesFromSQLType(sqlType) {
|
|
528
519
|
if (isIntLikeSQLTypeString(sqlType)) return {
|
|
529
520
|
value1: 1,
|
|
@@ -559,8 +550,7 @@ function createDistinctValuesFromSQLType(sqlType) {
|
|
|
559
550
|
};
|
|
560
551
|
throw UnknownTypeRumbleError(sqlType, "Distinct");
|
|
561
552
|
}
|
|
562
|
-
|
|
563
|
-
//#region lib/helpers/telemetry.ts
|
|
553
|
+
// lib/helpers/telemetry.ts
|
|
564
554
|
const SPAN_EXECUTE = _pothos_tracing_opentelemetry.SpanNames.EXECUTE;
|
|
565
555
|
/** @pothos/tracing-opentelemetry's SpanNames enum has no subscribe member. */
|
|
566
556
|
const SPAN_SUBSCRIBE = "graphql.subscribe";
|
|
@@ -734,8 +724,7 @@ function startTimer() {
|
|
|
734
724
|
function durationMs(start) {
|
|
735
725
|
return Math.round((performance.now() - start) * 100) / 100;
|
|
736
726
|
}
|
|
737
|
-
|
|
738
|
-
//#region lib/abilityBuilder/filterResponse.ts
|
|
727
|
+
// lib/abilityBuilder/filterResponse.ts
|
|
739
728
|
/**
|
|
740
729
|
* The limit of a find many call. An injected merge limit wins unless the
|
|
741
730
|
* ability limit is lower, otherwise the default limit caps the ability limit.
|
|
@@ -800,16 +789,14 @@ function createFilterResponder({ db, defaultLimit }, tableSchema) {
|
|
|
800
789
|
return ret;
|
|
801
790
|
};
|
|
802
791
|
}
|
|
803
|
-
|
|
804
|
-
//#region lib/abilityBuilder/queryFilter.ts
|
|
792
|
+
// lib/abilityBuilder/queryFilter.ts
|
|
805
793
|
function isDynamicQueryFilter(filter) {
|
|
806
794
|
return typeof filter === "function";
|
|
807
795
|
}
|
|
808
796
|
function isStaticQueryFilter(filter) {
|
|
809
797
|
return typeof filter !== "function";
|
|
810
798
|
}
|
|
811
|
-
|
|
812
|
-
//#region lib/helpers/errorLogging.ts
|
|
799
|
+
// lib/helpers/errorLogging.ts
|
|
813
800
|
function hasMessage(error) {
|
|
814
801
|
return typeof error === "object" && error !== null && "message" in error;
|
|
815
802
|
}
|
|
@@ -840,8 +827,7 @@ function errorsLogField(errors) {
|
|
|
840
827
|
function errorLogField(error) {
|
|
841
828
|
return errorsLogField([error]);
|
|
842
829
|
}
|
|
843
|
-
|
|
844
|
-
//#region lib/abilityBuilder/telemetry.ts
|
|
830
|
+
// lib/abilityBuilder/telemetry.ts
|
|
845
831
|
const makeNothingRegisteredWarner = (config, logger) => (0, es_toolkit.debounce)((model, action) => {
|
|
846
832
|
const msg = `No abilities registered for ${model}/${action} — blocking everything. Register the ability or ignore this warning if intentional.`;
|
|
847
833
|
if (logger) logger.warn({
|
|
@@ -889,8 +875,7 @@ function traceAbilityPreparation({ otel, log, telemetryConfig }, tableName, acti
|
|
|
889
875
|
});
|
|
890
876
|
return run();
|
|
891
877
|
}
|
|
892
|
-
|
|
893
|
-
//#region lib/abilityBuilder/tableAbilities.ts
|
|
878
|
+
// lib/abilityBuilder/tableAbilities.ts
|
|
894
879
|
/**
|
|
895
880
|
* filter() is async. Without type checking (plain JS, `any`) a forgotten await would
|
|
896
881
|
* hand the promise itself to drizzle
|
|
@@ -1003,8 +988,7 @@ const createTableAbilities = (settings, tableName, queryFilters) => {
|
|
|
1003
988
|
return abilities;
|
|
1004
989
|
} };
|
|
1005
990
|
};
|
|
1006
|
-
|
|
1007
|
-
//#region lib/abilityBuilder/inputGuard.ts
|
|
991
|
+
// lib/abilityBuilder/inputGuard.ts
|
|
1008
992
|
/** The ts names of the columns a relation joins on, on either side. */
|
|
1009
993
|
function relationColumnKeys(db, table, columns) {
|
|
1010
994
|
const known = tableHelper({
|
|
@@ -1137,8 +1121,7 @@ async function relationExposure(abilities, table, action, columns) {
|
|
|
1137
1121
|
const guard = abilities[guardInputKey];
|
|
1138
1122
|
return guard ? guard.exposed(table, action, columns) : [];
|
|
1139
1123
|
}
|
|
1140
|
-
|
|
1141
|
-
//#region lib/abilityBuilder/tableBuilder.ts
|
|
1124
|
+
// lib/abilityBuilder/tableBuilder.ts
|
|
1142
1125
|
/**
|
|
1143
1126
|
* Creates the registration API (allow/filter) of a single table.
|
|
1144
1127
|
*/
|
|
@@ -1222,8 +1205,7 @@ when: (queryFilter) => {
|
|
|
1222
1205
|
}
|
|
1223
1206
|
};
|
|
1224
1207
|
};
|
|
1225
|
-
|
|
1226
|
-
//#region lib/abilityBuilder/index.ts
|
|
1208
|
+
// lib/abilityBuilder/index.ts
|
|
1227
1209
|
const createAbilityBuilder = ({ db, actions, defaultLimit, otel, logger: loggerConfig }) => {
|
|
1228
1210
|
const log = loggerConfig?.enabled ? loggerConfig.logger : void 0;
|
|
1229
1211
|
const telemetryConfig = {
|
|
@@ -1300,8 +1282,7 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel, logger: loggerC
|
|
|
1300
1282
|
}
|
|
1301
1283
|
};
|
|
1302
1284
|
};
|
|
1303
|
-
|
|
1304
|
-
//#region lib/helpers/asserts.ts
|
|
1285
|
+
// lib/helpers/asserts.ts
|
|
1305
1286
|
/**
|
|
1306
1287
|
*
|
|
1307
1288
|
* Helper function to map a drizzle findFirst query result,
|
|
@@ -1380,8 +1361,7 @@ const assertFirstEntryExists = (value) => {
|
|
|
1380
1361
|
if (!v) throw new RumbleErrorSafe("Value not found but required (firstEntry)");
|
|
1381
1362
|
return v;
|
|
1382
1363
|
};
|
|
1383
|
-
|
|
1384
|
-
//#region lib/helpers/mapNullFieldsToUndefined.ts
|
|
1364
|
+
// lib/helpers/mapNullFieldsToUndefined.ts
|
|
1385
1365
|
/**
|
|
1386
1366
|
* Helper to map null fields to undefined
|
|
1387
1367
|
* @param obj The object to map
|
|
@@ -1443,11 +1423,9 @@ where: { id: user.id },
|
|
|
1443
1423
|
function mapNullFieldsToUndefined(obj) {
|
|
1444
1424
|
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, value === null ? void 0 : value]));
|
|
1445
1425
|
}
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
//#endregion
|
|
1450
|
-
//#region lib/args/orderArg.ts
|
|
1426
|
+
// package.json
|
|
1427
|
+
var version = "0.27.3";
|
|
1428
|
+
// lib/args/orderArg.ts
|
|
1451
1429
|
const makeDefaultName$1 = (dbName) => `${(0, es_toolkit.capitalize)((0, drizzle_orm_casing.toCamelCase)(dbName.toString()))}OrderInputArgument`;
|
|
1452
1430
|
const createOrderArgImplementer = ({ db, schemaBuilder }) => {
|
|
1453
1431
|
const referenceStorage = /* @__PURE__ */ new Map();
|
|
@@ -1478,8 +1456,7 @@ const createOrderArgImplementer = ({ db, schemaBuilder }) => {
|
|
|
1478
1456
|
};
|
|
1479
1457
|
return orderArgImplementer;
|
|
1480
1458
|
};
|
|
1481
|
-
|
|
1482
|
-
//#region lib/enum.ts
|
|
1459
|
+
// lib/enum.ts
|
|
1483
1460
|
/**
|
|
1484
1461
|
* Checks if a column is a database enum column (Postgres or MySQL).
|
|
1485
1462
|
*/
|
|
@@ -1539,8 +1516,7 @@ const createEnumImplementer = ({ schema, schemaBuilder }) => {
|
|
|
1539
1516
|
};
|
|
1540
1517
|
return enumImplementer;
|
|
1541
1518
|
};
|
|
1542
|
-
|
|
1543
|
-
//#region lib/helpers/sqlTypes/mapSQLTypeToTSType.ts
|
|
1519
|
+
// lib/helpers/sqlTypes/mapSQLTypeToTSType.ts
|
|
1544
1520
|
function mapSQLTypeToGraphQLType({ sqlType, fieldName }) {
|
|
1545
1521
|
if (/^enum\(/.test(sqlType)) return "String";
|
|
1546
1522
|
const normalized = normalizeSQLType(sqlType);
|
|
@@ -1562,8 +1538,7 @@ function mapSQLTypeToGraphQLType({ sqlType, fieldName }) {
|
|
|
1562
1538
|
if (ret !== void 0) return ret;
|
|
1563
1539
|
throw UnknownTypeRumbleError(sqlType, "SQL to GQL");
|
|
1564
1540
|
}
|
|
1565
|
-
|
|
1566
|
-
//#region lib/args/whereArg.ts
|
|
1541
|
+
// lib/args/whereArg.ts
|
|
1567
1542
|
const makeDefaultName = (dbName) => `${(0, es_toolkit.capitalize)((0, drizzle_orm_casing.toCamelCase)(dbName.toString()))}WhereInputArgument`;
|
|
1568
1543
|
const createWhereArgImplementer = ({ db, schemaBuilder, enumImplementer }) => {
|
|
1569
1544
|
const referenceStorage = /* @__PURE__ */ new Map();
|
|
@@ -1788,8 +1763,7 @@ const createWhereArgImplementer = ({ db, schemaBuilder, enumImplementer }) => {
|
|
|
1788
1763
|
};
|
|
1789
1764
|
return whereArgImplementer;
|
|
1790
1765
|
};
|
|
1791
|
-
|
|
1792
|
-
//#region lib/client/client.ts
|
|
1766
|
+
// lib/client/client.ts
|
|
1793
1767
|
const clientCreatorImplementer = ({ builtSchema }) => {
|
|
1794
1768
|
const clientCreator = async ({ apiUrl, outputPath, rumbleImportPath, useExternalUrqlClient, removeExisting, forceReactivity, autoIncludeIdField = false }) => {
|
|
1795
1769
|
if (process.env.NODE_ENV !== "development") console.warn(`Running rumble client generation in non development mode. Are you sure this is correct? Called with arguments: ${JSON.stringify({
|
|
@@ -1813,8 +1787,7 @@ const clientCreatorImplementer = ({ builtSchema }) => {
|
|
|
1813
1787
|
};
|
|
1814
1788
|
return clientCreator;
|
|
1815
1789
|
};
|
|
1816
|
-
|
|
1817
|
-
//#region lib/context.ts
|
|
1790
|
+
// lib/context.ts
|
|
1818
1791
|
const createContextFunction = ({ context: makeUserContext, abilityBuilder }) => {
|
|
1819
1792
|
const builtAbilityBuilder = (0, es_toolkit.once)(() => abilityBuilder._.build());
|
|
1820
1793
|
return async (req) => {
|
|
@@ -1825,8 +1798,7 @@ const createContextFunction = ({ context: makeUserContext, abilityBuilder }) =>
|
|
|
1825
1798
|
};
|
|
1826
1799
|
};
|
|
1827
1800
|
};
|
|
1828
|
-
|
|
1829
|
-
//#region lib/helpers/protoMapper.ts
|
|
1801
|
+
// lib/helpers/protoMapper.ts
|
|
1830
1802
|
function deepSetProto(obj, proto = Object.prototype, seen = /* @__PURE__ */ new WeakSet()) {
|
|
1831
1803
|
if (obj === null || typeof obj !== "object") return;
|
|
1832
1804
|
if (seen.has(obj)) return;
|
|
@@ -1840,8 +1812,7 @@ function deepSetProto(obj, proto = Object.prototype, seen = /* @__PURE__ */ new
|
|
|
1840
1812
|
Object.setPrototypeOf(obj, proto);
|
|
1841
1813
|
for (const key of Object.keys(obj)) deepSetProto(obj[key], proto, seen);
|
|
1842
1814
|
}
|
|
1843
|
-
|
|
1844
|
-
//#region lib/countQuery.ts
|
|
1815
|
+
// lib/countQuery.ts
|
|
1845
1816
|
const createCountQueryImplementer = ({ db, schemaBuilder, whereArgImplementer, makePubSubInstance }) => {
|
|
1846
1817
|
return ({ table, listAction = "read", isAllowed }) => {
|
|
1847
1818
|
const WhereArg = whereArgImplementer({ table });
|
|
@@ -1881,8 +1852,7 @@ const createCountQueryImplementer = ({ db, schemaBuilder, whereArgImplementer, m
|
|
|
1881
1852
|
});
|
|
1882
1853
|
};
|
|
1883
1854
|
};
|
|
1884
|
-
|
|
1885
|
-
//#region lib/helpers/sofaOpenAPIWebhookDocs.ts
|
|
1855
|
+
// lib/helpers/sofaOpenAPIWebhookDocs.ts
|
|
1886
1856
|
const sofaOpenAPIWebhookDocs = {
|
|
1887
1857
|
paths: {
|
|
1888
1858
|
"/webhook": { post: {
|
|
@@ -1966,8 +1936,7 @@ const sofaOpenAPIWebhookDocs = {
|
|
|
1966
1936
|
}
|
|
1967
1937
|
} }
|
|
1968
1938
|
};
|
|
1969
|
-
|
|
1970
|
-
//#region lib/helpers/tracing.ts
|
|
1939
|
+
// lib/helpers/tracing.ts
|
|
1971
1940
|
function isAsyncIterable(value) {
|
|
1972
1941
|
return typeof value === "object" && value !== null && Symbol.asyncIterator in value;
|
|
1973
1942
|
}
|
|
@@ -2155,8 +2124,7 @@ function buildTracedSubscribe(subscribeFn, rumbleInput, transport) {
|
|
|
2155
2124
|
});
|
|
2156
2125
|
};
|
|
2157
2126
|
}
|
|
2158
|
-
|
|
2159
|
-
//#region lib/helpers/sqlTypes/mapDrizzleTypeToGraphQlType.ts
|
|
2127
|
+
// lib/helpers/sqlTypes/mapDrizzleTypeToGraphQlType.ts
|
|
2160
2128
|
function buildPothosResponseTypeFromGraphQLType({ builder, sqlType, fieldName, nullable, isArray }) {
|
|
2161
2129
|
const gqlType = mapSQLTypeToGraphQLType({
|
|
2162
2130
|
sqlType,
|
|
@@ -2204,8 +2172,7 @@ function buildPothosResponseTypeFromGraphQLType({ builder, sqlType, fieldName, n
|
|
|
2204
2172
|
default: throw new RumbleError(`Unsupported object type ${gqlType} for column ${fieldName}`);
|
|
2205
2173
|
}
|
|
2206
2174
|
}
|
|
2207
|
-
|
|
2208
|
-
//#region lib/helpers/determineDialectFromSchema.ts
|
|
2175
|
+
// lib/helpers/determineDialectFromSchema.ts
|
|
2209
2176
|
const dialectCache = /* @__PURE__ */ new WeakMap();
|
|
2210
2177
|
function determineDBDialectFromSchema(schema) {
|
|
2211
2178
|
const cached = dialectCache.get(schema);
|
|
@@ -2229,8 +2196,7 @@ function determineDBDialectFromSchema(schema) {
|
|
|
2229
2196
|
function isPostgresDB(db) {
|
|
2230
2197
|
return determineDBDialectFromSchema(db._.relations) === "postgres";
|
|
2231
2198
|
}
|
|
2232
|
-
|
|
2233
|
-
//#region lib/search.ts
|
|
2199
|
+
// lib/search.ts
|
|
2234
2200
|
async function initSearchIfApplicable(input) {
|
|
2235
2201
|
const log = input.logger?.enabled ? input.logger.logger : void 0;
|
|
2236
2202
|
if (!isPostgresDB(input.db)) {
|
|
@@ -2290,8 +2256,7 @@ function adjustQueryArgsForSearch({ search, args, tableSchema, abilities }) {
|
|
|
2290
2256
|
}), drizzle_orm.sql.raw(" OR "))})` }] };
|
|
2291
2257
|
}
|
|
2292
2258
|
}
|
|
2293
|
-
|
|
2294
|
-
//#region lib/object.ts
|
|
2259
|
+
// lib/object.ts
|
|
2295
2260
|
const isProbablyAConfigObject = (t) => {
|
|
2296
2261
|
if (typeof t !== "object") return false;
|
|
2297
2262
|
if (Object.keys(t).some((k) => [
|
|
@@ -2519,8 +2484,7 @@ const createObjectImplementer = ({ db, search, otel, logger: loggerConfig, schem
|
|
|
2519
2484
|
});
|
|
2520
2485
|
};
|
|
2521
2486
|
};
|
|
2522
|
-
|
|
2523
|
-
//#region lib/pubsub.ts
|
|
2487
|
+
// lib/pubsub.ts
|
|
2524
2488
|
const SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX = "RUMBLE_SUBSCRIPTION_NOTIFICATION";
|
|
2525
2489
|
const SUBSCRIPTION_NOTIFIER_REMOVED = "REMOVED";
|
|
2526
2490
|
const SUBSCRIPTION_NOTIFIER_UPDATED = "UPDATED";
|
|
@@ -2595,8 +2559,7 @@ const createPubSubInstance = ({ subscriptions }) => {
|
|
|
2595
2559
|
makePubSubInstance
|
|
2596
2560
|
};
|
|
2597
2561
|
};
|
|
2598
|
-
|
|
2599
|
-
//#region lib/query.ts
|
|
2562
|
+
// lib/query.ts
|
|
2600
2563
|
const createQueryImplementer = ({ db, schemaBuilder, search, otel, logger: loggerConfig, whereArgImplementer, orderArgImplementer, makePubSubInstance }) => {
|
|
2601
2564
|
const registeredQueryFieldNames = /* @__PURE__ */ new Set();
|
|
2602
2565
|
const telemetryConfig = {
|
|
@@ -2711,8 +2674,7 @@ const createQueryImplementer = ({ db, schemaBuilder, search, otel, logger: logge
|
|
|
2711
2674
|
});
|
|
2712
2675
|
};
|
|
2713
2676
|
};
|
|
2714
|
-
|
|
2715
|
-
//#region lib/args/whereArgsImplementer.ts
|
|
2677
|
+
// lib/args/whereArgsImplementer.ts
|
|
2716
2678
|
function implementDefaultWhereInputArgs(schemaBuilder) {
|
|
2717
2679
|
const IntWhereInputArgument = schemaBuilder.inputRef("IntWhereInputArgument").implement({ fields: (t) => ({
|
|
2718
2680
|
eq: t.int(),
|
|
@@ -2964,16 +2926,14 @@ function implementDefaultWhereInputArgs(schemaBuilder) {
|
|
|
2964
2926
|
NOT: t.field({ type: DateTimeWhereInputArgument })
|
|
2965
2927
|
}) });
|
|
2966
2928
|
}
|
|
2967
|
-
|
|
2968
|
-
//#region lib/helpers/objectTypeOptions.ts
|
|
2929
|
+
// lib/helpers/objectTypeOptions.ts
|
|
2969
2930
|
function objectTypeOptionsOfField(buildCache, fieldConfig) {
|
|
2970
2931
|
const type = fieldConfig.type;
|
|
2971
2932
|
const ref = type.kind === "List" ? type.type.kind === "Object" ? type.type.ref : void 0 : type.kind === "Object" ? type.ref : void 0;
|
|
2972
2933
|
if (!ref) return void 0;
|
|
2973
2934
|
return buildCache.getTypeConfig(ref, "Object").pothosOptions;
|
|
2974
2935
|
}
|
|
2975
|
-
|
|
2976
|
-
//#region lib/helpers/registerPlugin.ts
|
|
2936
|
+
// lib/helpers/registerPlugin.ts
|
|
2977
2937
|
const registered = /* @__PURE__ */ new Set();
|
|
2978
2938
|
function registerPluginOnce(name, plugin) {
|
|
2979
2939
|
if (registered.has(name)) return;
|
|
@@ -2981,15 +2941,13 @@ function registerPluginOnce(name, plugin) {
|
|
|
2981
2941
|
_pothos_core.default.registerPlugin(name, plugin);
|
|
2982
2942
|
registered.add(name);
|
|
2983
2943
|
}
|
|
2984
|
-
|
|
2985
|
-
//#region lib/columnMaskPlugin/maskTypes.ts
|
|
2944
|
+
// lib/columnMaskPlugin/maskTypes.ts
|
|
2986
2945
|
const maskColumnsKey = "maskColumns";
|
|
2987
2946
|
const maskColumnsActionKey = "maskColumnsAction";
|
|
2988
2947
|
const maskPrimaryKeysKey = "maskPrimaryKeys";
|
|
2989
2948
|
const maskRelationsKey = "maskRelations";
|
|
2990
2949
|
const columnMaskPluginName = "ColumnMaskPlugin";
|
|
2991
|
-
|
|
2992
|
-
//#region lib/columnMaskPlugin/columnMaskPlugin.ts
|
|
2950
|
+
// lib/columnMaskPlugin/columnMaskPlugin.ts
|
|
2993
2951
|
var ColumnMaskPlugin = class extends _pothos_core.BasePlugin {
|
|
2994
2952
|
wrapResolve(resolver, fieldConfig) {
|
|
2995
2953
|
return this.maskResult(this.maskRelation(this.maskPrimaryKey(resolver, fieldConfig), fieldConfig), fieldConfig);
|
|
@@ -3028,8 +2986,7 @@ var ColumnMaskPlugin = class extends _pothos_core.BasePlugin {
|
|
|
3028
2986
|
function registerColumnMaskPlugin() {
|
|
3029
2987
|
registerPluginOnce(columnMaskPluginName, ColumnMaskPlugin);
|
|
3030
2988
|
}
|
|
3031
|
-
|
|
3032
|
-
//#region lib/helpers/abilityAwareClient.ts
|
|
2989
|
+
// lib/helpers/abilityAwareClient.ts
|
|
3033
2990
|
function createAbilityAwareClient({ db, abilityBuilder }) {
|
|
3034
2991
|
return (context) => {
|
|
3035
2992
|
const apis = /* @__PURE__ */ new Map();
|
|
@@ -3073,11 +3030,9 @@ function createAbilityAwareClient({ db, abilityBuilder }) {
|
|
|
3073
3030
|
} });
|
|
3074
3031
|
};
|
|
3075
3032
|
}
|
|
3076
|
-
|
|
3077
|
-
//#region lib/runtimeFiltersPlugin/filterTypes.ts
|
|
3033
|
+
// lib/runtimeFiltersPlugin/filterTypes.ts
|
|
3078
3034
|
const pluginName = "RuntimeFiltersPlugin";
|
|
3079
|
-
|
|
3080
|
-
//#region lib/runtimeFiltersPlugin/runtimeFiltersPlugin.ts
|
|
3035
|
+
// lib/runtimeFiltersPlugin/runtimeFiltersPlugin.ts
|
|
3081
3036
|
const applyFiltersKey = "applyFilters";
|
|
3082
3037
|
var RuntimeFiltersPlugin = class extends _pothos_core.BasePlugin {
|
|
3083
3038
|
tracer;
|
|
@@ -3179,8 +3134,7 @@ var RuntimeFiltersPlugin = class extends _pothos_core.BasePlugin {
|
|
|
3179
3134
|
function registerRuntimeFiltersPlugin() {
|
|
3180
3135
|
registerPluginOnce(pluginName, RuntimeFiltersPlugin);
|
|
3181
3136
|
}
|
|
3182
|
-
|
|
3183
|
-
//#region lib/scalars/addressData.ts
|
|
3137
|
+
// lib/scalars/addressData.ts
|
|
3184
3138
|
/*! Address data derived from Google's Address Data Service (https://github.com/google/libaddressinput),
|
|
3185
3139
|
* licensed under CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
|
|
3186
3140
|
* Changes: reduced to required fields, postal code patterns and examples, and regions with
|
|
@@ -8992,8 +8946,7 @@ const addressData = {
|
|
|
8992
8946
|
},
|
|
8993
8947
|
ZW: { require: "AC" }
|
|
8994
8948
|
};
|
|
8995
|
-
|
|
8996
|
-
//#region lib/scalars/addressValidation.ts
|
|
8949
|
+
// lib/scalars/addressValidation.ts
|
|
8997
8950
|
const REQUIRED_FIELD_PATHS = {
|
|
8998
8951
|
A: "streetAddress",
|
|
8999
8952
|
C: "locality",
|
|
@@ -9123,8 +9076,7 @@ const addressValidationSchema = zod.z.object({
|
|
|
9123
9076
|
message: issue.message
|
|
9124
9077
|
});
|
|
9125
9078
|
});
|
|
9126
|
-
|
|
9127
|
-
//#region lib/scalars/address.ts
|
|
9079
|
+
// lib/scalars/address.ts
|
|
9128
9080
|
function implementDefaultAddressTypes(schemaBuilder) {
|
|
9129
9081
|
return {
|
|
9130
9082
|
Address: schemaBuilder.objectRef("Address").implement({
|
|
@@ -9150,8 +9102,7 @@ function implementDefaultAddressTypes(schemaBuilder) {
|
|
|
9150
9102
|
})
|
|
9151
9103
|
};
|
|
9152
9104
|
}
|
|
9153
|
-
|
|
9154
|
-
//#region lib/scalars/emailAddress.ts
|
|
9105
|
+
// lib/scalars/emailAddress.ts
|
|
9155
9106
|
/**
|
|
9156
9107
|
* Validates an email address using graphql-scalars' own format check, then lowercases it, exactly
|
|
9157
9108
|
* as the `EmailAddress` scalar does. Exported for values that do not arrive as GraphQL input,
|
|
@@ -9177,8 +9128,7 @@ const EmailAddressResolver = new graphql.GraphQLScalarType({
|
|
|
9177
9128
|
return normalizeEmailAddress(ast.value);
|
|
9178
9129
|
}
|
|
9179
9130
|
});
|
|
9180
|
-
|
|
9181
|
-
//#region lib/scalars/personName.ts
|
|
9131
|
+
// lib/scalars/personName.ts
|
|
9182
9132
|
const MAX_LENGTH = 200;
|
|
9183
9133
|
const NAME_REGEX = /^[\p{L}\p{M}]+(?:(?:[ '-]|\.\x20?)[\p{L}\p{M}]+)*\.?$/u;
|
|
9184
9134
|
const APOSTROPHE_VARIANTS = /[\u2018\u2019\u02BC\u00B4\u0060]/gu;
|
|
@@ -9207,8 +9157,7 @@ const PersonNameResolver = new graphql.GraphQLScalarType({
|
|
|
9207
9157
|
return normalizePersonName(ast.value);
|
|
9208
9158
|
}
|
|
9209
9159
|
});
|
|
9210
|
-
|
|
9211
|
-
//#region lib/scalars/phoneNumber.ts
|
|
9160
|
+
// lib/scalars/phoneNumber.ts
|
|
9212
9161
|
/**
|
|
9213
9162
|
* Parses and validates a phone number using libphonenumber-js (Google's phone number metadata),
|
|
9214
9163
|
* which checks real per-country validity (length, area code plausibility, ...) rather than just
|
|
@@ -9245,8 +9194,7 @@ const PhoneNumberResolver = new graphql.GraphQLScalarType({
|
|
|
9245
9194
|
return parsePhoneNumber(ast.value);
|
|
9246
9195
|
}
|
|
9247
9196
|
});
|
|
9248
|
-
|
|
9249
|
-
//#region lib/schemaBuilder.ts
|
|
9197
|
+
// lib/schemaBuilder.ts
|
|
9250
9198
|
const createSchemaBuilder = ({ db, pubsub, pothosConfig, otel, logger, validation, abilityBuilder }) => {
|
|
9251
9199
|
const createSpan = otel?.enabled && otel.tracer ? (0, _pothos_tracing_opentelemetry.createOpenTelemetryWrapper)(otel.tracer, otel.options) : void 0;
|
|
9252
9200
|
registerRuntimeFiltersPlugin();
|
|
@@ -9330,8 +9278,7 @@ const createSchemaBuilder = ({ db, pubsub, pothosConfig, otel, logger, validatio
|
|
|
9330
9278
|
schemaBuilder.mutationType({});
|
|
9331
9279
|
return { schemaBuilder };
|
|
9332
9280
|
};
|
|
9333
|
-
|
|
9334
|
-
//#region lib/rumble.ts
|
|
9281
|
+
// lib/rumble.ts
|
|
9335
9282
|
/**
|
|
9336
9283
|
* Mirrors sofa's own default error handler: it derives the HTTP status from
|
|
9337
9284
|
* `extensions.http` and returns the errors as JSON. rumble only adds telemetry
|
|
@@ -9659,7 +9606,6 @@ export const r = rumble({
|
|
|
9659
9606
|
buildSchema: builtSchema
|
|
9660
9607
|
};
|
|
9661
9608
|
};
|
|
9662
|
-
//#endregion
|
|
9663
9609
|
exports.RumbleError = RumbleError;
|
|
9664
9610
|
exports.RumbleErrorSafe = RumbleErrorSafe;
|
|
9665
9611
|
exports.addressChecks = addressChecks;
|