@m1212e/rumble 0.16.21 → 0.16.23
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/index.cjs +90 -18
- 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 +90 -18
- package/out/index.mjs.map +1 -1
- package/package.json +1 -1
package/out/index.cjs
CHANGED
|
@@ -218,7 +218,7 @@ function mapNullFieldsToUndefined(obj) {
|
|
|
218
218
|
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region package.json
|
|
221
|
-
var version = "0.16.
|
|
221
|
+
var version = "0.16.23";
|
|
222
222
|
|
|
223
223
|
//#endregion
|
|
224
224
|
//#region lib/helpers/mergeFilters.ts
|
|
@@ -1640,33 +1640,105 @@ export const db = drizzle(
|
|
|
1640
1640
|
return (0, graphql_yoga.createYoga)({
|
|
1641
1641
|
...args,
|
|
1642
1642
|
graphiql: enableApiDocs,
|
|
1643
|
+
schema: builtSchema(),
|
|
1644
|
+
context,
|
|
1643
1645
|
plugins: [
|
|
1644
1646
|
...args?.plugins ?? [],
|
|
1645
1647
|
...enableApiDocs ? [] : [(0, _graphql_yoga_plugin_disable_introspection.useDisableIntrospection)(), (0, _escape_tech_graphql_armor.EnvelopArmorPlugin)()],
|
|
1646
|
-
rumbleInput.otel?.enabled ? {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1648
|
+
rumbleInput.otel?.enabled ? {
|
|
1649
|
+
onExecute: ({ setExecuteFn, executeFn }) => {
|
|
1650
|
+
setExecuteFn((options) => rumbleInput.otel.tracer.startActiveSpan(_pothos_tracing_opentelemetry.SpanNames.EXECUTE, { attributes: {
|
|
1651
|
+
[_pothos_tracing_opentelemetry.AttributeNames.OPERATION_NAME]: options.operationName ?? "anonymous",
|
|
1652
|
+
[_pothos_tracing_opentelemetry.AttributeNames.SOURCE]: options.document
|
|
1653
|
+
} }, async (span) => {
|
|
1654
|
+
try {
|
|
1655
|
+
const result = await executeFn(options);
|
|
1656
|
+
if (result && "errors" in result && result.errors?.length) {
|
|
1657
|
+
for (const error of result.errors) span.recordException(error);
|
|
1658
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1659
|
+
}
|
|
1660
|
+
return result;
|
|
1661
|
+
} catch (error) {
|
|
1662
|
+
if (error instanceof Error) span.recordException(error);
|
|
1663
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1664
|
+
throw error;
|
|
1665
|
+
} finally {
|
|
1666
|
+
span.end();
|
|
1667
|
+
}
|
|
1668
|
+
}));
|
|
1669
|
+
},
|
|
1670
|
+
onParse: ({ setParseFn, parseFn }) => {
|
|
1671
|
+
setParseFn((...args) => rumbleInput.otel.tracer.startActiveSpan(_pothos_tracing_opentelemetry.SpanNames.PARSE, (span) => {
|
|
1672
|
+
try {
|
|
1673
|
+
return parseFn(...args);
|
|
1674
|
+
} catch (error) {
|
|
1675
|
+
if (error instanceof Error) span.recordException(error);
|
|
1676
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1677
|
+
throw error;
|
|
1678
|
+
} finally {
|
|
1679
|
+
span.end();
|
|
1680
|
+
}
|
|
1681
|
+
}));
|
|
1682
|
+
},
|
|
1683
|
+
onValidate: ({ setValidationFn, validateFn }) => {
|
|
1684
|
+
setValidationFn((...args) => rumbleInput.otel.tracer.startActiveSpan(_pothos_tracing_opentelemetry.SpanNames.VALIDATE, (span) => {
|
|
1685
|
+
try {
|
|
1686
|
+
const errors = validateFn(...args);
|
|
1687
|
+
if (errors.length > 0) {
|
|
1688
|
+
for (const error of errors) span.recordException(error);
|
|
1689
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1690
|
+
}
|
|
1691
|
+
return errors;
|
|
1692
|
+
} catch (error) {
|
|
1693
|
+
if (error instanceof Error) span.recordException(error);
|
|
1694
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1695
|
+
throw error;
|
|
1696
|
+
} finally {
|
|
1697
|
+
span.end();
|
|
1698
|
+
}
|
|
1699
|
+
}));
|
|
1700
|
+
},
|
|
1701
|
+
onSubscribe: ({ setSubscribeFn, subscribeFn }) => {
|
|
1702
|
+
setSubscribeFn((options) => rumbleInput.otel.tracer.startActiveSpan("graphql.subscribe", { attributes: {
|
|
1703
|
+
[_pothos_tracing_opentelemetry.AttributeNames.OPERATION_NAME]: options.operationName ?? "anonymous",
|
|
1704
|
+
[_pothos_tracing_opentelemetry.AttributeNames.SOURCE]: options.document
|
|
1705
|
+
} }, async (span) => {
|
|
1706
|
+
try {
|
|
1707
|
+
return await subscribeFn(options);
|
|
1708
|
+
} catch (error) {
|
|
1709
|
+
if (error instanceof Error) span.recordException(error);
|
|
1710
|
+
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1711
|
+
throw error;
|
|
1712
|
+
} finally {
|
|
1713
|
+
span.end();
|
|
1714
|
+
}
|
|
1715
|
+
}));
|
|
1716
|
+
}
|
|
1717
|
+
} : false
|
|
1718
|
+
].filter(Boolean)
|
|
1662
1719
|
});
|
|
1663
1720
|
};
|
|
1664
1721
|
const createSofa = (args) => {
|
|
1665
1722
|
if (args.openAPI) (0, es_toolkit.merge)(args.openAPI, sofaOpenAPIWebhookDocs);
|
|
1723
|
+
if (args.errorHandler) {
|
|
1724
|
+
const originalHandler = args.errorHandler;
|
|
1725
|
+
args.errorHandler = (errors) => {
|
|
1726
|
+
const span = _opentelemetry_api.trace.getActiveSpan();
|
|
1727
|
+
for (const error of errors) span?.recordException(error);
|
|
1728
|
+
span?.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1729
|
+
return originalHandler(errors);
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1666
1732
|
return (0, sofa_api.useSofa)({
|
|
1667
1733
|
...args,
|
|
1668
1734
|
schema: builtSchema(),
|
|
1669
|
-
context
|
|
1735
|
+
context,
|
|
1736
|
+
errorHandler(errors) {
|
|
1737
|
+
const span = _opentelemetry_api.trace.getActiveSpan();
|
|
1738
|
+
for (const error of errors) span?.recordException(error);
|
|
1739
|
+
span?.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
1740
|
+
return new Response(errors[0].message, { status: 500 });
|
|
1741
|
+
}
|
|
1670
1742
|
});
|
|
1671
1743
|
};
|
|
1672
1744
|
return {
|