@mitralab.io/sdk-core 0.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.
package/dist/index.cjs ADDED
@@ -0,0 +1,443 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ SdkCoreConfigurationError: () => SdkCoreConfigurationError,
24
+ SdkCoreResponseError: () => SdkCoreResponseError,
25
+ createAuthModule: () => createAuthModule,
26
+ createEntitiesModule: () => createEntitiesModule,
27
+ createFunctionsModule: () => createFunctionsModule,
28
+ createIntegrationModule: () => createIntegrationModule,
29
+ createQueriesModule: () => createQueriesModule,
30
+ createSdkCore: () => createSdkCore,
31
+ defaultSdkCoreErrorFactory: () => defaultSdkCoreErrorFactory,
32
+ encodePathSegment: () => encodePathSegment,
33
+ expectEmpty: () => expectEmpty,
34
+ expectObject: () => expectObject,
35
+ expectObjectArray: () => expectObjectArray
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+
39
+ // src/errors.ts
40
+ var SdkCoreConfigurationError = class extends Error {
41
+ constructor(message) {
42
+ super(message);
43
+ this.name = "SdkCoreConfigurationError";
44
+ }
45
+ };
46
+ var SdkCoreResponseError = class extends Error {
47
+ code = "INVALID_RESPONSE";
48
+ retryable = false;
49
+ constructor(message) {
50
+ super(message);
51
+ this.name = "SdkCoreResponseError";
52
+ }
53
+ };
54
+ var defaultSdkCoreErrorFactory = {
55
+ configuration: (message) => new SdkCoreConfigurationError(message),
56
+ invalidResponse: (message) => new SdkCoreResponseError(message)
57
+ };
58
+ function configurationError(message, errors = defaultSdkCoreErrorFactory) {
59
+ throw errors.configuration(message);
60
+ }
61
+ function invalidResponse(message, errors = defaultSdkCoreErrorFactory) {
62
+ throw errors.invalidResponse(message);
63
+ }
64
+
65
+ // src/response.ts
66
+ function isObject(value) {
67
+ return value !== null && typeof value === "object" && !Array.isArray(value);
68
+ }
69
+ function isNullableString(value) {
70
+ return value === null || typeof value === "string";
71
+ }
72
+ function isInteger(value) {
73
+ return typeof value === "number" && Number.isInteger(value);
74
+ }
75
+ function isNullableInteger(value) {
76
+ return value === null || isInteger(value);
77
+ }
78
+ function isStringRecord(value) {
79
+ return isObject(value) && Object.values(value).every((item) => typeof item === "string");
80
+ }
81
+ function hasOwn(value, property) {
82
+ return Object.prototype.hasOwnProperty.call(value, property);
83
+ }
84
+ function invalidField(context, field, errors) {
85
+ return invalidResponse(`${context} has an invalid ${field} field`, errors);
86
+ }
87
+ function expectObject(value, context, errors = defaultSdkCoreErrorFactory) {
88
+ if (!isObject(value)) {
89
+ return invalidResponse(`${context} must be a JSON object`, errors);
90
+ }
91
+ return value;
92
+ }
93
+ function expectObjectArray(value, context, errors = defaultSdkCoreErrorFactory) {
94
+ if (!Array.isArray(value) || value.some((item) => !isObject(item))) {
95
+ return invalidResponse(`${context} must be a JSON array of objects`, errors);
96
+ }
97
+ return value;
98
+ }
99
+ function expectTenant(value, context, errors = defaultSdkCoreErrorFactory) {
100
+ const tenant = expectObject(value, context, errors);
101
+ if (typeof tenant.id !== "string") invalidField(context, "id", errors);
102
+ if (typeof tenant.shortId !== "string") invalidField(context, "shortId", errors);
103
+ if (!isNullableInteger(tenant.legacyId)) invalidField(context, "legacyId", errors);
104
+ if (typeof tenant.slug !== "string") invalidField(context, "slug", errors);
105
+ if (!isObject(tenant.plan)) invalidField(context, "plan", errors);
106
+ if (typeof tenant.plan.id !== "string") invalidField(`${context} plan`, "id", errors);
107
+ if (typeof tenant.plan.name !== "string") invalidField(`${context} plan`, "name", errors);
108
+ if (typeof tenant.name !== "string") invalidField(context, "name", errors);
109
+ if (!isNullableString(tenant.description)) invalidField(context, "description", errors);
110
+ if (!isNullableString(tenant.hexColor)) invalidField(context, "hexColor", errors);
111
+ if (!isNullableString(tenant.icon)) invalidField(context, "icon", errors);
112
+ if (typeof tenant.infraStatus !== "string") invalidField(context, "infraStatus", errors);
113
+ if (typeof tenant.active !== "boolean") invalidField(context, "active", errors);
114
+ return tenant;
115
+ }
116
+ function expectUser(value, context, errors = defaultSdkCoreErrorFactory) {
117
+ const user = expectObject(value, context, errors);
118
+ if (typeof user.id !== "string") invalidField(context, "id", errors);
119
+ expectTenant(user.tenant, `${context} tenant`, errors);
120
+ if (typeof user.name !== "string") invalidField(context, "name", errors);
121
+ if (typeof user.email !== "string") invalidField(context, "email", errors);
122
+ if (!isNullableString(user.imageUrl)) invalidField(context, "imageUrl", errors);
123
+ if (typeof user.onboardingCompleted !== "boolean") {
124
+ invalidField(context, "onboardingCompleted", errors);
125
+ }
126
+ return user;
127
+ }
128
+ function expectQueryResult(value, context, errors = defaultSdkCoreErrorFactory) {
129
+ const result = expectObject(value, context, errors);
130
+ if (!Array.isArray(result.rows) || result.rows.some((row) => !isObject(row))) {
131
+ invalidField(context, "rows", errors);
132
+ }
133
+ if (hasOwn(result, "affectedRows") && !isNullableInteger(result.affectedRows)) {
134
+ invalidField(context, "affectedRows", errors);
135
+ }
136
+ if (!isInteger(result.durationMs)) {
137
+ invalidField(context, "durationMs", errors);
138
+ }
139
+ return result;
140
+ }
141
+ function expectFunctionExecution(value, context, errors = defaultSdkCoreErrorFactory) {
142
+ const execution = expectObject(value, context, errors);
143
+ if (typeof execution.id !== "string") invalidField(context, "id", errors);
144
+ if (typeof execution.functionId !== "string") invalidField(context, "functionId", errors);
145
+ if (typeof execution.functionVersionId !== "string") {
146
+ invalidField(context, "functionVersionId", errors);
147
+ }
148
+ if (typeof execution.status !== "string") invalidField(context, "status", errors);
149
+ if (execution.input !== null && !isObject(execution.input)) {
150
+ invalidField(context, "input", errors);
151
+ }
152
+ if (execution.output !== null && !isObject(execution.output)) {
153
+ invalidField(context, "output", errors);
154
+ }
155
+ if (!isNullableString(execution.errorMessage)) {
156
+ invalidField(context, "errorMessage", errors);
157
+ }
158
+ if (!isNullableString(execution.logs)) invalidField(context, "logs", errors);
159
+ if (!isNullableInteger(execution.durationMs)) invalidField(context, "durationMs", errors);
160
+ if (!isNullableString(execution.startedAt)) invalidField(context, "startedAt", errors);
161
+ if (!isNullableString(execution.finishedAt)) invalidField(context, "finishedAt", errors);
162
+ if (typeof execution.createdAt !== "string") invalidField(context, "createdAt", errors);
163
+ return execution;
164
+ }
165
+ function expectProxyResult(value, context, errors = defaultSdkCoreErrorFactory) {
166
+ const result = expectObject(value, context, errors);
167
+ if (!isInteger(result.status)) {
168
+ invalidField(context, "status", errors);
169
+ }
170
+ if (!isStringRecord(result.headers)) invalidField(context, "headers", errors);
171
+ if (!hasOwn(result, "body")) invalidField(context, "body", errors);
172
+ if (!isInteger(result.durationMs)) {
173
+ invalidField(context, "durationMs", errors);
174
+ }
175
+ if (typeof result.executionId !== "string") invalidField(context, "executionId", errors);
176
+ return result;
177
+ }
178
+ function expectEmpty(value, context, errors = defaultSdkCoreErrorFactory) {
179
+ if (value !== void 0) invalidResponse(`${context} must be empty`, errors);
180
+ }
181
+
182
+ // src/modules/auth.ts
183
+ function createAuthModule(transport, errors = defaultSdkCoreErrorFactory) {
184
+ return {
185
+ async me() {
186
+ return expectUser(
187
+ await transport.request("/api/v1/auth/me", { method: "GET" }),
188
+ "Current user response",
189
+ errors
190
+ );
191
+ }
192
+ };
193
+ }
194
+
195
+ // src/path.ts
196
+ function encodePathSegment(value, name, errors = defaultSdkCoreErrorFactory) {
197
+ const segment = String(value);
198
+ if (!segment.trim()) configurationError(`${name} must not be empty`, errors);
199
+ if (segment === "." || segment === "..") {
200
+ configurationError(`${name} must not be a dot segment`, errors);
201
+ }
202
+ return encodeURIComponent(segment);
203
+ }
204
+
205
+ // src/modules/entities.ts
206
+ var DefaultEntitiesModule = class {
207
+ constructor(transport, errors) {
208
+ this.transport = transport;
209
+ this.errors = errors;
210
+ }
211
+ tables = /* @__PURE__ */ new Map();
212
+ getTable(tableName) {
213
+ if (!this.tables.has(tableName)) {
214
+ this.tables.set(tableName, this.createTable(tableName));
215
+ }
216
+ return this.tables.get(tableName);
217
+ }
218
+ createTable(tableName) {
219
+ const basePath = `/api/v1/tables/${encodePathSegment(tableName, "tableName", this.errors)}/records`;
220
+ return {
221
+ list: async (sortOrOptions, limit, skip, fields) => {
222
+ const options = typeof sortOrOptions === "object" ? sortOrOptions : void 0;
223
+ const params = {
224
+ sort: options?.sort ?? (typeof sortOrOptions === "string" ? sortOrOptions : void 0),
225
+ limit: options?.limit ?? limit,
226
+ skip: options?.skip ?? skip,
227
+ fields: (options?.fields ?? fields)?.join(",")
228
+ };
229
+ const response = expectObject(
230
+ await this.transport.request(basePath, { method: "GET", params }),
231
+ "Entity list response",
232
+ this.errors
233
+ );
234
+ return expectObjectArray(response.data, "Entity list data", this.errors);
235
+ },
236
+ filter: async (query, sort, limit, skip, fields) => {
237
+ const response = expectObject(
238
+ await this.transport.request(basePath, {
239
+ method: "GET",
240
+ params: {
241
+ q: JSON.stringify(query),
242
+ sort,
243
+ limit,
244
+ skip,
245
+ fields: fields?.join(",")
246
+ }
247
+ }),
248
+ "Entity list response",
249
+ this.errors
250
+ );
251
+ return expectObjectArray(response.data, "Entity list data", this.errors);
252
+ },
253
+ get: async (id) => expectObject(
254
+ await this.transport.request(
255
+ `${basePath}/${encodePathSegment(id, "id", this.errors)}`,
256
+ { method: "GET" }
257
+ ),
258
+ "Entity response",
259
+ this.errors
260
+ ),
261
+ create: async (data) => expectObject(
262
+ await this.transport.request(basePath, { method: "POST", body: data }),
263
+ "Created entity response",
264
+ this.errors
265
+ ),
266
+ bulkCreate: async (data) => expectObjectArray(
267
+ await this.transport.request(`${basePath}/bulk`, {
268
+ method: "POST",
269
+ body: data
270
+ }),
271
+ "Bulk create response",
272
+ this.errors
273
+ ),
274
+ update: async (id, data) => expectObject(
275
+ await this.transport.request(
276
+ `${basePath}/${encodePathSegment(id, "id", this.errors)}`,
277
+ { method: "PUT", body: data }
278
+ ),
279
+ "Updated entity response",
280
+ this.errors
281
+ ),
282
+ delete: (id) => this.transport.request(`${basePath}/${encodePathSegment(id, "id", this.errors)}`, {
283
+ method: "DELETE"
284
+ }).then((response) => expectEmpty(response, "Delete entity response", this.errors)),
285
+ deleteMany: async (query) => {
286
+ if (Object.keys(query).length === 0) {
287
+ configurationError("query must not be empty for deleteMany", this.errors);
288
+ }
289
+ const response = expectObject(
290
+ await this.transport.request(basePath, {
291
+ method: "DELETE",
292
+ params: { q: JSON.stringify(query) }
293
+ }),
294
+ "Delete many response",
295
+ this.errors
296
+ );
297
+ if (!Number.isInteger(response.deleted)) {
298
+ return invalidResponse(
299
+ "Delete many response must include an integer deleted count",
300
+ this.errors
301
+ );
302
+ }
303
+ return { deleted: response.deleted };
304
+ }
305
+ };
306
+ }
307
+ };
308
+ function createEntitiesModule(transport, errors = defaultSdkCoreErrorFactory) {
309
+ const instance = new DefaultEntitiesModule(transport, errors);
310
+ return new Proxy(instance, {
311
+ get(target, property, receiver) {
312
+ if (typeof property !== "string" || property in target) {
313
+ return Reflect.get(target, property, receiver);
314
+ }
315
+ return target.getTable(property);
316
+ }
317
+ });
318
+ }
319
+
320
+ // src/modules/functions.ts
321
+ var DefaultFunctionsModule = class {
322
+ constructor(transport, errors, options) {
323
+ this.transport = transport;
324
+ this.errors = errors;
325
+ this.options = options;
326
+ }
327
+ execute(id, input) {
328
+ return this.executeWithType(id, this.options.executeInvocationType, input);
329
+ }
330
+ executeAsync(id, input) {
331
+ return this.executeWithType(id, "async", input);
332
+ }
333
+ getExecution(id) {
334
+ return this.transport.request(
335
+ `/api/v1/executions/${encodePathSegment(id, "execution id", this.errors)}`,
336
+ { method: "GET" }
337
+ ).then(
338
+ (response) => expectFunctionExecution(response, "Function execution response", this.errors)
339
+ );
340
+ }
341
+ cancelExecution(id) {
342
+ return this.transport.request(
343
+ `/api/v1/executions/${encodePathSegment(id, "execution id", this.errors)}/cancel`,
344
+ { method: "POST" }
345
+ ).then((response) => expectEmpty(response, "Cancel execution response", this.errors));
346
+ }
347
+ executeWithType(id, invocationType, input) {
348
+ const request = {
349
+ method: "POST",
350
+ ...input !== void 0 || this.options.emptyInput !== "omit-body" ? { body: { input: input ?? {} } } : {},
351
+ ...invocationType === void 0 ? {} : { headers: { "X-Invocation-Type": invocationType } }
352
+ };
353
+ return this.transport.request(
354
+ `/api/v1/functions/${encodePathSegment(id, "function id", this.errors)}/execute`,
355
+ request
356
+ ).then(
357
+ (response) => expectFunctionExecution(response, "Function execution response", this.errors)
358
+ );
359
+ }
360
+ };
361
+ function createFunctionsModule(transport, options = {}, errors = defaultSdkCoreErrorFactory) {
362
+ return new DefaultFunctionsModule(transport, errors, options);
363
+ }
364
+
365
+ // src/modules/integration.ts
366
+ function createIntegrationModule(transport, errors = defaultSdkCoreErrorFactory) {
367
+ return {
368
+ async executeResource(resourceId, params = {}) {
369
+ return expectProxyResult(
370
+ await transport.request(
371
+ `/api/v1/proxy/resources/${encodePathSegment(resourceId, "resource id", errors)}/execute`,
372
+ { method: "POST", body: { params } }
373
+ ),
374
+ "Integration resource response",
375
+ errors
376
+ );
377
+ },
378
+ async execute(configId, request) {
379
+ return expectProxyResult(
380
+ await transport.request(
381
+ `/api/v1/proxy/template-configs/${encodePathSegment(configId, "config id", errors)}/execute`,
382
+ { method: "POST", body: { ...request, source: "SDK" } }
383
+ ),
384
+ "Integration proxy response",
385
+ errors
386
+ );
387
+ }
388
+ };
389
+ }
390
+
391
+ // src/modules/queries.ts
392
+ function createQueriesModule(transport, getDataSourceId, errors = defaultSdkCoreErrorFactory) {
393
+ return {
394
+ async execute(id, parameters = {}) {
395
+ const dataSourceId = getDataSourceId();
396
+ if (!dataSourceId) {
397
+ configurationError(
398
+ "A dataSourceId is required for queries. Call client.init() first or configure dataSourceId.",
399
+ errors
400
+ );
401
+ }
402
+ return expectQueryResult(
403
+ await transport.request(
404
+ `/api/v1/custom-queries/${encodePathSegment(id, "query id", errors)}/execute`,
405
+ {
406
+ method: "POST",
407
+ body: { dataSourceId, parameters }
408
+ }
409
+ ),
410
+ "Query execution response",
411
+ errors
412
+ );
413
+ }
414
+ };
415
+ }
416
+
417
+ // src/core.ts
418
+ function createSdkCore(options) {
419
+ const errors = options.errors ?? defaultSdkCoreErrorFactory;
420
+ return {
421
+ auth: createAuthModule(options.transports.auth, errors),
422
+ entities: createEntitiesModule(options.transports.dataManager, errors),
423
+ functions: createFunctionsModule(options.transports.functions, options.functions, errors),
424
+ integration: createIntegrationModule(options.transports.integration, errors),
425
+ queries: createQueriesModule(options.transports.dataManager, options.getDataSourceId, errors)
426
+ };
427
+ }
428
+ // Annotate the CommonJS export names for ESM import in node:
429
+ 0 && (module.exports = {
430
+ SdkCoreConfigurationError,
431
+ SdkCoreResponseError,
432
+ createAuthModule,
433
+ createEntitiesModule,
434
+ createFunctionsModule,
435
+ createIntegrationModule,
436
+ createQueriesModule,
437
+ createSdkCore,
438
+ defaultSdkCoreErrorFactory,
439
+ encodePathSegment,
440
+ expectEmpty,
441
+ expectObject,
442
+ expectObjectArray
443
+ });
@@ -0,0 +1,171 @@
1
+ interface SdkCoreErrorFactory {
2
+ configuration(message: string): Error;
3
+ invalidResponse(message: string): Error;
4
+ }
5
+ declare class SdkCoreConfigurationError extends Error {
6
+ constructor(message: string);
7
+ }
8
+ declare class SdkCoreResponseError extends Error {
9
+ readonly code = "INVALID_RESPONSE";
10
+ readonly retryable = false;
11
+ constructor(message: string);
12
+ }
13
+ declare const defaultSdkCoreErrorFactory: SdkCoreErrorFactory;
14
+
15
+ type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
16
+ type QueryParamValue = string | number | boolean | undefined;
17
+ interface TransportRequestOptions {
18
+ method?: HttpMethod;
19
+ body?: unknown;
20
+ headers?: Record<string, string>;
21
+ params?: Record<string, QueryParamValue>;
22
+ }
23
+ interface Transport {
24
+ request<T>(path: string, options?: TransportRequestOptions): Promise<T>;
25
+ }
26
+
27
+ interface Plan {
28
+ id: string;
29
+ name: string;
30
+ [key: string]: unknown;
31
+ }
32
+ interface Tenant {
33
+ id: string;
34
+ shortId: string;
35
+ legacyId: number | null;
36
+ slug: string;
37
+ plan: Plan;
38
+ name: string;
39
+ description: string | null;
40
+ hexColor: string | null;
41
+ icon: string | null;
42
+ infraStatus: string;
43
+ active: boolean;
44
+ [key: string]: unknown;
45
+ }
46
+ interface User {
47
+ id: string;
48
+ tenant: Tenant;
49
+ name: string;
50
+ email: string;
51
+ imageUrl: string | null;
52
+ onboardingCompleted: boolean;
53
+ }
54
+ interface EntityListOptions {
55
+ sort?: string;
56
+ limit?: number;
57
+ skip?: number;
58
+ fields?: string[];
59
+ }
60
+ interface EntityTable<T = Record<string, unknown>> {
61
+ list(sortOrOptions?: string | EntityListOptions, limit?: number, skip?: number, fields?: string[]): Promise<T[]>;
62
+ filter(query: Record<string, unknown>, sort?: string, limit?: number, skip?: number, fields?: string[]): Promise<T[]>;
63
+ get(id: string | number): Promise<T>;
64
+ create(data: Partial<T>): Promise<T>;
65
+ bulkCreate(data: Partial<T>[]): Promise<T[]>;
66
+ update(id: string | number, data: Partial<T>): Promise<T>;
67
+ delete(id: string | number): Promise<void>;
68
+ deleteMany(query: Record<string, unknown>): Promise<{
69
+ deleted: number;
70
+ }>;
71
+ }
72
+ interface QueryResult {
73
+ rows: Record<string, unknown>[];
74
+ affectedRows?: number | null;
75
+ durationMs: number;
76
+ }
77
+ interface FunctionExecution {
78
+ id: string;
79
+ functionId: string;
80
+ functionVersionId: string;
81
+ status: string;
82
+ input: Record<string, unknown> | null;
83
+ output: Record<string, unknown> | null;
84
+ errorMessage: string | null;
85
+ logs: string | null;
86
+ durationMs: number | null;
87
+ startedAt: string | null;
88
+ finishedAt: string | null;
89
+ createdAt: string;
90
+ }
91
+ interface ProxyInput {
92
+ method: string;
93
+ endpoint: string;
94
+ headers?: Record<string, string>;
95
+ body?: unknown;
96
+ queryParams?: Record<string, unknown>;
97
+ }
98
+ interface ProxyResult {
99
+ status: number;
100
+ headers: Record<string, string>;
101
+ body: unknown;
102
+ durationMs: number;
103
+ executionId: string;
104
+ }
105
+
106
+ interface AuthModule {
107
+ me(): Promise<User>;
108
+ }
109
+ declare function createAuthModule(transport: Transport, errors?: SdkCoreErrorFactory): AuthModule;
110
+
111
+ interface EntitiesModule {
112
+ getTable<T = Record<string, unknown>>(tableName: string): EntityTable<T>;
113
+ }
114
+ type EntitiesProxy = EntitiesModule & {
115
+ [tableName: string]: EntityTable;
116
+ };
117
+ declare function createEntitiesModule(transport: Transport, errors?: SdkCoreErrorFactory): EntitiesProxy;
118
+
119
+ type InvocationType = "sync" | "async";
120
+ type EmptyFunctionInput = "empty-object" | "omit-body";
121
+ interface FunctionsModuleOptions {
122
+ executeInvocationType?: InvocationType;
123
+ emptyInput?: EmptyFunctionInput;
124
+ }
125
+ interface FunctionsModule {
126
+ execute(id: string, input?: Record<string, unknown>): Promise<FunctionExecution>;
127
+ executeAsync(id: string, input?: Record<string, unknown>): Promise<FunctionExecution>;
128
+ getExecution(id: string): Promise<FunctionExecution>;
129
+ cancelExecution(id: string): Promise<void>;
130
+ }
131
+ declare function createFunctionsModule(transport: Transport, options?: FunctionsModuleOptions, errors?: SdkCoreErrorFactory): FunctionsModule;
132
+
133
+ interface IntegrationModule {
134
+ executeResource(resourceId: string, params?: Record<string, unknown>): Promise<ProxyResult>;
135
+ execute(configId: string, request: ProxyInput): Promise<ProxyResult>;
136
+ }
137
+ declare function createIntegrationModule(transport: Transport, errors?: SdkCoreErrorFactory): IntegrationModule;
138
+
139
+ interface QueriesModule {
140
+ execute(id: string, parameters?: Record<string, unknown>): Promise<QueryResult>;
141
+ }
142
+ declare function createQueriesModule(transport: Transport, getDataSourceId: () => string | undefined, errors?: SdkCoreErrorFactory): QueriesModule;
143
+
144
+ interface SdkCoreTransports {
145
+ auth: Transport;
146
+ dataManager: Transport;
147
+ functions: Transport;
148
+ integration: Transport;
149
+ }
150
+ interface SdkCoreOptions {
151
+ transports: SdkCoreTransports;
152
+ getDataSourceId: () => string | undefined;
153
+ functions?: FunctionsModuleOptions;
154
+ errors?: SdkCoreErrorFactory;
155
+ }
156
+ interface SdkCore {
157
+ readonly auth: AuthModule;
158
+ readonly entities: EntitiesProxy;
159
+ readonly functions: FunctionsModule;
160
+ readonly integration: IntegrationModule;
161
+ readonly queries: QueriesModule;
162
+ }
163
+ declare function createSdkCore(options: SdkCoreOptions): SdkCore;
164
+
165
+ declare function encodePathSegment(value: string | number, name: string, errors?: SdkCoreErrorFactory): string;
166
+
167
+ declare function expectObject<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory): T;
168
+ declare function expectObjectArray<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory): T[];
169
+ declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
170
+
171
+ export { type AuthModule, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityTable, type FunctionExecution, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type IntegrationModule, type InvocationType, type Plan, type ProxyInput, type ProxyResult, type QueriesModule, type QueryParamValue, type QueryResult, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type Tenant, type Transport, type TransportRequestOptions, type User, createAuthModule, createEntitiesModule, createFunctionsModule, createIntegrationModule, createQueriesModule, createSdkCore, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectObject, expectObjectArray };