@code.store/arcxp-sdk-ts 5.0.0-beta → 5.0.0

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,8 +1,10 @@
1
1
  import * as ANS from './ans.js';
2
2
  import * as ContentElements from './content.js';
3
3
  import * as Id from './id.js';
4
+ import * as Section from './section.js';
4
5
  export declare const ArcUtils: {
5
6
  Id: typeof Id;
6
7
  ANS: typeof ANS;
7
8
  ContentElements: typeof ContentElements;
9
+ Section: typeof Section;
8
10
  };
@@ -0,0 +1,33 @@
1
+ import type { ArcAPIType } from '../../api';
2
+ import type { Section, SectionReference, SetSectionPayload } from '../../types';
3
+ export type NavigationTreeNode<T = unknown> = {
4
+ id: string;
5
+ children: NavigationTreeNode<T>[];
6
+ parent: NavigationTreeNode<T> | null;
7
+ meta: T;
8
+ };
9
+ export type NavigationItem = {
10
+ id: string;
11
+ [key: `N${number}`]: string;
12
+ };
13
+ export declare const buildTree: <T = any>(items: NavigationItem[]) => NavigationTreeNode<T>[];
14
+ export declare const flattenTree: <T = any>(tree: NavigationTreeNode<T>[]) => NavigationTreeNode<T>[];
15
+ export declare const buildAndFlattenTree: <T>(items: NavigationItem[]) => NavigationTreeNode<T>[];
16
+ export declare const groupByWebsites: (sections: Section[]) => Record<string, Section[]>;
17
+ export declare const references: (sections: Section[]) => SectionReference[];
18
+ export declare const isReference: (section: any) => section is SectionReference;
19
+ export declare const removeDuplicates: <T extends Section | SectionReference>(sections: T[]) => T[];
20
+ export declare class SectionsRepository {
21
+ protected arc: ArcAPIType;
22
+ sectionsByWebsite: Record<string, Section[]>;
23
+ websitesAreLoaded: boolean;
24
+ constructor(arc: ArcAPIType);
25
+ put(ans: SetSectionPayload): Promise<void>;
26
+ loadWebsite(website: string): Promise<Section[]>;
27
+ loadWebsites(websites: string[]): Promise<void>;
28
+ save(section: Section): void;
29
+ getById(id: string, website: string): Section | undefined;
30
+ getByWebsite(website: string): Section[];
31
+ getParentSections(section: Section): Section[];
32
+ protected ensureWebsitesLoaded(): void;
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code.store/arcxp-sdk-ts",
3
- "version": "5.0.0-beta",
3
+ "version": "5.0.0",
4
4
  "description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,9 @@
20
20
  "url": "https://github.com/code-store-platform/arcxp-sdk-ts"
21
21
  },
22
22
  "homepage": "https://github.com/code-store-platform/arcxp-sdk-ts",
23
- "files": ["dist"],
23
+ "files": [
24
+ "dist"
25
+ ],
24
26
  "scripts": {
25
27
  "build": "tsc --noEmit && rollup -c",
26
28
  "format": "npx @biomejs/biome format --write .",
@@ -31,7 +33,11 @@
31
33
  "gen:ts": "npx tsx ./src/scripts/json-schema-to-ts.ts",
32
34
  "cs": "npx changeset && npx changeset version"
33
35
  },
34
- "keywords": ["ArcXP", "SDK", "Code.Store"],
36
+ "keywords": [
37
+ "ArcXP",
38
+ "SDK",
39
+ "Code.Store"
40
+ ],
35
41
  "author": "code.store",
36
42
  "license": "MIT",
37
43
  "dependencies": {
@@ -1,2 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
- export declare function addRateLimiter(instance: AxiosInstance): AxiosInstance;