@stackone/olap 0.4.0 → 0.6.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/dist/index.d.mts +70 -6
- package/dist/index.d.ts +70 -6
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -92,17 +92,46 @@ type AdvancedOptions = {
|
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/types.d.ts
|
|
94
94
|
interface IOlapClient {
|
|
95
|
-
recordAction(
|
|
95
|
+
recordAction(actionResult: ActionResult, options?: OlapOptions): void;
|
|
96
96
|
recordStep(stepResult: StepResult, options?: OlapOptions): void;
|
|
97
97
|
}
|
|
98
98
|
type ActionResult = {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
actionRunId: string;
|
|
100
|
+
actionId: string;
|
|
101
|
+
connectorKey: string;
|
|
102
|
+
connectorVersion: string;
|
|
103
|
+
mode?: string;
|
|
104
|
+
category?: string;
|
|
105
|
+
organizationId: string;
|
|
106
|
+
projectSecureId: string;
|
|
107
|
+
accountSecureId: string;
|
|
108
|
+
originOwnerId?: string;
|
|
109
|
+
originOwnerName?: string;
|
|
110
|
+
httpMethod?: string;
|
|
111
|
+
url?: string;
|
|
112
|
+
path?: string;
|
|
113
|
+
sourceId?: string;
|
|
114
|
+
sourceType?: string;
|
|
115
|
+
sourceValue?: string;
|
|
116
|
+
resource?: string;
|
|
117
|
+
subResource?: string;
|
|
118
|
+
childResource?: string;
|
|
119
|
+
status?: string;
|
|
120
|
+
message?: string;
|
|
121
|
+
outputs?: unknown;
|
|
122
|
+
startTime?: Date;
|
|
123
|
+
endTime?: Date;
|
|
102
124
|
};
|
|
103
125
|
type StepResult = {
|
|
126
|
+
actionRunId: string;
|
|
104
127
|
stepId: string;
|
|
105
|
-
status
|
|
128
|
+
status?: string;
|
|
129
|
+
message?: string;
|
|
130
|
+
outputs?: unknown;
|
|
131
|
+
errors?: unknown;
|
|
132
|
+
skipped?: boolean;
|
|
133
|
+
startTime?: Date;
|
|
134
|
+
endTime?: Date;
|
|
106
135
|
};
|
|
107
136
|
//#endregion
|
|
108
137
|
//#region src/olap/olapClient.d.ts
|
|
@@ -122,8 +151,43 @@ declare class OlapClient implements IOlapClient {
|
|
|
122
151
|
s3ClientConfig?: S3ClientConfig;
|
|
123
152
|
logger?: ILogger;
|
|
124
153
|
});
|
|
154
|
+
initialize(): Promise<void>;
|
|
125
155
|
recordAction(actionResult: ActionResult, options?: OlapOptions): Promise<void>;
|
|
126
156
|
recordStep(stepResult: StepResult, options?: OlapOptions): Promise<void>;
|
|
127
157
|
}
|
|
128
158
|
//#endregion
|
|
129
|
-
|
|
159
|
+
//#region src/olap/olapClientManager.d.ts
|
|
160
|
+
declare const buildOlapClientInstance: ({
|
|
161
|
+
getKafkaClient,
|
|
162
|
+
getS3Client,
|
|
163
|
+
kafkaClientConfig,
|
|
164
|
+
s3ClientConfig,
|
|
165
|
+
logger
|
|
166
|
+
}?: {
|
|
167
|
+
getKafkaClient?: KafkaClientBuilder;
|
|
168
|
+
getS3Client?: S3ClientBuilder;
|
|
169
|
+
kafkaClientConfig?: KafkaClientConfig;
|
|
170
|
+
s3ClientConfig?: S3ClientConfig;
|
|
171
|
+
logger?: ILogger;
|
|
172
|
+
}) => Promise<IOlapClient>;
|
|
173
|
+
declare class OlapClientManager {
|
|
174
|
+
private static olapClientPromise;
|
|
175
|
+
static getInstance({
|
|
176
|
+
getKafkaClient,
|
|
177
|
+
getS3Client,
|
|
178
|
+
kafkaClientConfig,
|
|
179
|
+
s3ClientConfig,
|
|
180
|
+
logger,
|
|
181
|
+
getOlapClient
|
|
182
|
+
}?: {
|
|
183
|
+
getKafkaClient?: KafkaClientBuilder;
|
|
184
|
+
getS3Client?: S3ClientBuilder;
|
|
185
|
+
kafkaClientConfig?: KafkaClientConfig;
|
|
186
|
+
s3ClientConfig?: S3ClientConfig;
|
|
187
|
+
logger?: ILogger;
|
|
188
|
+
getOlapClient?: typeof buildOlapClientInstance;
|
|
189
|
+
}): Promise<IOlapClient>;
|
|
190
|
+
static resetInstance(): void;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { type ActionResult, type IOlapClient, OlapClient, OlapClientManager, type OlapOptions, type StepResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -92,17 +92,46 @@ type AdvancedOptions = {
|
|
|
92
92
|
//#endregion
|
|
93
93
|
//#region src/types.d.ts
|
|
94
94
|
interface IOlapClient {
|
|
95
|
-
recordAction(
|
|
95
|
+
recordAction(actionResult: ActionResult, options?: OlapOptions): void;
|
|
96
96
|
recordStep(stepResult: StepResult, options?: OlapOptions): void;
|
|
97
97
|
}
|
|
98
98
|
type ActionResult = {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
actionRunId: string;
|
|
100
|
+
actionId: string;
|
|
101
|
+
connectorKey: string;
|
|
102
|
+
connectorVersion: string;
|
|
103
|
+
mode?: string;
|
|
104
|
+
category?: string;
|
|
105
|
+
organizationId: string;
|
|
106
|
+
projectSecureId: string;
|
|
107
|
+
accountSecureId: string;
|
|
108
|
+
originOwnerId?: string;
|
|
109
|
+
originOwnerName?: string;
|
|
110
|
+
httpMethod?: string;
|
|
111
|
+
url?: string;
|
|
112
|
+
path?: string;
|
|
113
|
+
sourceId?: string;
|
|
114
|
+
sourceType?: string;
|
|
115
|
+
sourceValue?: string;
|
|
116
|
+
resource?: string;
|
|
117
|
+
subResource?: string;
|
|
118
|
+
childResource?: string;
|
|
119
|
+
status?: string;
|
|
120
|
+
message?: string;
|
|
121
|
+
outputs?: unknown;
|
|
122
|
+
startTime?: Date;
|
|
123
|
+
endTime?: Date;
|
|
102
124
|
};
|
|
103
125
|
type StepResult = {
|
|
126
|
+
actionRunId: string;
|
|
104
127
|
stepId: string;
|
|
105
|
-
status
|
|
128
|
+
status?: string;
|
|
129
|
+
message?: string;
|
|
130
|
+
outputs?: unknown;
|
|
131
|
+
errors?: unknown;
|
|
132
|
+
skipped?: boolean;
|
|
133
|
+
startTime?: Date;
|
|
134
|
+
endTime?: Date;
|
|
106
135
|
};
|
|
107
136
|
//#endregion
|
|
108
137
|
//#region src/olap/olapClient.d.ts
|
|
@@ -122,8 +151,43 @@ declare class OlapClient implements IOlapClient {
|
|
|
122
151
|
s3ClientConfig?: S3ClientConfig;
|
|
123
152
|
logger?: ILogger;
|
|
124
153
|
});
|
|
154
|
+
initialize(): Promise<void>;
|
|
125
155
|
recordAction(actionResult: ActionResult, options?: OlapOptions): Promise<void>;
|
|
126
156
|
recordStep(stepResult: StepResult, options?: OlapOptions): Promise<void>;
|
|
127
157
|
}
|
|
128
158
|
//#endregion
|
|
129
|
-
|
|
159
|
+
//#region src/olap/olapClientManager.d.ts
|
|
160
|
+
declare const buildOlapClientInstance: ({
|
|
161
|
+
getKafkaClient,
|
|
162
|
+
getS3Client,
|
|
163
|
+
kafkaClientConfig,
|
|
164
|
+
s3ClientConfig,
|
|
165
|
+
logger
|
|
166
|
+
}?: {
|
|
167
|
+
getKafkaClient?: KafkaClientBuilder;
|
|
168
|
+
getS3Client?: S3ClientBuilder;
|
|
169
|
+
kafkaClientConfig?: KafkaClientConfig;
|
|
170
|
+
s3ClientConfig?: S3ClientConfig;
|
|
171
|
+
logger?: ILogger;
|
|
172
|
+
}) => Promise<IOlapClient>;
|
|
173
|
+
declare class OlapClientManager {
|
|
174
|
+
private static olapClientPromise;
|
|
175
|
+
static getInstance({
|
|
176
|
+
getKafkaClient,
|
|
177
|
+
getS3Client,
|
|
178
|
+
kafkaClientConfig,
|
|
179
|
+
s3ClientConfig,
|
|
180
|
+
logger,
|
|
181
|
+
getOlapClient
|
|
182
|
+
}?: {
|
|
183
|
+
getKafkaClient?: KafkaClientBuilder;
|
|
184
|
+
getS3Client?: S3ClientBuilder;
|
|
185
|
+
kafkaClientConfig?: KafkaClientConfig;
|
|
186
|
+
s3ClientConfig?: S3ClientConfig;
|
|
187
|
+
logger?: ILogger;
|
|
188
|
+
getOlapClient?: typeof buildOlapClientInstance;
|
|
189
|
+
}): Promise<IOlapClient>;
|
|
190
|
+
static resetInstance(): void;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { type ActionResult, type IOlapClient, OlapClient, OlapClientManager, type OlapOptions, type StepResult };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`@aws-sdk/client-s3`)),l=s(require(`kafkajs`));var
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`@aws-sdk/client-s3`)),l=s(require(`kafkajs`)),u=e=>{try{return JSON.stringify(e)}catch{return`[Unserializable payload]`}};var d=class{#s3Client;#logger;constructor(e,t){this.#s3Client=e,this.#logger=t}async initialize(){if(!this.#s3Client){this.#logger?.warning({message:`No s3 client provided, advanced sink will not function`,category:`AdvancedSink`});return}}async send(e,t,n){if(!n?.enabled){this.#logger?.debug({message:`Logs sink is disabled, skipping send to bucket ${e}`,category:`AdvancedSink`});return}let r=u(t);this.#logger?.info({message:`[S3] Sent to bucket ${e}: ${r}`,context:{bucket:e,payload:t},category:`S3Sink`}),await Promise.resolve()}};const f=(e,t)=>{try{let t=new c.S3Client(e);return t??void 0}catch(e){let n=e;t?.error({message:`Error building s3 client: ${n.message}`,error:n,code:`BuildS3ClientError`,category:`buildS3Client`});return}},p=(e,t)=>{try{let t=new l.Kafka(e);return t??void 0}catch(e){let n=e;t?.error({message:`Error building kafka client: ${n.message}`,error:n,code:`BuildKafkaClientError`,category:`buildKafkaClient`});return}};var m=class{#kafka;#producer;#logger;constructor(e,t){this.#kafka=e,this.#logger=t}async initialize(){if(!this.#kafka){this.#logger?.warning({message:`No kafka client provided, logs sink cannot be initialized`,category:`LogsSink`});return}if(!this.#producer){try{this.#producer=this.#kafka.producer({createPartitioner:l.Partitioners.DefaultPartitioner})}catch(e){this.#logger?.error({message:`Failed to create kafka producer for logs sink`,code:`KafkaProducerCreationError`,category:`LogsSink`,error:e}),this.#producer=void 0;return}try{await this.#producer.connect()}catch(e){this.#logger?.error?.({message:`Failed to connect kafka producer for logs sink`,code:`KafkaProducerConnectionError`,category:`LogsSink`,error:e}),this.#producer=void 0;return}this.#logger?.info({message:`Logs sink kafka producer initialized`,category:`LogsSink`})}}async send(e,t,n){if(!n?.enabled){this.#logger?.debug({message:`Logs sink is disabled, skipping send to topic ${e}`,category:`KafkaSink`});return}if(!this.#producer)throw this.#logger?.error({message:`Kafka not initialized, dropping message for topic ${e}`,category:`KafkaSink`,code:`KafkaNotReady`}),Error(`Kafka client is not initialized`);let r=this.buildLog(t),i=u(r);this.#logger?.debug({message:`Sending to topic ${e}: ${i}`,category:`KafkaSink`});try{let t=await this.#producer.send({topic:e,messages:[{value:i}]});this.#logger?.debug({message:`Kafka producer response: ${JSON.stringify(t)}`,category:`KafkaSink`})}catch(t){throw this.#logger?.error({message:`Error sending to topic ${e}: ${t.message}`,category:`KafkaSink`,error:t,code:`KafkaSendError`}),t}}buildLog(e){if(this.isActionResult(e)){let t=Object.fromEntries(Object.entries({actionRunId:e.actionRunId,actionId:e.actionId,organizationId:e.organizationId,projectSecureId:e.projectSecureId,accountSecureId:e.accountSecureId,mode:e.mode,connectorKey:e.connectorKey,connectorVersion:e.connectorVersion,category:e.category,originOwnerId:e.originOwnerId,originOwnerName:e.originOwnerName,httpMethod:e.httpMethod,url:e.url,path:e.path,sourceId:e.sourceId,sourceType:e.sourceType,sourceValue:e.sourceValue,status:e.status,startTime:e.startTime,endTime:e.endTime}).filter(([,e])=>e!==void 0));return t}else if(this.isStepResult(e)){let t=Object.fromEntries(Object.entries({actionRunId:e.actionRunId,stepId:e.stepId,skipped:e.skipped,status:e.status,message:e.message,startTime:e.startTime,endTime:e.endTime}).filter(([,e])=>e!==void 0));return t}else throw this.#logger?.error({message:`Unknown result type, cannot build log`,category:`KafkaSink`,code:`UnknownResultType`}),Error(`Unknown result type`)}isActionResult(e){return typeof e==`object`&&!!e&&`actionId`in e&&`organizationId`in e}isStepResult(e){return typeof e==`object`&&!!e&&`stepId`in e&&`actionRunId`in e}};const h={logs:{enabled:!0},advanced:{enabled:!1,ttl:7,errorsOnly:!1}};function g(e){return{...h,...e}}var _=class{#kafkaClient;#s3Client;#logger;#logsSink;#advancedSink;name=`OlapClient`;constructor({getKafkaClient:e=p,getS3Client:t=f,kafkaClientConfig:n,s3ClientConfig:r,logger:i}={}){this.#kafkaClient=e(n,i),this.#s3Client=t(r,i),this.#logger=i,this.#logsSink=new m(this.#kafkaClient,this.#logger),this.#advancedSink=new d(this.#s3Client,this.#logger)}async initialize(){await this.#logsSink?.initialize(),await this.#advancedSink?.initialize()}async recordAction(e,t){let{logs:n,advanced:r}=g(t);if(n?.enabled)try{await this.#logsSink?.send(`actions`,e,n)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to kafka: ${e.message}`,category:`OlapClient`,error:e})}if(r?.enabled)try{await this.#advancedSink?.send(`actions`,e,r)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to s3: ${e.message}`,category:`OlapClient`,error:e})}}async recordStep(e,t){let{logs:n,advanced:r}=g(t);if(n?.enabled)try{await this.#logsSink?.send(`steps`,e,n)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to kafka: ${e.message}`,category:`OlapClient`,error:e})}if(r?.enabled)try{await this.#advancedSink?.send(`steps`,e,r)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to s3: ${e.message}`,category:`OlapClient`,error:e})}}};const v=async({getKafkaClient:e=p,getS3Client:t=f,kafkaClientConfig:n,s3ClientConfig:r,logger:i}={})=>{let a=new _({getKafkaClient:e,getS3Client:t,kafkaClientConfig:n,s3ClientConfig:r,logger:i});return await a.initialize(),a};var y=class{static olapClientPromise=null;static getInstance({getKafkaClient:e,getS3Client:t,kafkaClientConfig:n,s3ClientConfig:r,logger:i,getOlapClient:a=v}={}){return this.olapClientPromise||=a({getKafkaClient:e,getS3Client:t,kafkaClientConfig:n,s3ClientConfig:r,logger:i}),this.olapClientPromise}static resetInstance(){this.olapClientPromise=null}};exports.OlapClient=_,exports.OlapClientManager=y;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S3Client as e}from"@aws-sdk/client-s3";import{Kafka as t}from"kafkajs";var
|
|
1
|
+
import{S3Client as e}from"@aws-sdk/client-s3";import{Kafka as t,Partitioners as n}from"kafkajs";const r=e=>{try{return JSON.stringify(e)}catch{return`[Unserializable payload]`}};var i=class{#s3Client;#logger;constructor(e,t){this.#s3Client=e,this.#logger=t}async initialize(){if(!this.#s3Client){this.#logger?.warning({message:`No s3 client provided, advanced sink will not function`,category:`AdvancedSink`});return}}async send(e,t,n){if(!n?.enabled){this.#logger?.debug({message:`Logs sink is disabled, skipping send to bucket ${e}`,category:`AdvancedSink`});return}let i=r(t);this.#logger?.info({message:`[S3] Sent to bucket ${e}: ${i}`,context:{bucket:e,payload:t},category:`S3Sink`}),await Promise.resolve()}};const a=(t,n)=>{try{let n=new e(t);return n??void 0}catch(e){let t=e;n?.error({message:`Error building s3 client: ${t.message}`,error:t,code:`BuildS3ClientError`,category:`buildS3Client`});return}},o=(e,n)=>{try{let n=new t(e);return n??void 0}catch(e){let t=e;n?.error({message:`Error building kafka client: ${t.message}`,error:t,code:`BuildKafkaClientError`,category:`buildKafkaClient`});return}};var s=class{#kafka;#producer;#logger;constructor(e,t){this.#kafka=e,this.#logger=t}async initialize(){if(!this.#kafka){this.#logger?.warning({message:`No kafka client provided, logs sink cannot be initialized`,category:`LogsSink`});return}if(!this.#producer){try{this.#producer=this.#kafka.producer({createPartitioner:n.DefaultPartitioner})}catch(e){this.#logger?.error({message:`Failed to create kafka producer for logs sink`,code:`KafkaProducerCreationError`,category:`LogsSink`,error:e}),this.#producer=void 0;return}try{await this.#producer.connect()}catch(e){this.#logger?.error?.({message:`Failed to connect kafka producer for logs sink`,code:`KafkaProducerConnectionError`,category:`LogsSink`,error:e}),this.#producer=void 0;return}this.#logger?.info({message:`Logs sink kafka producer initialized`,category:`LogsSink`})}}async send(e,t,n){if(!n?.enabled){this.#logger?.debug({message:`Logs sink is disabled, skipping send to topic ${e}`,category:`KafkaSink`});return}if(!this.#producer)throw this.#logger?.error({message:`Kafka not initialized, dropping message for topic ${e}`,category:`KafkaSink`,code:`KafkaNotReady`}),Error(`Kafka client is not initialized`);let i=this.buildLog(t),a=r(i);this.#logger?.debug({message:`Sending to topic ${e}: ${a}`,category:`KafkaSink`});try{let t=await this.#producer.send({topic:e,messages:[{value:a}]});this.#logger?.debug({message:`Kafka producer response: ${JSON.stringify(t)}`,category:`KafkaSink`})}catch(t){throw this.#logger?.error({message:`Error sending to topic ${e}: ${t.message}`,category:`KafkaSink`,error:t,code:`KafkaSendError`}),t}}buildLog(e){if(this.isActionResult(e)){let t=Object.fromEntries(Object.entries({actionRunId:e.actionRunId,actionId:e.actionId,organizationId:e.organizationId,projectSecureId:e.projectSecureId,accountSecureId:e.accountSecureId,mode:e.mode,connectorKey:e.connectorKey,connectorVersion:e.connectorVersion,category:e.category,originOwnerId:e.originOwnerId,originOwnerName:e.originOwnerName,httpMethod:e.httpMethod,url:e.url,path:e.path,sourceId:e.sourceId,sourceType:e.sourceType,sourceValue:e.sourceValue,status:e.status,startTime:e.startTime,endTime:e.endTime}).filter(([,e])=>e!==void 0));return t}else if(this.isStepResult(e)){let t=Object.fromEntries(Object.entries({actionRunId:e.actionRunId,stepId:e.stepId,skipped:e.skipped,status:e.status,message:e.message,startTime:e.startTime,endTime:e.endTime}).filter(([,e])=>e!==void 0));return t}else throw this.#logger?.error({message:`Unknown result type, cannot build log`,category:`KafkaSink`,code:`UnknownResultType`}),Error(`Unknown result type`)}isActionResult(e){return typeof e==`object`&&!!e&&`actionId`in e&&`organizationId`in e}isStepResult(e){return typeof e==`object`&&!!e&&`stepId`in e&&`actionRunId`in e}};const c={logs:{enabled:!0},advanced:{enabled:!1,ttl:7,errorsOnly:!1}};function l(e){return{...c,...e}}var u=class{#kafkaClient;#s3Client;#logger;#logsSink;#advancedSink;name=`OlapClient`;constructor({getKafkaClient:e=o,getS3Client:t=a,kafkaClientConfig:n,s3ClientConfig:r,logger:c}={}){this.#kafkaClient=e(n,c),this.#s3Client=t(r,c),this.#logger=c,this.#logsSink=new s(this.#kafkaClient,this.#logger),this.#advancedSink=new i(this.#s3Client,this.#logger)}async initialize(){await this.#logsSink?.initialize(),await this.#advancedSink?.initialize()}async recordAction(e,t){let{logs:n,advanced:r}=l(t);if(n?.enabled)try{await this.#logsSink?.send(`actions`,e,n)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to kafka: ${e.message}`,category:`OlapClient`,error:e})}if(r?.enabled)try{await this.#advancedSink?.send(`actions`,e,r)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to s3: ${e.message}`,category:`OlapClient`,error:e})}}async recordStep(e,t){let{logs:n,advanced:r}=l(t);if(n?.enabled)try{await this.#logsSink?.send(`steps`,e,n)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to kafka: ${e.message}`,category:`OlapClient`,error:e})}if(r?.enabled)try{await this.#advancedSink?.send(`steps`,e,r)}catch(e){this.#logger?.warning({message:`[OlapClient] Error sending to s3: ${e.message}`,category:`OlapClient`,error:e})}}};const d=async({getKafkaClient:e=o,getS3Client:t=a,kafkaClientConfig:n,s3ClientConfig:r,logger:i}={})=>{let s=new u({getKafkaClient:e,getS3Client:t,kafkaClientConfig:n,s3ClientConfig:r,logger:i});return await s.initialize(),s};var f=class{static olapClientPromise=null;static getInstance({getKafkaClient:e,getS3Client:t,kafkaClientConfig:n,s3ClientConfig:r,logger:i,getOlapClient:a=d}={}){return this.olapClientPromise||=a({getKafkaClient:e,getS3Client:t,kafkaClientConfig:n,s3ClientConfig:r,logger:i}),this.olapClientPromise}static resetInstance(){this.olapClientPromise=null}};export{u as OlapClient,f as OlapClientManager};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackone/olap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"license": "ISC",
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@aws-sdk/client-s3": "3.913.0",
|
|
45
|
-
"kafkajs": "2.2.4"
|
|
45
|
+
"kafkajs": "2.2.4",
|
|
46
|
+
"date-fns": "2.30.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"tsdown": "0.12.9"
|