@arcane-utils/pubsub 1.2.3 → 1.2.4

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,4 @@
1
+ import * as pubsub from '@google-cloud/pubsub';
2
+ export { pubsub as googlePubsub };
3
+ export { MonitoringMessage, getPubsubClient, publishAvroRecords, publishMessage, publishProductFlowMonitoringMessage, publishStorageMessage } from './pubsub.cjs';
4
+ import '@arcane-utils/types';
@@ -0,0 +1,4 @@
1
+ import * as pubsub from '@google-cloud/pubsub';
2
+ export { pubsub as googlePubsub };
3
+ export { MonitoringMessage, getPubsubClient, publishAvroRecords, publishMessage, publishProductFlowMonitoringMessage, publishStorageMessage } from './pubsub.js';
4
+ import '@arcane-utils/types';
@@ -0,0 +1,43 @@
1
+ import { PubSub } from '@google-cloud/pubsub';
2
+ import { MonitoringStatus } from '@arcane-utils/types';
3
+
4
+ interface MonitoringMessage {
5
+ entity_id: number;
6
+ status: MonitoringStatus;
7
+ monitoring_id: string;
8
+ step: string;
9
+ error_message?: string;
10
+ }
11
+ /**
12
+ * Get PubSub client.
13
+ *
14
+ * To be used in Cloud Functions because of an issue with global declaration of clients.
15
+ */
16
+ declare const getPubsubClient: (gcpProject: string, serviceAccount: string) => PubSub;
17
+ /**
18
+ * Publish a message on PubSub.
19
+ */
20
+ declare const publishMessage: (topicName: string, message: any, pubsub: PubSub, attributes?: any) => Promise<string>;
21
+ /**
22
+ * Publish a message for Product Flow monitoring
23
+ */
24
+ declare const publishProductFlowMonitoringMessage: (step: string, entityId: number, monitoringId: string, status: MonitoringStatus, topicName: string, pubsub: PubSub, errorMessage?: string) => Promise<string>;
25
+ /**
26
+ * Publish a message similar to a storage notification
27
+ */
28
+ declare const publishStorageMessage: (objectId: string, bucketId: string, topicName: string, pubsub: PubSub, monitoringId?: string) => Promise<string>;
29
+ /**
30
+ *
31
+ * @param schemaNameOrId : schema name or id
32
+ * @param pubsub : pubsub client
33
+ * @returns : schema definition Avro
34
+ */
35
+ declare const getSchema: (schemaNameOrId: string, pubsub: PubSub) => Promise<string | null | undefined>;
36
+ /**
37
+ * Publish message with schema validation
38
+ *
39
+ * The schema will be retrieved from the topic metadata and validated
40
+ */
41
+ declare const publishAvroRecords: (topicNameOrId: string, pubSubClient: PubSub, message: any) => Promise<string>;
42
+
43
+ export { type MonitoringMessage, getPubsubClient, getSchema, publishAvroRecords, publishMessage, publishProductFlowMonitoringMessage, publishStorageMessage };
@@ -0,0 +1,43 @@
1
+ import { PubSub } from '@google-cloud/pubsub';
2
+ import { MonitoringStatus } from '@arcane-utils/types';
3
+
4
+ interface MonitoringMessage {
5
+ entity_id: number;
6
+ status: MonitoringStatus;
7
+ monitoring_id: string;
8
+ step: string;
9
+ error_message?: string;
10
+ }
11
+ /**
12
+ * Get PubSub client.
13
+ *
14
+ * To be used in Cloud Functions because of an issue with global declaration of clients.
15
+ */
16
+ declare const getPubsubClient: (gcpProject: string, serviceAccount: string) => PubSub;
17
+ /**
18
+ * Publish a message on PubSub.
19
+ */
20
+ declare const publishMessage: (topicName: string, message: any, pubsub: PubSub, attributes?: any) => Promise<string>;
21
+ /**
22
+ * Publish a message for Product Flow monitoring
23
+ */
24
+ declare const publishProductFlowMonitoringMessage: (step: string, entityId: number, monitoringId: string, status: MonitoringStatus, topicName: string, pubsub: PubSub, errorMessage?: string) => Promise<string>;
25
+ /**
26
+ * Publish a message similar to a storage notification
27
+ */
28
+ declare const publishStorageMessage: (objectId: string, bucketId: string, topicName: string, pubsub: PubSub, monitoringId?: string) => Promise<string>;
29
+ /**
30
+ *
31
+ * @param schemaNameOrId : schema name or id
32
+ * @param pubsub : pubsub client
33
+ * @returns : schema definition Avro
34
+ */
35
+ declare const getSchema: (schemaNameOrId: string, pubsub: PubSub) => Promise<string | null | undefined>;
36
+ /**
37
+ * Publish message with schema validation
38
+ *
39
+ * The schema will be retrieved from the topic metadata and validated
40
+ */
41
+ declare const publishAvroRecords: (topicNameOrId: string, pubSubClient: PubSub, message: any) => Promise<string>;
42
+
43
+ export { type MonitoringMessage, getPubsubClient, getSchema, publishAvroRecords, publishMessage, publishProductFlowMonitoringMessage, publishStorageMessage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcane-utils/pubsub",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "PubSub helper functions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "tsup": {
30
30
  "entry": ["./src/index.ts"],
31
31
  "format": ["cjs", "esm"],
32
- "dts": false,
32
+ "dts": true,
33
33
  "splitting": false,
34
34
  "sourcemap": true,
35
35
  "clean": true,
@@ -38,7 +38,7 @@
38
38
  "keywords": [
39
39
  "arcane",
40
40
  "utils",
41
- "storage"
41
+ "pubsub"
42
42
  ],
43
43
  "dependencies": {
44
44
  "@arcane-utils/types": "1.2.17",
package/dist/avro.d.cjs DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=avro.d.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/avro.d.js DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=avro.d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}