@arkstack/common 0.16.13 → 0.17.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.
@@ -51,7 +51,7 @@ type ModelName = Extract<keyof ModelRegistry, string>;
51
51
  */
52
52
  declare const isClass: <T = unknown>(target: unknown) => target is new (...args: any[]) => T;
53
53
  /**
54
- * Determine the number of items to return per page based on the provided query parameters.
54
+ * Resolves the number of items to return per page based on the provided query parameters.
55
55
  *
56
56
  * @param query
57
57
  * @returns
@@ -59,6 +59,8 @@ declare const isClass: <T = unknown>(target: unknown) => target is new (...args:
59
59
  declare const perPage: (query: {
60
60
  limit?: number;
61
61
  perPage?: number;
62
+ per_page?: number;
63
+ "per-page"?: number;
62
64
  }) => number;
63
65
  /**
64
66
  * Import an application model by name.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./app.d.ts" />
2
- import { a as abortIf, c as initializeGlobalContext, d as Hash, f as Encryption, i as abort, l as isClass, n as ModelConstructor, o as assertFound, r as ModelRegistry, s as getModel, t as AbstractModelConstructor, u as perPage } from "./helpers-BBIpia-7.js";
2
+ import { a as abortIf, c as initializeGlobalContext, d as Hash, f as Encryption, i as abort, l as isClass, n as ModelConstructor, o as assertFound, r as ModelRegistry, s as getModel, t as AbstractModelConstructor, u as perPage } from "./helpers-FHx7jP7g.js";
3
3
  import { JitiOptions, JitiResolveOptions } from "jiti";
4
4
  import { Arkstack } from "@arkstack/contract";
5
5
  import pino from "pino";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as EnvLoader, a as env, c as nodeEnv, d as resolveRuntimeDir, f as resolveRuntimeModule, g as configLoader, h as ConfigLoader, i as discoverCommands, l as outputDir, m as CONFIG_KEY, n as appUrl, o as importFile, p as toOutputPath, r as config, s as interopDefault, t as appKey, u as rebuildOutput, v as envLoader } from "./system-XvUhJFS0.js";
2
- import { _ as Hash, c as abortIf, d as initializeGlobalContext, f as isClass, g as Exception, h as AppException, l as assertFound, m as RequestException, p as perPage, s as abort, u as getModel, v as Encryption } from "./utils-CrxwQPPI.js";
2
+ import { _ as Hash, c as abortIf, d as initializeGlobalContext, f as isClass, g as Exception, h as AppException, l as assertFound, m as RequestException, p as perPage, s as abort, u as getModel, v as Encryption } from "./utils-BGjeEW4M.js";
3
3
  import { Hook as Hook$1 } from "@arkstack/foundry";
4
4
  import { Arkstack } from "@arkstack/contract";
5
5
  import { str } from "@h3ravel/support";
@@ -1,4 +1,4 @@
1
- import { a as abortIf, c as initializeGlobalContext, d as Hash, f as Encryption, i as abort, l as isClass, n as ModelConstructor, o as assertFound, r as ModelRegistry, s as getModel, t as AbstractModelConstructor, u as perPage } from "../helpers-BBIpia-7.js";
1
+ import { a as abortIf, c as initializeGlobalContext, d as Hash, f as Encryption, i as abort, l as isClass, n as ModelConstructor, o as assertFound, r as ModelRegistry, s as getModel, t as AbstractModelConstructor, u as perPage } from "../helpers-FHx7jP7g.js";
2
2
  import { Model } from "arkormx";
3
3
 
4
4
  //#region src/utils/traits.d.ts
@@ -1,2 +1,2 @@
1
- import { _ as Hash, a as use, c as abortIf, d as initializeGlobalContext, f as isClass, i as trait, l as assertFound, n as crc32, o as uses, p as perPage, r as getTraitMethods, s as abort, t as callTraitMethods, u as getModel, v as Encryption } from "../utils-CrxwQPPI.js";
1
+ import { _ as Hash, a as use, c as abortIf, d as initializeGlobalContext, f as isClass, i as trait, l as assertFound, n as crc32, o as uses, p as perPage, r as getTraitMethods, s as abort, t as callTraitMethods, u as getModel, v as Encryption } from "../utils-BGjeEW4M.js";
2
2
  export { Encryption, Hash, abort, abortIf, assertFound, callTraitMethods, crc32, getModel, getTraitMethods, initializeGlobalContext, isClass, perPage, trait, use, uses };
@@ -170,13 +170,13 @@ const isClass = (target) => {
170
170
  return typeof target === "function" && /^class\s/.test(Function.prototype.toString.call(target));
171
171
  };
172
172
  /**
173
- * Determine the number of items to return per page based on the provided query parameters.
173
+ * Resolves the number of items to return per page based on the provided query parameters.
174
174
  *
175
175
  * @param query
176
176
  * @returns
177
177
  */
178
178
  const perPage = (query) => {
179
- const requestedPerPage = Number(query.limit ?? query.perPage ?? 15);
179
+ const requestedPerPage = Number(query.limit ?? query.perPage ?? query["per-page"] ?? query.per_page ?? 15);
180
180
  return Number.isFinite(requestedPerPage) && requestedPerPage > 0 ? Math.min(requestedPerPage, 50) : 15;
181
181
  };
182
182
  async function getModel(modelName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/common",
3
- "version": "0.16.13",
3
+ "version": "0.17.1",
4
4
  "type": "module",
5
5
  "description": "Core utilities, primitives, and shared infrastructure for the Arkstack ecosystem.",
6
6
  "homepage": "https://arkstack.toneflix.net",
@@ -47,8 +47,8 @@
47
47
  "peerDependencies": {
48
48
  "@h3ravel/support": "^2.2.4",
49
49
  "arkormx": "^2.11.4",
50
- "@arkstack/contract": "^0.16.13",
51
- "@arkstack/foundry": "^0.16.13"
50
+ "@arkstack/contract": "^0.17.1",
51
+ "@arkstack/foundry": "^0.17.1"
52
52
  },
53
53
  "optionalDependencies": {
54
54
  "@faker-js/faker": "^10.4.0"