@dyrected/core 2.9.0 → 2.10.1

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.
@@ -2474,6 +2474,11 @@ function registerJexlHelpers(jexlInstance = import_jexl.default) {
2474
2474
  try {
2475
2475
  jexlInstance.addBinaryOp("and", 20, (left, right) => Boolean(left && right));
2476
2476
  jexlInstance.addBinaryOp("or", 10, (left, right) => Boolean(left || right));
2477
+ jexlInstance.addBinaryOp("in", 30, (left, right) => {
2478
+ if (Array.isArray(right)) return right.includes(left);
2479
+ if (typeof right === "string") return right.includes(String(left ?? ""));
2480
+ return false;
2481
+ });
2477
2482
  } catch {
2478
2483
  }
2479
2484
  }
@@ -4363,39 +4368,94 @@ function generateOpenApi(config) {
4363
4368
  post: {
4364
4369
  tags: [collectionTag],
4365
4370
  summary: `Aggregate ${labels.plural}`,
4366
- description: `Compute statistical aggregations (count, sum, avg, min, max) across ${labels.plural}.`,
4371
+ description: `Compute statistical aggregations (count, countDistinct, distinct, sum, avg, min, max, groupBy) across ${labels.plural}.`,
4372
+ parameters: [
4373
+ {
4374
+ name: "groupBy",
4375
+ in: "query",
4376
+ description: "Optional field name to compute aggregates grouped by distinct values",
4377
+ required: false,
4378
+ schema: { type: "string" }
4379
+ }
4380
+ ],
4367
4381
  requestBody: {
4368
4382
  required: true,
4369
4383
  content: {
4370
4384
  "application/json": {
4371
4385
  schema: {
4372
- type: "object",
4373
- additionalProperties: {
4374
- type: "object",
4375
- properties: {
4376
- count: { type: "string", example: "*" },
4377
- sum: { type: "string", description: "Field to sum" },
4378
- avg: { type: "string", description: "Field to average" },
4379
- min: { type: "string", description: "Field for minimum" },
4380
- max: { type: "string", description: "Field for maximum" },
4381
- cast: {
4382
- type: "string",
4383
- enum: [
4384
- "number",
4385
- "integer",
4386
- "float",
4387
- "boolean",
4388
- "date",
4389
- "string"
4390
- ]
4391
- },
4392
- where: {
4386
+ oneOf: [
4387
+ {
4388
+ type: "object",
4389
+ description: "Flat aggregate operations dictionary",
4390
+ additionalProperties: {
4393
4391
  type: "object",
4394
- description: "Per-aggregate filter condition",
4395
- additionalProperties: true
4392
+ properties: {
4393
+ count: { type: "string", example: "*" },
4394
+ countDistinct: { type: "string", description: "Field to count unique non-null values" },
4395
+ distinct: { type: "string", description: "Field to extract unique non-null values" },
4396
+ sum: { type: "string", description: "Field to sum" },
4397
+ avg: { type: "string", description: "Field to average" },
4398
+ min: { type: "string", description: "Field for minimum" },
4399
+ max: { type: "string", description: "Field for maximum" },
4400
+ cast: {
4401
+ type: "string",
4402
+ enum: [
4403
+ "number",
4404
+ "integer",
4405
+ "float",
4406
+ "boolean",
4407
+ "date",
4408
+ "string"
4409
+ ]
4410
+ },
4411
+ where: {
4412
+ type: "object",
4413
+ description: "Per-aggregate filter condition",
4414
+ additionalProperties: true
4415
+ }
4416
+ }
4396
4417
  }
4418
+ },
4419
+ {
4420
+ type: "object",
4421
+ description: "Grouped aggregate payload with explicit groupBy property",
4422
+ properties: {
4423
+ groupBy: { type: "string", description: "Field name to group aggregates by" },
4424
+ aggregates: {
4425
+ type: "object",
4426
+ additionalProperties: {
4427
+ type: "object",
4428
+ properties: {
4429
+ count: { type: "string", example: "*" },
4430
+ countDistinct: { type: "string", description: "Field to count unique non-null values" },
4431
+ distinct: { type: "string", description: "Field to extract unique non-null values" },
4432
+ sum: { type: "string", description: "Field to sum" },
4433
+ avg: { type: "string", description: "Field to average" },
4434
+ min: { type: "string", description: "Field for minimum" },
4435
+ max: { type: "string", description: "Field for maximum" },
4436
+ cast: {
4437
+ type: "string",
4438
+ enum: [
4439
+ "number",
4440
+ "integer",
4441
+ "float",
4442
+ "boolean",
4443
+ "date",
4444
+ "string"
4445
+ ]
4446
+ },
4447
+ where: {
4448
+ type: "object",
4449
+ description: "Per-aggregate filter condition",
4450
+ additionalProperties: true
4451
+ }
4452
+ }
4453
+ }
4454
+ }
4455
+ },
4456
+ required: ["aggregates"]
4397
4457
  }
4398
- }
4458
+ ]
4399
4459
  }
4400
4460
  }
4401
4461
  }
@@ -4406,11 +4466,36 @@ function generateOpenApi(config) {
4406
4466
  content: {
4407
4467
  "application/json": {
4408
4468
  schema: {
4409
- type: "object",
4410
- additionalProperties: {
4411
- type: "number",
4412
- nullable: true
4413
- }
4469
+ oneOf: [
4470
+ {
4471
+ type: "object",
4472
+ description: "Flat aggregate results map",
4473
+ additionalProperties: {
4474
+ oneOf: [
4475
+ { type: "number", nullable: true },
4476
+ { type: "array", items: { type: "string" } }
4477
+ ]
4478
+ }
4479
+ },
4480
+ {
4481
+ type: "object",
4482
+ description: "Grouped aggregate results breakdown",
4483
+ properties: {
4484
+ groups: {
4485
+ type: "object",
4486
+ additionalProperties: {
4487
+ type: "object",
4488
+ additionalProperties: {
4489
+ oneOf: [
4490
+ { type: "number", nullable: true },
4491
+ { type: "array", items: { type: "string" } }
4492
+ ]
4493
+ }
4494
+ }
4495
+ }
4496
+ }
4497
+ }
4498
+ ]
4414
4499
  }
4415
4500
  }
4416
4501
  }