rads-db 0.1.58 → 0.1.60

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/dist/index.cjs CHANGED
@@ -348,8 +348,8 @@ const computedPresets = {
348
348
  }
349
349
  };
350
350
  async function handlePrecomputed(context, docs, ctx) {
351
- const { schema, typeName, options, drivers, db } = context;
352
- if (drivers[typeName]?.driverName === "restApi")
351
+ const { schema, typeName, options, db } = context;
352
+ if (options.skipComputed)
353
353
  return;
354
354
  const { precomputedFields, nestedTypeFields, fields } = schema[typeName];
355
355
  const computed = options.computed;
@@ -384,6 +384,8 @@ async function handlePrecomputed(context, docs, ctx) {
384
384
  }
385
385
  async function handleComputed(context, data, ctx) {
386
386
  const { schema, typeName, options, db } = context;
387
+ if (options.skipComputed)
388
+ return;
387
389
  const { computedFields, nestedTypeFields, fields } = schema[typeName];
388
390
  const computed = options.computed;
389
391
  for (const fieldName of computedFields || []) {
@@ -644,7 +646,9 @@ function generateMethods(schema, validators, options) {
644
646
  for (const key in schema) {
645
647
  effects[key] = [];
646
648
  }
647
- verifyComputedPresense(schema, opts.computed);
649
+ if (!opts.skipComputed) {
650
+ verifyComputedPresense(schema, opts.computed);
651
+ }
648
652
  verifyEventSourcingSetup(schema, effects);
649
653
  verifyRelationsSetup(schema, effects);
650
654
  for (const key in schema) {
package/dist/index.d.ts CHANGED
@@ -139,6 +139,7 @@ interface CreateRadsArgs {
139
139
  driver?: DriverConstructor;
140
140
  drivers?: Record<string, DriverConstructor>;
141
141
  fileUploadDriver?: FileUploadDriver;
142
+ skipComputed?: boolean;
142
143
  computed?: Record<string, Record<string, Function>>;
143
144
  context?: Record<string, any> & RadsRequestContext;
144
145
  }
package/dist/index.mjs CHANGED
@@ -341,8 +341,8 @@ const computedPresets = {
341
341
  }
342
342
  };
343
343
  async function handlePrecomputed(context, docs, ctx) {
344
- const { schema, typeName, options, drivers, db } = context;
345
- if (drivers[typeName]?.driverName === "restApi")
344
+ const { schema, typeName, options, db } = context;
345
+ if (options.skipComputed)
346
346
  return;
347
347
  const { precomputedFields, nestedTypeFields, fields } = schema[typeName];
348
348
  const computed = options.computed;
@@ -377,6 +377,8 @@ async function handlePrecomputed(context, docs, ctx) {
377
377
  }
378
378
  async function handleComputed(context, data, ctx) {
379
379
  const { schema, typeName, options, db } = context;
380
+ if (options.skipComputed)
381
+ return;
380
382
  const { computedFields, nestedTypeFields, fields } = schema[typeName];
381
383
  const computed = options.computed;
382
384
  for (const fieldName of computedFields || []) {
@@ -637,7 +639,9 @@ function generateMethods(schema, validators, options) {
637
639
  for (const key in schema) {
638
640
  effects[key] = [];
639
641
  }
640
- verifyComputedPresense(schema, opts.computed);
642
+ if (!opts.skipComputed) {
643
+ verifyComputedPresense(schema, opts.computed);
644
+ }
641
645
  verifyEventSourcingSetup(schema, effects);
642
646
  verifyRelationsSetup(schema, effects);
643
647
  for (const key in schema) {
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "require": "./integrations/*.cjs"
35
35
  }
36
36
  },
37
- "version": "0.1.58",
37
+ "version": "0.1.60",
38
38
  "description": "Say goodbye to boilerplate code and hello to efficient and elegant syntax.",
39
39
  "keywords": [],
40
40
  "author": "",