@dereekb/zoho 13.38.0 → 13.40.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.
- package/cli/index.js +7 -5
- package/cli/package.json +7 -7
- package/index.esm.js +3354 -556
- package/nestjs/docs/analytics-testing.md +202 -0
- package/nestjs/index.esm.js +867 -268
- package/nestjs/package.json +10 -10
- package/nestjs/src/lib/analytics/analytics.api.d.ts +236 -0
- package/nestjs/src/lib/analytics/analytics.config.d.ts +24 -0
- package/nestjs/src/lib/analytics/analytics.module.d.ts +65 -0
- package/nestjs/src/lib/analytics/index.d.ts +3 -0
- package/nestjs/src/lib/index.d.ts +1 -0
- package/package.json +15 -16
- package/src/lib/analytics/analytics.api.export.d.ts +167 -0
- package/src/lib/analytics/analytics.api.import.d.ts +252 -0
- package/src/lib/analytics/analytics.api.modeling.d.ts +106 -0
- package/src/lib/analytics/analytics.api.orgs.d.ts +36 -0
- package/src/lib/analytics/analytics.api.rows.d.ts +214 -0
- package/src/lib/analytics/analytics.api.views.d.ts +104 -0
- package/src/lib/analytics/analytics.api.workspaces.d.ts +96 -0
- package/src/lib/analytics/analytics.config.d.ts +92 -0
- package/src/lib/analytics/analytics.d.ts +86 -0
- package/src/lib/analytics/analytics.data.d.ts +74 -0
- package/src/lib/analytics/analytics.diff.d.ts +178 -0
- package/src/lib/analytics/analytics.error.api.d.ts +150 -0
- package/src/lib/analytics/analytics.export.d.ts +91 -0
- package/src/lib/analytics/analytics.factory.d.ts +56 -0
- package/src/lib/analytics/analytics.import.d.ts +176 -0
- package/src/lib/analytics/analytics.job.d.ts +132 -0
- package/src/lib/analytics/analytics.limit.d.ts +55 -0
- package/src/lib/analytics/analytics.org.d.ts +51 -0
- package/src/lib/analytics/analytics.param.d.ts +70 -0
- package/src/lib/analytics/analytics.view.d.ts +99 -0
- package/src/lib/analytics/index.d.ts +20 -0
- package/src/lib/index.d.ts +1 -0
- package/src/lib/zoho.limit.d.ts +14 -1
- package/index.cjs.default.js +0 -1
- package/index.cjs.js +0 -10617
- package/index.cjs.mjs +0 -2
- package/nestjs/index.cjs.default.js +0 -1
- package/nestjs/index.cjs.js +0 -4679
- package/nestjs/index.cjs.mjs +0 -2
package/nestjs/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/zoho/nestjs",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.40.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/nestjs": "13.
|
|
6
|
-
"@dereekb/rxjs": "13.
|
|
7
|
-
"@dereekb/util": "13.
|
|
8
|
-
"@dereekb/zoho": "13.
|
|
6
|
+
"@dereekb/nestjs": "13.40.0",
|
|
7
|
+
"@dereekb/rxjs": "13.40.0",
|
|
8
|
+
"@dereekb/util": "13.40.0",
|
|
9
|
+
"@dereekb/zoho": "13.40.0",
|
|
9
10
|
"@nestjs/common": "^11.1.19",
|
|
10
11
|
"@nestjs/config": "^4.0.4",
|
|
11
12
|
"express": "^5.2.1"
|
|
@@ -17,13 +18,12 @@
|
|
|
17
18
|
"exports": {
|
|
18
19
|
"./package.json": "./package.json",
|
|
19
20
|
".": {
|
|
20
|
-
"module": "./index.esm.js",
|
|
21
21
|
"types": "./index.d.ts",
|
|
22
|
-
"import": "./index.
|
|
23
|
-
"default": "./index.
|
|
22
|
+
"import": "./index.esm.js",
|
|
23
|
+
"default": "./index.esm.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"module": "./index.esm.js",
|
|
27
|
-
"main": "./index.
|
|
27
|
+
"main": "./index.esm.js",
|
|
28
28
|
"types": "./index.d.ts"
|
|
29
|
-
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { type ZohoAnalytics, type ZohoAnalyticsContext } from '@dereekb/zoho';
|
|
2
|
+
import { ZohoAnalyticsServiceConfig } from './analytics.config';
|
|
3
|
+
import { ZohoAccountsApi } from '../accounts/accounts.api';
|
|
4
|
+
/**
|
|
5
|
+
* Injectable wrapper around the Zoho Analytics API.
|
|
6
|
+
*
|
|
7
|
+
* Each accessor is a configured pass-through to the corresponding `@dereekb/zoho` function, bound
|
|
8
|
+
* to this instance's authenticated {@link ZohoAnalyticsContext}.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ZohoAnalyticsApi {
|
|
11
|
+
readonly config: ZohoAnalyticsServiceConfig;
|
|
12
|
+
readonly zohoAccountsApi: ZohoAccountsApi;
|
|
13
|
+
readonly zohoAnalytics: ZohoAnalytics;
|
|
14
|
+
/**
|
|
15
|
+
* The authenticated context used by every Analytics operation.
|
|
16
|
+
*
|
|
17
|
+
* @returns The context carrying the configured fetch, config, and rate limiter.
|
|
18
|
+
*/
|
|
19
|
+
get analyticsContext(): ZohoAnalyticsContext;
|
|
20
|
+
/**
|
|
21
|
+
* The shared rate limiter instance.
|
|
22
|
+
*
|
|
23
|
+
* @returns The rate limiter pacing requests against the Analytics frequency limit.
|
|
24
|
+
*/
|
|
25
|
+
get zohoRateLimiter(): import("@dereekb/util").ResetPeriodPromiseRateLimiter;
|
|
26
|
+
/**
|
|
27
|
+
* Initializes the Analytics client by combining the service config with the accounts context for
|
|
28
|
+
* OAuth token management.
|
|
29
|
+
*
|
|
30
|
+
* @param config - Zoho Analytics service configuration.
|
|
31
|
+
* @param zohoAccountsApi - Accounts API used for OAuth token management.
|
|
32
|
+
*/
|
|
33
|
+
constructor(config: ZohoAnalyticsServiceConfig, zohoAccountsApi: ZohoAccountsApi);
|
|
34
|
+
/**
|
|
35
|
+
* Configured pass-through for {@link zohoAnalyticsGetOrgs}.
|
|
36
|
+
*
|
|
37
|
+
* Lists the organizations available to the authenticated user. The only operation that works without a configured
|
|
38
|
+
* `orgId`.
|
|
39
|
+
*
|
|
40
|
+
* @returns Bound get orgs function.
|
|
41
|
+
*/
|
|
42
|
+
get getOrgs(): import("@dereekb/zoho").ZohoAnalyticsGetOrgsFunction;
|
|
43
|
+
/**
|
|
44
|
+
* Configured pass-through for {@link zohoAnalyticsGetAllWorkspaces}.
|
|
45
|
+
*
|
|
46
|
+
* Lists every accessible workspace, grouped into owned and shared.
|
|
47
|
+
*
|
|
48
|
+
* @returns Bound get all workspaces function.
|
|
49
|
+
*/
|
|
50
|
+
get getAllWorkspaces(): import("@dereekb/zoho").ZohoAnalyticsGetAllWorkspacesFunction;
|
|
51
|
+
/**
|
|
52
|
+
* Configured pass-through for {@link zohoAnalyticsGetOwnedWorkspaces}.
|
|
53
|
+
*
|
|
54
|
+
* Lists the workspaces owned by the authenticated user.
|
|
55
|
+
*
|
|
56
|
+
* @returns Bound get owned workspaces function.
|
|
57
|
+
*/
|
|
58
|
+
get getOwnedWorkspaces(): import("@dereekb/zoho").ZohoAnalyticsGetWorkspacesFunction;
|
|
59
|
+
/**
|
|
60
|
+
* Configured pass-through for {@link zohoAnalyticsGetSharedWorkspaces}.
|
|
61
|
+
*
|
|
62
|
+
* Lists the workspaces shared with the authenticated user.
|
|
63
|
+
*
|
|
64
|
+
* @returns Bound get shared workspaces function.
|
|
65
|
+
*/
|
|
66
|
+
get getSharedWorkspaces(): import("@dereekb/zoho").ZohoAnalyticsGetWorkspacesFunction;
|
|
67
|
+
/**
|
|
68
|
+
* Configured pass-through for {@link zohoAnalyticsGetWorkspaceDetails}.
|
|
69
|
+
*
|
|
70
|
+
* Retrieves a single workspace by id.
|
|
71
|
+
*
|
|
72
|
+
* @returns Bound get workspace details function.
|
|
73
|
+
*/
|
|
74
|
+
get getWorkspaceDetails(): import("@dereekb/zoho").ZohoAnalyticsGetWorkspaceDetailsFunction;
|
|
75
|
+
/**
|
|
76
|
+
* Configured pass-through for {@link zohoAnalyticsGetViews}.
|
|
77
|
+
*
|
|
78
|
+
* Lists every view in a workspace.
|
|
79
|
+
*
|
|
80
|
+
* @returns Bound get views function.
|
|
81
|
+
*/
|
|
82
|
+
get getViews(): import("@dereekb/zoho").ZohoAnalyticsGetViewsFunction;
|
|
83
|
+
/**
|
|
84
|
+
* Configured pass-through for {@link zohoAnalyticsGetViewDetails}.
|
|
85
|
+
*
|
|
86
|
+
* Retrieves a single view by its globally unique id.
|
|
87
|
+
*
|
|
88
|
+
* @returns Bound get view details function.
|
|
89
|
+
*/
|
|
90
|
+
get getViewDetails(): import("@dereekb/zoho").ZohoAnalyticsGetViewDetailsFunction;
|
|
91
|
+
/**
|
|
92
|
+
* Configured pass-through for {@link zohoAnalyticsGetTableMetadata}.
|
|
93
|
+
*
|
|
94
|
+
* Retrieves a table's column metadata.
|
|
95
|
+
*
|
|
96
|
+
* @returns Bound get table metadata function.
|
|
97
|
+
*/
|
|
98
|
+
get getTableMetadata(): import("@dereekb/zoho").ZohoAnalyticsGetTableMetadataFunction;
|
|
99
|
+
/**
|
|
100
|
+
* Configured pass-through for {@link zohoAnalyticsImportDataInTable}.
|
|
101
|
+
*
|
|
102
|
+
* Imports data into an existing table and waits for the result.
|
|
103
|
+
*
|
|
104
|
+
* @returns Bound import data in table function.
|
|
105
|
+
*/
|
|
106
|
+
get importDataInTable(): import("@dereekb/zoho").ZohoAnalyticsImportDataInTableFunction;
|
|
107
|
+
/**
|
|
108
|
+
* Configured pass-through for {@link zohoAnalyticsImportDataInNewTable}.
|
|
109
|
+
*
|
|
110
|
+
* Creates a table from the imported data.
|
|
111
|
+
*
|
|
112
|
+
* @returns Bound import data in new table function.
|
|
113
|
+
*/
|
|
114
|
+
get importDataInNewTable(): import("@dereekb/zoho").ZohoAnalyticsImportDataInNewTableFunction;
|
|
115
|
+
/**
|
|
116
|
+
* Configured pass-through for {@link zohoAnalyticsCreateImportJobInTable}.
|
|
117
|
+
*
|
|
118
|
+
* Queues an asynchronous import into an existing table.
|
|
119
|
+
*
|
|
120
|
+
* @returns Bound create import job in table function.
|
|
121
|
+
*/
|
|
122
|
+
get createImportJobInTable(): import("@dereekb/zoho").ZohoAnalyticsCreateImportJobInTableFunction;
|
|
123
|
+
/**
|
|
124
|
+
* Configured pass-through for {@link zohoAnalyticsCreateImportJobInNewTable}.
|
|
125
|
+
*
|
|
126
|
+
* Queues an asynchronous import that creates a new table.
|
|
127
|
+
*
|
|
128
|
+
* @returns Bound create import job in new table function.
|
|
129
|
+
*/
|
|
130
|
+
get createImportJobInNewTable(): import("@dereekb/zoho").ZohoAnalyticsCreateImportJobInNewTableFunction;
|
|
131
|
+
/**
|
|
132
|
+
* Configured pass-through for {@link zohoAnalyticsGetImportJob}.
|
|
133
|
+
*
|
|
134
|
+
* Retrieves an import job's status.
|
|
135
|
+
*
|
|
136
|
+
* @returns Bound get import job function.
|
|
137
|
+
*/
|
|
138
|
+
get getImportJob(): import("@dereekb/zoho").ZohoAnalyticsGetImportJobFunction;
|
|
139
|
+
/**
|
|
140
|
+
* Configured pass-through for {@link zohoAnalyticsImportDataInTableAndAwaitJob}.
|
|
141
|
+
*
|
|
142
|
+
* Queues an asynchronous import and polls until the job reaches a terminal state.
|
|
143
|
+
*
|
|
144
|
+
* @returns Bound import data in table and await job function.
|
|
145
|
+
*/
|
|
146
|
+
get importDataInTableAndAwaitJob(): import("@dereekb/zoho").ZohoAnalyticsImportDataInTableAndAwaitJobFunction;
|
|
147
|
+
/**
|
|
148
|
+
* Configured pass-through for {@link zohoAnalyticsExportData}.
|
|
149
|
+
*
|
|
150
|
+
* Exports a view's data, resolving with the raw response.
|
|
151
|
+
*
|
|
152
|
+
* @returns Bound export data function.
|
|
153
|
+
*/
|
|
154
|
+
get exportData(): import("@dereekb/zoho").ZohoAnalyticsExportDataFunction;
|
|
155
|
+
/**
|
|
156
|
+
* Configured pass-through for {@link zohoAnalyticsCreateExportJob}.
|
|
157
|
+
*
|
|
158
|
+
* Queues an asynchronous export of a view.
|
|
159
|
+
*
|
|
160
|
+
* @returns Bound create export job function.
|
|
161
|
+
*/
|
|
162
|
+
get createExportJob(): import("@dereekb/zoho").ZohoAnalyticsCreateExportJobFunction;
|
|
163
|
+
/**
|
|
164
|
+
* Configured pass-through for {@link zohoAnalyticsCreateExportJobForSqlQuery}.
|
|
165
|
+
*
|
|
166
|
+
* Queues an asynchronous export of a SQL query's results.
|
|
167
|
+
*
|
|
168
|
+
* @returns Bound create export job for SQL query function.
|
|
169
|
+
*/
|
|
170
|
+
get createExportJobForSqlQuery(): import("@dereekb/zoho").ZohoAnalyticsCreateExportJobForSqlQueryFunction;
|
|
171
|
+
/**
|
|
172
|
+
* Configured pass-through for {@link zohoAnalyticsGetExportJob}.
|
|
173
|
+
*
|
|
174
|
+
* Retrieves an export job's status.
|
|
175
|
+
*
|
|
176
|
+
* @returns Bound get export job function.
|
|
177
|
+
*/
|
|
178
|
+
get getExportJob(): import("@dereekb/zoho").ZohoAnalyticsGetExportJobFunction;
|
|
179
|
+
/**
|
|
180
|
+
* Configured pass-through for {@link zohoAnalyticsDownloadExport}.
|
|
181
|
+
*
|
|
182
|
+
* Downloads the file produced by a completed export job.
|
|
183
|
+
*
|
|
184
|
+
* @returns Bound download export function.
|
|
185
|
+
*/
|
|
186
|
+
get downloadExport(): import("@dereekb/zoho").ZohoAnalyticsDownloadExportFunction;
|
|
187
|
+
/**
|
|
188
|
+
* Configured pass-through for {@link zohoAnalyticsExportDataAndAwaitJob}.
|
|
189
|
+
*
|
|
190
|
+
* Queues an asynchronous export and polls until the job reaches a terminal state.
|
|
191
|
+
*
|
|
192
|
+
* @returns Bound export data and await job function.
|
|
193
|
+
*/
|
|
194
|
+
get exportDataAndAwaitJob(): import("@dereekb/zoho").ZohoAnalyticsExportDataAndAwaitJobFunction;
|
|
195
|
+
/**
|
|
196
|
+
* Configured pass-through for {@link zohoAnalyticsAddRow}.
|
|
197
|
+
*
|
|
198
|
+
* Adds a single row to a table. Prefer an import for bulk data.
|
|
199
|
+
*
|
|
200
|
+
* @returns Bound add row function.
|
|
201
|
+
*/
|
|
202
|
+
get addRow(): import("@dereekb/zoho").ZohoAnalyticsAddRowFunction;
|
|
203
|
+
/**
|
|
204
|
+
* Configured pass-through for {@link zohoAnalyticsUpdateRows}.
|
|
205
|
+
*
|
|
206
|
+
* Updates rows matching a criteria expression.
|
|
207
|
+
*
|
|
208
|
+
* @returns Bound update rows function.
|
|
209
|
+
*/
|
|
210
|
+
get updateRows(): import("@dereekb/zoho").ZohoAnalyticsUpdateRowsFunction;
|
|
211
|
+
/**
|
|
212
|
+
* Configured pass-through for {@link zohoAnalyticsDeleteRows}.
|
|
213
|
+
*
|
|
214
|
+
* Deletes rows matching a criteria expression.
|
|
215
|
+
*
|
|
216
|
+
* @returns Bound delete rows function.
|
|
217
|
+
*/
|
|
218
|
+
get deleteRows(): import("@dereekb/zoho").ZohoAnalyticsDeleteRowsFunction;
|
|
219
|
+
/**
|
|
220
|
+
* Configured pass-through for {@link zohoAnalyticsDeleteView}.
|
|
221
|
+
*
|
|
222
|
+
* Irreversibly deletes a table, query table, report or dashboard. Needs the
|
|
223
|
+
* `ZohoAnalytics.modeling.delete` scope, which `modeling.create` does not imply.
|
|
224
|
+
*
|
|
225
|
+
* @returns Bound delete view function.
|
|
226
|
+
*/
|
|
227
|
+
get deleteView(): import("@dereekb/zoho").ZohoAnalyticsDeleteViewFunction;
|
|
228
|
+
/**
|
|
229
|
+
* Configured pass-through for {@link zohoAnalyticsDeleteWorkspace}.
|
|
230
|
+
*
|
|
231
|
+
* Irreversibly deletes a workspace and every view inside it.
|
|
232
|
+
*
|
|
233
|
+
* @returns Bound delete workspace function.
|
|
234
|
+
*/
|
|
235
|
+
get deleteWorkspace(): import("@dereekb/zoho").ZohoAnalyticsDeleteWorkspaceFunction;
|
|
236
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ZohoAnalyticsConfig, type ZohoAnalyticsFactoryConfig } from '@dereekb/zoho';
|
|
2
|
+
/**
|
|
3
|
+
* Zoho Analytics API configuration for the `ZohoAnalyticsApi`.
|
|
4
|
+
*/
|
|
5
|
+
export type ZohoAnalyticsServiceApiConfig = ZohoAnalyticsConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for the Zoho Analytics service, used as the injection token for the
|
|
8
|
+
* `ZohoAnalyticsApi`.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class ZohoAnalyticsServiceConfig {
|
|
11
|
+
readonly zohoAnalytics: ZohoAnalyticsServiceApiConfig;
|
|
12
|
+
readonly factoryConfig?: ZohoAnalyticsFactoryConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Asserts the config carries everything needed to reach the Zoho Analytics API.
|
|
15
|
+
*
|
|
16
|
+
* Unlike Zoho Desk, the organization id is not required here: `GET /orgs` is the bootstrap call
|
|
17
|
+
* that discovers it, and is the one endpoint that works without it. Every other endpoint fails
|
|
18
|
+
* with error code 8083 when `orgId` is absent.
|
|
19
|
+
*
|
|
20
|
+
* @param config - The config to validate.
|
|
21
|
+
* @throws {Error} When the API URL is missing.
|
|
22
|
+
*/
|
|
23
|
+
static assertValidConfig(config: ZohoAnalyticsServiceConfig): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { ZohoAnalyticsServiceConfig } from './analytics.config';
|
|
4
|
+
import { ZohoAccountsServiceConfig } from '../accounts/accounts.config';
|
|
5
|
+
import { type Maybe } from '@dereekb/util';
|
|
6
|
+
/**
|
|
7
|
+
* Config key suffix for the Zoho Analytics organization ID.
|
|
8
|
+
* Resolves to `ZOHO_ANALYTICS_ORG_ID` or `ZOHO_ORG_ID`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ZOHO_ANALYTICS_ORG_ID_CONFIG_KEY = "ORG_ID";
|
|
11
|
+
/**
|
|
12
|
+
* Reads Zoho Analytics connection settings from the NestJS ConfigService
|
|
13
|
+
* and returns a validated service config.
|
|
14
|
+
*
|
|
15
|
+
* Resolves the API URL via environment variables following the naming convention
|
|
16
|
+
* `ZOHO_ANALYTICS_API_URL` (service-specific) or `ZOHO_API_URL` (shared fallback).
|
|
17
|
+
* The organization ID is read from `ZOHO_ANALYTICS_ORG_ID` or `ZOHO_ORG_ID`.
|
|
18
|
+
*
|
|
19
|
+
* The organization ID is optional: without it only `getOrgs()` succeeds, which is how the id is
|
|
20
|
+
* discovered in the first place.
|
|
21
|
+
*
|
|
22
|
+
* @param configService - NestJS config service populated with Zoho environment variables.
|
|
23
|
+
* @returns Validated Zoho Analytics service configuration.
|
|
24
|
+
* @throws {Error} If the API URL is missing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function zohoAnalyticsServiceConfigFactory(configService: ConfigService): ZohoAnalyticsServiceConfig;
|
|
27
|
+
/**
|
|
28
|
+
* Reads Zoho Accounts (OAuth) settings scoped to the Analytics service from
|
|
29
|
+
* the NestJS ConfigService and returns an accounts service config.
|
|
30
|
+
*
|
|
31
|
+
* @param configService - NestJS config service populated with Zoho OAuth environment variables.
|
|
32
|
+
* @returns Zoho Accounts service config scoped to the Analytics service access token.
|
|
33
|
+
*/
|
|
34
|
+
export declare function zohoAnalyticsAccountServiceConfigFactory(configService: ConfigService): ZohoAccountsServiceConfig;
|
|
35
|
+
/**
|
|
36
|
+
* Configuration for generating the application-level Zoho Analytics NestJS module metadata.
|
|
37
|
+
*
|
|
38
|
+
* Extends standard NestJS {@link ModuleMetadata} fields (`imports`, `exports`, `providers`)
|
|
39
|
+
* so additional providers or modules can be merged into the generated metadata.
|
|
40
|
+
*/
|
|
41
|
+
export interface ProvideAppZohoAnalyticsMetadataConfig extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
|
|
42
|
+
/**
|
|
43
|
+
* Module that exports the required dependencies for this module.
|
|
44
|
+
* When provided, this module is automatically included in the generated `imports` array.
|
|
45
|
+
*/
|
|
46
|
+
readonly dependencyModule?: Maybe<Required<ModuleMetadata>['imports']['0']>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Generates NestJS {@link ModuleMetadata} that wires up the full Zoho Analytics stack
|
|
50
|
+
* (config, accounts, and API service) so consuming modules only need a single import.
|
|
51
|
+
*
|
|
52
|
+
* The generated module requires the following dependencies in order to initialize properly:
|
|
53
|
+
* - `ZohoAccountsAccessTokenCacheService`
|
|
54
|
+
*
|
|
55
|
+
* Use the `dependencyModule` config option to import a module that exports those dependencies.
|
|
56
|
+
*
|
|
57
|
+
* The returned metadata registers {@link ZohoAnalyticsServiceConfig}, {@link ZohoAnalyticsApi},
|
|
58
|
+
* {@link ZohoAccountsServiceConfig}, and {@link ZohoAccountsApi} as providers, and
|
|
59
|
+
* exports {@link ZohoAnalyticsApi} by default. Additional imports, exports, and providers
|
|
60
|
+
* from the config are merged in.
|
|
61
|
+
*
|
|
62
|
+
* @param config - Module configuration with optional dependency module and extra metadata.
|
|
63
|
+
* @returns Complete NestJS module metadata ready to pass to `@Module()`
|
|
64
|
+
*/
|
|
65
|
+
export declare function appZohoAnalyticsModuleMetadata(config: ProvideAppZohoAnalyticsMetadataConfig): ModuleMetadata;
|
package/package.json
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/zoho",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.40.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"bin": {
|
|
5
6
|
"zoho-cli": "cli/index.js"
|
|
6
7
|
},
|
|
7
8
|
"exports": {
|
|
8
9
|
"./nestjs": {
|
|
9
|
-
"module": "./nestjs/index.esm.js",
|
|
10
10
|
"types": "./nestjs/index.d.ts",
|
|
11
|
-
"import": "./nestjs/index.
|
|
12
|
-
"default": "./nestjs/index.
|
|
11
|
+
"import": "./nestjs/index.esm.js",
|
|
12
|
+
"default": "./nestjs/index.esm.js"
|
|
13
13
|
},
|
|
14
14
|
"./cli": {
|
|
15
15
|
"default": "./cli/index.js"
|
|
16
16
|
},
|
|
17
17
|
"./package.json": "./package.json",
|
|
18
18
|
".": {
|
|
19
|
-
"module": "./index.esm.js",
|
|
20
19
|
"types": "./index.d.ts",
|
|
21
|
-
"import": "./index.
|
|
22
|
-
"default": "./index.
|
|
20
|
+
"import": "./index.esm.js",
|
|
21
|
+
"default": "./index.esm.js"
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
24
|
"peerDependencies": {
|
|
26
|
-
"@dereekb/date": "13.
|
|
27
|
-
"@dereekb/dbx-cli": "13.
|
|
28
|
-
"@dereekb/firebase": "13.
|
|
29
|
-
"@dereekb/model": "13.
|
|
30
|
-
"@dereekb/nestjs": "13.
|
|
31
|
-
"@dereekb/rxjs": "13.
|
|
32
|
-
"@dereekb/util": "13.
|
|
25
|
+
"@dereekb/date": "13.40.0",
|
|
26
|
+
"@dereekb/dbx-cli": "13.40.0",
|
|
27
|
+
"@dereekb/firebase": "13.40.0",
|
|
28
|
+
"@dereekb/model": "13.40.0",
|
|
29
|
+
"@dereekb/nestjs": "13.40.0",
|
|
30
|
+
"@dereekb/rxjs": "13.40.0",
|
|
31
|
+
"@dereekb/util": "13.40.0",
|
|
33
32
|
"@nestjs/common": "^11.1.19",
|
|
34
33
|
"@nestjs/config": "^4.0.4",
|
|
35
34
|
"express": "^5.2.1",
|
|
@@ -41,6 +40,6 @@
|
|
|
41
40
|
"date-fns": "^4.1.0"
|
|
42
41
|
},
|
|
43
42
|
"module": "./index.esm.js",
|
|
44
|
-
"main": "./index.
|
|
43
|
+
"main": "./index.esm.js",
|
|
45
44
|
"types": "./index.d.ts"
|
|
46
|
-
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { type ZohoAnalyticsJobId, type ZohoAnalyticsResponse, type ZohoAnalyticsViewId, type ZohoAnalyticsWorkspaceId } from './analytics';
|
|
2
|
+
import { type ZohoAnalyticsContext } from './analytics.config';
|
|
3
|
+
import { type ZohoAnalyticsExportConfig, type ZohoAnalyticsExportJobConfig, type ZohoAnalyticsExportJobSqlQueryConfig, type ZohoAnalyticsExportJobStatus } from './analytics.export';
|
|
4
|
+
import { type ZohoAnalyticsJobCreationResult } from './analytics.api.import';
|
|
5
|
+
import { type PollZohoAnalyticsJobConfig } from './analytics.job';
|
|
6
|
+
/**
|
|
7
|
+
* Input for exporting the data of a view.
|
|
8
|
+
*/
|
|
9
|
+
export interface ZohoAnalyticsExportDataInput {
|
|
10
|
+
readonly workspaceId: ZohoAnalyticsWorkspaceId;
|
|
11
|
+
readonly viewId: ZohoAnalyticsViewId;
|
|
12
|
+
readonly config: ZohoAnalyticsExportConfig;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Exports a view's data, resolving with the raw response.
|
|
16
|
+
*/
|
|
17
|
+
export type ZohoAnalyticsExportDataFunction = (input: ZohoAnalyticsExportDataInput) => Promise<Response>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a {@link ZohoAnalyticsExportDataFunction} bound to the given context.
|
|
20
|
+
*
|
|
21
|
+
* Resolves with the raw {@link Response} rather than a parsed body, because the payload's type is
|
|
22
|
+
* chosen by the caller through `config.responseFormat` — read it with `.json()` for the `json`
|
|
23
|
+
* format and `.text()` for `csv`, `xml` and `html`.
|
|
24
|
+
*
|
|
25
|
+
* Zoho rejects a synchronous export for tables over 1,000,000 rows, for live-connect workspaces,
|
|
26
|
+
* and for dashboard and query-table views. Use {@link zohoAnalyticsCreateExportJob} for those.
|
|
27
|
+
*
|
|
28
|
+
* @param context - Authenticated Zoho Analytics context providing fetch and rate limiting.
|
|
29
|
+
* @returns Function that exports a view's data.
|
|
30
|
+
*
|
|
31
|
+
* @see https://www.zoho.com/analytics/api/v2/bulk-api/export-data.html
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const exportData = zohoAnalyticsExportData(context);
|
|
36
|
+
* const response = await exportData({ workspaceId, viewId, config: { responseFormat: 'csv' } });
|
|
37
|
+
* const csv = await response.text();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function zohoAnalyticsExportData(context: ZohoAnalyticsContext): ZohoAnalyticsExportDataFunction;
|
|
41
|
+
/**
|
|
42
|
+
* Response returned when an asynchronous export job is created.
|
|
43
|
+
*/
|
|
44
|
+
export type ZohoAnalyticsCreateExportJobResponse = ZohoAnalyticsResponse<ZohoAnalyticsJobCreationResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Input for queueing an asynchronous export of a view.
|
|
47
|
+
*/
|
|
48
|
+
export interface ZohoAnalyticsCreateExportJobInput {
|
|
49
|
+
readonly workspaceId: ZohoAnalyticsWorkspaceId;
|
|
50
|
+
readonly viewId: ZohoAnalyticsViewId;
|
|
51
|
+
readonly config: ZohoAnalyticsExportJobConfig;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Queues an asynchronous export of a view.
|
|
55
|
+
*/
|
|
56
|
+
export type ZohoAnalyticsCreateExportJobFunction = (input: ZohoAnalyticsCreateExportJobInput) => Promise<ZohoAnalyticsCreateExportJobResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a {@link ZohoAnalyticsCreateExportJobFunction} bound to the given context.
|
|
59
|
+
*
|
|
60
|
+
* Zoho Analytics allows at most 5 concurrent export jobs per organization, and the resulting file
|
|
61
|
+
* remains downloadable for roughly one hour.
|
|
62
|
+
*
|
|
63
|
+
* @param context - Authenticated Zoho Analytics context providing fetch and rate limiting.
|
|
64
|
+
* @returns Function that queues an asynchronous view export.
|
|
65
|
+
*
|
|
66
|
+
* @see https://www.zoho.com/analytics/api/v2/bulk-api/export-data-async/create-export/view-id.html
|
|
67
|
+
*/
|
|
68
|
+
export declare function zohoAnalyticsCreateExportJob(context: ZohoAnalyticsContext): ZohoAnalyticsCreateExportJobFunction;
|
|
69
|
+
/**
|
|
70
|
+
* Input for queueing an asynchronous export driven by a SQL query.
|
|
71
|
+
*/
|
|
72
|
+
export interface ZohoAnalyticsCreateExportJobForSqlQueryInput {
|
|
73
|
+
readonly workspaceId: ZohoAnalyticsWorkspaceId;
|
|
74
|
+
readonly config: ZohoAnalyticsExportJobSqlQueryConfig;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Queues an asynchronous export of a SQL query's results.
|
|
78
|
+
*/
|
|
79
|
+
export type ZohoAnalyticsCreateExportJobForSqlQueryFunction = (input: ZohoAnalyticsCreateExportJobForSqlQueryInput) => Promise<ZohoAnalyticsCreateExportJobResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates a {@link ZohoAnalyticsCreateExportJobForSqlQueryFunction} bound to the given context.
|
|
82
|
+
*
|
|
83
|
+
* This is the only way to run ad-hoc SQL against a workspace: Zoho Analytics has no synchronous
|
|
84
|
+
* query endpoint. The query result is exported as a file and nothing is persisted — to keep a query
|
|
85
|
+
* as a reusable view, create a query table through the Modeling API instead.
|
|
86
|
+
*
|
|
87
|
+
* @param context - Authenticated Zoho Analytics context providing fetch and rate limiting.
|
|
88
|
+
* @returns Function that queues an asynchronous SQL query export.
|
|
89
|
+
*
|
|
90
|
+
* @see https://www.zoho.com/analytics/api/v2/bulk-api/export-data-async/create-export/sql-query.html
|
|
91
|
+
*/
|
|
92
|
+
export declare function zohoAnalyticsCreateExportJobForSqlQuery(context: ZohoAnalyticsContext): ZohoAnalyticsCreateExportJobForSqlQueryFunction;
|
|
93
|
+
/**
|
|
94
|
+
* Response for `GET /bulk/workspaces/{workspaceId}/exportjobs/{jobId}`.
|
|
95
|
+
*/
|
|
96
|
+
export type ZohoAnalyticsGetExportJobResponse = ZohoAnalyticsResponse<ZohoAnalyticsExportJobStatus>;
|
|
97
|
+
/**
|
|
98
|
+
* Input for retrieving an export job's status.
|
|
99
|
+
*/
|
|
100
|
+
export interface ZohoAnalyticsGetExportJobInput {
|
|
101
|
+
readonly workspaceId: ZohoAnalyticsWorkspaceId;
|
|
102
|
+
readonly jobId: ZohoAnalyticsJobId;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves the status of an asynchronous export job.
|
|
106
|
+
*/
|
|
107
|
+
export type ZohoAnalyticsGetExportJobFunction = (input: ZohoAnalyticsGetExportJobInput) => Promise<ZohoAnalyticsGetExportJobResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a {@link ZohoAnalyticsGetExportJobFunction} bound to the given context.
|
|
110
|
+
*
|
|
111
|
+
* Checking job status costs zero API units.
|
|
112
|
+
*
|
|
113
|
+
* A job id that does not exist is a thrown 404 (error 8120), not a resolved status carrying
|
|
114
|
+
* `ZOHO_ANALYTICS_JOB_CODE_NOT_FOUND`. Verified against the live API.
|
|
115
|
+
*
|
|
116
|
+
* @param context - Authenticated Zoho Analytics context providing fetch and rate limiting.
|
|
117
|
+
* @returns Function that retrieves an export job's status.
|
|
118
|
+
*
|
|
119
|
+
* @see https://www.zoho.com/analytics/api/v2/bulk-api/export-data-async/get-export.html
|
|
120
|
+
*/
|
|
121
|
+
export declare function zohoAnalyticsGetExportJob(context: ZohoAnalyticsContext): ZohoAnalyticsGetExportJobFunction;
|
|
122
|
+
/**
|
|
123
|
+
* Input for downloading a completed export.
|
|
124
|
+
*/
|
|
125
|
+
export type ZohoAnalyticsDownloadExportInput = ZohoAnalyticsGetExportJobInput;
|
|
126
|
+
/**
|
|
127
|
+
* Downloads the file produced by a completed export job.
|
|
128
|
+
*/
|
|
129
|
+
export type ZohoAnalyticsDownloadExportFunction = (input: ZohoAnalyticsDownloadExportInput) => Promise<Response>;
|
|
130
|
+
/**
|
|
131
|
+
* Creates a {@link ZohoAnalyticsDownloadExportFunction} bound to the given context.
|
|
132
|
+
*
|
|
133
|
+
* Resolves with the raw {@link Response} carrying the exported file. Downloading costs zero API
|
|
134
|
+
* units, but the file is only available for roughly an hour after the job completes.
|
|
135
|
+
*
|
|
136
|
+
* @param context - Authenticated Zoho Analytics context providing fetch and rate limiting.
|
|
137
|
+
* @returns Function that downloads a completed export.
|
|
138
|
+
*
|
|
139
|
+
* @see https://www.zoho.com/analytics/api/v2/bulk-api/export-data-async/download-export.html
|
|
140
|
+
*/
|
|
141
|
+
export declare function zohoAnalyticsDownloadExport(context: ZohoAnalyticsContext): ZohoAnalyticsDownloadExportFunction;
|
|
142
|
+
/**
|
|
143
|
+
* Input for queueing an asynchronous export and waiting for it to finish.
|
|
144
|
+
*/
|
|
145
|
+
export interface ZohoAnalyticsExportDataAndAwaitJobInput extends ZohoAnalyticsCreateExportJobInput {
|
|
146
|
+
/**
|
|
147
|
+
* Overrides for how the job is polled.
|
|
148
|
+
*/
|
|
149
|
+
readonly poll?: Omit<PollZohoAnalyticsJobConfig<ZohoAnalyticsGetExportJobResponse>, 'loadJob' | 'readJobCode'>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Queues an asynchronous export of a view and resolves once it reaches a terminal state.
|
|
153
|
+
*/
|
|
154
|
+
export type ZohoAnalyticsExportDataAndAwaitJobFunction = (input: ZohoAnalyticsExportDataAndAwaitJobInput) => Promise<ZohoAnalyticsGetExportJobResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Creates a {@link ZohoAnalyticsExportDataAndAwaitJobFunction} bound to the given context.
|
|
157
|
+
*
|
|
158
|
+
* Queues the export, then polls until the job completes, fails, or the poll budget is exhausted.
|
|
159
|
+
* The returned job is the last one observed — check it with `isZohoAnalyticsJobComplete()` before
|
|
160
|
+
* reading `downloadUrl`.
|
|
161
|
+
*
|
|
162
|
+
* @param context - Authenticated Zoho Analytics context providing fetch and rate limiting.
|
|
163
|
+
* @returns Function that exports asynchronously and waits for the job.
|
|
164
|
+
*
|
|
165
|
+
* @see https://www.zoho.com/analytics/api/v2/bulk-api/export-data-async/get-export.html
|
|
166
|
+
*/
|
|
167
|
+
export declare function zohoAnalyticsExportDataAndAwaitJob(context: ZohoAnalyticsContext): ZohoAnalyticsExportDataAndAwaitJobFunction;
|