griddo-sdk 2.1.0-rc.2 → 2.1.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.
Files changed (45) hide show
  1. package/dist/config/version.d.ts +1 -1
  2. package/dist/config/version.d.ts.map +1 -1
  3. package/dist/exception/ActivityLogException.d.ts +69 -0
  4. package/dist/exception/ActivityLogException.d.ts.map +1 -0
  5. package/dist/exception/index.d.ts +1 -0
  6. package/dist/exception/index.d.ts.map +1 -1
  7. package/dist/facades/ActivityLogFacade.d.ts +27 -0
  8. package/dist/facades/ActivityLogFacade.d.ts.map +1 -0
  9. package/dist/factories/ServiceFactory.d.ts +8 -0
  10. package/dist/factories/ServiceFactory.d.ts.map +1 -1
  11. package/dist/index.d.ts +6 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +45 -45
  14. package/dist/interfaces/ActivityLog.d.ts +67 -0
  15. package/dist/interfaces/ActivityLog.d.ts.map +1 -0
  16. package/dist/services/ActivityLogService.d.ts +18 -0
  17. package/dist/services/ActivityLogService.d.ts.map +1 -0
  18. package/package.json +2 -7
  19. package/dist/cli/bin.d.ts +0 -2
  20. package/dist/cli/bin.d.ts.map +0 -1
  21. package/dist/cli/commands/alerts.d.ts +0 -3
  22. package/dist/cli/commands/alerts.d.ts.map +0 -1
  23. package/dist/cli/commands/api.d.ts +0 -3
  24. package/dist/cli/commands/api.d.ts.map +0 -1
  25. package/dist/cli/commands/data.d.ts +0 -3
  26. package/dist/cli/commands/data.d.ts.map +0 -1
  27. package/dist/cli/commands/images.d.ts +0 -3
  28. package/dist/cli/commands/images.d.ts.map +0 -1
  29. package/dist/cli/commands/languages.d.ts +0 -3
  30. package/dist/cli/commands/languages.d.ts.map +0 -1
  31. package/dist/cli/commands/live-status.d.ts +0 -3
  32. package/dist/cli/commands/live-status.d.ts.map +0 -1
  33. package/dist/cli/commands/pages.d.ts +0 -3
  34. package/dist/cli/commands/pages.d.ts.map +0 -1
  35. package/dist/cli/commands/site.d.ts +0 -3
  36. package/dist/cli/commands/site.d.ts.map +0 -1
  37. package/dist/cli/input.d.ts +0 -4
  38. package/dist/cli/input.d.ts.map +0 -1
  39. package/dist/cli/output.d.ts +0 -5
  40. package/dist/cli/output.d.ts.map +0 -1
  41. package/dist/cli/program.d.ts +0 -3
  42. package/dist/cli/program.d.ts.map +0 -1
  43. package/dist/cli/sdk-factory.d.ts +0 -6
  44. package/dist/cli/sdk-factory.d.ts.map +0 -1
  45. package/dist/cli.js +0 -155
@@ -0,0 +1,67 @@
1
+ import type { ExportResponse, LogActivityDTO, LogActivityExportRequest, LogActivityGroupedDayDTO, LogActivityGroupedUserDTO, LogActivityPaginationRequest, PaginationResponse } from "@griddo/api-types";
2
+ import type { LogActivityEventDTO } from "@griddo/api-types/dist/logs/activity_events";
3
+ /**
4
+ * Interface for the ActivityLog operations exposed by the SDK.
5
+ *
6
+ * Defines the contract for querying and exporting superadmin activity logs:
7
+ * a timeline view, two grouped views (by user and by day), and their
8
+ * corresponding export endpoints, plus the catalog of available event types.
9
+ */
10
+ export interface ActivityLogManager {
11
+ /**
12
+ * Retrieves a paginated list of activity log entries.
13
+ *
14
+ * @param params - The query parameters for pagination and filtering.
15
+ * @returns A promise that resolves with the paginated activity log entries.
16
+ * @throws If the HTTP response is not successful or if the response format is incorrect.
17
+ */
18
+ timeline(params?: LogActivityPaginationRequest): Promise<PaginationResponse<LogActivityDTO>>;
19
+ /**
20
+ * Retrieves a paginated list of activity log entries grouped by user.
21
+ *
22
+ * @param params - The query parameters for pagination and filtering.
23
+ * @returns A promise that resolves with the paginated grouped activity log entries.
24
+ * @throws If the HTTP response is not successful or if the response format is incorrect.
25
+ */
26
+ groupedByUser<TLogActivity = LogActivityDTO[]>(params?: LogActivityPaginationRequest): Promise<PaginationResponse<LogActivityGroupedUserDTO<TLogActivity>>>;
27
+ /**
28
+ * Retrieves a paginated list of activity log entries grouped by day.
29
+ *
30
+ * @param params - The query parameters for pagination and filtering.
31
+ * @returns A promise that resolves with the paginated grouped activity log entries.
32
+ * @throws If the HTTP response is not successful or if the response format is incorrect.
33
+ */
34
+ groupedByDay(params?: LogActivityPaginationRequest): Promise<PaginationResponse<LogActivityGroupedDayDTO>>;
35
+ /**
36
+ * Exports the activity log timeline in one or more formats.
37
+ *
38
+ * @param body - The export options (formats, date range, optional start time and max events).
39
+ * @returns A promise that resolves with the export response.
40
+ * @throws If the HTTP response is not successful or if the response format is incorrect.
41
+ */
42
+ exportTimeline(body: LogActivityExportRequest): Promise<ExportResponse>;
43
+ /**
44
+ * Exports the activity log grouped by user in one or more formats.
45
+ *
46
+ * @param body - The export options (formats, date range, optional start time and max events).
47
+ * @returns A promise that resolves with the export response.
48
+ * @throws If the HTTP response is not successful or if the response format is incorrect.
49
+ */
50
+ exportGroupedByUser(body: LogActivityExportRequest): Promise<ExportResponse>;
51
+ /**
52
+ * Exports the activity log grouped by day in one or more formats.
53
+ *
54
+ * @param body - The export options (formats, date range, optional start time and max events).
55
+ * @returns A promise that resolves with the export response.
56
+ * @throws If the HTTP response is not successful or if the response format is incorrect.
57
+ */
58
+ exportGroupedByDay(body: LogActivityExportRequest): Promise<ExportResponse>;
59
+ /**
60
+ * Retrieves the catalog of available activity log event types.
61
+ *
62
+ * @returns A promise that resolves with the list of event types.
63
+ * @throws If the HTTP response is not successful or if the response format is incorrect.
64
+ */
65
+ fetchEventTypes(): Promise<LogActivityEventDTO[]>;
66
+ }
67
+ //# sourceMappingURL=ActivityLog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityLog.d.ts","sourceRoot":"","sources":["../../src/interfaces/ActivityLog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;;;OAMG;IACH,QAAQ,CACP,MAAM,CAAC,EAAE,4BAA4B,GACnC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC;IAE/C;;;;;;OAMG;IACH,aAAa,CAAC,YAAY,GAAG,cAAc,EAAE,EAC5C,MAAM,CAAC,EAAE,4BAA4B,GACnC,OAAO,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,YAAY,CACX,MAAM,CAAC,EAAE,4BAA4B,GACnC,OAAO,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAEzD;;;;;;OAMG;IACH,cAAc,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,mBAAmB,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE7E;;;;;;OAMG;IACH,kBAAkB,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5E;;;;;OAKG;IACH,eAAe,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;CAClD"}
@@ -0,0 +1,18 @@
1
+ import type { ApiService } from "./ApiService";
2
+ import type { ExportResponse, LogActivityDTO, LogActivityExportRequest, LogActivityGroupedDayDTO, LogActivityGroupedUserDTO, LogActivityPaginationRequest, PaginationResponse } from "@griddo/api-types";
3
+ import type { LogActivityEventDTO } from "@griddo/api-types/dist/logs/activity_events";
4
+ import type { ActivityLogManager } from "../interfaces/ActivityLog";
5
+ export declare class ActivityLogService implements ActivityLogManager {
6
+ private readonly apiService;
7
+ constructor(apiService: ApiService);
8
+ timeline(params?: LogActivityPaginationRequest): Promise<PaginationResponse<LogActivityDTO>>;
9
+ groupedByUser<TLogActivity = LogActivityDTO[]>(params?: LogActivityPaginationRequest): Promise<PaginationResponse<LogActivityGroupedUserDTO<TLogActivity>>>;
10
+ groupedByDay(params?: LogActivityPaginationRequest): Promise<PaginationResponse<LogActivityGroupedDayDTO>>;
11
+ exportTimeline(body: LogActivityExportRequest): Promise<ExportResponse>;
12
+ exportGroupedByUser(body: LogActivityExportRequest): Promise<ExportResponse>;
13
+ exportGroupedByDay(body: LogActivityExportRequest): Promise<ExportResponse>;
14
+ fetchEventTypes(): Promise<LogActivityEventDTO[]>;
15
+ private buildEndpoint;
16
+ private toQueryString;
17
+ }
18
+ //# sourceMappingURL=ActivityLogService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActivityLogService.d.ts","sourceRoot":"","sources":["../../src/services/ActivityLogService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACX,cAAc,EACd,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAMlE,qBAAa,kBAAmB,YAAW,kBAAkB;IAC5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;gBAE5B,UAAU,EAAE,UAAU;IAYrB,QAAQ,CACpB,MAAM,CAAC,EAAE,4BAA4B,GACnC,OAAO,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAOjC,aAAa,CAAC,YAAY,GAAG,cAAc,EAAE,EACzD,MAAM,CAAC,EAAE,4BAA4B,GACnC,OAAO,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAC,CAAC;IAS1D,YAAY,CACxB,MAAM,CAAC,EAAE,4BAA4B,GACnC,OAAO,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;IAO3C,cAAc,CAC1B,IAAI,EAAE,wBAAwB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAQb,mBAAmB,CAC/B,IAAI,EAAE,wBAAwB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAQb,kBAAkB,CAC9B,IAAI,EAAE,wBAAwB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAQb,eAAe,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAO9D,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,aAAa;CA0BrB"}
package/package.json CHANGED
@@ -1,14 +1,10 @@
1
1
  {
2
2
  "name": "griddo-sdk",
3
- "version": "2.1.0-rc.2",
3
+ "version": "2.1.0",
4
4
  "descripcion": "Griddo SDK es una biblioteca que facilita la integración con la API de Griddo, permitiendo a los desarrolladores conectarse, realizar consultas estructuradas de datos con facilidad. Este SDK proporciona métodos sencillos para interactuar con los diferentes servicios de Griddo, manejando detalles como la autenticación y la paginación de resultados, y permitiendo personalizar consultas con diversos parámetros.",
5
5
  "main": "dist/index.js",
6
- "bin": {
7
- "griddo": "./dist/cli.js"
8
- },
9
6
  "scripts": {
10
7
  "build": "node scripts/build.cjs && tsc --emitDeclarationOnly && tsc-alias",
11
- "build:cli": "node scripts/build-cli.cjs",
12
8
  "build:tsc": "esbuild src/index.ts --bundle --platform=node --minify --outfile=./dist/index.js && tsc --emitDeclarationOnly",
13
9
  "build:examples": "esbuild examples/*.ts --bundle --platform=node --outdir=dist/examples && tsc --emitDeclarationOnly",
14
10
  "build:doc": "npx typedoc",
@@ -20,7 +16,7 @@
20
16
  "lint:fix": "eslint --fix 'src/**/*.{ts,js}'",
21
17
  "prettier": "prettier --write 'src/**/*.{js,ts}'",
22
18
  "release": "release-it",
23
- "run:example": "node examples/run_example.js pages/get_ids",
19
+ "run:example": "node examples/run_example.js activity-log/fetch_event_types",
24
20
  "test": "vitest",
25
21
  "test:sync": "vitest --pool=forks --no-file-parallelism",
26
22
  "test:coverage": "npx vitest run --coverage",
@@ -61,7 +57,6 @@
61
57
  "@typescript-eslint/parser": "^8.23.0",
62
58
  "@vitest/coverage-v8": "^3.0.7",
63
59
  "@vitest/ui": "^3.0.7",
64
- "commander": "^14.0.3",
65
60
  "dotenv": "^16.4.5",
66
61
  "esbuild": "^0.25.0",
67
62
  "esbuild-plugin-alias": "^0.2.1",
package/dist/cli/bin.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=bin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/cli/bin.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerAlertsCommands(parent: Command): void;
3
- //# sourceMappingURL=alerts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/alerts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA4D5D"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerApiCommands(parent: Command): void;
3
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBzC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkCzD"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerDataCommands(parent: Command): void;
3
- //# sourceMappingURL=data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAqH1D"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerImagesCommands(parent: Command): void;
3
- //# sourceMappingURL=images.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/images.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkJ5D"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerLanguagesCommands(parent: Command): void;
3
- //# sourceMappingURL=languages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/languages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAkD/D"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerLiveStatusCommands(parent: Command): void;
3
- //# sourceMappingURL=live-status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"live-status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/live-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAsDhE"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerPagesCommands(parent: Command): void;
3
- //# sourceMappingURL=pages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAiI3D"}
@@ -1,3 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerSiteCommands(parent: Command): void;
3
- //# sourceMappingURL=site.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/site.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CA8F1D"}
@@ -1,4 +0,0 @@
1
- export declare function readInput(filePath?: string): Promise<string>;
2
- export declare function parseJSONInput(filePath?: string): Promise<unknown>;
3
- export declare function parseJSONObject(filePath?: string, label?: string): Promise<Record<string, unknown>>;
4
- //# sourceMappingURL=input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/cli/input.ts"],"names":[],"mappings":"AAaA,wBAAsB,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlE;AAED,wBAAsB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUxE;AAED,wBAAsB,eAAe,CACpC,QAAQ,CAAC,EAAE,MAAM,EACjB,KAAK,SAAU,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAUlC"}
@@ -1,5 +0,0 @@
1
- export declare function outputJSON(data: unknown, opts: {
2
- format?: string;
3
- }): void;
4
- export declare function outputError(error: unknown): void;
5
- //# sourceMappingURL=output.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CACzB,IAAI,EAAE,OAAO,EACb,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACvB,IAAI,CAGN;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAgBhD"}
@@ -1,3 +0,0 @@
1
- import { Command } from "commander";
2
- export declare function createProgram(): Command;
3
- //# sourceMappingURL=program.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,aAAa,IAAI,OAAO,CAqBvC"}
@@ -1,6 +0,0 @@
1
- import { SDK } from "../index";
2
- export declare function createSDK(globalOpts: {
3
- verbose?: boolean;
4
- silent?: boolean;
5
- }): SDK;
6
- //# sourceMappingURL=sdk-factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk-factory.d.ts","sourceRoot":"","sources":["../../src/cli/sdk-factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAyB/B,wBAAgB,SAAS,CAAC,UAAU,EAAE;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,GAAG,CAqCN"}