@regojs/erp-sdk 1.0.0 → 1.0.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * as Enums from "./enums";
2
+ export * as Variables from "./variables";
@@ -0,0 +1 @@
1
+ export declare const baseUri = "https://api.regosolution.com";
@@ -0,0 +1,2 @@
1
+ export * from "./providers";
2
+ export type * from "./types";
@@ -0,0 +1,24 @@
1
+ import type { IApp, TCredential, TOptions } from "../types";
2
+ export declare class App implements IApp {
3
+ protected readonly params: Readonly<{
4
+ credential: TCredential;
5
+ options?: TOptions;
6
+ }>;
7
+ protected appName: string;
8
+ protected defaultVersion: number;
9
+ protected token?: string;
10
+ /**
11
+ * Initialize Rego ERP client instance
12
+ * @param configs
13
+ * @param options
14
+ */
15
+ constructor(params: Readonly<{
16
+ credential: TCredential;
17
+ options?: TOptions;
18
+ }>);
19
+ /**
20
+ * Sign JWT token with Ed25519 algorithm
21
+ * @returns
22
+ */
23
+ signToken(): Promise<string>;
24
+ }
@@ -0,0 +1,15 @@
1
+ import type { IClient, TApps, TCredential, TOptions } from "../types";
2
+ import { App } from "./app";
3
+ export declare class Client extends App implements IClient {
4
+ #private;
5
+ /**
6
+ * Initialize Rego ERP client instance
7
+ * @param configs
8
+ * @param options
9
+ */
10
+ constructor(params: Readonly<{
11
+ credential: TCredential;
12
+ options?: TOptions;
13
+ }>);
14
+ use<T extends keyof TApps = "CMS" | "CRM" | "PIM">(domain: T): TApps[T];
15
+ }
@@ -0,0 +1,16 @@
1
+ import type { ICmsApp, TCredential, TOptions } from "../types";
2
+ import { App } from "./app";
3
+ export declare class CmsApp extends App implements ICmsApp {
4
+ #private;
5
+ /**
6
+ * Initialize Rego ERP CMS app instance
7
+ * @param configs
8
+ * @param options
9
+ */
10
+ constructor(params: Readonly<{
11
+ credential: TCredential;
12
+ options?: TOptions;
13
+ }>);
14
+ register(payload: Parameters<ICmsApp["register"]>[number]): ReturnType<ICmsApp["register"]>;
15
+ getRoutes(): ReturnType<ICmsApp["getRoutes"]>;
16
+ }
@@ -0,0 +1,13 @@
1
+ import type { ICrmApp, TCredential, TOptions } from "../types";
2
+ import { App } from "./app";
3
+ export declare class CrmApp extends App implements ICrmApp {
4
+ /**
5
+ * Initialize Rego ERP PIM app instance
6
+ * @param configs
7
+ * @param options
8
+ */
9
+ constructor(params: Readonly<{
10
+ credential: TCredential;
11
+ options?: TOptions;
12
+ }>);
13
+ }
@@ -0,0 +1,2 @@
1
+ export { Client } from "./client";
2
+ export { CmsApp } from "./cms.app";
@@ -0,0 +1,13 @@
1
+ import type { IPimApp, TCredential, TOptions } from "../types";
2
+ import { App } from "./app";
3
+ export declare class PimApp extends App implements IPimApp {
4
+ /**
5
+ * Initialize Rego ERP PIM app instance
6
+ * @param configs
7
+ * @param options
8
+ */
9
+ constructor(params: Readonly<{
10
+ credential: TCredential;
11
+ options?: TOptions;
12
+ }>);
13
+ }
@@ -0,0 +1,12 @@
1
+ export type TCredential = {
2
+ workspaceId: string;
3
+ appId: string;
4
+ secret: string;
5
+ };
6
+ export type TOptions = {
7
+ version?: number;
8
+ logs?: boolean;
9
+ };
10
+ export interface IApp {
11
+ signToken(): Promise<string>;
12
+ }
@@ -0,0 +1,13 @@
1
+ import type { IApp } from "./app";
2
+ import type { ICmsApp } from "./cms.app";
3
+ import type { ICrmApp } from "./crm.app";
4
+ import type { IPimApp } from "./pim.app";
5
+ export type TApps = {
6
+ CMS: ICmsApp;
7
+ CRM: ICrmApp;
8
+ PIM: IPimApp;
9
+ };
10
+ export type TDomains = "CMS" | "CRM" | "PIM";
11
+ export interface IClient extends IApp {
12
+ use<T extends keyof TApps = "CMS" | "CRM" | "PIM">(domain: T): TApps[T];
13
+ }
@@ -0,0 +1,19 @@
1
+ import type { IApp } from "./app";
2
+ export type TBlueprintRoute = {
3
+ path: string;
4
+ index?: boolean;
5
+ component?: string;
6
+ };
7
+ export interface ICmsApp extends IApp {
8
+ register(payload: {
9
+ blueprintId?: string;
10
+ }): ICmsApp;
11
+ getRoutes(): Promise<{
12
+ hostname?: string | null;
13
+ routes?: Array<TBlueprintRoute> | null;
14
+ data?: {
15
+ metadata?: Record<string, string> | null;
16
+ dynamicData?: unknown;
17
+ } | null;
18
+ } | null>;
19
+ }
@@ -0,0 +1,3 @@
1
+ import type { IApp } from "./app";
2
+ export interface ICrmApp extends IApp {
3
+ }
@@ -0,0 +1,6 @@
1
+ export type * from "./app";
2
+ export type * from "./client";
3
+ export type * from "./cms.app";
4
+ export type * from "./crm.app";
5
+ export type * from "./pim.app";
6
+ export type * from "./response";
@@ -0,0 +1,3 @@
1
+ import type { IApp } from "./app";
2
+ export interface IPimApp extends IApp {
3
+ }
@@ -0,0 +1,3 @@
1
+ export type TApiResponse<T> = Readonly<{
2
+ data: Awaited<ReturnType<T extends (...args: any) => Promise<infer R> ? () => R : never>>;
3
+ }>;
package/package.json CHANGED
@@ -36,13 +36,13 @@
36
36
  "url": "git+https://github.com/rego-solution/erp-sdk"
37
37
  },
38
38
  "scripts": {
39
- "build:browser": "tsc --noEmit && APP=\"browser\" bun run ./app.build.ts",
40
- "build:server": "tsc --noEmit && APP=\"server\" bun run ./app.build.ts",
39
+ "build:browser": "tsc --noEmit && APP=\"browser\" bun run ./app.build.ts && tsc --emitDeclarationOnly",
40
+ "build:server": "tsc --noEmit && APP=\"server\" bun run ./app.build.ts && tsc --emitDeclarationOnly",
41
41
  "format": "prettier \"./src/**/*.ts\" --write",
42
42
  "test": "bun --hot run __test/index.ts"
43
43
  },
44
44
  "types": "./dist/index.d.ts",
45
- "version": "1.0.0",
45
+ "version": "1.0.2",
46
46
  "exports": {
47
47
  ".": {
48
48
  "import": "./dist/index.js",
@@ -1,3 +1,2 @@
1
1
  export * from "./providers";
2
-
3
2
  export type * from "./types";
@@ -7,7 +7,7 @@ export type TBlueprintRoute = {
7
7
  };
8
8
 
9
9
  export interface ICmsApp extends IApp {
10
- register(payload: { blueprintId?: string } = {}): ICmsApp;
10
+ register(payload: { blueprintId?: string }): ICmsApp;
11
11
  getRoutes(): Promise<{
12
12
  hostname?: string | null;
13
13
  routes?: Array<TBlueprintRoute> | null;
@@ -0,0 +1,6 @@
1
+ export type * from "./app";
2
+ export type * from "./client";
3
+ export type * from "./cms.app";
4
+ export type * from "./crm.app";
5
+ export type * from "./pim.app";
6
+ export type * from "./response";
@@ -1,6 +0,0 @@
1
- export type * from "./app.d.ts";
2
- export type * from "./client.d.ts";
3
- export type * from "./cms.app";
4
- export type * from "./crm.app";
5
- export type * from "./pim.app";
6
- export type * from "./response.d.ts";
File without changes
File without changes
File without changes
File without changes
File without changes