@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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as generateFromSchema } from "./generate-
|
|
1
|
+
import { t as generateFromSchema } from "./generate-Dzf2klR2.mjs";
|
|
2
2
|
import { One, aliasedTable, asc, count, desc, getTableColumns, getTableName, is, isTable, or, relationsFilterToSQL, sql } from "drizzle-orm";
|
|
3
3
|
import { GraphQLError, GraphQLScalarType, GraphQLSchema, Kind, execute as defaultExecute, getOperationAST, print, subscribe as defaultSubscribe } from "graphql";
|
|
4
4
|
import { capitalize, cloneDeep, debounce, merge, once, toMerged } from "es-toolkit";
|
|
@@ -22,7 +22,7 @@ import { BigIntResolver, ByteResolver, DateResolver, DateTimeISOResolver, EmailA
|
|
|
22
22
|
import DataLoader from "dataloader";
|
|
23
23
|
import { z } from "zod";
|
|
24
24
|
import { parsePhoneNumberFromString } from "libphonenumber-js";
|
|
25
|
-
|
|
25
|
+
// lib/types/rumbleError.ts
|
|
26
26
|
/**
|
|
27
27
|
* An error that gets raised by rumble whenever something does not go according to plan.
|
|
28
28
|
* Mostly internals, configuration errors or other unexpected things.
|
|
@@ -39,8 +39,7 @@ var RumbleError = class extends Error {
|
|
|
39
39
|
* E.g. the assert helpers issue these.
|
|
40
40
|
*/
|
|
41
41
|
var RumbleErrorSafe = class extends GraphQLError {};
|
|
42
|
-
|
|
43
|
-
//#region lib/helpers/tableHelpers.ts
|
|
42
|
+
// lib/helpers/tableHelpers.ts
|
|
44
43
|
const indexCache = /* @__PURE__ */ new WeakMap();
|
|
45
44
|
function buildIndex(db) {
|
|
46
45
|
const byTsName = /* @__PURE__ */ new Map();
|
|
@@ -109,8 +108,7 @@ function tableHelper({ db, table }) {
|
|
|
109
108
|
foundRelation: entry.foundRelation
|
|
110
109
|
};
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
//#region lib/helpers/mergeFilters.ts
|
|
111
|
+
// lib/helpers/mergeFilters.ts
|
|
114
112
|
const EmptyFilter$1 = Symbol.for("drizzle:EmptyFilter");
|
|
115
113
|
/**
|
|
116
114
|
* Normalizes drizzle-orm's `EmptyFilter` sentinel to `undefined` so it's
|
|
@@ -154,8 +152,7 @@ function mergeFilters(filterA, filterB, mode = "AND") {
|
|
|
154
152
|
with: mergeRecords(filterA?.with, filterB?.with)
|
|
155
153
|
};
|
|
156
154
|
}
|
|
157
|
-
|
|
158
|
-
//#region lib/helpers/sanitizeFilterValue.ts
|
|
155
|
+
// lib/helpers/sanitizeFilterValue.ts
|
|
159
156
|
const EmptyFilter = Symbol.for("drizzle:EmptyFilter");
|
|
160
157
|
function isPlainObject(value) {
|
|
161
158
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -168,8 +165,7 @@ function sanitizeFilterValue(value) {
|
|
|
168
165
|
if (isPlainObject(value)) return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, sanitizeFilterValue(entry)]));
|
|
169
166
|
return value;
|
|
170
167
|
}
|
|
171
|
-
|
|
172
|
-
//#region lib/abilityBuilder/keys.ts
|
|
168
|
+
// lib/abilityBuilder/keys.ts
|
|
173
169
|
const ACTION_FLAG_KEY = "__rumble_action";
|
|
174
170
|
const columnFlagKey = (group) => `__rumble_columns_${group}`;
|
|
175
171
|
const columnMaskKey = Symbol.for("rumble:columnMask");
|
|
@@ -177,8 +173,7 @@ const columnVisibilityKey = Symbol.for("rumble:columnVisibility");
|
|
|
177
173
|
const guardInputKey = Symbol.for("rumble:guardInput");
|
|
178
174
|
const resolvedFilterKey = Symbol.for("rumble:resolvedFilter");
|
|
179
175
|
const requestStateKey = Symbol.for("rumble:requestState");
|
|
180
|
-
|
|
181
|
-
//#region lib/abilityBuilder/requestState.ts
|
|
176
|
+
// lib/abilityBuilder/requestState.ts
|
|
182
177
|
function createRequestState() {
|
|
183
178
|
return {
|
|
184
179
|
masked: /* @__PURE__ */ new WeakMap(),
|
|
@@ -193,8 +188,7 @@ function attachRequestState(abilities, state) {
|
|
|
193
188
|
function requestStateOf(abilities) {
|
|
194
189
|
return abilities?.[requestStateKey];
|
|
195
190
|
}
|
|
196
|
-
|
|
197
|
-
//#region lib/abilityBuilder/columnMask.ts
|
|
191
|
+
// lib/abilityBuilder/columnMask.ts
|
|
198
192
|
function referencesRelation(filter, relations) {
|
|
199
193
|
if (!filter || typeof filter !== "object") return false;
|
|
200
194
|
return Object.entries(filter).some(([key, value]) => {
|
|
@@ -384,8 +378,7 @@ function createColumnMasker({ actions }, tables) {
|
|
|
384
378
|
columnsHidden
|
|
385
379
|
};
|
|
386
380
|
}
|
|
387
|
-
|
|
388
|
-
//#region lib/helpers/sqlTypes/types.ts
|
|
381
|
+
// lib/helpers/sqlTypes/types.ts
|
|
389
382
|
/**
|
|
390
383
|
* Strips parameter suffixes like `(256)`, `(10,2)` and timezone modifiers
|
|
391
384
|
* (`with time zone`, `without time zone`) from raw getSQLType() output so
|
|
@@ -492,8 +485,7 @@ function isBytesSQLTypeString(sqlType) {
|
|
|
492
485
|
return bytesSQLTypeStrings.includes(sqlType);
|
|
493
486
|
}
|
|
494
487
|
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})`);
|
|
495
|
-
|
|
496
|
-
//#region lib/helpers/sqlTypes/distinctValuesFromSQLType.ts
|
|
488
|
+
// lib/helpers/sqlTypes/distinctValuesFromSQLType.ts
|
|
497
489
|
function createDistinctValuesFromSQLType(sqlType) {
|
|
498
490
|
if (isIntLikeSQLTypeString(sqlType)) return {
|
|
499
491
|
value1: 1,
|
|
@@ -529,8 +521,7 @@ function createDistinctValuesFromSQLType(sqlType) {
|
|
|
529
521
|
};
|
|
530
522
|
throw UnknownTypeRumbleError(sqlType, "Distinct");
|
|
531
523
|
}
|
|
532
|
-
|
|
533
|
-
//#region lib/helpers/telemetry.ts
|
|
524
|
+
// lib/helpers/telemetry.ts
|
|
534
525
|
const SPAN_EXECUTE = SpanNames.EXECUTE;
|
|
535
526
|
/** @pothos/tracing-opentelemetry's SpanNames enum has no subscribe member. */
|
|
536
527
|
const SPAN_SUBSCRIBE = "graphql.subscribe";
|
|
@@ -704,8 +695,7 @@ function startTimer() {
|
|
|
704
695
|
function durationMs(start) {
|
|
705
696
|
return Math.round((performance.now() - start) * 100) / 100;
|
|
706
697
|
}
|
|
707
|
-
|
|
708
|
-
//#region lib/abilityBuilder/filterResponse.ts
|
|
698
|
+
// lib/abilityBuilder/filterResponse.ts
|
|
709
699
|
/**
|
|
710
700
|
* The limit of a find many call. An injected merge limit wins unless the
|
|
711
701
|
* ability limit is lower, otherwise the default limit caps the ability limit.
|
|
@@ -770,16 +760,14 @@ function createFilterResponder({ db, defaultLimit }, tableSchema) {
|
|
|
770
760
|
return ret;
|
|
771
761
|
};
|
|
772
762
|
}
|
|
773
|
-
|
|
774
|
-
//#region lib/abilityBuilder/queryFilter.ts
|
|
763
|
+
// lib/abilityBuilder/queryFilter.ts
|
|
775
764
|
function isDynamicQueryFilter(filter) {
|
|
776
765
|
return typeof filter === "function";
|
|
777
766
|
}
|
|
778
767
|
function isStaticQueryFilter(filter) {
|
|
779
768
|
return typeof filter !== "function";
|
|
780
769
|
}
|
|
781
|
-
|
|
782
|
-
//#region lib/helpers/errorLogging.ts
|
|
770
|
+
// lib/helpers/errorLogging.ts
|
|
783
771
|
function hasMessage(error) {
|
|
784
772
|
return typeof error === "object" && error !== null && "message" in error;
|
|
785
773
|
}
|
|
@@ -810,8 +798,7 @@ function errorsLogField(errors) {
|
|
|
810
798
|
function errorLogField(error) {
|
|
811
799
|
return errorsLogField([error]);
|
|
812
800
|
}
|
|
813
|
-
|
|
814
|
-
//#region lib/abilityBuilder/telemetry.ts
|
|
801
|
+
// lib/abilityBuilder/telemetry.ts
|
|
815
802
|
const makeNothingRegisteredWarner = (config, logger) => debounce((model, action) => {
|
|
816
803
|
const msg = `No abilities registered for ${model}/${action} — blocking everything. Register the ability or ignore this warning if intentional.`;
|
|
817
804
|
if (logger) logger.warn({
|
|
@@ -859,8 +846,7 @@ function traceAbilityPreparation({ otel, log, telemetryConfig }, tableName, acti
|
|
|
859
846
|
});
|
|
860
847
|
return run();
|
|
861
848
|
}
|
|
862
|
-
|
|
863
|
-
//#region lib/abilityBuilder/tableAbilities.ts
|
|
849
|
+
// lib/abilityBuilder/tableAbilities.ts
|
|
864
850
|
/**
|
|
865
851
|
* filter() is async. Without type checking (plain JS, `any`) a forgotten await would
|
|
866
852
|
* hand the promise itself to drizzle
|
|
@@ -973,8 +959,7 @@ const createTableAbilities = (settings, tableName, queryFilters) => {
|
|
|
973
959
|
return abilities;
|
|
974
960
|
} };
|
|
975
961
|
};
|
|
976
|
-
|
|
977
|
-
//#region lib/abilityBuilder/inputGuard.ts
|
|
962
|
+
// lib/abilityBuilder/inputGuard.ts
|
|
978
963
|
/** The ts names of the columns a relation joins on, on either side. */
|
|
979
964
|
function relationColumnKeys(db, table, columns) {
|
|
980
965
|
const known = tableHelper({
|
|
@@ -1107,8 +1092,7 @@ async function relationExposure(abilities, table, action, columns) {
|
|
|
1107
1092
|
const guard = abilities[guardInputKey];
|
|
1108
1093
|
return guard ? guard.exposed(table, action, columns) : [];
|
|
1109
1094
|
}
|
|
1110
|
-
|
|
1111
|
-
//#region lib/abilityBuilder/tableBuilder.ts
|
|
1095
|
+
// lib/abilityBuilder/tableBuilder.ts
|
|
1112
1096
|
/**
|
|
1113
1097
|
* Creates the registration API (allow/filter) of a single table.
|
|
1114
1098
|
*/
|
|
@@ -1192,8 +1176,7 @@ when: (queryFilter) => {
|
|
|
1192
1176
|
}
|
|
1193
1177
|
};
|
|
1194
1178
|
};
|
|
1195
|
-
|
|
1196
|
-
//#region lib/abilityBuilder/index.ts
|
|
1179
|
+
// lib/abilityBuilder/index.ts
|
|
1197
1180
|
const createAbilityBuilder = ({ db, actions, defaultLimit, otel, logger: loggerConfig }) => {
|
|
1198
1181
|
const log = loggerConfig?.enabled ? loggerConfig.logger : void 0;
|
|
1199
1182
|
const telemetryConfig = {
|
|
@@ -1270,8 +1253,7 @@ const createAbilityBuilder = ({ db, actions, defaultLimit, otel, logger: loggerC
|
|
|
1270
1253
|
}
|
|
1271
1254
|
};
|
|
1272
1255
|
};
|
|
1273
|
-
|
|
1274
|
-
//#region lib/helpers/asserts.ts
|
|
1256
|
+
// lib/helpers/asserts.ts
|
|
1275
1257
|
/**
|
|
1276
1258
|
*
|
|
1277
1259
|
* Helper function to map a drizzle findFirst query result,
|
|
@@ -1350,8 +1332,7 @@ const assertFirstEntryExists = (value) => {
|
|
|
1350
1332
|
if (!v) throw new RumbleErrorSafe("Value not found but required (firstEntry)");
|
|
1351
1333
|
return v;
|
|
1352
1334
|
};
|
|
1353
|
-
|
|
1354
|
-
//#region lib/helpers/mapNullFieldsToUndefined.ts
|
|
1335
|
+
// lib/helpers/mapNullFieldsToUndefined.ts
|
|
1355
1336
|
/**
|
|
1356
1337
|
* Helper to map null fields to undefined
|
|
1357
1338
|
* @param obj The object to map
|
|
@@ -1413,11 +1394,9 @@ where: { id: user.id },
|
|
|
1413
1394
|
function mapNullFieldsToUndefined(obj) {
|
|
1414
1395
|
return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, value === null ? void 0 : value]));
|
|
1415
1396
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
//#endregion
|
|
1420
|
-
//#region lib/args/orderArg.ts
|
|
1397
|
+
// package.json
|
|
1398
|
+
var version = "0.27.3";
|
|
1399
|
+
// lib/args/orderArg.ts
|
|
1421
1400
|
const makeDefaultName$1 = (dbName) => `${capitalize(toCamelCase(dbName.toString()))}OrderInputArgument`;
|
|
1422
1401
|
const createOrderArgImplementer = ({ db, schemaBuilder }) => {
|
|
1423
1402
|
const referenceStorage = /* @__PURE__ */ new Map();
|
|
@@ -1448,8 +1427,7 @@ const createOrderArgImplementer = ({ db, schemaBuilder }) => {
|
|
|
1448
1427
|
};
|
|
1449
1428
|
return orderArgImplementer;
|
|
1450
1429
|
};
|
|
1451
|
-
|
|
1452
|
-
//#region lib/enum.ts
|
|
1430
|
+
// lib/enum.ts
|
|
1453
1431
|
/**
|
|
1454
1432
|
* Checks if a column is a database enum column (Postgres or MySQL).
|
|
1455
1433
|
*/
|
|
@@ -1509,8 +1487,7 @@ const createEnumImplementer = ({ schema, schemaBuilder }) => {
|
|
|
1509
1487
|
};
|
|
1510
1488
|
return enumImplementer;
|
|
1511
1489
|
};
|
|
1512
|
-
|
|
1513
|
-
//#region lib/helpers/sqlTypes/mapSQLTypeToTSType.ts
|
|
1490
|
+
// lib/helpers/sqlTypes/mapSQLTypeToTSType.ts
|
|
1514
1491
|
function mapSQLTypeToGraphQLType({ sqlType, fieldName }) {
|
|
1515
1492
|
if (/^enum\(/.test(sqlType)) return "String";
|
|
1516
1493
|
const normalized = normalizeSQLType(sqlType);
|
|
@@ -1532,8 +1509,7 @@ function mapSQLTypeToGraphQLType({ sqlType, fieldName }) {
|
|
|
1532
1509
|
if (ret !== void 0) return ret;
|
|
1533
1510
|
throw UnknownTypeRumbleError(sqlType, "SQL to GQL");
|
|
1534
1511
|
}
|
|
1535
|
-
|
|
1536
|
-
//#region lib/args/whereArg.ts
|
|
1512
|
+
// lib/args/whereArg.ts
|
|
1537
1513
|
const makeDefaultName = (dbName) => `${capitalize(toCamelCase(dbName.toString()))}WhereInputArgument`;
|
|
1538
1514
|
const createWhereArgImplementer = ({ db, schemaBuilder, enumImplementer }) => {
|
|
1539
1515
|
const referenceStorage = /* @__PURE__ */ new Map();
|
|
@@ -1758,8 +1734,7 @@ const createWhereArgImplementer = ({ db, schemaBuilder, enumImplementer }) => {
|
|
|
1758
1734
|
};
|
|
1759
1735
|
return whereArgImplementer;
|
|
1760
1736
|
};
|
|
1761
|
-
|
|
1762
|
-
//#region lib/client/client.ts
|
|
1737
|
+
// lib/client/client.ts
|
|
1763
1738
|
const clientCreatorImplementer = ({ builtSchema }) => {
|
|
1764
1739
|
const clientCreator = async ({ apiUrl, outputPath, rumbleImportPath, useExternalUrqlClient, removeExisting, forceReactivity, autoIncludeIdField = false }) => {
|
|
1765
1740
|
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({
|
|
@@ -1783,8 +1758,7 @@ const clientCreatorImplementer = ({ builtSchema }) => {
|
|
|
1783
1758
|
};
|
|
1784
1759
|
return clientCreator;
|
|
1785
1760
|
};
|
|
1786
|
-
|
|
1787
|
-
//#region lib/context.ts
|
|
1761
|
+
// lib/context.ts
|
|
1788
1762
|
const createContextFunction = ({ context: makeUserContext, abilityBuilder }) => {
|
|
1789
1763
|
const builtAbilityBuilder = once(() => abilityBuilder._.build());
|
|
1790
1764
|
return async (req) => {
|
|
@@ -1795,8 +1769,7 @@ const createContextFunction = ({ context: makeUserContext, abilityBuilder }) =>
|
|
|
1795
1769
|
};
|
|
1796
1770
|
};
|
|
1797
1771
|
};
|
|
1798
|
-
|
|
1799
|
-
//#region lib/helpers/protoMapper.ts
|
|
1772
|
+
// lib/helpers/protoMapper.ts
|
|
1800
1773
|
function deepSetProto(obj, proto = Object.prototype, seen = /* @__PURE__ */ new WeakSet()) {
|
|
1801
1774
|
if (obj === null || typeof obj !== "object") return;
|
|
1802
1775
|
if (seen.has(obj)) return;
|
|
@@ -1810,8 +1783,7 @@ function deepSetProto(obj, proto = Object.prototype, seen = /* @__PURE__ */ new
|
|
|
1810
1783
|
Object.setPrototypeOf(obj, proto);
|
|
1811
1784
|
for (const key of Object.keys(obj)) deepSetProto(obj[key], proto, seen);
|
|
1812
1785
|
}
|
|
1813
|
-
|
|
1814
|
-
//#region lib/countQuery.ts
|
|
1786
|
+
// lib/countQuery.ts
|
|
1815
1787
|
const createCountQueryImplementer = ({ db, schemaBuilder, whereArgImplementer, makePubSubInstance }) => {
|
|
1816
1788
|
return ({ table, listAction = "read", isAllowed }) => {
|
|
1817
1789
|
const WhereArg = whereArgImplementer({ table });
|
|
@@ -1851,8 +1823,7 @@ const createCountQueryImplementer = ({ db, schemaBuilder, whereArgImplementer, m
|
|
|
1851
1823
|
});
|
|
1852
1824
|
};
|
|
1853
1825
|
};
|
|
1854
|
-
|
|
1855
|
-
//#region lib/helpers/sofaOpenAPIWebhookDocs.ts
|
|
1826
|
+
// lib/helpers/sofaOpenAPIWebhookDocs.ts
|
|
1856
1827
|
const sofaOpenAPIWebhookDocs = {
|
|
1857
1828
|
paths: {
|
|
1858
1829
|
"/webhook": { post: {
|
|
@@ -1936,8 +1907,7 @@ const sofaOpenAPIWebhookDocs = {
|
|
|
1936
1907
|
}
|
|
1937
1908
|
} }
|
|
1938
1909
|
};
|
|
1939
|
-
|
|
1940
|
-
//#region lib/helpers/tracing.ts
|
|
1910
|
+
// lib/helpers/tracing.ts
|
|
1941
1911
|
function isAsyncIterable(value) {
|
|
1942
1912
|
return typeof value === "object" && value !== null && Symbol.asyncIterator in value;
|
|
1943
1913
|
}
|
|
@@ -2125,8 +2095,7 @@ function buildTracedSubscribe(subscribeFn, rumbleInput, transport) {
|
|
|
2125
2095
|
});
|
|
2126
2096
|
};
|
|
2127
2097
|
}
|
|
2128
|
-
|
|
2129
|
-
//#region lib/helpers/sqlTypes/mapDrizzleTypeToGraphQlType.ts
|
|
2098
|
+
// lib/helpers/sqlTypes/mapDrizzleTypeToGraphQlType.ts
|
|
2130
2099
|
function buildPothosResponseTypeFromGraphQLType({ builder, sqlType, fieldName, nullable, isArray }) {
|
|
2131
2100
|
const gqlType = mapSQLTypeToGraphQLType({
|
|
2132
2101
|
sqlType,
|
|
@@ -2174,8 +2143,7 @@ function buildPothosResponseTypeFromGraphQLType({ builder, sqlType, fieldName, n
|
|
|
2174
2143
|
default: throw new RumbleError(`Unsupported object type ${gqlType} for column ${fieldName}`);
|
|
2175
2144
|
}
|
|
2176
2145
|
}
|
|
2177
|
-
|
|
2178
|
-
//#region lib/helpers/determineDialectFromSchema.ts
|
|
2146
|
+
// lib/helpers/determineDialectFromSchema.ts
|
|
2179
2147
|
const dialectCache = /* @__PURE__ */ new WeakMap();
|
|
2180
2148
|
function determineDBDialectFromSchema(schema) {
|
|
2181
2149
|
const cached = dialectCache.get(schema);
|
|
@@ -2199,8 +2167,7 @@ function determineDBDialectFromSchema(schema) {
|
|
|
2199
2167
|
function isPostgresDB(db) {
|
|
2200
2168
|
return determineDBDialectFromSchema(db._.relations) === "postgres";
|
|
2201
2169
|
}
|
|
2202
|
-
|
|
2203
|
-
//#region lib/search.ts
|
|
2170
|
+
// lib/search.ts
|
|
2204
2171
|
async function initSearchIfApplicable(input) {
|
|
2205
2172
|
const log = input.logger?.enabled ? input.logger.logger : void 0;
|
|
2206
2173
|
if (!isPostgresDB(input.db)) {
|
|
@@ -2260,8 +2227,7 @@ function adjustQueryArgsForSearch({ search, args, tableSchema, abilities }) {
|
|
|
2260
2227
|
}), sql.raw(" OR "))})` }] };
|
|
2261
2228
|
}
|
|
2262
2229
|
}
|
|
2263
|
-
|
|
2264
|
-
//#region lib/object.ts
|
|
2230
|
+
// lib/object.ts
|
|
2265
2231
|
const isProbablyAConfigObject = (t) => {
|
|
2266
2232
|
if (typeof t !== "object") return false;
|
|
2267
2233
|
if (Object.keys(t).some((k) => [
|
|
@@ -2489,8 +2455,7 @@ const createObjectImplementer = ({ db, search, otel, logger: loggerConfig, schem
|
|
|
2489
2455
|
});
|
|
2490
2456
|
};
|
|
2491
2457
|
};
|
|
2492
|
-
|
|
2493
|
-
//#region lib/pubsub.ts
|
|
2458
|
+
// lib/pubsub.ts
|
|
2494
2459
|
const SUBSCRIPTION_NOTIFIER_RUMBLE_PREFIX = "RUMBLE_SUBSCRIPTION_NOTIFICATION";
|
|
2495
2460
|
const SUBSCRIPTION_NOTIFIER_REMOVED = "REMOVED";
|
|
2496
2461
|
const SUBSCRIPTION_NOTIFIER_UPDATED = "UPDATED";
|
|
@@ -2565,8 +2530,7 @@ const createPubSubInstance = ({ subscriptions }) => {
|
|
|
2565
2530
|
makePubSubInstance
|
|
2566
2531
|
};
|
|
2567
2532
|
};
|
|
2568
|
-
|
|
2569
|
-
//#region lib/query.ts
|
|
2533
|
+
// lib/query.ts
|
|
2570
2534
|
const createQueryImplementer = ({ db, schemaBuilder, search, otel, logger: loggerConfig, whereArgImplementer, orderArgImplementer, makePubSubInstance }) => {
|
|
2571
2535
|
const registeredQueryFieldNames = /* @__PURE__ */ new Set();
|
|
2572
2536
|
const telemetryConfig = {
|
|
@@ -2681,8 +2645,7 @@ const createQueryImplementer = ({ db, schemaBuilder, search, otel, logger: logge
|
|
|
2681
2645
|
});
|
|
2682
2646
|
};
|
|
2683
2647
|
};
|
|
2684
|
-
|
|
2685
|
-
//#region lib/args/whereArgsImplementer.ts
|
|
2648
|
+
// lib/args/whereArgsImplementer.ts
|
|
2686
2649
|
function implementDefaultWhereInputArgs(schemaBuilder) {
|
|
2687
2650
|
const IntWhereInputArgument = schemaBuilder.inputRef("IntWhereInputArgument").implement({ fields: (t) => ({
|
|
2688
2651
|
eq: t.int(),
|
|
@@ -2934,16 +2897,14 @@ function implementDefaultWhereInputArgs(schemaBuilder) {
|
|
|
2934
2897
|
NOT: t.field({ type: DateTimeWhereInputArgument })
|
|
2935
2898
|
}) });
|
|
2936
2899
|
}
|
|
2937
|
-
|
|
2938
|
-
//#region lib/helpers/objectTypeOptions.ts
|
|
2900
|
+
// lib/helpers/objectTypeOptions.ts
|
|
2939
2901
|
function objectTypeOptionsOfField(buildCache, fieldConfig) {
|
|
2940
2902
|
const type = fieldConfig.type;
|
|
2941
2903
|
const ref = type.kind === "List" ? type.type.kind === "Object" ? type.type.ref : void 0 : type.kind === "Object" ? type.ref : void 0;
|
|
2942
2904
|
if (!ref) return void 0;
|
|
2943
2905
|
return buildCache.getTypeConfig(ref, "Object").pothosOptions;
|
|
2944
2906
|
}
|
|
2945
|
-
|
|
2946
|
-
//#region lib/helpers/registerPlugin.ts
|
|
2907
|
+
// lib/helpers/registerPlugin.ts
|
|
2947
2908
|
const registered = /* @__PURE__ */ new Set();
|
|
2948
2909
|
function registerPluginOnce(name, plugin) {
|
|
2949
2910
|
if (registered.has(name)) return;
|
|
@@ -2951,15 +2912,13 @@ function registerPluginOnce(name, plugin) {
|
|
|
2951
2912
|
SchemaBuilder.registerPlugin(name, plugin);
|
|
2952
2913
|
registered.add(name);
|
|
2953
2914
|
}
|
|
2954
|
-
|
|
2955
|
-
//#region lib/columnMaskPlugin/maskTypes.ts
|
|
2915
|
+
// lib/columnMaskPlugin/maskTypes.ts
|
|
2956
2916
|
const maskColumnsKey = "maskColumns";
|
|
2957
2917
|
const maskColumnsActionKey = "maskColumnsAction";
|
|
2958
2918
|
const maskPrimaryKeysKey = "maskPrimaryKeys";
|
|
2959
2919
|
const maskRelationsKey = "maskRelations";
|
|
2960
2920
|
const columnMaskPluginName = "ColumnMaskPlugin";
|
|
2961
|
-
|
|
2962
|
-
//#region lib/columnMaskPlugin/columnMaskPlugin.ts
|
|
2921
|
+
// lib/columnMaskPlugin/columnMaskPlugin.ts
|
|
2963
2922
|
var ColumnMaskPlugin = class extends BasePlugin {
|
|
2964
2923
|
wrapResolve(resolver, fieldConfig) {
|
|
2965
2924
|
return this.maskResult(this.maskRelation(this.maskPrimaryKey(resolver, fieldConfig), fieldConfig), fieldConfig);
|
|
@@ -2998,8 +2957,7 @@ var ColumnMaskPlugin = class extends BasePlugin {
|
|
|
2998
2957
|
function registerColumnMaskPlugin() {
|
|
2999
2958
|
registerPluginOnce(columnMaskPluginName, ColumnMaskPlugin);
|
|
3000
2959
|
}
|
|
3001
|
-
|
|
3002
|
-
//#region lib/helpers/abilityAwareClient.ts
|
|
2960
|
+
// lib/helpers/abilityAwareClient.ts
|
|
3003
2961
|
function createAbilityAwareClient({ db, abilityBuilder }) {
|
|
3004
2962
|
return (context) => {
|
|
3005
2963
|
const apis = /* @__PURE__ */ new Map();
|
|
@@ -3043,11 +3001,9 @@ function createAbilityAwareClient({ db, abilityBuilder }) {
|
|
|
3043
3001
|
} });
|
|
3044
3002
|
};
|
|
3045
3003
|
}
|
|
3046
|
-
|
|
3047
|
-
//#region lib/runtimeFiltersPlugin/filterTypes.ts
|
|
3004
|
+
// lib/runtimeFiltersPlugin/filterTypes.ts
|
|
3048
3005
|
const pluginName = "RuntimeFiltersPlugin";
|
|
3049
|
-
|
|
3050
|
-
//#region lib/runtimeFiltersPlugin/runtimeFiltersPlugin.ts
|
|
3006
|
+
// lib/runtimeFiltersPlugin/runtimeFiltersPlugin.ts
|
|
3051
3007
|
const applyFiltersKey = "applyFilters";
|
|
3052
3008
|
var RuntimeFiltersPlugin = class extends BasePlugin {
|
|
3053
3009
|
tracer;
|
|
@@ -3149,8 +3105,7 @@ var RuntimeFiltersPlugin = class extends BasePlugin {
|
|
|
3149
3105
|
function registerRuntimeFiltersPlugin() {
|
|
3150
3106
|
registerPluginOnce(pluginName, RuntimeFiltersPlugin);
|
|
3151
3107
|
}
|
|
3152
|
-
|
|
3153
|
-
//#region lib/scalars/addressData.ts
|
|
3108
|
+
// lib/scalars/addressData.ts
|
|
3154
3109
|
/*! Address data derived from Google's Address Data Service (https://github.com/google/libaddressinput),
|
|
3155
3110
|
* licensed under CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
|
|
3156
3111
|
* Changes: reduced to required fields, postal code patterns and examples, and regions with
|
|
@@ -8962,8 +8917,7 @@ const addressData = {
|
|
|
8962
8917
|
},
|
|
8963
8918
|
ZW: { require: "AC" }
|
|
8964
8919
|
};
|
|
8965
|
-
|
|
8966
|
-
//#region lib/scalars/addressValidation.ts
|
|
8920
|
+
// lib/scalars/addressValidation.ts
|
|
8967
8921
|
const REQUIRED_FIELD_PATHS = {
|
|
8968
8922
|
A: "streetAddress",
|
|
8969
8923
|
C: "locality",
|
|
@@ -9093,8 +9047,7 @@ const addressValidationSchema = z.object({
|
|
|
9093
9047
|
message: issue.message
|
|
9094
9048
|
});
|
|
9095
9049
|
});
|
|
9096
|
-
|
|
9097
|
-
//#region lib/scalars/address.ts
|
|
9050
|
+
// lib/scalars/address.ts
|
|
9098
9051
|
function implementDefaultAddressTypes(schemaBuilder) {
|
|
9099
9052
|
return {
|
|
9100
9053
|
Address: schemaBuilder.objectRef("Address").implement({
|
|
@@ -9120,8 +9073,7 @@ function implementDefaultAddressTypes(schemaBuilder) {
|
|
|
9120
9073
|
})
|
|
9121
9074
|
};
|
|
9122
9075
|
}
|
|
9123
|
-
|
|
9124
|
-
//#region lib/scalars/emailAddress.ts
|
|
9076
|
+
// lib/scalars/emailAddress.ts
|
|
9125
9077
|
/**
|
|
9126
9078
|
* Validates an email address using graphql-scalars' own format check, then lowercases it, exactly
|
|
9127
9079
|
* as the `EmailAddress` scalar does. Exported for values that do not arrive as GraphQL input,
|
|
@@ -9147,8 +9099,7 @@ const EmailAddressResolver$1 = new GraphQLScalarType({
|
|
|
9147
9099
|
return normalizeEmailAddress(ast.value);
|
|
9148
9100
|
}
|
|
9149
9101
|
});
|
|
9150
|
-
|
|
9151
|
-
//#region lib/scalars/personName.ts
|
|
9102
|
+
// lib/scalars/personName.ts
|
|
9152
9103
|
const MAX_LENGTH = 200;
|
|
9153
9104
|
const NAME_REGEX = /^[\p{L}\p{M}]+(?:(?:[ '-]|\.\x20?)[\p{L}\p{M}]+)*\.?$/u;
|
|
9154
9105
|
const APOSTROPHE_VARIANTS = /[\u2018\u2019\u02BC\u00B4\u0060]/gu;
|
|
@@ -9177,8 +9128,7 @@ const PersonNameResolver = new GraphQLScalarType({
|
|
|
9177
9128
|
return normalizePersonName(ast.value);
|
|
9178
9129
|
}
|
|
9179
9130
|
});
|
|
9180
|
-
|
|
9181
|
-
//#region lib/scalars/phoneNumber.ts
|
|
9131
|
+
// lib/scalars/phoneNumber.ts
|
|
9182
9132
|
/**
|
|
9183
9133
|
* Parses and validates a phone number using libphonenumber-js (Google's phone number metadata),
|
|
9184
9134
|
* which checks real per-country validity (length, area code plausibility, ...) rather than just
|
|
@@ -9215,8 +9165,7 @@ const PhoneNumberResolver = new GraphQLScalarType({
|
|
|
9215
9165
|
return parsePhoneNumber(ast.value);
|
|
9216
9166
|
}
|
|
9217
9167
|
});
|
|
9218
|
-
|
|
9219
|
-
//#region lib/schemaBuilder.ts
|
|
9168
|
+
// lib/schemaBuilder.ts
|
|
9220
9169
|
const createSchemaBuilder = ({ db, pubsub, pothosConfig, otel, logger, validation, abilityBuilder }) => {
|
|
9221
9170
|
const createSpan = otel?.enabled && otel.tracer ? createOpenTelemetryWrapper(otel.tracer, otel.options) : void 0;
|
|
9222
9171
|
registerRuntimeFiltersPlugin();
|
|
@@ -9300,8 +9249,7 @@ const createSchemaBuilder = ({ db, pubsub, pothosConfig, otel, logger, validatio
|
|
|
9300
9249
|
schemaBuilder.mutationType({});
|
|
9301
9250
|
return { schemaBuilder };
|
|
9302
9251
|
};
|
|
9303
|
-
|
|
9304
|
-
//#region lib/rumble.ts
|
|
9252
|
+
// lib/rumble.ts
|
|
9305
9253
|
/**
|
|
9306
9254
|
* Mirrors sofa's own default error handler: it derives the HTTP status from
|
|
9307
9255
|
* `extensions.http` and returns the errors as JSON. rumble only adds telemetry
|
|
@@ -9629,7 +9577,6 @@ export const r = rumble({
|
|
|
9629
9577
|
buildSchema: builtSchema
|
|
9630
9578
|
};
|
|
9631
9579
|
};
|
|
9632
|
-
//#endregion
|
|
9633
9580
|
export { RumbleError, RumbleErrorSafe, addressChecks, addressData, addressValidationSchema, assertFindFirstExists, assertFirstEntryExists, checkPostalCode, checkRegion, checkRequiredFields, findRegionCode, guardFilterInput, mapNullFieldsToUndefined, normalizeAddress, normalizeEmailAddress, normalizePersonName, parsePhoneNumber, rumble, validateAddress };
|
|
9634
9581
|
|
|
9635
9582
|
//# sourceMappingURL=index.mjs.map
|