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,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycDeleteDocument } from "../../funcs/kycDeleteDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.DeleteDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycDeleteDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-delete-document",
|
|
15
|
+
description: `Delete document
|
|
16
|
+
|
|
17
|
+
Delete document`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycDeleteDocument(
|
|
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
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycGetDocument } from "../../funcs/kycGetDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.GetDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycGetDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-get-document",
|
|
15
|
+
description: `Retrieve document detail
|
|
16
|
+
|
|
17
|
+
Retrieve document detail`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycGetDocument(
|
|
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
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycListDocumentType } from "../../funcs/kycListDocumentType.js";
|
|
6
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
7
|
+
|
|
8
|
+
export const tool$kycListDocumentType: ToolDefinition = {
|
|
9
|
+
name: "kyc-list-document-type",
|
|
10
|
+
description: `List all document types
|
|
11
|
+
|
|
12
|
+
List all kyc documents types configured for a particular store.`,
|
|
13
|
+
tool: async (client, ctx) => {
|
|
14
|
+
const [result, apiCall] = await kycListDocumentType(
|
|
15
|
+
client,
|
|
16
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
17
|
+
).$inspect();
|
|
18
|
+
|
|
19
|
+
if (!result.ok) {
|
|
20
|
+
return {
|
|
21
|
+
content: [{ type: "text", text: result.error.message }],
|
|
22
|
+
isError: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const value = result.value;
|
|
27
|
+
|
|
28
|
+
return formatResult(value, apiCall);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycListDocuments } from "../../funcs/kycListDocuments.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.ListDocumentsRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycListDocuments: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-list-documents",
|
|
15
|
+
description: `List all documents
|
|
16
|
+
|
|
17
|
+
List all documents added by a particular customer.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycListDocuments(
|
|
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
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycUpdateDocument } from "../../funcs/kycUpdateDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.UpdateDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycUpdateDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-update-document",
|
|
15
|
+
description: `Update document detail
|
|
16
|
+
|
|
17
|
+
Update document detail`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycUpdateDocument(
|
|
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
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycVerifyDocument } from "../../funcs/kycVerifyDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.VerifyDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycVerifyDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-verify-document",
|
|
15
|
+
description: `Verify document
|
|
16
|
+
|
|
17
|
+
Verify document number before saving.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycVerifyDocument(
|
|
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
|
+
};
|
package/src/mcp-server/tools.ts
CHANGED
|
@@ -102,12 +102,15 @@ export function createRegisterTool(
|
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
const
|
|
106
|
-
if (allowedScopes.size > 0 &&
|
|
105
|
+
const scopes = tool.scopes ?? [];
|
|
106
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
if (
|
|
110
|
+
if (
|
|
111
|
+
allowedScopes.size > 0
|
|
112
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
113
|
+
) {
|
|
111
114
|
return;
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export const DocumentStatus = {
|
|
13
|
+
Submitted: "submitted",
|
|
14
|
+
Approved: "approved",
|
|
15
|
+
Rejected: "rejected",
|
|
16
|
+
} as const;
|
|
17
|
+
export type DocumentStatus = ClosedEnum<typeof DocumentStatus>;
|
|
18
|
+
|
|
19
|
+
export const DocumentVerificationType = {
|
|
20
|
+
Automatic: "automatic",
|
|
21
|
+
Manual: "manual",
|
|
22
|
+
} as const;
|
|
23
|
+
export type DocumentVerificationType = ClosedEnum<
|
|
24
|
+
typeof DocumentVerificationType
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
export const CreatedBy = {
|
|
28
|
+
Customer: "customer",
|
|
29
|
+
Admin: "admin",
|
|
30
|
+
} as const;
|
|
31
|
+
export type CreatedBy = ClosedEnum<typeof CreatedBy>;
|
|
32
|
+
|
|
33
|
+
export const ModifiedBy = {
|
|
34
|
+
Customer: "customer",
|
|
35
|
+
Admin: "admin",
|
|
36
|
+
} as const;
|
|
37
|
+
export type ModifiedBy = ClosedEnum<typeof ModifiedBy>;
|
|
38
|
+
|
|
39
|
+
export type Document = {
|
|
40
|
+
id?: string | undefined;
|
|
41
|
+
documentNumber: string;
|
|
42
|
+
note?: string | undefined;
|
|
43
|
+
status?: DocumentStatus | undefined;
|
|
44
|
+
title?: string | undefined;
|
|
45
|
+
fileUrl?: string | undefined;
|
|
46
|
+
verificationType?: DocumentVerificationType | undefined;
|
|
47
|
+
isVerified?: boolean | undefined;
|
|
48
|
+
verifiedAt?: Date | undefined;
|
|
49
|
+
createdBy?: CreatedBy | undefined;
|
|
50
|
+
createdAt?: Date | undefined;
|
|
51
|
+
modifiedBy?: ModifiedBy | undefined;
|
|
52
|
+
modifiedAt?: Date | undefined;
|
|
53
|
+
modifiedReason?: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
export const DocumentStatus$inboundSchema: z.ZodNativeEnum<
|
|
58
|
+
typeof DocumentStatus
|
|
59
|
+
> = z.nativeEnum(DocumentStatus);
|
|
60
|
+
|
|
61
|
+
/** @internal */
|
|
62
|
+
export const DocumentStatus$outboundSchema: z.ZodNativeEnum<
|
|
63
|
+
typeof DocumentStatus
|
|
64
|
+
> = DocumentStatus$inboundSchema;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
69
|
+
*/
|
|
70
|
+
export namespace DocumentStatus$ {
|
|
71
|
+
/** @deprecated use `DocumentStatus$inboundSchema` instead. */
|
|
72
|
+
export const inboundSchema = DocumentStatus$inboundSchema;
|
|
73
|
+
/** @deprecated use `DocumentStatus$outboundSchema` instead. */
|
|
74
|
+
export const outboundSchema = DocumentStatus$outboundSchema;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const DocumentVerificationType$inboundSchema: z.ZodNativeEnum<
|
|
79
|
+
typeof DocumentVerificationType
|
|
80
|
+
> = z.nativeEnum(DocumentVerificationType);
|
|
81
|
+
|
|
82
|
+
/** @internal */
|
|
83
|
+
export const DocumentVerificationType$outboundSchema: z.ZodNativeEnum<
|
|
84
|
+
typeof DocumentVerificationType
|
|
85
|
+
> = DocumentVerificationType$inboundSchema;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @internal
|
|
89
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
90
|
+
*/
|
|
91
|
+
export namespace DocumentVerificationType$ {
|
|
92
|
+
/** @deprecated use `DocumentVerificationType$inboundSchema` instead. */
|
|
93
|
+
export const inboundSchema = DocumentVerificationType$inboundSchema;
|
|
94
|
+
/** @deprecated use `DocumentVerificationType$outboundSchema` instead. */
|
|
95
|
+
export const outboundSchema = DocumentVerificationType$outboundSchema;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** @internal */
|
|
99
|
+
export const CreatedBy$inboundSchema: z.ZodNativeEnum<typeof CreatedBy> = z
|
|
100
|
+
.nativeEnum(CreatedBy);
|
|
101
|
+
|
|
102
|
+
/** @internal */
|
|
103
|
+
export const CreatedBy$outboundSchema: z.ZodNativeEnum<typeof CreatedBy> =
|
|
104
|
+
CreatedBy$inboundSchema;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
109
|
+
*/
|
|
110
|
+
export namespace CreatedBy$ {
|
|
111
|
+
/** @deprecated use `CreatedBy$inboundSchema` instead. */
|
|
112
|
+
export const inboundSchema = CreatedBy$inboundSchema;
|
|
113
|
+
/** @deprecated use `CreatedBy$outboundSchema` instead. */
|
|
114
|
+
export const outboundSchema = CreatedBy$outboundSchema;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** @internal */
|
|
118
|
+
export const ModifiedBy$inboundSchema: z.ZodNativeEnum<typeof ModifiedBy> = z
|
|
119
|
+
.nativeEnum(ModifiedBy);
|
|
120
|
+
|
|
121
|
+
/** @internal */
|
|
122
|
+
export const ModifiedBy$outboundSchema: z.ZodNativeEnum<typeof ModifiedBy> =
|
|
123
|
+
ModifiedBy$inboundSchema;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @internal
|
|
127
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
128
|
+
*/
|
|
129
|
+
export namespace ModifiedBy$ {
|
|
130
|
+
/** @deprecated use `ModifiedBy$inboundSchema` instead. */
|
|
131
|
+
export const inboundSchema = ModifiedBy$inboundSchema;
|
|
132
|
+
/** @deprecated use `ModifiedBy$outboundSchema` instead. */
|
|
133
|
+
export const outboundSchema = ModifiedBy$outboundSchema;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** @internal */
|
|
137
|
+
export const Document$inboundSchema: z.ZodType<
|
|
138
|
+
Document,
|
|
139
|
+
z.ZodTypeDef,
|
|
140
|
+
unknown
|
|
141
|
+
> = z.object({
|
|
142
|
+
id: z.string().optional(),
|
|
143
|
+
document_number: z.string(),
|
|
144
|
+
note: z.string().optional(),
|
|
145
|
+
status: DocumentStatus$inboundSchema.optional(),
|
|
146
|
+
title: z.string().optional(),
|
|
147
|
+
file_url: z.string().optional(),
|
|
148
|
+
verification_type: DocumentVerificationType$inboundSchema.optional(),
|
|
149
|
+
is_verified: z.boolean().optional(),
|
|
150
|
+
verified_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
151
|
+
.optional(),
|
|
152
|
+
created_by: CreatedBy$inboundSchema.optional(),
|
|
153
|
+
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
154
|
+
.optional(),
|
|
155
|
+
modified_by: ModifiedBy$inboundSchema.optional(),
|
|
156
|
+
modified_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
157
|
+
.optional(),
|
|
158
|
+
modified_reason: z.string().optional(),
|
|
159
|
+
}).transform((v) => {
|
|
160
|
+
return remap$(v, {
|
|
161
|
+
"document_number": "documentNumber",
|
|
162
|
+
"file_url": "fileUrl",
|
|
163
|
+
"verification_type": "verificationType",
|
|
164
|
+
"is_verified": "isVerified",
|
|
165
|
+
"verified_at": "verifiedAt",
|
|
166
|
+
"created_by": "createdBy",
|
|
167
|
+
"created_at": "createdAt",
|
|
168
|
+
"modified_by": "modifiedBy",
|
|
169
|
+
"modified_at": "modifiedAt",
|
|
170
|
+
"modified_reason": "modifiedReason",
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
/** @internal */
|
|
175
|
+
export type Document$Outbound = {
|
|
176
|
+
id?: string | undefined;
|
|
177
|
+
document_number: string;
|
|
178
|
+
note?: string | undefined;
|
|
179
|
+
status?: string | undefined;
|
|
180
|
+
title?: string | undefined;
|
|
181
|
+
file_url?: string | undefined;
|
|
182
|
+
verification_type?: string | undefined;
|
|
183
|
+
is_verified?: boolean | undefined;
|
|
184
|
+
verified_at?: string | undefined;
|
|
185
|
+
created_by?: string | undefined;
|
|
186
|
+
created_at?: string | undefined;
|
|
187
|
+
modified_by?: string | undefined;
|
|
188
|
+
modified_at?: string | undefined;
|
|
189
|
+
modified_reason?: string | undefined;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/** @internal */
|
|
193
|
+
export const Document$outboundSchema: z.ZodType<
|
|
194
|
+
Document$Outbound,
|
|
195
|
+
z.ZodTypeDef,
|
|
196
|
+
Document
|
|
197
|
+
> = z.object({
|
|
198
|
+
id: z.string().optional(),
|
|
199
|
+
documentNumber: z.string(),
|
|
200
|
+
note: z.string().optional(),
|
|
201
|
+
status: DocumentStatus$outboundSchema.optional(),
|
|
202
|
+
title: z.string().optional(),
|
|
203
|
+
fileUrl: z.string().optional(),
|
|
204
|
+
verificationType: DocumentVerificationType$outboundSchema.optional(),
|
|
205
|
+
isVerified: z.boolean().optional(),
|
|
206
|
+
verifiedAt: z.date().transform(v => v.toISOString()).optional(),
|
|
207
|
+
createdBy: CreatedBy$outboundSchema.optional(),
|
|
208
|
+
createdAt: z.date().transform(v => v.toISOString()).optional(),
|
|
209
|
+
modifiedBy: ModifiedBy$outboundSchema.optional(),
|
|
210
|
+
modifiedAt: z.date().transform(v => v.toISOString()).optional(),
|
|
211
|
+
modifiedReason: z.string().optional(),
|
|
212
|
+
}).transform((v) => {
|
|
213
|
+
return remap$(v, {
|
|
214
|
+
documentNumber: "document_number",
|
|
215
|
+
fileUrl: "file_url",
|
|
216
|
+
verificationType: "verification_type",
|
|
217
|
+
isVerified: "is_verified",
|
|
218
|
+
verifiedAt: "verified_at",
|
|
219
|
+
createdBy: "created_by",
|
|
220
|
+
createdAt: "created_at",
|
|
221
|
+
modifiedBy: "modified_by",
|
|
222
|
+
modifiedAt: "modified_at",
|
|
223
|
+
modifiedReason: "modified_reason",
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @internal
|
|
229
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
230
|
+
*/
|
|
231
|
+
export namespace Document$ {
|
|
232
|
+
/** @deprecated use `Document$inboundSchema` instead. */
|
|
233
|
+
export const inboundSchema = Document$inboundSchema;
|
|
234
|
+
/** @deprecated use `Document$outboundSchema` instead. */
|
|
235
|
+
export const outboundSchema = Document$outboundSchema;
|
|
236
|
+
/** @deprecated use `Document$Outbound` instead. */
|
|
237
|
+
export type Outbound = Document$Outbound;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function documentToJSON(document: Document): string {
|
|
241
|
+
return JSON.stringify(Document$outboundSchema.parse(document));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function documentFromJSON(
|
|
245
|
+
jsonString: string,
|
|
246
|
+
): SafeParseResult<Document, SDKValidationError> {
|
|
247
|
+
return safeParse(
|
|
248
|
+
jsonString,
|
|
249
|
+
(x) => Document$inboundSchema.parse(JSON.parse(x)),
|
|
250
|
+
`Failed to parse 'Document' from JSON`,
|
|
251
|
+
);
|
|
252
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { blobLikeSchema } from "../../types/blobs.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export type FileT = {
|
|
13
|
+
fileName: string;
|
|
14
|
+
content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type DocumentInput = {
|
|
18
|
+
documentNumber: string;
|
|
19
|
+
note?: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* file attachment will be required or optional as per store setting.
|
|
22
|
+
*/
|
|
23
|
+
file?: FileT | Blob | undefined;
|
|
24
|
+
documentTypeId: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const FileT$inboundSchema: z.ZodType<FileT, z.ZodTypeDef, unknown> = z
|
|
29
|
+
.object({
|
|
30
|
+
fileName: z.string(),
|
|
31
|
+
content: z.union([
|
|
32
|
+
z.instanceof(ReadableStream<Uint8Array>),
|
|
33
|
+
z.instanceof(Blob),
|
|
34
|
+
z.instanceof(ArrayBuffer),
|
|
35
|
+
z.instanceof(Uint8Array),
|
|
36
|
+
]),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export type FileT$Outbound = {
|
|
41
|
+
fileName: string;
|
|
42
|
+
content: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const FileT$outboundSchema: z.ZodType<
|
|
47
|
+
FileT$Outbound,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
FileT
|
|
50
|
+
> = z.object({
|
|
51
|
+
fileName: z.string(),
|
|
52
|
+
content: z.union([
|
|
53
|
+
z.instanceof(ReadableStream<Uint8Array>),
|
|
54
|
+
z.instanceof(Blob),
|
|
55
|
+
z.instanceof(ArrayBuffer),
|
|
56
|
+
z.instanceof(Uint8Array),
|
|
57
|
+
]),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
63
|
+
*/
|
|
64
|
+
export namespace FileT$ {
|
|
65
|
+
/** @deprecated use `FileT$inboundSchema` instead. */
|
|
66
|
+
export const inboundSchema = FileT$inboundSchema;
|
|
67
|
+
/** @deprecated use `FileT$outboundSchema` instead. */
|
|
68
|
+
export const outboundSchema = FileT$outboundSchema;
|
|
69
|
+
/** @deprecated use `FileT$Outbound` instead. */
|
|
70
|
+
export type Outbound = FileT$Outbound;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function fileToJSON(fileT: FileT): string {
|
|
74
|
+
return JSON.stringify(FileT$outboundSchema.parse(fileT));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function fileFromJSON(
|
|
78
|
+
jsonString: string,
|
|
79
|
+
): SafeParseResult<FileT, SDKValidationError> {
|
|
80
|
+
return safeParse(
|
|
81
|
+
jsonString,
|
|
82
|
+
(x) => FileT$inboundSchema.parse(JSON.parse(x)),
|
|
83
|
+
`Failed to parse 'FileT' from JSON`,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** @internal */
|
|
88
|
+
export const DocumentInput$inboundSchema: z.ZodType<
|
|
89
|
+
DocumentInput,
|
|
90
|
+
z.ZodTypeDef,
|
|
91
|
+
unknown
|
|
92
|
+
> = z.object({
|
|
93
|
+
document_number: z.string(),
|
|
94
|
+
note: z.string().optional(),
|
|
95
|
+
file: z.lazy(() => FileT$inboundSchema).optional(),
|
|
96
|
+
document_type_id: z.string(),
|
|
97
|
+
}).transform((v) => {
|
|
98
|
+
return remap$(v, {
|
|
99
|
+
"document_number": "documentNumber",
|
|
100
|
+
"document_type_id": "documentTypeId",
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
/** @internal */
|
|
105
|
+
export type DocumentInput$Outbound = {
|
|
106
|
+
document_number: string;
|
|
107
|
+
note?: string | undefined;
|
|
108
|
+
file?: FileT$Outbound | Blob | undefined;
|
|
109
|
+
document_type_id: string;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/** @internal */
|
|
113
|
+
export const DocumentInput$outboundSchema: z.ZodType<
|
|
114
|
+
DocumentInput$Outbound,
|
|
115
|
+
z.ZodTypeDef,
|
|
116
|
+
DocumentInput
|
|
117
|
+
> = z.object({
|
|
118
|
+
documentNumber: z.string(),
|
|
119
|
+
note: z.string().optional(),
|
|
120
|
+
file: z.lazy(() => FileT$outboundSchema).or(blobLikeSchema).optional(),
|
|
121
|
+
documentTypeId: z.string(),
|
|
122
|
+
}).transform((v) => {
|
|
123
|
+
return remap$(v, {
|
|
124
|
+
documentNumber: "document_number",
|
|
125
|
+
documentTypeId: "document_type_id",
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @internal
|
|
131
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
132
|
+
*/
|
|
133
|
+
export namespace DocumentInput$ {
|
|
134
|
+
/** @deprecated use `DocumentInput$inboundSchema` instead. */
|
|
135
|
+
export const inboundSchema = DocumentInput$inboundSchema;
|
|
136
|
+
/** @deprecated use `DocumentInput$outboundSchema` instead. */
|
|
137
|
+
export const outboundSchema = DocumentInput$outboundSchema;
|
|
138
|
+
/** @deprecated use `DocumentInput$Outbound` instead. */
|
|
139
|
+
export type Outbound = DocumentInput$Outbound;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function documentInputToJSON(documentInput: DocumentInput): string {
|
|
143
|
+
return JSON.stringify(DocumentInput$outboundSchema.parse(documentInput));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function documentInputFromJSON(
|
|
147
|
+
jsonString: string,
|
|
148
|
+
): SafeParseResult<DocumentInput, SDKValidationError> {
|
|
149
|
+
return safeParse(
|
|
150
|
+
jsonString,
|
|
151
|
+
(x) => DocumentInput$inboundSchema.parse(JSON.parse(x)),
|
|
152
|
+
`Failed to parse 'DocumentInput' from JSON`,
|
|
153
|
+
);
|
|
154
|
+
}
|