@adonisjs/content 1.5.0 → 1.6.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.
@@ -11,15 +11,16 @@ import { dirname } from "path";
11
11
  async function fetchAllSponsors({
12
12
  login,
13
13
  isOrg,
14
- ghToken
14
+ ghToken,
15
+ includeInactive
15
16
  }) {
16
17
  let hasNext = true;
17
18
  let cursor = null;
18
19
  const allSponsors = [];
19
20
  const query = `
20
- query($login: String!, $cursor: String) {
21
+ query($login: String!, $cursor: String, $activeOnly: Boolean) {
21
22
  ${isOrg ? `organization(login: $login)` : `user(login: $login)`} {
22
- sponsorshipsAsMaintainer(first: 100, after: $cursor) {
23
+ sponsorshipsAsMaintainer(first: 100, after: $cursor, activeOnly: $activeOnly) {
23
24
  nodes {
24
25
  id
25
26
  createdAt
@@ -60,7 +61,8 @@ async function fetchAllSponsors({
60
61
  authorization: `token ${ghToken}`
61
62
  },
62
63
  login,
63
- cursor
64
+ cursor,
65
+ activeOnly: includeInactive === true ? false : true
64
66
  });
65
67
  const root = isOrg ? data.organization : data.user;
66
68
  if (!root) {
@@ -75,6 +77,7 @@ async function fetchAllSponsors({
75
77
  allSponsors.push({
76
78
  id: node.id,
77
79
  createdAt: node.createdAt,
80
+ isActive: node.isActive,
78
81
  privacyLevel: node.privacyLevel,
79
82
  tierName: node.tier?.name ?? null,
80
83
  tierMonthlyPriceInCents: node.tier?.monthlyPriceInCents ?? null,
@@ -5,6 +5,7 @@ import {
5
5
  // src/collection.ts
6
6
  var Collection = class _Collection {
7
7
  static #vite;
8
+ static #app;
8
9
  /** Collection configuration options */
9
10
  #options;
10
11
  /** Cached validated data */
@@ -100,6 +101,9 @@ var Collection = class _Collection {
100
101
  static useVite(vite) {
101
102
  this.#vite = vite;
102
103
  }
104
+ static useApp(app) {
105
+ this.#app = app;
106
+ }
103
107
  /**
104
108
  * Loads and validates data using the configured loader and schema.
105
109
  * Returns cached data if caching is enabled and data was previously loaded.
@@ -120,6 +124,7 @@ var Collection = class _Collection {
120
124
  debug_default("computing data");
121
125
  this.#data = await this.#options.loader.load(this.#options.schema, {
122
126
  vite: _Collection.#vite,
127
+ app: _Collection.#app,
123
128
  ...this.#options.validatorMetaData
124
129
  });
125
130
  const views = this.#options.views ?? {};
package/build/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Collection
3
- } from "./chunk-Q6QIMTOW.js";
3
+ } from "./chunk-IGPZNVR2.js";
4
4
  import {
5
5
  createCache
6
- } from "./chunk-WO5VTK7D.js";
6
+ } from "./chunk-7MAXCXCX.js";
7
7
  import "./chunk-LB6JFRVG.js";
8
8
 
9
9
  // configure.ts
@@ -1,22 +1,20 @@
1
1
  import {
2
2
  Collection
3
- } from "../chunk-Q6QIMTOW.js";
3
+ } from "../chunk-IGPZNVR2.js";
4
4
  import "../chunk-LB6JFRVG.js";
5
5
 
6
6
  // providers/content_provider.ts
7
- import { resolve } from "path";
7
+ import { isAbsolute, resolve } from "path";
8
8
  import vine, { VineString } from "@vinejs/vine";
9
9
  import { readFile } from "fs/promises";
10
10
  var toVitePath = vine.createRule(function vitePath(value, _, field) {
11
11
  if (typeof value === "string") {
12
- field.mutate(
13
- field.meta.vite.assetPath(value.replace(/^\.\/|^\//, "").replace(/\/$/, "")),
14
- field
15
- );
12
+ value = isAbsolute(value) ? value : resolve(field.meta.menuFileRoot, value);
13
+ field.mutate(field.meta.vite.assetPath(field.meta.app.relativePath(value)), field);
16
14
  }
17
15
  });
18
16
  var toContents = vine.createRule(
19
- async function vitePath2(value, _, field) {
17
+ async function contents(value, _, field) {
20
18
  if (typeof value === "string") {
21
19
  const absolutePath2 = resolve(field.meta.menuFileRoot, value);
22
20
  field.mutate(await readFile(absolutePath2, "utf-8"), field);
@@ -54,6 +52,7 @@ var ContentProvider = class {
54
52
  * the Collection class to use Vite's asset resolution system.
55
53
  */
56
54
  async boot() {
55
+ Collection.useApp(this.app);
57
56
  if (this.app.container.hasBinding("vite")) {
58
57
  const vite = await this.app.container.make("vite");
59
58
  Collection.useVite(vite);
@@ -2,6 +2,7 @@ import { type Vite } from '@adonisjs/vite';
2
2
  import { type Infer, type SchemaTypes } from '@vinejs/vine/types';
3
3
  import { type CollectionOptions, type ViewFn, type ViewsToQueryMethods } from './types.js';
4
4
  import { type Prettify } from '@adonisjs/core/types/common';
5
+ import { type Application } from '@adonisjs/core/app';
5
6
  /**
6
7
  * Manages a collection of data with schema validation and custom view functions.
7
8
  *
@@ -103,6 +104,7 @@ export declare class Collection<Schema extends SchemaTypes, Views extends Record
103
104
  * ```
104
105
  */
105
106
  static useVite(vite: Vite): void;
107
+ static useApp(app: Application<any>): void;
106
108
  /**
107
109
  * Loads and validates data using the configured loader and schema.
108
110
  * Returns cached data if caching is enabled and data was previously loaded.
@@ -6,7 +6,7 @@ import {
6
6
  fetchContributorsForOrg,
7
7
  fetchReleases,
8
8
  mergeArrays
9
- } from "../../chunk-WO5VTK7D.js";
9
+ } from "../../chunk-7MAXCXCX.js";
10
10
  import {
11
11
  debug_default
12
12
  } from "../../chunk-LB6JFRVG.js";
@@ -137,6 +137,7 @@ export type GithubReleasesOptions = {
137
137
  export type GithubSponsor = {
138
138
  /** Unique identifier for the sponsorship */
139
139
  id: string;
140
+ isActive: boolean;
140
141
  /** ISO 8601 timestamp when the sponsorship was created */
141
142
  createdAt: string;
142
143
  /** Privacy level of the sponsorship (PUBLIC, PRIVATE, etc.) */
@@ -173,6 +174,7 @@ export type GithubSponsor = {
173
174
  export type GithubSponsorsOptions = {
174
175
  /** GitHub username or organization name */
175
176
  login: string;
177
+ includeInactive?: boolean;
176
178
  /** Whether the login is an organization (true) or user (false) */
177
179
  isOrg: boolean;
178
180
  /** GitHub personal access token for authentication */
@@ -14,7 +14,7 @@ import { type GithubSponsor, type GithubReleasesOptions, type GithubReleaseWithR
14
14
  * })
15
15
  * ```
16
16
  */
17
- export declare function fetchAllSponsors({ login, isOrg, ghToken, }: GithubSponsorsOptions): Promise<GithubSponsor[]>;
17
+ export declare function fetchAllSponsors({ login, isOrg, ghToken, includeInactive, }: GithubSponsorsOptions): Promise<GithubSponsor[]>;
18
18
  /**
19
19
  * Fetches all releases from public repositories of a GitHub organization.
20
20
  * Handles pagination and supports filtering releases by name patterns.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/content",
3
3
  "description": "Content management for AdonisJS with schema validation, GitHub loaders, and custom queries",
4
- "version": "1.5.0",
4
+ "version": "1.6.1",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },