macrocosmos 1.2.2 → 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.
- package/dist/generated/apex/v1/apex.d.ts +440 -718
- package/dist/generated/apex/v1/apex.js +2924 -582
- package/dist/generated/billing/v1/billing.d.ts +71 -94
- package/dist/generated/billing/v1/billing.js +328 -80
- package/dist/generated/google/protobuf/timestamp.d.ts +122 -0
- package/dist/generated/google/protobuf/timestamp.js +92 -0
- package/dist/generated/gravity/v1/gravity.d.ts +378 -562
- package/dist/generated/gravity/v1/gravity.js +2360 -457
- package/dist/generated/sn13/v1/sn13_validator.d.ts +91 -114
- package/dist/generated/sn13/v1/sn13_validator.js +421 -96
- package/dist/lib/BaseClient.js +5 -5
- package/dist/lib/apex/Client.d.ts +8 -13
- package/dist/lib/apex/Client.js +14 -24
- package/dist/lib/billing/Client.d.ts +4 -17
- package/dist/lib/billing/Client.js +7 -21
- package/dist/lib/gravity/Client.d.ts +14 -22
- package/dist/lib/gravity/Client.js +13 -27
- package/dist/lib/sn13/Client.d.ts +4 -20
- package/dist/lib/sn13/Client.js +8 -22
- package/dist/lib/util.types.d.ts +1 -0
- package/dist/lib/util.types.js +3 -0
- package/new_version.txt +1 -1
- package/old_version.txt +1 -1
- package/package.json +7 -3
- package/tsconfig.eslint.json +1 -1
- package/eslint.config.cjs +0 -33
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IGetUsageRequest, IGetUsageResponse, IBillingServiceClient } from "../../generated/billing/v1/billing";
|
|
1
|
+
import { BillingServiceClient, GetUsageRequest, GetUsageResponse } from "../../generated/billing/v1/billing";
|
|
3
2
|
import { BaseClient, BaseClientOptions } from "../BaseClient";
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export type GetUsageRequest = IGetUsageRequest;
|
|
7
|
-
export type GetUsageResponse = IGetUsageResponse;
|
|
8
|
-
interface BillingService extends grpc.ServiceClientConstructor, IBillingServiceClient {
|
|
9
|
-
}
|
|
10
|
-
export interface BillingProtoClient {
|
|
11
|
-
BillingService: {
|
|
12
|
-
new (address: string, credentials: grpc.ChannelCredentials): BillingService;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
3
|
+
export type { GetUsageResponse, GetUsageRequest };
|
|
15
4
|
/**
|
|
16
5
|
* Client for interacting with the Billing API
|
|
17
6
|
* Provides billing service interface over gRPC
|
|
18
7
|
*/
|
|
19
8
|
export declare class BillingClient extends BaseClient {
|
|
20
|
-
private
|
|
21
|
-
constructor(options:
|
|
22
|
-
private initializeGrpcClient;
|
|
9
|
+
private _grpcClient?;
|
|
10
|
+
constructor(options: BaseClientOptions, grpcClient?: BillingServiceClient);
|
|
23
11
|
private createGrpcClient;
|
|
24
12
|
/**
|
|
25
13
|
* Get usage information for a product
|
|
26
14
|
*/
|
|
27
15
|
getUsage: (params: GetUsageRequest) => Promise<GetUsageResponse>;
|
|
28
16
|
}
|
|
29
|
-
export {};
|
|
@@ -34,16 +34,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.BillingClient = void 0;
|
|
37
|
+
const billing_1 = require("../../generated/billing/v1/billing");
|
|
37
38
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
38
|
-
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
39
|
const BaseClient_1 = require("../BaseClient");
|
|
41
40
|
/**
|
|
42
41
|
* Client for interacting with the Billing API
|
|
43
42
|
* Provides billing service interface over gRPC
|
|
44
43
|
*/
|
|
45
44
|
class BillingClient extends BaseClient_1.BaseClient {
|
|
46
|
-
constructor(options) {
|
|
45
|
+
constructor(options, grpcClient) {
|
|
47
46
|
super(options);
|
|
48
47
|
/**
|
|
49
48
|
* Get usage information for a product
|
|
@@ -51,7 +50,7 @@ class BillingClient extends BaseClient_1.BaseClient {
|
|
|
51
50
|
this.getUsage = async (params) => {
|
|
52
51
|
const client = this.createGrpcClient();
|
|
53
52
|
return new Promise((resolve, reject) => {
|
|
54
|
-
|
|
53
|
+
client.getUsage(params, (error, response) => {
|
|
55
54
|
if (error) {
|
|
56
55
|
reject(error);
|
|
57
56
|
return;
|
|
@@ -60,24 +59,11 @@ class BillingClient extends BaseClient_1.BaseClient {
|
|
|
60
59
|
});
|
|
61
60
|
});
|
|
62
61
|
};
|
|
63
|
-
this.
|
|
64
|
-
}
|
|
65
|
-
initializeGrpcClient() {
|
|
66
|
-
// Load proto file directly
|
|
67
|
-
const PROTO_PATH = path.resolve(__dirname, "../../../protos/billing/v1/billing.proto");
|
|
68
|
-
// Load protos using standard protobuf loader
|
|
69
|
-
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
|
|
70
|
-
keepCase: false,
|
|
71
|
-
longs: String,
|
|
72
|
-
enums: String,
|
|
73
|
-
defaults: true,
|
|
74
|
-
oneofs: true,
|
|
75
|
-
});
|
|
76
|
-
// Get the BillingService definition
|
|
77
|
-
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
|
|
78
|
-
return protoDescriptor.billing.v1;
|
|
62
|
+
this._grpcClient = grpcClient;
|
|
79
63
|
}
|
|
80
64
|
createGrpcClient() {
|
|
65
|
+
if (this._grpcClient)
|
|
66
|
+
return this._grpcClient;
|
|
81
67
|
// Create gRPC credentials with API key
|
|
82
68
|
const callCreds = grpc.credentials.createFromMetadataGenerator((_params, callback) => {
|
|
83
69
|
const meta = new grpc.Metadata();
|
|
@@ -100,7 +86,7 @@ class BillingClient extends BaseClient_1.BaseClient {
|
|
|
100
86
|
credentials = grpc.credentials.createInsecure();
|
|
101
87
|
}
|
|
102
88
|
// Create gRPC client
|
|
103
|
-
return new
|
|
89
|
+
return new billing_1.BillingServiceClient(this.getBaseURL(), credentials);
|
|
104
90
|
}
|
|
105
91
|
}
|
|
106
92
|
exports.BillingClient = BillingClient;
|
|
@@ -1,51 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IGetGravityTasksRequest, IGetGravityTasksResponse, IGetCrawlerRequest, IGetCrawlerResponse, ICreateGravityTaskRequest, ICreateGravityTaskResponse, IBuildDatasetRequest, IBuildDatasetResponse, IGetDatasetRequest, IGetDatasetResponse, ICancelGravityTaskRequest, ICancelGravityTaskResponse, ICancelDatasetRequest, ICancelDatasetResponse, IGravityServiceClient } from "../../generated/gravity/v1/gravity";
|
|
1
|
+
import { GravityServiceClient, GetGravityTasksRequest, GetGravityTasksResponse, GetCrawlerRequest, GetCrawlerResponse, CreateGravityTaskRequest as GeneratedCreateGravityTaskRequest, CreateGravityTaskResponse, BuildDatasetRequest as GeneratedBuildDatasetRequest, BuildDatasetResponse, GetDatasetRequest, GetDatasetResponse, CancelGravityTaskRequest, CancelGravityTaskResponse, CancelDatasetRequest, CancelDatasetResponse, Crawler, CrawlerCriteria, CrawlerNotification, HfRepo, CrawlerState, GravityTaskState, NotificationRequest, Dataset, DatasetFile, DatasetStep } from "../../generated/gravity/v1/gravity";
|
|
3
2
|
import { BaseClient, BaseClientOptions } from "../BaseClient";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export interface GravityProtoClient {
|
|
9
|
-
GravityService: {
|
|
10
|
-
new (address: string, credentials: grpc.ChannelCredentials): GravityService;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
3
|
+
import { MarkFieldsOptional } from "../util.types";
|
|
4
|
+
type CreateGravityTaskRequest = MarkFieldsOptional<GeneratedCreateGravityTaskRequest, "notificationRequests">;
|
|
5
|
+
type BuildDatasetRequest = MarkFieldsOptional<GeneratedBuildDatasetRequest, "notificationRequests">;
|
|
6
|
+
export type { GetGravityTasksRequest, GetGravityTasksResponse, GetCrawlerRequest, GetCrawlerResponse, CreateGravityTaskRequest, CreateGravityTaskResponse, BuildDatasetRequest, BuildDatasetResponse, GetDatasetRequest, GetDatasetResponse, CancelGravityTaskRequest, CancelGravityTaskResponse, CancelDatasetRequest, CancelDatasetResponse, Crawler, CrawlerCriteria, CrawlerNotification, HfRepo, CrawlerState, GravityTaskState, NotificationRequest, Dataset, DatasetFile, DatasetStep, };
|
|
13
7
|
/**
|
|
14
8
|
* Client for interacting with the Gravity API
|
|
15
9
|
* Provides gRPC interface for data collection and dataset management
|
|
16
10
|
*/
|
|
17
11
|
export declare class GravityClient extends BaseClient {
|
|
18
|
-
private
|
|
19
|
-
constructor(options:
|
|
20
|
-
private initializeGrpcClient;
|
|
12
|
+
private _grpcClient?;
|
|
13
|
+
constructor(options: BaseClientOptions, grpcClient?: GravityServiceClient);
|
|
21
14
|
private createGrpcClient;
|
|
22
15
|
/**
|
|
23
16
|
* Lists all data collection tasks for a user
|
|
24
17
|
*/
|
|
25
|
-
getGravityTasks: (params:
|
|
18
|
+
getGravityTasks: (params: GetGravityTasksRequest) => Promise<GetGravityTasksResponse>;
|
|
26
19
|
/**
|
|
27
20
|
* Get a single crawler by its ID
|
|
28
21
|
*/
|
|
29
|
-
getCrawler: (params:
|
|
22
|
+
getCrawler: (params: GetCrawlerRequest) => Promise<GetCrawlerResponse>;
|
|
30
23
|
/**
|
|
31
24
|
* Create a new gravity task
|
|
32
25
|
*/
|
|
33
|
-
createGravityTask: (params:
|
|
26
|
+
createGravityTask: (params: CreateGravityTaskRequest) => Promise<CreateGravityTaskResponse>;
|
|
34
27
|
/**
|
|
35
28
|
* Build a dataset for a single crawler
|
|
36
29
|
*/
|
|
37
|
-
buildDataset: (params:
|
|
30
|
+
buildDataset: (params: BuildDatasetRequest) => Promise<BuildDatasetResponse>;
|
|
38
31
|
/**
|
|
39
32
|
* Get the dataset build status and results
|
|
40
33
|
*/
|
|
41
|
-
getDataset: (params:
|
|
34
|
+
getDataset: (params: GetDatasetRequest) => Promise<GetDatasetResponse>;
|
|
42
35
|
/**
|
|
43
36
|
* Cancel a gravity task and any crawlers associated with it
|
|
44
37
|
*/
|
|
45
|
-
cancelGravityTask: (params:
|
|
38
|
+
cancelGravityTask: (params: CancelGravityTaskRequest) => Promise<CancelGravityTaskResponse>;
|
|
46
39
|
/**
|
|
47
40
|
* Cancel dataset build if it is in progress and purges the dataset
|
|
48
41
|
*/
|
|
49
|
-
cancelDataset: (params:
|
|
42
|
+
cancelDataset: (params: CancelDatasetRequest) => Promise<CancelDatasetResponse>;
|
|
50
43
|
}
|
|
51
|
-
export {};
|
|
@@ -35,15 +35,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.GravityClient = void 0;
|
|
37
37
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
38
|
-
const
|
|
39
|
-
const path = __importStar(require("path"));
|
|
38
|
+
const gravity_1 = require("../../generated/gravity/v1/gravity");
|
|
40
39
|
const BaseClient_1 = require("../BaseClient");
|
|
41
40
|
/**
|
|
42
41
|
* Client for interacting with the Gravity API
|
|
43
42
|
* Provides gRPC interface for data collection and dataset management
|
|
44
43
|
*/
|
|
45
44
|
class GravityClient extends BaseClient_1.BaseClient {
|
|
46
|
-
constructor(options) {
|
|
45
|
+
constructor(options, grpcClient) {
|
|
47
46
|
super(options);
|
|
48
47
|
/**
|
|
49
48
|
* Lists all data collection tasks for a user
|
|
@@ -51,7 +50,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
51
50
|
this.getGravityTasks = async (params) => {
|
|
52
51
|
const client = this.createGrpcClient();
|
|
53
52
|
return new Promise((resolve, reject) => {
|
|
54
|
-
|
|
53
|
+
client.getGravityTasks(params, (error, response) => {
|
|
55
54
|
if (error) {
|
|
56
55
|
reject(error);
|
|
57
56
|
return;
|
|
@@ -66,7 +65,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
66
65
|
this.getCrawler = async (params) => {
|
|
67
66
|
const client = this.createGrpcClient();
|
|
68
67
|
return new Promise((resolve, reject) => {
|
|
69
|
-
|
|
68
|
+
client.getCrawler(params, (error, response) => {
|
|
70
69
|
if (error) {
|
|
71
70
|
reject(error);
|
|
72
71
|
return;
|
|
@@ -81,7 +80,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
81
80
|
this.createGravityTask = async (params) => {
|
|
82
81
|
const client = this.createGrpcClient();
|
|
83
82
|
return new Promise((resolve, reject) => {
|
|
84
|
-
|
|
83
|
+
client.createGravityTask(params, (error, response) => {
|
|
85
84
|
if (error) {
|
|
86
85
|
reject(error);
|
|
87
86
|
return;
|
|
@@ -96,7 +95,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
96
95
|
this.buildDataset = async (params) => {
|
|
97
96
|
const client = this.createGrpcClient();
|
|
98
97
|
return new Promise((resolve, reject) => {
|
|
99
|
-
|
|
98
|
+
client.buildDataset(params, (error, response) => {
|
|
100
99
|
if (error) {
|
|
101
100
|
reject(error);
|
|
102
101
|
return;
|
|
@@ -111,7 +110,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
111
110
|
this.getDataset = async (params) => {
|
|
112
111
|
const client = this.createGrpcClient();
|
|
113
112
|
return new Promise((resolve, reject) => {
|
|
114
|
-
|
|
113
|
+
client.getDataset(params, (error, response) => {
|
|
115
114
|
if (error) {
|
|
116
115
|
reject(error);
|
|
117
116
|
return;
|
|
@@ -126,7 +125,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
126
125
|
this.cancelGravityTask = async (params) => {
|
|
127
126
|
const client = this.createGrpcClient();
|
|
128
127
|
return new Promise((resolve, reject) => {
|
|
129
|
-
|
|
128
|
+
client.cancelGravityTask(params, (error, response) => {
|
|
130
129
|
if (error) {
|
|
131
130
|
reject(error);
|
|
132
131
|
return;
|
|
@@ -141,7 +140,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
141
140
|
this.cancelDataset = async (params) => {
|
|
142
141
|
const client = this.createGrpcClient();
|
|
143
142
|
return new Promise((resolve, reject) => {
|
|
144
|
-
|
|
143
|
+
client.cancelDataset(params, (error, response) => {
|
|
145
144
|
if (error) {
|
|
146
145
|
reject(error);
|
|
147
146
|
return;
|
|
@@ -150,24 +149,11 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
150
149
|
});
|
|
151
150
|
});
|
|
152
151
|
};
|
|
153
|
-
this.
|
|
154
|
-
}
|
|
155
|
-
initializeGrpcClient() {
|
|
156
|
-
// Load proto file directly
|
|
157
|
-
const PROTO_PATH = path.resolve(__dirname, "../../../protos/gravity/v1/gravity.proto");
|
|
158
|
-
// Load protos using standard protobuf loader
|
|
159
|
-
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
|
|
160
|
-
keepCase: false,
|
|
161
|
-
longs: String,
|
|
162
|
-
enums: String,
|
|
163
|
-
defaults: true,
|
|
164
|
-
oneofs: true,
|
|
165
|
-
});
|
|
166
|
-
// Get the GravityService definition
|
|
167
|
-
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
|
|
168
|
-
return protoDescriptor.gravity.v1;
|
|
152
|
+
this._grpcClient = grpcClient;
|
|
169
153
|
}
|
|
170
154
|
createGrpcClient() {
|
|
155
|
+
if (this._grpcClient)
|
|
156
|
+
return this._grpcClient;
|
|
171
157
|
// Create gRPC credentials with API key
|
|
172
158
|
const callCreds = grpc.credentials.createFromMetadataGenerator((_params, callback) => {
|
|
173
159
|
const meta = new grpc.Metadata();
|
|
@@ -190,7 +176,7 @@ class GravityClient extends BaseClient_1.BaseClient {
|
|
|
190
176
|
credentials = grpc.credentials.createInsecure();
|
|
191
177
|
}
|
|
192
178
|
// Create gRPC client
|
|
193
|
-
return new
|
|
179
|
+
return new gravity_1.GravityServiceClient(this.getBaseURL(), credentials);
|
|
194
180
|
}
|
|
195
181
|
}
|
|
196
182
|
exports.GravityClient = GravityClient;
|
|
@@ -1,28 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IListTopicsRequest, IListTopicsResponse, IListTopicsResponseDetail, IValidateRedditTopicRequest, IValidateRedditTopicResponse, ISn13ServiceClient } from "../../generated/sn13/v1/sn13_validator";
|
|
1
|
+
import { Sn13ServiceClient, ListTopicsRequest, ListTopicsResponse, ListTopicsResponseDetail, ValidateRedditTopicRequest, ValidateRedditTopicResponse } from "../../generated/sn13/v1/sn13_validator";
|
|
3
2
|
import { BaseClient, BaseClientOptions } from "../BaseClient";
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export type ListTopicsRequest = IListTopicsRequest;
|
|
7
|
-
export type ListTopicsResponse = IListTopicsResponse;
|
|
8
|
-
export type ListTopicsResponseDetail = IListTopicsResponseDetail;
|
|
9
|
-
export type ValidateRedditTopicRequest = IValidateRedditTopicRequest;
|
|
10
|
-
export type ValidateRedditTopicResponse = IValidateRedditTopicResponse;
|
|
11
|
-
interface Sn13Service extends grpc.ServiceClientConstructor, ISn13ServiceClient {
|
|
12
|
-
}
|
|
13
|
-
export interface Sn13ProtoClient {
|
|
14
|
-
Sn13Service: {
|
|
15
|
-
new (address: string, credentials: grpc.ChannelCredentials): Sn13Service;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
3
|
+
export type { ListTopicsRequest, ListTopicsResponse, ListTopicsResponseDetail, ValidateRedditTopicRequest, ValidateRedditTopicResponse, };
|
|
18
4
|
/**
|
|
19
5
|
* Client for interacting with the SN13 API
|
|
20
6
|
* Provides SN13 service interface over gRPC
|
|
21
7
|
*/
|
|
22
8
|
export declare class Sn13Client extends BaseClient {
|
|
23
|
-
private
|
|
24
|
-
constructor(options:
|
|
25
|
-
private initializeGrpcClient;
|
|
9
|
+
private _grpcClient?;
|
|
10
|
+
constructor(options: BaseClientOptions, grpcClient?: Sn13ServiceClient);
|
|
26
11
|
private createGrpcClient;
|
|
27
12
|
/**
|
|
28
13
|
* List topics from a source
|
|
@@ -33,4 +18,3 @@ export declare class Sn13Client extends BaseClient {
|
|
|
33
18
|
*/
|
|
34
19
|
validateRedditTopic: (params: ValidateRedditTopicRequest) => Promise<ValidateRedditTopicResponse>;
|
|
35
20
|
}
|
|
36
|
-
export {};
|
package/dist/lib/sn13/Client.js
CHANGED
|
@@ -34,16 +34,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Sn13Client = void 0;
|
|
37
|
+
const sn13_validator_1 = require("../../generated/sn13/v1/sn13_validator");
|
|
37
38
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
38
|
-
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
39
|
const BaseClient_1 = require("../BaseClient");
|
|
41
40
|
/**
|
|
42
41
|
* Client for interacting with the SN13 API
|
|
43
42
|
* Provides SN13 service interface over gRPC
|
|
44
43
|
*/
|
|
45
44
|
class Sn13Client extends BaseClient_1.BaseClient {
|
|
46
|
-
constructor(options) {
|
|
45
|
+
constructor(options, grpcClient) {
|
|
47
46
|
super(options);
|
|
48
47
|
/**
|
|
49
48
|
* List topics from a source
|
|
@@ -51,7 +50,7 @@ class Sn13Client extends BaseClient_1.BaseClient {
|
|
|
51
50
|
this.listTopics = async (params) => {
|
|
52
51
|
const client = this.createGrpcClient();
|
|
53
52
|
return new Promise((resolve, reject) => {
|
|
54
|
-
|
|
53
|
+
client.listTopics(params, (error, response) => {
|
|
55
54
|
if (error) {
|
|
56
55
|
reject(error);
|
|
57
56
|
return;
|
|
@@ -66,7 +65,7 @@ class Sn13Client extends BaseClient_1.BaseClient {
|
|
|
66
65
|
this.validateRedditTopic = async (params) => {
|
|
67
66
|
const client = this.createGrpcClient();
|
|
68
67
|
return new Promise((resolve, reject) => {
|
|
69
|
-
|
|
68
|
+
client.validateRedditTopic(params, (error, response) => {
|
|
70
69
|
if (error) {
|
|
71
70
|
reject(error);
|
|
72
71
|
return;
|
|
@@ -75,24 +74,11 @@ class Sn13Client extends BaseClient_1.BaseClient {
|
|
|
75
74
|
});
|
|
76
75
|
});
|
|
77
76
|
};
|
|
78
|
-
this.
|
|
79
|
-
}
|
|
80
|
-
initializeGrpcClient() {
|
|
81
|
-
// Load proto file directly
|
|
82
|
-
const PROTO_PATH = path.resolve(__dirname, "../../../protos/sn13/v1/sn13_validator.proto");
|
|
83
|
-
// Load protos using standard protobuf loader
|
|
84
|
-
const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
|
|
85
|
-
keepCase: false,
|
|
86
|
-
longs: String,
|
|
87
|
-
enums: String,
|
|
88
|
-
defaults: true,
|
|
89
|
-
oneofs: true,
|
|
90
|
-
});
|
|
91
|
-
// Get the Sn13Service definition
|
|
92
|
-
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
|
|
93
|
-
return protoDescriptor.sn13.v1;
|
|
77
|
+
this._grpcClient = grpcClient;
|
|
94
78
|
}
|
|
95
79
|
createGrpcClient() {
|
|
80
|
+
if (this._grpcClient)
|
|
81
|
+
return this._grpcClient;
|
|
96
82
|
// Create gRPC credentials with API key
|
|
97
83
|
const callCreds = grpc.credentials.createFromMetadataGenerator((_params, callback) => {
|
|
98
84
|
const meta = new grpc.Metadata();
|
|
@@ -115,7 +101,7 @@ class Sn13Client extends BaseClient_1.BaseClient {
|
|
|
115
101
|
credentials = grpc.credentials.createInsecure();
|
|
116
102
|
}
|
|
117
103
|
// Create gRPC client
|
|
118
|
-
return new
|
|
104
|
+
return new sn13_validator_1.Sn13ServiceClient(this.getBaseURL(), credentials);
|
|
119
105
|
}
|
|
120
106
|
}
|
|
121
107
|
exports.Sn13Client = Sn13Client;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MarkFieldsOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
package/new_version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.4
|
package/old_version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.3
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "macrocosmos",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "TypeScript SDK package for Macrocosmos",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"clean": "rimraf dist",
|
|
9
|
-
"build": "npm run clean && npm run
|
|
9
|
+
"build": "npm run clean && npm run gen:proto && tsc",
|
|
10
|
+
"pack": "npm pack && tar -tf macrocosmos-$(node -p \"require('./package.json').version\").tgz && open macrocosmos-$(node -p \"require('./package.json').version\").tgz",
|
|
11
|
+
"pack:rm": "rm macrocosmos-$(node -p \"require('./package.json').version\").tgz && rm -rf package",
|
|
10
12
|
"ts-check": "tsc --noEmit",
|
|
11
13
|
"test": "jest",
|
|
12
14
|
"test:watch": "jest --watch",
|
|
@@ -14,7 +16,7 @@
|
|
|
14
16
|
"lint:fix": "eslint . --ext .ts --fix",
|
|
15
17
|
"format:check": "prettier --check \"src/**/*.{ts,js,json,md}\"",
|
|
16
18
|
"format:write": "prettier --write \"src/**/*.{ts,js,json,md}\"",
|
|
17
|
-
"
|
|
19
|
+
"gen:proto": "npx protoc --plugin=protoc-gen-ts_proto=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/generated --ts_proto_opt=outputServices=grpc-js,useOptionals=messages,useExactTypes=false,esModuleInterop=true,forceLong=number -I ./protos $(find ./protos -name \"*.proto\") && prettier --write \"src/generated/**/*.{ts,js,json,md}\" ",
|
|
18
20
|
"example:sn13:list-topics": "ts-node src/__examples__/sn13/list-topics.ts"
|
|
19
21
|
},
|
|
20
22
|
"keywords": [],
|
|
@@ -24,6 +26,7 @@
|
|
|
24
26
|
"dependencies": {
|
|
25
27
|
"@grpc/grpc-js": "^1.10.1",
|
|
26
28
|
"@grpc/proto-loader": "^0.7.10",
|
|
29
|
+
"dotenv": "^16.5.0",
|
|
27
30
|
"protobufjs": "^7.2.6"
|
|
28
31
|
},
|
|
29
32
|
"prettier": {
|
|
@@ -49,6 +52,7 @@
|
|
|
49
52
|
"rimraf": "^5.0.5",
|
|
50
53
|
"ts-jest": "^29.1.2",
|
|
51
54
|
"ts-node": "^10.9.2",
|
|
55
|
+
"ts-proto": "^2.7.0",
|
|
52
56
|
"typescript": "^5.3.3"
|
|
53
57
|
}
|
|
54
58
|
}
|
package/tsconfig.eslint.json
CHANGED
package/eslint.config.cjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const tsPlugin = require("@typescript-eslint/eslint-plugin");
|
|
2
|
-
const tsParser = require("@typescript-eslint/parser");
|
|
3
|
-
const prettierPlugin = require("eslint-plugin-prettier");
|
|
4
|
-
|
|
5
|
-
module.exports = [
|
|
6
|
-
{
|
|
7
|
-
ignores: ["node_modules", "dist", "build"],
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
files: ["**/*.{ts,tsx}"],
|
|
11
|
-
languageOptions: {
|
|
12
|
-
parser: tsParser,
|
|
13
|
-
parserOptions: {
|
|
14
|
-
project: "./tsconfig.eslint.json",
|
|
15
|
-
tsconfigRootDir: __dirname,
|
|
16
|
-
sourceType: "module",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
plugins: {
|
|
20
|
-
"@typescript-eslint": tsPlugin,
|
|
21
|
-
prettier: prettierPlugin,
|
|
22
|
-
},
|
|
23
|
-
rules: {
|
|
24
|
-
...tsPlugin.configs.recommended.rules,
|
|
25
|
-
...tsPlugin.configs["recommended-type-checked"].rules,
|
|
26
|
-
"prettier/prettier": "warn",
|
|
27
|
-
"@typescript-eslint/no-unused-vars": [
|
|
28
|
-
"warn",
|
|
29
|
-
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
];
|