@ptkl/sdk 1.0.3 → 1.3.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.0.10.js +453 -135
- package/dist/index.0.9.js +135 -8
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +152 -20
- package/dist/v0.10/api/functions.d.ts +1 -2
- package/dist/v0.10/api/index.d.ts +4 -2
- package/dist/v0.10/api/integrations/dms.d.ts +0 -9
- package/dist/v0.10/api/integrations/mail.d.ts +125 -0
- package/dist/v0.10/api/integrations/serbia/minfin/index.d.ts +10 -0
- package/dist/v0.10/api/integrations/serbia/minfin/vpfr.d.ts +4 -0
- package/dist/v0.10/api/integrations/serbia/nbs/index.d.ts +10 -0
- package/dist/v0.10/api/integrations/serbiaUtil.d.ts +9 -7
- package/dist/v0.10/api/integrations.d.ts +6 -3
- package/dist/v0.10/api/platform.d.ts +2 -2
- package/dist/v0.10/api/platformBaseClient.d.ts +0 -1
- package/dist/v0.10/api/project.d.ts +6 -1
- package/dist/v0.10/index.cjs.js +453 -135
- package/dist/v0.10/index.esm.js +451 -135
- package/dist/v0.10/types/component.d.ts +73 -3
- package/dist/v0.10/types/integrations/mail.d.ts +156 -0
- package/dist/v0.10/types/integrations/minimax.d.ts +961 -0
- package/dist/v0.10/types/integrations/payments.d.ts +48 -0
- package/dist/v0.10/types/integrations/serbiaUtils.d.ts +40 -0
- package/dist/v0.10/types/integrations/serbiaUtits.d.ts +37 -0
- package/dist/v0.9/api/functions.d.ts +1 -2
- package/dist/v0.9/api/index.d.ts +1 -0
- package/dist/v0.9/api/integrations/mail.d.ts +69 -0
- package/dist/v0.9/api/integrations/serbiaUtil.d.ts +10 -7
- package/dist/v0.9/api/integrations.d.ts +2 -0
- package/dist/v0.9/api/platformBaseClient.d.ts +0 -1
- package/dist/v0.9/api/project.d.ts +6 -1
- package/dist/v0.9/api/roles.d.ts +12 -0
- package/dist/v0.9/index.cjs.js +135 -8
- package/dist/v0.9/index.esm.js +135 -9
- package/dist/v0.9/types/integrations/mail.d.ts +155 -0
- package/dist/v0.9/types/integrations/minimax.d.ts +961 -0
- package/dist/v0.9/types/integrations/payments.d.ts +48 -0
- package/dist/v0.9/types/integrations/serbiaUtits.d.ts +40 -0
- package/dist/v0.9/types/integrations.d.ts +0 -12
- package/package.json +1 -1
package/dist/index.0.9.js
CHANGED
|
@@ -25,7 +25,6 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
25
25
|
*
|
|
26
26
|
* @class PlatformBaseClient
|
|
27
27
|
* @extends BaseClient
|
|
28
|
-
* @constructor
|
|
29
28
|
* @param {AxiosInstance} [client] - The axios instance to use for the client
|
|
30
29
|
*
|
|
31
30
|
* @example
|
|
@@ -57,7 +56,7 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
|
-
|
|
59
|
+
if (isNode) {
|
|
61
60
|
host = (_d = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _d !== void 0 ? _d : null;
|
|
62
61
|
env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
|
|
63
62
|
token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
|
|
@@ -475,8 +474,7 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
475
474
|
* Run platform function
|
|
476
475
|
*
|
|
477
476
|
* @param id - Function ID
|
|
478
|
-
* @param
|
|
479
|
-
* @param query - Query parameters
|
|
477
|
+
* @param d - Object containing input data, query parameters, and headers
|
|
480
478
|
* @returns - Function result
|
|
481
479
|
*
|
|
482
480
|
* @example
|
|
@@ -991,7 +989,7 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
991
989
|
}
|
|
992
990
|
/**
|
|
993
991
|
* Invite a user to the project
|
|
994
|
-
* @param
|
|
992
|
+
* @param emails Array of emails
|
|
995
993
|
* @param roles Array of role UUIDs
|
|
996
994
|
*/
|
|
997
995
|
async invite(emails, roles) {
|
|
@@ -1017,6 +1015,13 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
1017
1015
|
async acceptInvite(uuid) {
|
|
1018
1016
|
return await this.client.get(`/v1/project/invite/accept/${uuid}`);
|
|
1019
1017
|
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Revoke an invite
|
|
1020
|
+
* @param uuid Invite UUID
|
|
1021
|
+
*/
|
|
1022
|
+
async revokeInvite(uuid) {
|
|
1023
|
+
return await this.client.delete(`/v1/project/invite/${uuid}`);
|
|
1024
|
+
}
|
|
1020
1025
|
/**
|
|
1021
1026
|
* Register through an invite
|
|
1022
1027
|
* @param uuid Invite UUID
|
|
@@ -1256,7 +1261,7 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
1256
1261
|
}
|
|
1257
1262
|
}
|
|
1258
1263
|
}
|
|
1259
|
-
|
|
1264
|
+
if (isNode) {
|
|
1260
1265
|
host = (_d = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _d !== void 0 ? _d : null;
|
|
1261
1266
|
env = (_e = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _e !== void 0 ? _e : null;
|
|
1262
1267
|
token = (_f = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _f !== void 0 ? _f : null;
|
|
@@ -1953,18 +1958,135 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
1953
1958
|
}
|
|
1954
1959
|
}
|
|
1955
1960
|
|
|
1961
|
+
/**
|
|
1962
|
+
* SDK client for the Protokol Mail integration.
|
|
1963
|
+
*
|
|
1964
|
+
* Provides methods to send emails, list email logs, resend failed emails,
|
|
1965
|
+
* and manage attachments through the Protokol Mail API.
|
|
1966
|
+
*
|
|
1967
|
+
* @example
|
|
1968
|
+
* ```typescript
|
|
1969
|
+
* import { Mail } from "@ptkl/sdk"
|
|
1970
|
+
*
|
|
1971
|
+
* const mail = new Mail()
|
|
1972
|
+
*
|
|
1973
|
+
* // Send an email
|
|
1974
|
+
* const result = await mail.send({
|
|
1975
|
+
* to: ["user@example.com"],
|
|
1976
|
+
* subject: "Hello",
|
|
1977
|
+
* body: "<h1>Welcome!</h1>"
|
|
1978
|
+
* })
|
|
1979
|
+
*
|
|
1980
|
+
* console.log(result.message_id)
|
|
1981
|
+
* ```
|
|
1982
|
+
*/
|
|
1983
|
+
class Mail extends IntegrationsBaseClient {
|
|
1984
|
+
/**
|
|
1985
|
+
* Send an email. The email is queued for async delivery.
|
|
1986
|
+
*
|
|
1987
|
+
* @param input - The email content and recipients
|
|
1988
|
+
* @returns The queued email's message ID and status
|
|
1989
|
+
*/
|
|
1990
|
+
async send(input) {
|
|
1991
|
+
const { data } = await this.client.post("/protokol-mail/v1/emails", input);
|
|
1992
|
+
return data;
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* List emails for the current project with optional filtering and pagination.
|
|
1996
|
+
*
|
|
1997
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
1998
|
+
* @returns Paginated list of email log entries
|
|
1999
|
+
*/
|
|
2000
|
+
async list(params) {
|
|
2001
|
+
const { data } = await this.client.get("/protokol-mail/v1/emails", { params });
|
|
2002
|
+
return data;
|
|
2003
|
+
}
|
|
2004
|
+
/**
|
|
2005
|
+
* Get a single email by its message ID.
|
|
2006
|
+
*
|
|
2007
|
+
* @param messageId - The UUID of the email message
|
|
2008
|
+
* @returns The full email log entry
|
|
2009
|
+
*/
|
|
2010
|
+
async get(messageId) {
|
|
2011
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}`);
|
|
2012
|
+
return data;
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Resend a previously failed email.
|
|
2016
|
+
*
|
|
2017
|
+
* @param messageId - The UUID of the email to resend
|
|
2018
|
+
* @returns Confirmation with the message ID
|
|
2019
|
+
*/
|
|
2020
|
+
async resend(messageId) {
|
|
2021
|
+
const { data } = await this.client.post(`/protokol-mail/v1/emails/${messageId}/resend`);
|
|
2022
|
+
return data;
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* List attachment metadata for a specific email.
|
|
2026
|
+
*
|
|
2027
|
+
* @param messageId - The UUID of the email message
|
|
2028
|
+
* @returns Array of attachment metadata entries
|
|
2029
|
+
*/
|
|
2030
|
+
async listAttachments(messageId) {
|
|
2031
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}/attachments`);
|
|
2032
|
+
return data;
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Download an attachment's binary content.
|
|
2036
|
+
*
|
|
2037
|
+
* @param messageId - The UUID of the email message
|
|
2038
|
+
* @param attachmentId - The UUID of the attachment
|
|
2039
|
+
* @returns The raw binary data as an ArrayBuffer
|
|
2040
|
+
*/
|
|
2041
|
+
async downloadAttachment(messageId, attachmentId) {
|
|
2042
|
+
const { data } = await this.client.get(`/protokol-mail/v1/emails/${messageId}/attachments/${attachmentId}`, { responseType: "arraybuffer" });
|
|
2043
|
+
return data;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
|
|
1956
2047
|
class SerbiaUtil extends IntegrationsBaseClient {
|
|
1957
2048
|
async nbsSearch(params) {
|
|
1958
|
-
return await this.services("GET", "nbs/search", {
|
|
2049
|
+
return await this.services("GET", "nbs/search", {
|
|
2050
|
+
params
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
async getNbsIpsQrCode(code, size, lang) {
|
|
2054
|
+
return await this.request("GET", `ipsQr/generate`, {
|
|
2055
|
+
params: {
|
|
2056
|
+
size,
|
|
2057
|
+
lang
|
|
2058
|
+
},
|
|
2059
|
+
data: {
|
|
2060
|
+
...code
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
async validateNbsIpsQrCode(qrCodeString, lang) {
|
|
2065
|
+
return await this.request("GET", `ipsQr/validate`, {
|
|
2066
|
+
params: {
|
|
2067
|
+
lang
|
|
2068
|
+
},
|
|
2069
|
+
data: {
|
|
2070
|
+
QRCodeString: qrCodeString
|
|
2071
|
+
}
|
|
2072
|
+
});
|
|
1959
2073
|
}
|
|
1960
2074
|
async getReceiptFromUrl(url, source) {
|
|
1961
|
-
return await this.services("POST", "receipt/
|
|
2075
|
+
return await this.services("POST", "receipt/extract", {
|
|
1962
2076
|
data: {
|
|
1963
2077
|
url,
|
|
1964
2078
|
source
|
|
1965
2079
|
}
|
|
1966
2080
|
});
|
|
1967
2081
|
}
|
|
2082
|
+
async getReceiptFromQrCode(qrCodeImage, source) {
|
|
2083
|
+
return await this.services("POST", "receipt/extract", {
|
|
2084
|
+
data: {
|
|
2085
|
+
qrCodeImage,
|
|
2086
|
+
source
|
|
2087
|
+
}
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
1968
2090
|
async getContoList() {
|
|
1969
2091
|
return await this.services("GET", "conto");
|
|
1970
2092
|
}
|
|
@@ -2777,6 +2899,7 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
2777
2899
|
'protokol-invoicing': new Invoicing().setClient(this.client),
|
|
2778
2900
|
'protokol-vpfr': new VPFR().setClient(this.client),
|
|
2779
2901
|
'protokol-dms': new DMS().setClient(this.client),
|
|
2902
|
+
'protokol-mail': new Mail().setClient(this.client),
|
|
2780
2903
|
'serbia-utilities': new SerbiaUtil().setClient(this.client),
|
|
2781
2904
|
'protokol-payments': new Payments().setClient(this.client),
|
|
2782
2905
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
@@ -2794,6 +2917,9 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
2794
2917
|
getInvoicing() {
|
|
2795
2918
|
return this.getInterfaceOf('protokol-invoicing');
|
|
2796
2919
|
}
|
|
2920
|
+
getMail() {
|
|
2921
|
+
return this.getInterfaceOf('protokol-mail');
|
|
2922
|
+
}
|
|
2797
2923
|
getPayments() {
|
|
2798
2924
|
return this.getInterfaceOf('protokol-payments');
|
|
2799
2925
|
}
|
|
@@ -2829,6 +2955,7 @@ var ProtokolSDK09 = (function (exports, axios) {
|
|
|
2829
2955
|
exports.Integration = Integrations;
|
|
2830
2956
|
exports.Integrations = Integrations;
|
|
2831
2957
|
exports.Invoicing = Invoicing;
|
|
2958
|
+
exports.Mail = Mail;
|
|
2832
2959
|
exports.Payments = Payments;
|
|
2833
2960
|
exports.Platform = Platform;
|
|
2834
2961
|
exports.Project = Project;
|
package/dist/package.json
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, StreamHandler, AggregateChainable, ComponentOptions, UpdateManyOptions, CreateManyOptions } from "../types/component";
|
|
1
|
+
import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, StreamHandler, AggregateChainable, ComponentOptions, UpdateManyOptions, CreateManyOptions, Extension, Policy } from "../types/component";
|
|
2
2
|
import PlatformBaseClient from "./platformBaseClient";
|
|
3
3
|
import { AxiosResponse } from "axios";
|
|
4
4
|
export default class Component extends PlatformBaseClient {
|
|
5
5
|
private ref;
|
|
6
|
-
|
|
7
|
-
constructor(ref?: string | null, options?: ComponentOptions);
|
|
8
|
-
/**
|
|
9
|
-
* Get the base path for component API calls
|
|
10
|
-
* @private
|
|
11
|
-
*/
|
|
12
|
-
private getComponentPath;
|
|
6
|
+
constructor(ref?: string | null);
|
|
13
7
|
/**
|
|
14
8
|
* Find method to search for models
|
|
15
9
|
*
|
|
@@ -56,9 +50,26 @@ export default class Component extends PlatformBaseClient {
|
|
|
56
50
|
/**
|
|
57
51
|
* Update model by uuid
|
|
58
52
|
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
53
|
+
* Regular fields in `data` are applied via `$set`. You can include MongoDB
|
|
54
|
+
* update operators (prefixed with `$`) directly in the data object for
|
|
55
|
+
* granular updates like incrementing, pushing to arrays, etc.
|
|
56
|
+
*
|
|
57
|
+
* @param uuid - The uuid of the model to update
|
|
58
|
+
* @param data - Fields to update, optionally including update operators
|
|
59
|
+
* @param options - Update options
|
|
60
|
+
* @returns The updated model
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Simple update (backwards compatible)
|
|
64
|
+
* await component.update(uuid, { name: "John" }, opts)
|
|
65
|
+
*
|
|
66
|
+
* // With update operators
|
|
67
|
+
* await component.update(uuid, {
|
|
68
|
+
* name: "John",
|
|
69
|
+
* $inc: { login_count: 1 },
|
|
70
|
+
* $push: { tags: "verified" },
|
|
71
|
+
* $addToSet: { roles: "admin" }
|
|
72
|
+
* }, opts)
|
|
62
73
|
*/
|
|
63
74
|
update(uuid: string, data: Record<string, any>, options: UpdateOptions): Promise<AxiosResponse<any, any>>;
|
|
64
75
|
/**
|
|
@@ -80,18 +91,40 @@ export default class Component extends PlatformBaseClient {
|
|
|
80
91
|
/**
|
|
81
92
|
* Modify models by filters
|
|
82
93
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
94
|
+
* Updates all models matching the given filters. Supports inline update
|
|
95
|
+
* operators in the data payload for granular operations.
|
|
96
|
+
*
|
|
97
|
+
* @param filters - Query filters to match models
|
|
98
|
+
* @param data - Fields to update, optionally including update operators
|
|
99
|
+
* @param options - Modify options (e.g. upsert)
|
|
100
|
+
* @returns The modified models
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* await component.modify(
|
|
104
|
+
* { status: "active" },
|
|
105
|
+
* { $inc: { impression_count: 1 }, $addToSet: { viewers: "user-1" } },
|
|
106
|
+
* { upsert: false }
|
|
107
|
+
* )
|
|
86
108
|
*/
|
|
87
109
|
modify(filters: Record<string, any>, data: Record<string, any>, options: ModifyOptions): Promise<AxiosResponse<any, any>>;
|
|
88
110
|
/**
|
|
89
|
-
* Concurrent update model by uuid
|
|
111
|
+
* Concurrent update model by uuid with optimistic locking
|
|
90
112
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
113
|
+
* Uses version-based concurrency control — the update will fail with a
|
|
114
|
+
* conflict error if the document has been modified since the provided version.
|
|
115
|
+
* Supports inline update operators in the data payload.
|
|
116
|
+
*
|
|
117
|
+
* @param uuid - The uuid of the model
|
|
118
|
+
* @param version - The expected __version__ of the model
|
|
119
|
+
* @param data - Fields to update, optionally including update operators
|
|
120
|
+
* @param options - Update options
|
|
121
|
+
* @returns The updated model
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* await component.concurrentUpdate(uuid, model.__version__, {
|
|
125
|
+
* status: "processed",
|
|
126
|
+
* $inc: { retry_count: 1 }
|
|
127
|
+
* }, opts)
|
|
95
128
|
*/
|
|
96
129
|
concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options: UpdateOptions): Promise<AxiosResponse<any, any>>;
|
|
97
130
|
create(model: Record<string, any>): Promise<AxiosResponse<any, any>>;
|
|
@@ -121,11 +154,110 @@ export default class Component extends PlatformBaseClient {
|
|
|
121
154
|
*/
|
|
122
155
|
aggregate(pipeline: FindAggregateParams): AggregateChainable;
|
|
123
156
|
settings(): Promise<AxiosResponse<any, any>>;
|
|
157
|
+
settingsForVersion(version: string): Promise<AxiosResponse<any, any>>;
|
|
158
|
+
publish(version: string, env: string): Promise<AxiosResponse<any, any>>;
|
|
124
159
|
saveSettings(settings: any, version: string): Promise<AxiosResponse<any, any>>;
|
|
125
160
|
saveTemplatesDist(version: string, sdkVersion: string, engine: string, dist: Record<string, string>): Promise<any>;
|
|
126
161
|
workflow(event: string, input: any): Promise<AxiosResponse<any, any>>;
|
|
127
162
|
function(name: string, input: any): Promise<AxiosResponse<any, any>>;
|
|
128
163
|
revisions(uuid: string): Promise<AxiosResponse<any, any>>;
|
|
164
|
+
/**
|
|
165
|
+
* Install a new extension on the component
|
|
166
|
+
*
|
|
167
|
+
* @param extension - The extension definition to install
|
|
168
|
+
* @param version - The component version to install the extension on
|
|
169
|
+
* @returns Updated component settings
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* await component.installExtension({
|
|
174
|
+
* name: 'shipping_tracker',
|
|
175
|
+
* is_active: true,
|
|
176
|
+
* fields: [...],
|
|
177
|
+
* config: { api_key: 'key' }
|
|
178
|
+
* }, '0.1.0')
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
installExtension(extension: Extension, version: string): Promise<AxiosResponse<any, any>>;
|
|
182
|
+
/**
|
|
183
|
+
* Update an existing extension on the component
|
|
184
|
+
*
|
|
185
|
+
* @param name - The name of the extension to update
|
|
186
|
+
* @param version - The component version
|
|
187
|
+
* @param data - Partial extension data to update
|
|
188
|
+
* @returns Updated component settings
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* await component.updateExtension('shipping_tracker', '0.1.0', {
|
|
193
|
+
* is_active: false,
|
|
194
|
+
* config: { api_key: 'new-key' }
|
|
195
|
+
* })
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
updateExtension(name: string, version: string, data: Partial<Extension>): Promise<AxiosResponse<any, any>>;
|
|
199
|
+
/**
|
|
200
|
+
* Delete an extension from the component
|
|
201
|
+
*
|
|
202
|
+
* @param name - The name of the extension to delete
|
|
203
|
+
* @param version - The component version
|
|
204
|
+
* @returns Updated component settings
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```typescript
|
|
208
|
+
* await component.deleteExtension('shipping_tracker', '0.1.0')
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
deleteExtension(name: string, version: string): Promise<AxiosResponse<any, any>>;
|
|
212
|
+
/**
|
|
213
|
+
* Install a new policy on the component
|
|
214
|
+
*
|
|
215
|
+
* @param policy - The policy definition to install
|
|
216
|
+
* @param version - The component version to install the policy on
|
|
217
|
+
* @returns Updated component settings
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* await component.installPolicy({
|
|
222
|
+
* type: 'field_access',
|
|
223
|
+
* name: 'restrict_email',
|
|
224
|
+
* enabled: true,
|
|
225
|
+
* priority: 1,
|
|
226
|
+
* config: { fields: ['email'], actions: ['see'], roles: ['role-uuid'] }
|
|
227
|
+
* }, '0.1.0')
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
installPolicy(policy: Policy, version: string): Promise<AxiosResponse<any, any>>;
|
|
231
|
+
/**
|
|
232
|
+
* Update an existing policy on the component
|
|
233
|
+
*
|
|
234
|
+
* @param name - The name of the policy to update
|
|
235
|
+
* @param version - The component version
|
|
236
|
+
* @param data - Partial policy data to update
|
|
237
|
+
* @returns Updated component settings
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* await component.updatePolicy('restrict_email', '0.1.0', {
|
|
242
|
+
* enabled: false,
|
|
243
|
+
* priority: 2
|
|
244
|
+
* })
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
updatePolicy(name: string, version: string, data: Partial<Policy>): Promise<AxiosResponse<any, any>>;
|
|
248
|
+
/**
|
|
249
|
+
* Delete a policy from the component
|
|
250
|
+
*
|
|
251
|
+
* @param name - The name of the policy to delete
|
|
252
|
+
* @param version - The component version
|
|
253
|
+
* @returns Updated component settings
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* await component.deletePolicy('restrict_email', '0.1.0')
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
deletePolicy(name: string, version: string): Promise<AxiosResponse<any, any>>;
|
|
129
261
|
/**
|
|
130
262
|
* Internal method to handle NDJSON streaming responses
|
|
131
263
|
*
|
|
@@ -133,4 +265,4 @@ export default class Component extends PlatformBaseClient {
|
|
|
133
265
|
*/
|
|
134
266
|
private _streamNDJSON;
|
|
135
267
|
}
|
|
136
|
-
export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, StreamHandler, AggregateChainable, ComponentOptions, };
|
|
268
|
+
export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, StreamHandler, AggregateChainable, ComponentOptions, Extension, };
|
|
@@ -7,8 +7,7 @@ export default class Functions extends PlatformBaseClient {
|
|
|
7
7
|
* Run platform function
|
|
8
8
|
*
|
|
9
9
|
* @param id - Function ID
|
|
10
|
-
* @param
|
|
11
|
-
* @param query - Query parameters
|
|
10
|
+
* @param d - Object containing input data, query parameters, and headers
|
|
12
11
|
* @returns - Function result
|
|
13
12
|
*
|
|
14
13
|
* @example
|
|
@@ -18,5 +18,7 @@ export { default as Integration } from './integrations';
|
|
|
18
18
|
export { default as Payments } from './integrations/payments';
|
|
19
19
|
export { default as Invoicing } from './integrations/invoicing';
|
|
20
20
|
export { default as DMS } from './integrations/dms';
|
|
21
|
-
export { default as
|
|
22
|
-
export { default as
|
|
21
|
+
export { default as SerbiaMinFin } from './integrations/serbia/minfin';
|
|
22
|
+
export { default as NBS } from './integrations/serbia/nbs';
|
|
23
|
+
export { default as VPFR } from './integrations/serbia/minfin/vpfr';
|
|
24
|
+
export { default as Mail } from './integrations/mail';
|
|
@@ -150,7 +150,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
150
150
|
* - Explicit structure: JSON with `header`, `items`, and `footer` properties
|
|
151
151
|
* - Auto-detection: Mixed JSON arrays with metadata objects and summary rows
|
|
152
152
|
*
|
|
153
|
-
* @param lib - Library reference UUID
|
|
154
153
|
* @param data - Raw data to convert
|
|
155
154
|
* @param params - Conversion parameters including structured data options
|
|
156
155
|
* @returns Promise resolving to converted data
|
|
@@ -208,7 +207,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
208
207
|
/**
|
|
209
208
|
* Get information about data format and structure
|
|
210
209
|
*
|
|
211
|
-
* @param lib - Library reference UUID
|
|
212
210
|
* @param data - Raw data to analyze
|
|
213
211
|
* @param params - Analysis parameters
|
|
214
212
|
* @returns Promise resolving to data information
|
|
@@ -240,7 +238,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
240
238
|
/**
|
|
241
239
|
* Validate data format without performing conversion
|
|
242
240
|
*
|
|
243
|
-
* @param lib - Library reference UUID
|
|
244
241
|
* @param data - Raw data to validate
|
|
245
242
|
* @param params - Validation parameters
|
|
246
243
|
* @returns Promise resolving to validation result
|
|
@@ -279,7 +276,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
279
276
|
* - Regular arrays are converted directly to CSV
|
|
280
277
|
* - Structured data (with metadata objects) is automatically detected and formatted
|
|
281
278
|
*
|
|
282
|
-
* @param lib - Library reference UUID
|
|
283
279
|
* @param jsonData - JSON data (array of objects or structured data)
|
|
284
280
|
* @returns Promise resolving to CSV string
|
|
285
281
|
*
|
|
@@ -317,7 +313,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
317
313
|
* Supports both regular JSON arrays and structured data patterns.
|
|
318
314
|
* Excel files are always generated with .xlsx extension.
|
|
319
315
|
*
|
|
320
|
-
* @param lib - Library reference UUID
|
|
321
316
|
* @param jsonData - JSON data (array of objects or structured data)
|
|
322
317
|
* @param options - Optional conversion options
|
|
323
318
|
* @returns Promise resolving to Excel file as Blob
|
|
@@ -360,7 +355,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
360
355
|
/**
|
|
361
356
|
* Convert CSV data to JSON format
|
|
362
357
|
*
|
|
363
|
-
* @param lib - Library reference UUID
|
|
364
358
|
* @param csvData - CSV data string (with headers in first row)
|
|
365
359
|
* @returns Promise resolving to JSON array
|
|
366
360
|
*
|
|
@@ -383,7 +377,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
383
377
|
/**
|
|
384
378
|
* Convert CSV data to Excel (.xlsx) format
|
|
385
379
|
*
|
|
386
|
-
* @param lib - Library reference UUID
|
|
387
380
|
* @param csvData - CSV data string (with headers in first row)
|
|
388
381
|
* @param options - Optional conversion options
|
|
389
382
|
* @returns Promise resolving to Excel file as Blob
|
|
@@ -408,7 +401,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
408
401
|
/**
|
|
409
402
|
* Convert Excel (.xlsx) data to JSON format
|
|
410
403
|
*
|
|
411
|
-
* @param lib - Library reference UUID
|
|
412
404
|
* @param excelData - Excel file data as Blob or ArrayBuffer
|
|
413
405
|
* @param options - Optional conversion options
|
|
414
406
|
* @returns Promise resolving to JSON array
|
|
@@ -435,7 +427,6 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
435
427
|
/**
|
|
436
428
|
* Convert Excel (.xlsx) data to CSV format
|
|
437
429
|
*
|
|
438
|
-
* @param lib - Library reference UUID
|
|
439
430
|
* @param excelData - Excel file data as Blob or ArrayBuffer
|
|
440
431
|
* @param options - Optional conversion options
|
|
441
432
|
* @returns Promise resolving to CSV string
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
|
+
import { SendEmailRequest, SendEmailResponse, MailLog, EmailListResponse, ListEmailsParams, AttachmentMeta } from "../../types/integrations/mail";
|
|
3
|
+
/**
|
|
4
|
+
* SDK client for the Protokol Mail integration.
|
|
5
|
+
*
|
|
6
|
+
* Provides methods to send emails, list email logs, resend failed emails,
|
|
7
|
+
* and manage attachments through the Protokol Mail API.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Mail } from "@ptkl/sdk/beta"
|
|
12
|
+
*
|
|
13
|
+
* const mail = new Mail()
|
|
14
|
+
*
|
|
15
|
+
* // Send an email
|
|
16
|
+
* const result = await mail.send({
|
|
17
|
+
* to: ["user@example.com"],
|
|
18
|
+
* subject: "Hello",
|
|
19
|
+
* body: "<h1>Welcome!</h1>"
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* console.log(result.message_id)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export default class Mail extends IntegrationsBaseClient {
|
|
26
|
+
/**
|
|
27
|
+
* Send an email. The email is queued for async delivery.
|
|
28
|
+
*
|
|
29
|
+
* Supports both JSON body (with base64-encoded attachments) and
|
|
30
|
+
* multipart/form-data (with file uploads).
|
|
31
|
+
*
|
|
32
|
+
* @param input - The email content and recipients
|
|
33
|
+
* @returns The queued email's message ID and status
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const result = await mail.send({
|
|
38
|
+
* to: ["recipient@example.com"],
|
|
39
|
+
* cc: ["cc@example.com"],
|
|
40
|
+
* subject: "Invoice #123",
|
|
41
|
+
* body: "<p>Please find your invoice attached.</p>",
|
|
42
|
+
* reply_to: "billing@company.com",
|
|
43
|
+
* sender_name: "Billing Department",
|
|
44
|
+
* attachments: [{
|
|
45
|
+
* file_name: "invoice.pdf",
|
|
46
|
+
* mime_type: "application/pdf",
|
|
47
|
+
* content: "base64encodedcontent...",
|
|
48
|
+
* size: 12345
|
|
49
|
+
* }]
|
|
50
|
+
* })
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
send(input: SendEmailRequest): Promise<SendEmailResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* List emails for the current project with optional filtering and pagination.
|
|
56
|
+
*
|
|
57
|
+
* @param params - Optional query parameters for filtering and pagination
|
|
58
|
+
* @returns Paginated list of email log entries
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* // List all emails
|
|
63
|
+
* const emails = await mail.list()
|
|
64
|
+
*
|
|
65
|
+
* // List failed emails, page 2
|
|
66
|
+
* const failed = await mail.list({ status: "failed", page: 2, limit: 10 })
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
list(params?: ListEmailsParams): Promise<EmailListResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Get a single email by its message ID.
|
|
72
|
+
*
|
|
73
|
+
* @param messageId - The UUID of the email message
|
|
74
|
+
* @returns The full email log entry
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const email = await mail.get("550e8400-e29b-41d4-a716-446655440000")
|
|
79
|
+
* console.log(email.status, email.subject)
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
get(messageId: string): Promise<MailLog>;
|
|
83
|
+
/**
|
|
84
|
+
* Resend a previously failed email. Resets the retry counter and
|
|
85
|
+
* re-queues the email for delivery.
|
|
86
|
+
*
|
|
87
|
+
* @param messageId - The UUID of the email to resend
|
|
88
|
+
* @returns Confirmation with the message ID
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* await mail.resend("550e8400-e29b-41d4-a716-446655440000")
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
resend(messageId: string): Promise<SendEmailResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* List attachment metadata for a specific email.
|
|
98
|
+
*
|
|
99
|
+
* @param messageId - The UUID of the email message
|
|
100
|
+
* @returns Array of attachment metadata entries
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const attachments = await mail.listAttachments("550e8400-e29b-41d4-a716-446655440000")
|
|
105
|
+
* attachments.forEach(att => console.log(att.file_name, att.file_size))
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
listAttachments(messageId: string): Promise<AttachmentMeta[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Download an attachment's binary content.
|
|
111
|
+
*
|
|
112
|
+
* @param messageId - The UUID of the email message
|
|
113
|
+
* @param attachmentId - The UUID of the attachment
|
|
114
|
+
* @returns The raw binary data as an ArrayBuffer
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const content = await mail.downloadAttachment(
|
|
119
|
+
* "550e8400-e29b-41d4-a716-446655440000",
|
|
120
|
+
* "660e8400-e29b-41d4-a716-446655440000"
|
|
121
|
+
* )
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
downloadAttachment(messageId: string, attachmentId: string): Promise<ArrayBuffer>;
|
|
125
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import IntegrationsBaseClient from "../../../integrationsBaseClient";
|
|
2
|
+
import VPFR from "./vpfr";
|
|
3
|
+
export default class MinFin extends IntegrationsBaseClient {
|
|
4
|
+
getReceiptFromUrl(url: string, source: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
5
|
+
getReceiptFromQrCode(qrCodeImage: string, source: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
6
|
+
getContoList(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
7
|
+
private services;
|
|
8
|
+
private request;
|
|
9
|
+
vpfr(): VPFR;
|
|
10
|
+
}
|