@lab-anssi/lib 1.4.1 → 1.4.2

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.
@@ -1,3 +1,4 @@
1
+ import { SectionCrisp } from './types';
1
2
  export type ArticleMarkdownCrisp = {
2
3
  titre: string;
3
4
  contenuMarkdown: string;
@@ -12,10 +13,6 @@ export type ResumeArticleCrisp = {
12
13
  nom?: string;
13
14
  };
14
15
  };
15
- export type SectionCrisp = {
16
- id: string;
17
- nom: string;
18
- };
19
16
  export declare class AdaptateurCmsCrisp {
20
17
  readonly urlBase: string;
21
18
  readonly enteteCrisp: {
@@ -1,31 +1,13 @@
1
- import { AdaptateurCmsCrisp, ResumeArticleCrisp, SectionCrisp } from './adaptateurCmsCrisp';
1
+ import { AdaptateurCmsCrisp } from './adaptateurCmsCrisp';
2
2
  import CrispMarkdown from './crispMarkdown';
3
- export type PageHtmlCrisp = {
4
- titre: string;
5
- contenu: string | null;
6
- description: string;
7
- tableDesMatieres: any[];
8
- };
9
- type ArticleMarkdownCrispAvecSection = {
10
- titre: string;
11
- contenuMarkdown: string;
12
- description: string;
13
- section: {
14
- id?: string;
15
- nom?: string;
16
- };
17
- };
18
- type ResumeArticleCrispAvecSlug = ResumeArticleCrisp & {
19
- slug: string | null;
20
- };
3
+ import { ArticleCrispAvecSection, PageHtmlCrisp, ResumeArticleCrispAvecSlug, SectionCrisp } from './types';
21
4
  export declare class CmsCrisp {
22
5
  adaptateurCmsCrisp: AdaptateurCmsCrisp;
23
6
  constructeurCrispMarkdown: (contenuMarkdown: string) => CrispMarkdown;
24
7
  constructor(idSite: string, cleApi: string);
25
8
  recupereArticle(id: string): Promise<PageHtmlCrisp>;
26
- recupereArticleCategorie(slug: string, idCategorie: string): Promise<ArticleMarkdownCrispAvecSection>;
9
+ recupereArticleCategorie(slug: string, idCategorie: string): Promise<ArticleCrispAvecSection>;
27
10
  recupereSectionsCategorie(idCategorie: string): Promise<SectionCrisp[]>;
28
11
  recupereArticlesCategorie(idCategorie: string): Promise<ResumeArticleCrispAvecSlug[]>;
29
12
  private extraitSlugArticle;
30
13
  }
31
- export {};
@@ -31,7 +31,7 @@ class CmsCrisp {
31
31
  if (!article) {
32
32
  throw new erreurs_1.ErreurArticleCrispIntrouvable();
33
33
  }
34
- const articleCrisp = await this.adaptateurCmsCrisp.recupereArticle(article.id);
34
+ const articleCrisp = await this.recupereArticle(article.id);
35
35
  return {
36
36
  ...articleCrisp,
37
37
  section: { id: article.section.id, nom: article.section.nom },
@@ -1,3 +1,4 @@
1
+ import { EntreeTableDesMatieres } from './types';
1
2
  declare class CrispMarkdown {
2
3
  private contenuMarkdown;
3
4
  private contenuHTML;
@@ -7,6 +8,6 @@ declare class CrispMarkdown {
7
8
  constructor(contenuMarkdown: string);
8
9
  parseLeMarkdown(): void;
9
10
  versHTML(): string | null;
10
- tableDesMatieres(): any[];
11
+ tableDesMatieres(): EntreeTableDesMatieres[];
11
12
  }
12
13
  export default CrispMarkdown;
@@ -0,0 +1,22 @@
1
+ import { ResumeArticleCrisp } from './adaptateurCmsCrisp';
2
+ export type EntreeTableDesMatieres = {
3
+ id: string;
4
+ texte: string;
5
+ profondeur: number;
6
+ };
7
+ export type PageHtmlCrisp = {
8
+ titre: string;
9
+ contenu: string | null;
10
+ description: string;
11
+ tableDesMatieres: EntreeTableDesMatieres[];
12
+ };
13
+ export type ResumeArticleCrispAvecSlug = ResumeArticleCrisp & {
14
+ slug: string | null;
15
+ };
16
+ export type SectionCrisp = {
17
+ id: string;
18
+ nom: string;
19
+ };
20
+ export type ArticleCrispAvecSection = PageHtmlCrisp & {
21
+ section: Partial<SectionCrisp>;
22
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { CmsCrisp, type PageHtmlCrisp } from './cms/cmsCrisp';
1
+ export { type EntreeTableDesMatieres, type PageHtmlCrisp, type ResumeArticleCrispAvecSlug, type SectionCrisp, type ArticleCrispAvecSection, } from './cms/types';
2
+ export { CmsCrisp } from './cms/cmsCrisp';
2
3
  export { AdaptateurProfilAnssi } from './profilAnssi/adaptateurProfilAnssi';
3
4
  export { ErreurArticleCrispIntrouvable } from './erreurs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lab-anssi/lib",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/betagouv/lab-anssi-lib.git"