@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.mjs
CHANGED
|
@@ -185,7 +185,7 @@ function mapNullFieldsToUndefined(obj) {
|
|
|
185
185
|
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region package.json
|
|
188
|
-
var version = "0.16.
|
|
188
|
+
var version = "0.16.23";
|
|
189
189
|
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region lib/helpers/mergeFilters.ts
|
|
@@ -1607,33 +1607,105 @@ export const db = drizzle(
|
|
|
1607
1607
|
return createYoga({
|
|
1608
1608
|
...args,
|
|
1609
1609
|
graphiql: enableApiDocs,
|
|
1610
|
+
schema: builtSchema(),
|
|
1611
|
+
context,
|
|
1610
1612
|
plugins: [
|
|
1611
1613
|
...args?.plugins ?? [],
|
|
1612
1614
|
...enableApiDocs ? [] : [useDisableIntrospection(), EnvelopArmorPlugin()],
|
|
1613
|
-
rumbleInput.otel?.enabled ? {
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1615
|
+
rumbleInput.otel?.enabled ? {
|
|
1616
|
+
onExecute: ({ setExecuteFn, executeFn }) => {
|
|
1617
|
+
setExecuteFn((options) => rumbleInput.otel.tracer.startActiveSpan(SpanNames.EXECUTE, { attributes: {
|
|
1618
|
+
[AttributeNames.OPERATION_NAME]: options.operationName ?? "anonymous",
|
|
1619
|
+
[AttributeNames.SOURCE]: options.document
|
|
1620
|
+
} }, async (span) => {
|
|
1621
|
+
try {
|
|
1622
|
+
const result = await executeFn(options);
|
|
1623
|
+
if (result && "errors" in result && result.errors?.length) {
|
|
1624
|
+
for (const error of result.errors) span.recordException(error);
|
|
1625
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1626
|
+
}
|
|
1627
|
+
return result;
|
|
1628
|
+
} catch (error) {
|
|
1629
|
+
if (error instanceof Error) span.recordException(error);
|
|
1630
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1631
|
+
throw error;
|
|
1632
|
+
} finally {
|
|
1633
|
+
span.end();
|
|
1634
|
+
}
|
|
1635
|
+
}));
|
|
1636
|
+
},
|
|
1637
|
+
onParse: ({ setParseFn, parseFn }) => {
|
|
1638
|
+
setParseFn((...args) => rumbleInput.otel.tracer.startActiveSpan(SpanNames.PARSE, (span) => {
|
|
1639
|
+
try {
|
|
1640
|
+
return parseFn(...args);
|
|
1641
|
+
} catch (error) {
|
|
1642
|
+
if (error instanceof Error) span.recordException(error);
|
|
1643
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1644
|
+
throw error;
|
|
1645
|
+
} finally {
|
|
1646
|
+
span.end();
|
|
1647
|
+
}
|
|
1648
|
+
}));
|
|
1649
|
+
},
|
|
1650
|
+
onValidate: ({ setValidationFn, validateFn }) => {
|
|
1651
|
+
setValidationFn((...args) => rumbleInput.otel.tracer.startActiveSpan(SpanNames.VALIDATE, (span) => {
|
|
1652
|
+
try {
|
|
1653
|
+
const errors = validateFn(...args);
|
|
1654
|
+
if (errors.length > 0) {
|
|
1655
|
+
for (const error of errors) span.recordException(error);
|
|
1656
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1657
|
+
}
|
|
1658
|
+
return errors;
|
|
1659
|
+
} catch (error) {
|
|
1660
|
+
if (error instanceof Error) span.recordException(error);
|
|
1661
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1662
|
+
throw error;
|
|
1663
|
+
} finally {
|
|
1664
|
+
span.end();
|
|
1665
|
+
}
|
|
1666
|
+
}));
|
|
1667
|
+
},
|
|
1668
|
+
onSubscribe: ({ setSubscribeFn, subscribeFn }) => {
|
|
1669
|
+
setSubscribeFn((options) => rumbleInput.otel.tracer.startActiveSpan("graphql.subscribe", { attributes: {
|
|
1670
|
+
[AttributeNames.OPERATION_NAME]: options.operationName ?? "anonymous",
|
|
1671
|
+
[AttributeNames.SOURCE]: options.document
|
|
1672
|
+
} }, async (span) => {
|
|
1673
|
+
try {
|
|
1674
|
+
return await subscribeFn(options);
|
|
1675
|
+
} catch (error) {
|
|
1676
|
+
if (error instanceof Error) span.recordException(error);
|
|
1677
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1678
|
+
throw error;
|
|
1679
|
+
} finally {
|
|
1680
|
+
span.end();
|
|
1681
|
+
}
|
|
1682
|
+
}));
|
|
1683
|
+
}
|
|
1684
|
+
} : false
|
|
1685
|
+
].filter(Boolean)
|
|
1629
1686
|
});
|
|
1630
1687
|
};
|
|
1631
1688
|
const createSofa = (args) => {
|
|
1632
1689
|
if (args.openAPI) merge(args.openAPI, sofaOpenAPIWebhookDocs);
|
|
1690
|
+
if (args.errorHandler) {
|
|
1691
|
+
const originalHandler = args.errorHandler;
|
|
1692
|
+
args.errorHandler = (errors) => {
|
|
1693
|
+
const span = trace.getActiveSpan();
|
|
1694
|
+
for (const error of errors) span?.recordException(error);
|
|
1695
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
1696
|
+
return originalHandler(errors);
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1633
1699
|
return useSofa({
|
|
1634
1700
|
...args,
|
|
1635
1701
|
schema: builtSchema(),
|
|
1636
|
-
context
|
|
1702
|
+
context,
|
|
1703
|
+
errorHandler(errors) {
|
|
1704
|
+
const span = trace.getActiveSpan();
|
|
1705
|
+
for (const error of errors) span?.recordException(error);
|
|
1706
|
+
span?.setStatus({ code: SpanStatusCode.ERROR });
|
|
1707
|
+
return new Response(errors[0].message, { status: 500 });
|
|
1708
|
+
}
|
|
1637
1709
|
});
|
|
1638
1710
|
};
|
|
1639
1711
|
return {
|