ce-storefront 0.8.2 → 0.9.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/README.md +53 -0
- package/bin/mcp-server.js +1672 -123
- package/bin/mcp-server.js.map +43 -13
- package/docs/sdks/auth/README.md +10 -10
- package/docs/sdks/carts/README.md +10 -0
- package/docs/sdks/customers/README.md +22 -22
- package/docs/sdks/kyc/README.md +547 -0
- package/esm/funcs/authGetAnonymousToken.js +1 -1
- package/esm/funcs/authGetAnonymousToken.js.map +1 -1
- package/esm/funcs/kycCreateDocument.d.ts +16 -0
- package/esm/funcs/kycCreateDocument.d.ts.map +1 -0
- package/esm/funcs/kycCreateDocument.js +106 -0
- package/esm/funcs/kycCreateDocument.js.map +1 -0
- package/esm/funcs/kycDeleteDocument.d.ts +16 -0
- package/esm/funcs/kycDeleteDocument.d.ts.map +1 -0
- package/esm/funcs/kycDeleteDocument.js +85 -0
- package/esm/funcs/kycDeleteDocument.js.map +1 -0
- package/esm/funcs/kycGetDocument.d.ts +16 -0
- package/esm/funcs/kycGetDocument.d.ts.map +1 -0
- package/esm/funcs/kycGetDocument.js +85 -0
- package/esm/funcs/kycGetDocument.js.map +1 -0
- package/esm/funcs/kycListDocumentType.d.ts +16 -0
- package/esm/funcs/kycListDocumentType.d.ts.map +1 -0
- package/esm/funcs/kycListDocumentType.js +66 -0
- package/esm/funcs/kycListDocumentType.js.map +1 -0
- package/esm/funcs/kycListDocuments.d.ts +16 -0
- package/esm/funcs/kycListDocuments.d.ts.map +1 -0
- package/esm/funcs/kycListDocuments.js +81 -0
- package/esm/funcs/kycListDocuments.js.map +1 -0
- package/esm/funcs/kycUpdateDocument.d.ts +16 -0
- package/esm/funcs/kycUpdateDocument.d.ts.map +1 -0
- package/esm/funcs/kycUpdateDocument.js +111 -0
- package/esm/funcs/kycUpdateDocument.js.map +1 -0
- package/esm/funcs/kycVerifyDocument.d.ts +16 -0
- package/esm/funcs/kycVerifyDocument.d.ts.map +1 -0
- package/esm/funcs/kycVerifyDocument.js +82 -0
- package/esm/funcs/kycVerifyDocument.js.map +1 -0
- package/esm/lib/config.d.ts +4 -4
- package/esm/lib/config.js +4 -4
- package/esm/lib/config.js.map +1 -1
- package/esm/mcp-server/mcp-server.js +1 -1
- package/esm/mcp-server/prompts.d.ts.map +1 -1
- package/esm/mcp-server/prompts.js +5 -1
- package/esm/mcp-server/prompts.js.map +1 -1
- package/esm/mcp-server/resources.d.ts.map +1 -1
- package/esm/mcp-server/resources.js +10 -2
- package/esm/mcp-server/resources.js.map +1 -1
- package/esm/mcp-server/server.d.ts.map +1 -1
- package/esm/mcp-server/server.js +16 -3
- package/esm/mcp-server/server.js.map +1 -1
- package/esm/mcp-server/tools/kycCreateDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycCreateDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycCreateDocument.js +28 -0
- package/esm/mcp-server/tools/kycCreateDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycDeleteDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycDeleteDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycDeleteDocument.js +28 -0
- package/esm/mcp-server/tools/kycDeleteDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycGetDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycGetDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycGetDocument.js +28 -0
- package/esm/mcp-server/tools/kycGetDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycListDocumentType.d.ts +3 -0
- package/esm/mcp-server/tools/kycListDocumentType.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycListDocumentType.js +23 -0
- package/esm/mcp-server/tools/kycListDocumentType.js.map +1 -0
- package/esm/mcp-server/tools/kycListDocuments.d.ts +8 -0
- package/esm/mcp-server/tools/kycListDocuments.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycListDocuments.js +28 -0
- package/esm/mcp-server/tools/kycListDocuments.js.map +1 -0
- package/esm/mcp-server/tools/kycUpdateDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycUpdateDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycUpdateDocument.js +28 -0
- package/esm/mcp-server/tools/kycUpdateDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycVerifyDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycVerifyDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycVerifyDocument.js +28 -0
- package/esm/mcp-server/tools/kycVerifyDocument.js.map +1 -0
- package/esm/mcp-server/tools.d.ts.map +1 -1
- package/esm/mcp-server/tools.js +4 -3
- package/esm/mcp-server/tools.js.map +1 -1
- package/esm/models/components/document.d.ts +159 -0
- package/esm/models/components/document.d.ts.map +1 -0
- package/esm/models/components/document.js +166 -0
- package/esm/models/components/document.js.map +1 -0
- package/esm/models/components/documentinput.d.ts +65 -0
- package/esm/models/components/documentinput.d.ts.map +1 -0
- package/esm/models/components/documentinput.js +87 -0
- package/esm/models/components/documentinput.js.map +1 -0
- package/esm/models/components/documenttype.d.ts +97 -0
- package/esm/models/components/documenttype.d.ts.map +1 -0
- package/esm/models/components/documenttype.js +99 -0
- package/esm/models/components/documenttype.js.map +1 -0
- package/esm/models/components/gstindetail.d.ts +29 -0
- package/esm/models/components/gstindetail.d.ts.map +1 -0
- package/esm/models/components/gstindetail.js +31 -0
- package/esm/models/components/gstindetail.js.map +1 -0
- package/esm/models/components/index.d.ts +6 -0
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +6 -0
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/pandetail.d.ts +29 -0
- package/esm/models/components/pandetail.d.ts.map +1 -0
- package/esm/models/components/pandetail.js +31 -0
- package/esm/models/components/pandetail.js.map +1 -0
- package/esm/models/components/updatedocument.d.ts +67 -0
- package/esm/models/components/updatedocument.d.ts.map +1 -0
- package/esm/models/components/updatedocument.js +91 -0
- package/esm/models/components/updatedocument.js.map +1 -0
- package/esm/models/operations/createdocument.d.ts +92 -0
- package/esm/models/operations/createdocument.d.ts.map +1 -0
- package/esm/models/operations/createdocument.js +97 -0
- package/esm/models/operations/createdocument.js.map +1 -0
- package/esm/models/operations/deletedocument.d.ts +67 -0
- package/esm/models/operations/deletedocument.d.ts.map +1 -0
- package/esm/models/operations/deletedocument.js +69 -0
- package/esm/models/operations/deletedocument.js.map +1 -0
- package/esm/models/operations/getdocument.d.ts +95 -0
- package/esm/models/operations/getdocument.d.ts.map +1 -0
- package/esm/models/operations/getdocument.js +97 -0
- package/esm/models/operations/getdocument.js.map +1 -0
- package/esm/models/operations/index.d.ts +7 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +7 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/listdocuments.d.ts +90 -0
- package/esm/models/operations/listdocuments.d.ts.map +1 -0
- package/esm/models/operations/listdocuments.js +86 -0
- package/esm/models/operations/listdocuments.js.map +1 -0
- package/esm/models/operations/listdocumenttype.d.ts +62 -0
- package/esm/models/operations/listdocumenttype.d.ts.map +1 -0
- package/esm/models/operations/listdocumenttype.js +70 -0
- package/esm/models/operations/listdocumenttype.js.map +1 -0
- package/esm/models/operations/updatedocument.d.ts +97 -0
- package/esm/models/operations/updatedocument.d.ts.map +1 -0
- package/esm/models/operations/updatedocument.js +101 -0
- package/esm/models/operations/updatedocument.js.map +1 -0
- package/esm/models/operations/verifydocument.d.ts +140 -0
- package/esm/models/operations/verifydocument.d.ts.map +1 -0
- package/esm/models/operations/verifydocument.js +168 -0
- package/esm/models/operations/verifydocument.js.map +1 -0
- package/esm/sdk/kyc.d.ts +54 -0
- package/esm/sdk/kyc.d.ts.map +1 -0
- package/esm/sdk/kyc.js +78 -0
- package/esm/sdk/kyc.js.map +1 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +4 -0
- package/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/authGetAnonymousToken.ts +1 -1
- package/src/funcs/kycCreateDocument.ts +190 -0
- package/src/funcs/kycDeleteDocument.ts +166 -0
- package/src/funcs/kycGetDocument.ts +166 -0
- package/src/funcs/kycListDocumentType.ts +136 -0
- package/src/funcs/kycListDocuments.ts +160 -0
- package/src/funcs/kycUpdateDocument.ts +201 -0
- package/src/funcs/kycVerifyDocument.ts +161 -0
- package/src/lib/config.ts +4 -4
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/prompts.ts +8 -1
- package/src/mcp-server/resources.ts +16 -2
- package/src/mcp-server/server.ts +17 -3
- package/src/mcp-server/tools/kycCreateDocument.ts +37 -0
- package/src/mcp-server/tools/kycDeleteDocument.ts +37 -0
- package/src/mcp-server/tools/kycGetDocument.ts +37 -0
- package/src/mcp-server/tools/kycListDocumentType.ts +30 -0
- package/src/mcp-server/tools/kycListDocuments.ts +37 -0
- package/src/mcp-server/tools/kycUpdateDocument.ts +37 -0
- package/src/mcp-server/tools/kycVerifyDocument.ts +37 -0
- package/src/mcp-server/tools.ts +6 -3
- package/src/models/components/document.ts +252 -0
- package/src/models/components/documentinput.ts +154 -0
- package/src/models/components/documenttype.ts +163 -0
- package/src/models/components/gstindetail.ts +62 -0
- package/src/models/components/index.ts +6 -0
- package/src/models/components/pandetail.ts +62 -0
- package/src/models/components/updatedocument.ts +168 -0
- package/src/models/operations/createdocument.ts +210 -0
- package/src/models/operations/deletedocument.ts +150 -0
- package/src/models/operations/getdocument.ts +213 -0
- package/src/models/operations/index.ts +7 -0
- package/src/models/operations/listdocuments.ts +197 -0
- package/src/models/operations/listdocumenttype.ts +147 -0
- package/src/models/operations/updatedocument.ts +219 -0
- package/src/models/operations/verifydocument.ts +346 -0
- package/src/sdk/kyc.ts +133 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CeStorefrontCore } from "../core.js";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { CeError } from "../models/errors/ceerror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
22
|
+
import * as operations from "../models/operations/index.js";
|
|
23
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* List all documents
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* List all documents added by a particular customer.
|
|
31
|
+
*/
|
|
32
|
+
export function kycListDocuments(
|
|
33
|
+
client: CeStorefrontCore,
|
|
34
|
+
request: operations.ListDocumentsRequest,
|
|
35
|
+
options?: RequestOptions,
|
|
36
|
+
): APIPromise<
|
|
37
|
+
Result<
|
|
38
|
+
operations.ListDocumentsResponseBody,
|
|
39
|
+
| CeError
|
|
40
|
+
| SDKValidationError
|
|
41
|
+
| UnexpectedClientError
|
|
42
|
+
| InvalidRequestError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
>
|
|
47
|
+
> {
|
|
48
|
+
return new APIPromise($do(
|
|
49
|
+
client,
|
|
50
|
+
request,
|
|
51
|
+
options,
|
|
52
|
+
));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function $do(
|
|
56
|
+
client: CeStorefrontCore,
|
|
57
|
+
request: operations.ListDocumentsRequest,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<
|
|
60
|
+
[
|
|
61
|
+
Result<
|
|
62
|
+
operations.ListDocumentsResponseBody,
|
|
63
|
+
| CeError
|
|
64
|
+
| SDKValidationError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| InvalidRequestError
|
|
67
|
+
| RequestAbortedError
|
|
68
|
+
| RequestTimeoutError
|
|
69
|
+
| ConnectionError
|
|
70
|
+
>,
|
|
71
|
+
APICall,
|
|
72
|
+
]
|
|
73
|
+
> {
|
|
74
|
+
const parsed = safeParse(
|
|
75
|
+
request,
|
|
76
|
+
(value) => operations.ListDocumentsRequest$outboundSchema.parse(value),
|
|
77
|
+
"Input validation failed",
|
|
78
|
+
);
|
|
79
|
+
if (!parsed.ok) {
|
|
80
|
+
return [parsed, { status: "invalid" }];
|
|
81
|
+
}
|
|
82
|
+
const payload = parsed.value;
|
|
83
|
+
const body = null;
|
|
84
|
+
|
|
85
|
+
const pathParams = {
|
|
86
|
+
id: encodeSimple("id", payload.id, {
|
|
87
|
+
explode: false,
|
|
88
|
+
charEncoding: "percent",
|
|
89
|
+
}),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const path = pathToFunc("/customers/{id}/documents")(pathParams);
|
|
93
|
+
|
|
94
|
+
const headers = new Headers(compactMap({
|
|
95
|
+
Accept: "application/json",
|
|
96
|
+
}));
|
|
97
|
+
|
|
98
|
+
const secConfig = await extractSecurity(client._options.authorization);
|
|
99
|
+
const securityInput = secConfig == null ? {} : { authorization: secConfig };
|
|
100
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
101
|
+
|
|
102
|
+
const context = {
|
|
103
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
104
|
+
operationID: "list-documents",
|
|
105
|
+
oAuth2Scopes: [],
|
|
106
|
+
|
|
107
|
+
resolvedSecurity: requestSecurity,
|
|
108
|
+
|
|
109
|
+
securitySource: client._options.authorization,
|
|
110
|
+
retryConfig: options?.retries
|
|
111
|
+
|| client._options.retryConfig
|
|
112
|
+
|| { strategy: "none" },
|
|
113
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const requestRes = client._createRequest(context, {
|
|
117
|
+
security: requestSecurity,
|
|
118
|
+
method: "GET",
|
|
119
|
+
baseURL: options?.serverURL,
|
|
120
|
+
path: path,
|
|
121
|
+
headers: headers,
|
|
122
|
+
body: body,
|
|
123
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
124
|
+
}, options);
|
|
125
|
+
if (!requestRes.ok) {
|
|
126
|
+
return [requestRes, { status: "invalid" }];
|
|
127
|
+
}
|
|
128
|
+
const req = requestRes.value;
|
|
129
|
+
|
|
130
|
+
const doResult = await client._do(req, {
|
|
131
|
+
context,
|
|
132
|
+
errorCodes: ["4XX", "5XX"],
|
|
133
|
+
retryConfig: context.retryConfig,
|
|
134
|
+
retryCodes: context.retryCodes,
|
|
135
|
+
});
|
|
136
|
+
if (!doResult.ok) {
|
|
137
|
+
return [doResult, { status: "request-error", request: req }];
|
|
138
|
+
}
|
|
139
|
+
const response = doResult.value;
|
|
140
|
+
|
|
141
|
+
const [result] = await M.match<
|
|
142
|
+
operations.ListDocumentsResponseBody,
|
|
143
|
+
| CeError
|
|
144
|
+
| SDKValidationError
|
|
145
|
+
| UnexpectedClientError
|
|
146
|
+
| InvalidRequestError
|
|
147
|
+
| RequestAbortedError
|
|
148
|
+
| RequestTimeoutError
|
|
149
|
+
| ConnectionError
|
|
150
|
+
>(
|
|
151
|
+
M.json(200, operations.ListDocumentsResponseBody$inboundSchema),
|
|
152
|
+
M.fail("4XX"),
|
|
153
|
+
M.fail("5XX"),
|
|
154
|
+
)(response);
|
|
155
|
+
if (!result.ok) {
|
|
156
|
+
return [result, { status: "complete", request: req, response }];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return [result, { status: "complete", request: req, response }];
|
|
160
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CeStorefrontCore } from "../core.js";
|
|
6
|
+
import { appendForm, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { readableStreamToArrayBuffer } from "../lib/files.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { CeError } from "../models/errors/ceerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { isBlobLike } from "../types/blobs.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
import { isReadableStream } from "../types/streams.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Update document detail
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Update document detail
|
|
34
|
+
*/
|
|
35
|
+
export function kycUpdateDocument(
|
|
36
|
+
client: CeStorefrontCore,
|
|
37
|
+
request: operations.UpdateDocumentRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.UpdateDocumentResponseBody,
|
|
42
|
+
| CeError
|
|
43
|
+
| SDKValidationError
|
|
44
|
+
| UnexpectedClientError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
>
|
|
50
|
+
> {
|
|
51
|
+
return new APIPromise($do(
|
|
52
|
+
client,
|
|
53
|
+
request,
|
|
54
|
+
options,
|
|
55
|
+
));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function $do(
|
|
59
|
+
client: CeStorefrontCore,
|
|
60
|
+
request: operations.UpdateDocumentRequest,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<
|
|
63
|
+
[
|
|
64
|
+
Result<
|
|
65
|
+
operations.UpdateDocumentResponseBody,
|
|
66
|
+
| CeError
|
|
67
|
+
| SDKValidationError
|
|
68
|
+
| UnexpectedClientError
|
|
69
|
+
| InvalidRequestError
|
|
70
|
+
| RequestAbortedError
|
|
71
|
+
| RequestTimeoutError
|
|
72
|
+
| ConnectionError
|
|
73
|
+
>,
|
|
74
|
+
APICall,
|
|
75
|
+
]
|
|
76
|
+
> {
|
|
77
|
+
const parsed = safeParse(
|
|
78
|
+
request,
|
|
79
|
+
(value) => operations.UpdateDocumentRequest$outboundSchema.parse(value),
|
|
80
|
+
"Input validation failed",
|
|
81
|
+
);
|
|
82
|
+
if (!parsed.ok) {
|
|
83
|
+
return [parsed, { status: "invalid" }];
|
|
84
|
+
}
|
|
85
|
+
const payload = parsed.value;
|
|
86
|
+
const body = new FormData();
|
|
87
|
+
if (payload.UpdateDocument != null) {
|
|
88
|
+
appendForm(body, "document_number", payload.UpdateDocument.document_number);
|
|
89
|
+
appendForm(
|
|
90
|
+
body,
|
|
91
|
+
"document_type_id",
|
|
92
|
+
payload.UpdateDocument.document_type_id,
|
|
93
|
+
);
|
|
94
|
+
appendForm(body, "modified_reason", payload.UpdateDocument.modified_reason);
|
|
95
|
+
if (payload.UpdateDocument.file !== undefined) {
|
|
96
|
+
if (isBlobLike(payload.UpdateDocument.file)) {
|
|
97
|
+
appendForm(body, "file", payload.UpdateDocument.file);
|
|
98
|
+
} else if (isReadableStream(payload.UpdateDocument.file.content)) {
|
|
99
|
+
const buffer = await readableStreamToArrayBuffer(
|
|
100
|
+
payload.UpdateDocument.file.content,
|
|
101
|
+
);
|
|
102
|
+
const blob = new Blob([buffer], { type: "application/octet-stream" });
|
|
103
|
+
appendForm(body, "file", blob);
|
|
104
|
+
} else {
|
|
105
|
+
appendForm(
|
|
106
|
+
body,
|
|
107
|
+
"file",
|
|
108
|
+
new Blob([payload.UpdateDocument.file.content], {
|
|
109
|
+
type: "application/octet-stream",
|
|
110
|
+
}),
|
|
111
|
+
payload.UpdateDocument.file.fileName,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (payload.UpdateDocument.note !== undefined) {
|
|
116
|
+
appendForm(body, "note", payload.UpdateDocument.note);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const pathParams = {
|
|
121
|
+
document_id: encodeSimple("document_id", payload.document_id, {
|
|
122
|
+
explode: false,
|
|
123
|
+
charEncoding: "percent",
|
|
124
|
+
}),
|
|
125
|
+
id: encodeSimple("id", payload.id, {
|
|
126
|
+
explode: false,
|
|
127
|
+
charEncoding: "percent",
|
|
128
|
+
}),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const path = pathToFunc("/customers/{id}/documents/{document_id}")(
|
|
132
|
+
pathParams,
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const headers = new Headers(compactMap({
|
|
136
|
+
Accept: "application/json",
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
const secConfig = await extractSecurity(client._options.authorization);
|
|
140
|
+
const securityInput = secConfig == null ? {} : { authorization: secConfig };
|
|
141
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
142
|
+
|
|
143
|
+
const context = {
|
|
144
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
145
|
+
operationID: "update-document",
|
|
146
|
+
oAuth2Scopes: [],
|
|
147
|
+
|
|
148
|
+
resolvedSecurity: requestSecurity,
|
|
149
|
+
|
|
150
|
+
securitySource: client._options.authorization,
|
|
151
|
+
retryConfig: options?.retries
|
|
152
|
+
|| client._options.retryConfig
|
|
153
|
+
|| { strategy: "none" },
|
|
154
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const requestRes = client._createRequest(context, {
|
|
158
|
+
security: requestSecurity,
|
|
159
|
+
method: "PUT",
|
|
160
|
+
baseURL: options?.serverURL,
|
|
161
|
+
path: path,
|
|
162
|
+
headers: headers,
|
|
163
|
+
body: body,
|
|
164
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
165
|
+
}, options);
|
|
166
|
+
if (!requestRes.ok) {
|
|
167
|
+
return [requestRes, { status: "invalid" }];
|
|
168
|
+
}
|
|
169
|
+
const req = requestRes.value;
|
|
170
|
+
|
|
171
|
+
const doResult = await client._do(req, {
|
|
172
|
+
context,
|
|
173
|
+
errorCodes: ["4XX", "5XX"],
|
|
174
|
+
retryConfig: context.retryConfig,
|
|
175
|
+
retryCodes: context.retryCodes,
|
|
176
|
+
});
|
|
177
|
+
if (!doResult.ok) {
|
|
178
|
+
return [doResult, { status: "request-error", request: req }];
|
|
179
|
+
}
|
|
180
|
+
const response = doResult.value;
|
|
181
|
+
|
|
182
|
+
const [result] = await M.match<
|
|
183
|
+
operations.UpdateDocumentResponseBody,
|
|
184
|
+
| CeError
|
|
185
|
+
| SDKValidationError
|
|
186
|
+
| UnexpectedClientError
|
|
187
|
+
| InvalidRequestError
|
|
188
|
+
| RequestAbortedError
|
|
189
|
+
| RequestTimeoutError
|
|
190
|
+
| ConnectionError
|
|
191
|
+
>(
|
|
192
|
+
M.json(200, operations.UpdateDocumentResponseBody$inboundSchema),
|
|
193
|
+
M.fail("4XX"),
|
|
194
|
+
M.fail("5XX"),
|
|
195
|
+
)(response);
|
|
196
|
+
if (!result.ok) {
|
|
197
|
+
return [result, { status: "complete", request: req, response }];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return [result, { status: "complete", request: req, response }];
|
|
201
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CeStorefrontCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { CeError } from "../models/errors/ceerror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
22
|
+
import * as operations from "../models/operations/index.js";
|
|
23
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Verify document
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Verify document number before saving.
|
|
31
|
+
*/
|
|
32
|
+
export function kycVerifyDocument(
|
|
33
|
+
client: CeStorefrontCore,
|
|
34
|
+
request: operations.VerifyDocumentRequest,
|
|
35
|
+
options?: RequestOptions,
|
|
36
|
+
): APIPromise<
|
|
37
|
+
Result<
|
|
38
|
+
operations.VerifyDocumentResponseBody,
|
|
39
|
+
| CeError
|
|
40
|
+
| SDKValidationError
|
|
41
|
+
| UnexpectedClientError
|
|
42
|
+
| InvalidRequestError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
>
|
|
47
|
+
> {
|
|
48
|
+
return new APIPromise($do(
|
|
49
|
+
client,
|
|
50
|
+
request,
|
|
51
|
+
options,
|
|
52
|
+
));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function $do(
|
|
56
|
+
client: CeStorefrontCore,
|
|
57
|
+
request: operations.VerifyDocumentRequest,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<
|
|
60
|
+
[
|
|
61
|
+
Result<
|
|
62
|
+
operations.VerifyDocumentResponseBody,
|
|
63
|
+
| CeError
|
|
64
|
+
| SDKValidationError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| InvalidRequestError
|
|
67
|
+
| RequestAbortedError
|
|
68
|
+
| RequestTimeoutError
|
|
69
|
+
| ConnectionError
|
|
70
|
+
>,
|
|
71
|
+
APICall,
|
|
72
|
+
]
|
|
73
|
+
> {
|
|
74
|
+
const parsed = safeParse(
|
|
75
|
+
request,
|
|
76
|
+
(value) => operations.VerifyDocumentRequest$outboundSchema.parse(value),
|
|
77
|
+
"Input validation failed",
|
|
78
|
+
);
|
|
79
|
+
if (!parsed.ok) {
|
|
80
|
+
return [parsed, { status: "invalid" }];
|
|
81
|
+
}
|
|
82
|
+
const payload = parsed.value;
|
|
83
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
84
|
+
|
|
85
|
+
const pathParams = {
|
|
86
|
+
id: encodeSimple("id", payload.id, {
|
|
87
|
+
explode: false,
|
|
88
|
+
charEncoding: "percent",
|
|
89
|
+
}),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const path = pathToFunc("/customers/{id}/documents/verify")(pathParams);
|
|
93
|
+
|
|
94
|
+
const headers = new Headers(compactMap({
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
|
+
Accept: "application/json",
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
const secConfig = await extractSecurity(client._options.authorization);
|
|
100
|
+
const securityInput = secConfig == null ? {} : { authorization: secConfig };
|
|
101
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
102
|
+
|
|
103
|
+
const context = {
|
|
104
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
105
|
+
operationID: "verify-document",
|
|
106
|
+
oAuth2Scopes: [],
|
|
107
|
+
|
|
108
|
+
resolvedSecurity: requestSecurity,
|
|
109
|
+
|
|
110
|
+
securitySource: client._options.authorization,
|
|
111
|
+
retryConfig: options?.retries
|
|
112
|
+
|| client._options.retryConfig
|
|
113
|
+
|| { strategy: "none" },
|
|
114
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const requestRes = client._createRequest(context, {
|
|
118
|
+
security: requestSecurity,
|
|
119
|
+
method: "POST",
|
|
120
|
+
baseURL: options?.serverURL,
|
|
121
|
+
path: path,
|
|
122
|
+
headers: headers,
|
|
123
|
+
body: body,
|
|
124
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
125
|
+
}, options);
|
|
126
|
+
if (!requestRes.ok) {
|
|
127
|
+
return [requestRes, { status: "invalid" }];
|
|
128
|
+
}
|
|
129
|
+
const req = requestRes.value;
|
|
130
|
+
|
|
131
|
+
const doResult = await client._do(req, {
|
|
132
|
+
context,
|
|
133
|
+
errorCodes: ["4XX", "5XX"],
|
|
134
|
+
retryConfig: context.retryConfig,
|
|
135
|
+
retryCodes: context.retryCodes,
|
|
136
|
+
});
|
|
137
|
+
if (!doResult.ok) {
|
|
138
|
+
return [doResult, { status: "request-error", request: req }];
|
|
139
|
+
}
|
|
140
|
+
const response = doResult.value;
|
|
141
|
+
|
|
142
|
+
const [result] = await M.match<
|
|
143
|
+
operations.VerifyDocumentResponseBody,
|
|
144
|
+
| CeError
|
|
145
|
+
| SDKValidationError
|
|
146
|
+
| UnexpectedClientError
|
|
147
|
+
| InvalidRequestError
|
|
148
|
+
| RequestAbortedError
|
|
149
|
+
| RequestTimeoutError
|
|
150
|
+
| ConnectionError
|
|
151
|
+
>(
|
|
152
|
+
M.json(200, operations.VerifyDocumentResponseBody$inboundSchema),
|
|
153
|
+
M.fail("4XX"),
|
|
154
|
+
M.fail("5XX"),
|
|
155
|
+
)(response);
|
|
156
|
+
if (!result.ok) {
|
|
157
|
+
return [result, { status: "complete", request: req, response }];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return [result, { status: "complete", request: req, response }];
|
|
161
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const ServerProd = "prod";
|
|
|
20
20
|
*/
|
|
21
21
|
export const ServerList = {
|
|
22
22
|
[ServerStaging]:
|
|
23
|
-
"https://staging.api.commercengine.io/api/v1/
|
|
23
|
+
"https://staging.api.commercengine.io/api/v1/store_id/storefront",
|
|
24
24
|
[ServerProd]:
|
|
25
25
|
"https://prod.api.commercengine.io/api/v1/{store_id}/storefront",
|
|
26
26
|
} as const;
|
|
@@ -76,7 +76,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
76
76
|
export const SDK_METADATA = {
|
|
77
77
|
language: "typescript",
|
|
78
78
|
openapiDocVersion: "1.0",
|
|
79
|
-
sdkVersion: "0.
|
|
80
|
-
genVersion: "2.
|
|
81
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
79
|
+
sdkVersion: "0.9.0",
|
|
80
|
+
genVersion: "2.568.2",
|
|
81
|
+
userAgent: "speakeasy-sdk/typescript 0.9.0 2.568.2 1.0 ce-storefront",
|
|
82
82
|
} as const;
|
|
@@ -74,7 +74,14 @@ export function createRegisterPrompt(
|
|
|
74
74
|
prompt: PromptDefinition<A>,
|
|
75
75
|
): void => {
|
|
76
76
|
const scopes = prompt.scopes ?? [];
|
|
77
|
-
if (
|
|
77
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (
|
|
82
|
+
allowedScopes.size > 0
|
|
83
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
84
|
+
) {
|
|
78
85
|
return;
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -109,7 +109,14 @@ export function createRegisterResource(
|
|
|
109
109
|
): (resource: ResourceDefinition) => void {
|
|
110
110
|
return (resource: ResourceDefinition): void => {
|
|
111
111
|
const scopes = resource.scopes ?? [];
|
|
112
|
-
if (
|
|
112
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (
|
|
117
|
+
allowedScopes.size > 0
|
|
118
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
119
|
+
) {
|
|
113
120
|
return;
|
|
114
121
|
}
|
|
115
122
|
|
|
@@ -137,7 +144,14 @@ export function createRegisterResourceTemplate(
|
|
|
137
144
|
): (resource: ResourceTemplateDefinition) => void {
|
|
138
145
|
return (resource: ResourceTemplateDefinition): void => {
|
|
139
146
|
const scopes = resource.scopes ?? [];
|
|
140
|
-
if (
|
|
147
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (
|
|
152
|
+
allowedScopes.size > 0
|
|
153
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
154
|
+
) {
|
|
141
155
|
return;
|
|
142
156
|
}
|
|
143
157
|
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createRegisterResource,
|
|
12
12
|
createRegisterResourceTemplate,
|
|
13
13
|
} from "./resources.js";
|
|
14
|
-
import { MCPScope
|
|
14
|
+
import { MCPScope } from "./scopes.js";
|
|
15
15
|
import { createRegisterTool } from "./tools.js";
|
|
16
16
|
import { tool$authCheckVerificationStatus } from "./tools/authCheckVerificationStatus.js";
|
|
17
17
|
import { tool$authCreateNotificationPreferences } from "./tools/authCreateNotificationPreferences.js";
|
|
@@ -54,6 +54,13 @@ import { tool$customersGetAddressDetail } from "./tools/customersGetAddressDetai
|
|
|
54
54
|
import { tool$customersListAddresses } from "./tools/customersListAddresses.js";
|
|
55
55
|
import { tool$customersListUserReviews } from "./tools/customersListUserReviews.js";
|
|
56
56
|
import { tool$customersUpdateAddressDetail } from "./tools/customersUpdateAddressDetail.js";
|
|
57
|
+
import { tool$kycCreateDocument } from "./tools/kycCreateDocument.js";
|
|
58
|
+
import { tool$kycDeleteDocument } from "./tools/kycDeleteDocument.js";
|
|
59
|
+
import { tool$kycGetDocument } from "./tools/kycGetDocument.js";
|
|
60
|
+
import { tool$kycListDocuments } from "./tools/kycListDocuments.js";
|
|
61
|
+
import { tool$kycListDocumentType } from "./tools/kycListDocumentType.js";
|
|
62
|
+
import { tool$kycUpdateDocument } from "./tools/kycUpdateDocument.js";
|
|
63
|
+
import { tool$kycVerifyDocument } from "./tools/kycVerifyDocument.js";
|
|
57
64
|
import { tool$ordersCancelOrder } from "./tools/ordersCancelOrder.js";
|
|
58
65
|
import { tool$ordersCreateOrder } from "./tools/ordersCreateOrder.js";
|
|
59
66
|
import { tool$ordersGetOrderDetail } from "./tools/ordersGetOrderDetail.js";
|
|
@@ -74,7 +81,7 @@ export function createMCPServer(deps: {
|
|
|
74
81
|
}) {
|
|
75
82
|
const server = new McpServer({
|
|
76
83
|
name: "CeStorefront",
|
|
77
|
-
version: "0.
|
|
84
|
+
version: "0.9.0",
|
|
78
85
|
});
|
|
79
86
|
|
|
80
87
|
const client = new CeStorefrontCore({
|
|
@@ -84,7 +91,7 @@ export function createMCPServer(deps: {
|
|
|
84
91
|
storeId: deps.storeId,
|
|
85
92
|
});
|
|
86
93
|
|
|
87
|
-
const scopes = new Set(deps.scopes
|
|
94
|
+
const scopes = new Set(deps.scopes);
|
|
88
95
|
|
|
89
96
|
const allowedTools = deps.allowedTools && new Set(deps.allowedTools);
|
|
90
97
|
const tool = createRegisterTool(
|
|
@@ -131,6 +138,13 @@ export function createMCPServer(deps: {
|
|
|
131
138
|
tool(tool$customersUpdateAddressDetail);
|
|
132
139
|
tool(tool$customersDeleteAddress);
|
|
133
140
|
tool(tool$customersListUserReviews);
|
|
141
|
+
tool(tool$kycListDocumentType);
|
|
142
|
+
tool(tool$kycListDocuments);
|
|
143
|
+
tool(tool$kycCreateDocument);
|
|
144
|
+
tool(tool$kycGetDocument);
|
|
145
|
+
tool(tool$kycUpdateDocument);
|
|
146
|
+
tool(tool$kycDeleteDocument);
|
|
147
|
+
tool(tool$kycVerifyDocument);
|
|
134
148
|
tool(tool$ordersCreateOrder);
|
|
135
149
|
tool(tool$ordersListOrders);
|
|
136
150
|
tool(tool$ordersGetOrderDetail);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycCreateDocument } from "../../funcs/kycCreateDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.CreateDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycCreateDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-create-document",
|
|
15
|
+
description: `Create document
|
|
16
|
+
|
|
17
|
+
Create document`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycCreateDocument(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|