@technicity/data-service-generator 0.23.0-next.7 → 0.23.0-next.8

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.
@@ -637,6 +637,7 @@ function getMethodSourceOnHandlerPostOne(x) {
637
637
  return `on${(0, capitalizeFirstLetter_1.capitalizeFirstLetter)(x.methodName)}(handler:
638
638
  (sdk: InstanceType<typeof SDK>, input: { data: ${x.typeDataName} },
639
639
  output: Partial<${getTypeReturnName(x.table)}>,
640
+ before: null,
640
641
  context: TContext,
641
642
  ) => Promise<void>
642
643
  ): void {
@@ -751,6 +752,7 @@ function getMethodSourceOnHandlerDeleteOne(x, findOnes) {
751
752
  .map((findOne) => `{ ${findOne.name}: ${findOne.type}${findOne.nullable ? " | null" : ""} }`)
752
753
  .join(" | ")}, },
753
754
  output: void,
755
+ before: ${getTypeReturnName(x.table)} | null,
754
756
  context: TContext,
755
757
  ) => Promise<void>
756
758
  ): void {
@@ -70,7 +70,9 @@ async function resolve(input, dbCall, formatQuery, beginTransaction, dialect, mi
70
70
  const shouldRunOnHandler = typeof onHandler === "function" &&
71
71
  asyncLocalStorage != null &&
72
72
  asyncLocalStorage?.getStore()?.isInOnHandler !== true;
73
- const beforeValue = shouldRunOnHandler && input.passBeforeValueToAfterCallback
73
+ const beforeValue = shouldRunOnHandler &&
74
+ input.passBeforeValueToAfterCallback &&
75
+ input.action !== "create"
74
76
  ? await _resolve({
75
77
  ...paramsChanged,
76
78
  action: paramsChanged.action === "updateMany" ||
@@ -103,7 +105,9 @@ async function resolve(input, dbCall, formatQuery, beginTransaction, dialect, mi
103
105
  const shouldRunOnHandler = typeof onHandler === "function" &&
104
106
  asyncLocalStorage != null &&
105
107
  asyncLocalStorage?.getStore()?.isInOnHandler !== true;
106
- const beforeValue = shouldRunOnHandler && input.passBeforeValueToAfterCallback
108
+ const beforeValue = shouldRunOnHandler &&
109
+ input.passBeforeValueToAfterCallback &&
110
+ input.action !== "create"
107
111
  ? await _resolve({
108
112
  ...input,
109
113
  action: input.action === "updateMany" || input.action === "deleteMany"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@technicity/data-service-generator",
3
- "version": "0.23.0-next.7",
3
+ "version": "0.23.0-next.8",
4
4
  "main": "./dist/index.js",
5
5
  "files": [
6
6
  "dist"