@documenso/sdk-typescript 0.8.1 → 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 +385 -360
- package/bin/mcp-server.js +3946 -1699
- package/bin/mcp-server.js.map +68 -57
- package/funcs/envelopeEnvelopeAuditLogDownloadPdf.d.ts +18 -0
- package/funcs/envelopeEnvelopeAuditLogDownloadPdf.d.ts.map +1 -0
- package/funcs/envelopeEnvelopeAuditLogDownloadPdf.js +127 -0
- package/funcs/envelopeEnvelopeAuditLogDownloadPdf.js.map +1 -0
- package/funcs/envelopeEnvelopeCancel.d.ts +15 -0
- package/funcs/envelopeEnvelopeCancel.d.ts.map +1 -0
- package/funcs/envelopeEnvelopeCancel.js +116 -0
- package/funcs/envelopeEnvelopeCancel.js.map +1 -0
- package/funcs/envelopeEnvelopeCertificateDownloadPdf.d.ts +18 -0
- package/funcs/envelopeEnvelopeCertificateDownloadPdf.d.ts.map +1 -0
- package/funcs/envelopeEnvelopeCertificateDownloadPdf.js +124 -0
- package/funcs/envelopeEnvelopeCertificateDownloadPdf.js.map +1 -0
- package/funcs/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.d.ts +18 -0
- package/funcs/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.d.ts.map +1 -0
- package/funcs/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.js +125 -0
- package/funcs/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.js.map +1 -0
- package/hooks/types.d.ts +1 -0
- package/hooks/types.d.ts.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/encodings.js +12 -12
- package/lib/encodings.js.map +1 -1
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +3 -3
- package/lib/env.js.map +1 -1
- package/lib/http.d.ts +1 -1
- package/lib/http.d.ts.map +1 -1
- package/lib/http.js +1 -1
- package/lib/http.js.map +1 -1
- package/lib/matchers.js +3 -3
- package/lib/matchers.js.map +1 -1
- package/lib/primitives.d.ts +1 -0
- package/lib/primitives.d.ts.map +1 -1
- package/lib/primitives.js +18 -0
- package/lib/primitives.js.map +1 -1
- package/lib/retries.js +7 -0
- package/lib/retries.js.map +1 -1
- package/lib/sdks.d.ts.map +1 -1
- package/lib/sdks.js +50 -16
- package/lib/sdks.js.map +1 -1
- package/lib/security.d.ts +5 -4
- package/lib/security.d.ts.map +1 -1
- package/lib/security.js +6 -7
- package/lib/security.js.map +1 -1
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +9 -1
- package/mcp-server/server.js.map +1 -1
- package/mcp-server/tools/envelopeEnvelopeAuditLogDownloadPdf.d.ts +8 -0
- package/mcp-server/tools/envelopeEnvelopeAuditLogDownloadPdf.d.ts.map +1 -0
- package/mcp-server/tools/envelopeEnvelopeAuditLogDownloadPdf.js +64 -0
- package/mcp-server/tools/envelopeEnvelopeAuditLogDownloadPdf.js.map +1 -0
- package/mcp-server/tools/envelopeEnvelopeCancel.d.ts +8 -0
- package/mcp-server/tools/envelopeEnvelopeCancel.d.ts.map +1 -0
- package/mcp-server/tools/envelopeEnvelopeCancel.js +62 -0
- package/mcp-server/tools/envelopeEnvelopeCancel.js.map +1 -0
- package/mcp-server/tools/envelopeEnvelopeCertificateDownloadPdf.d.ts +8 -0
- package/mcp-server/tools/envelopeEnvelopeCertificateDownloadPdf.d.ts.map +1 -0
- package/mcp-server/tools/envelopeEnvelopeCertificateDownloadPdf.js +64 -0
- package/mcp-server/tools/envelopeEnvelopeCertificateDownloadPdf.js.map +1 -0
- package/mcp-server/tools/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.d.ts +8 -0
- package/mcp-server/tools/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.d.ts.map +1 -0
- package/mcp-server/tools/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.js +64 -0
- package/mcp-server/tools/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.js.map +1 -0
- package/models/errors/envelopeauditlogdownloadpdf.d.ts +230 -0
- package/models/errors/envelopeauditlogdownloadpdf.d.ts.map +1 -0
- package/models/errors/envelopeauditlogdownloadpdf.js +318 -0
- package/models/errors/envelopeauditlogdownloadpdf.js.map +1 -0
- package/models/errors/envelopecancel.d.ts +185 -0
- package/models/errors/envelopecancel.d.ts.map +1 -0
- package/models/errors/envelopecancel.js +268 -0
- package/models/errors/envelopecancel.js.map +1 -0
- package/models/errors/envelopecertificatedownloadpdf.d.ts +230 -0
- package/models/errors/envelopecertificatedownloadpdf.d.ts.map +1 -0
- package/models/errors/envelopecertificatedownloadpdf.js +319 -0
- package/models/errors/envelopecertificatedownloadpdf.js.map +1 -0
- package/models/errors/enveloperecipientrejectonbehalfof.d.ts +185 -0
- package/models/errors/enveloperecipientrejectonbehalfof.d.ts.map +1 -0
- package/models/errors/enveloperecipientrejectonbehalfof.js +265 -0
- package/models/errors/enveloperecipientrejectonbehalfof.js.map +1 -0
- package/models/errors/index.d.ts +4 -0
- package/models/errors/index.d.ts.map +1 -1
- package/models/errors/index.js +4 -0
- package/models/errors/index.js.map +1 -1
- package/models/operations/documentcreatedocumenttemporary.d.ts +1 -0
- package/models/operations/documentcreatedocumenttemporary.d.ts.map +1 -1
- package/models/operations/documentcreatedocumenttemporary.js +1 -0
- package/models/operations/documentcreatedocumenttemporary.js.map +1 -1
- package/models/operations/documentdistribute.d.ts +1 -0
- package/models/operations/documentdistribute.d.ts.map +1 -1
- package/models/operations/documentdistribute.js +1 -0
- package/models/operations/documentdistribute.js.map +1 -1
- package/models/operations/documentfind.d.ts +2 -0
- package/models/operations/documentfind.d.ts.map +1 -1
- package/models/operations/documentfind.js +2 -0
- package/models/operations/documentfind.js.map +1 -1
- package/models/operations/documentget.d.ts +1 -0
- package/models/operations/documentget.d.ts.map +1 -1
- package/models/operations/documentget.js +1 -0
- package/models/operations/documentget.js.map +1 -1
- package/models/operations/documentgetmany.d.ts +1 -0
- package/models/operations/documentgetmany.d.ts.map +1 -1
- package/models/operations/documentgetmany.js +1 -0
- package/models/operations/documentgetmany.js.map +1 -1
- package/models/operations/documentupdate.d.ts +1 -0
- package/models/operations/documentupdate.d.ts.map +1 -1
- package/models/operations/documentupdate.js +1 -0
- package/models/operations/documentupdate.js.map +1 -1
- package/models/operations/envelopeauditlogdownloadpdf.d.ts +39 -0
- package/models/operations/envelopeauditlogdownloadpdf.d.ts.map +1 -0
- package/models/operations/envelopeauditlogdownloadpdf.js +87 -0
- package/models/operations/envelopeauditlogdownloadpdf.js.map +1 -0
- package/models/operations/envelopeauditlogfind.d.ts +591 -251
- package/models/operations/envelopeauditlogfind.d.ts.map +1 -1
- package/models/operations/envelopeauditlogfind.js +678 -278
- package/models/operations/envelopeauditlogfind.js.map +1 -1
- package/models/operations/envelopecancel.d.ts +35 -0
- package/models/operations/envelopecancel.d.ts.map +1 -0
- package/models/operations/envelopecancel.js +76 -0
- package/models/operations/envelopecancel.js.map +1 -0
- package/models/operations/envelopecertificatedownloadpdf.d.ts +39 -0
- package/models/operations/envelopecertificatedownloadpdf.d.ts.map +1 -0
- package/models/operations/envelopecertificatedownloadpdf.js +87 -0
- package/models/operations/envelopecertificatedownloadpdf.js.map +1 -0
- package/models/operations/envelopeduplicate.d.ts +4 -0
- package/models/operations/envelopeduplicate.d.ts.map +1 -1
- package/models/operations/envelopeduplicate.js +4 -0
- package/models/operations/envelopeduplicate.js.map +1 -1
- package/models/operations/envelopefind.d.ts +2 -0
- package/models/operations/envelopefind.d.ts.map +1 -1
- package/models/operations/envelopefind.js +2 -0
- package/models/operations/envelopefind.js.map +1 -1
- package/models/operations/envelopeget.d.ts +1 -0
- package/models/operations/envelopeget.d.ts.map +1 -1
- package/models/operations/envelopeget.js +1 -0
- package/models/operations/envelopeget.js.map +1 -1
- package/models/operations/envelopegetmany.d.ts +1 -0
- package/models/operations/envelopegetmany.d.ts.map +1 -1
- package/models/operations/envelopegetmany.js +1 -0
- package/models/operations/envelopegetmany.js.map +1 -1
- package/models/operations/enveloperecipientrejectonbehalfof.d.ts +793 -0
- package/models/operations/enveloperecipientrejectonbehalfof.d.ts.map +1 -0
- package/models/operations/enveloperecipientrejectonbehalfof.js +965 -0
- package/models/operations/enveloperecipientrejectonbehalfof.js.map +1 -0
- package/models/operations/envelopeupdate.d.ts +1 -0
- package/models/operations/envelopeupdate.d.ts.map +1 -1
- package/models/operations/envelopeupdate.js +1 -0
- package/models/operations/envelopeupdate.js.map +1 -1
- package/models/operations/index.d.ts +4 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +4 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/templatecreatedocumentfromtemplate.d.ts +1 -0
- package/models/operations/templatecreatedocumentfromtemplate.d.ts.map +1 -1
- package/models/operations/templatecreatedocumentfromtemplate.js +1 -0
- package/models/operations/templatecreatedocumentfromtemplate.js.map +1 -1
- package/package.json +1 -1
- package/sdk/envelope.d.ts +18 -0
- package/sdk/envelope.d.ts.map +1 -1
- package/sdk/envelope.js +27 -0
- package/sdk/envelope.js.map +1 -1
- package/sdk/enveloperecipients.d.ts +12 -0
- package/sdk/enveloperecipients.d.ts.map +1 -0
- package/sdk/enveloperecipients.js +22 -0
- package/sdk/enveloperecipients.js.map +1 -0
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +4 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/envelopeEnvelopeAuditLogDownloadPdf.ts +213 -0
- package/src/funcs/envelopeEnvelopeCancel.ts +180 -0
- package/src/funcs/envelopeEnvelopeCertificateDownloadPdf.ts +216 -0
- package/src/funcs/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.ts +209 -0
- package/src/hooks/types.ts +1 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/encodings.ts +1 -1
- package/src/lib/env.ts +7 -3
- package/src/lib/http.ts +3 -1
- package/src/lib/matchers.ts +1 -1
- package/src/lib/primitives.ts +16 -0
- package/src/lib/retries.ts +8 -0
- package/src/lib/sdks.ts +54 -17
- package/src/lib/security.ts +10 -5
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +9 -1
- package/src/mcp-server/tools/envelopeEnvelopeAuditLogDownloadPdf.ts +39 -0
- package/src/mcp-server/tools/envelopeEnvelopeCancel.ts +35 -0
- package/src/mcp-server/tools/envelopeEnvelopeCertificateDownloadPdf.ts +39 -0
- package/src/mcp-server/tools/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.ts +39 -0
- package/src/models/errors/envelopeauditlogdownloadpdf.ts +689 -0
- package/src/models/errors/envelopecancel.ts +498 -0
- package/src/models/errors/envelopecertificatedownloadpdf.ts +716 -0
- package/src/models/errors/enveloperecipientrejectonbehalfof.ts +584 -0
- package/src/models/errors/index.ts +4 -0
- package/src/models/operations/documentcreatedocumenttemporary.ts +1 -0
- package/src/models/operations/documentdistribute.ts +1 -0
- package/src/models/operations/documentfind.ts +2 -0
- package/src/models/operations/documentget.ts +1 -0
- package/src/models/operations/documentgetmany.ts +1 -0
- package/src/models/operations/documentupdate.ts +1 -0
- package/src/models/operations/envelopeauditlogdownloadpdf.ts +118 -0
- package/src/models/operations/envelopeauditlogfind.ts +1471 -513
- package/src/models/operations/envelopecancel.ts +101 -0
- package/src/models/operations/envelopecertificatedownloadpdf.ts +119 -0
- package/src/models/operations/envelopeduplicate.ts +8 -0
- package/src/models/operations/envelopefind.ts +2 -0
- package/src/models/operations/envelopeget.ts +1 -0
- package/src/models/operations/envelopegetmany.ts +1 -0
- package/src/models/operations/enveloperecipientrejectonbehalfof.ts +2277 -0
- package/src/models/operations/envelopeupdate.ts +1 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/templatecreatedocumentfromtemplate.ts +1 -0
- package/src/sdk/envelope.ts +51 -0
- package/src/sdk/enveloperecipients.ts +27 -0
- package/src/sdk/sdk.ts +6 -0
- package/src/types/async.ts +8 -7
- package/types/async.d.ts.map +1 -1
- package/types/async.js +8 -7
- package/types/async.js.map +1 -1
- package/lib/dlv.d.ts +0 -14
- package/lib/dlv.d.ts.map +0 -1
- package/lib/dlv.js +0 -49
- package/lib/dlv.js.map +0 -1
- package/lib/is-plain-object.d.ts +0 -2
- package/lib/is-plain-object.d.ts.map +0 -1
- package/lib/is-plain-object.js +0 -41
- package/lib/is-plain-object.js.map +0 -1
- package/src/lib/dlv.ts +0 -53
- package/src/lib/is-plain-object.ts +0 -43
|
@@ -24,7 +24,10 @@ export * from "./envelopeattachmentcreate.js";
|
|
|
24
24
|
export * from "./envelopeattachmentdelete.js";
|
|
25
25
|
export * from "./envelopeattachmentfind.js";
|
|
26
26
|
export * from "./envelopeattachmentupdate.js";
|
|
27
|
+
export * from "./envelopeauditlogdownloadpdf.js";
|
|
27
28
|
export * from "./envelopeauditlogfind.js";
|
|
29
|
+
export * from "./envelopecancel.js";
|
|
30
|
+
export * from "./envelopecertificatedownloadpdf.js";
|
|
28
31
|
export * from "./envelopecreate.js";
|
|
29
32
|
export * from "./envelopedelete.js";
|
|
30
33
|
export * from "./envelopedistribute.js";
|
|
@@ -43,6 +46,7 @@ export * from "./envelopeitemupdatemany.js";
|
|
|
43
46
|
export * from "./enveloperecipientcreatemany.js";
|
|
44
47
|
export * from "./enveloperecipientdelete.js";
|
|
45
48
|
export * from "./enveloperecipientget.js";
|
|
49
|
+
export * from "./enveloperecipientrejectonbehalfof.js";
|
|
46
50
|
export * from "./enveloperecipientupdatemany.js";
|
|
47
51
|
export * from "./enveloperedistribute.js";
|
|
48
52
|
export * from "./envelopeupdate.js";
|
|
@@ -257,6 +257,7 @@ export const TemplateCreateDocumentFromTemplateStatus = {
|
|
|
257
257
|
Pending: "PENDING",
|
|
258
258
|
Completed: "COMPLETED",
|
|
259
259
|
Rejected: "REJECTED",
|
|
260
|
+
Cancelled: "CANCELLED",
|
|
260
261
|
} as const;
|
|
261
262
|
export type TemplateCreateDocumentFromTemplateStatus = ClosedEnum<
|
|
262
263
|
typeof TemplateCreateDocumentFromTemplateStatus
|
package/src/sdk/envelope.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { envelopeEnvelopeAuditLogDownloadPdf } from "../funcs/envelopeEnvelopeAuditLogDownloadPdf.js";
|
|
5
6
|
import { envelopeEnvelopeAuditLogFind } from "../funcs/envelopeEnvelopeAuditLogFind.js";
|
|
7
|
+
import { envelopeEnvelopeCancel } from "../funcs/envelopeEnvelopeCancel.js";
|
|
8
|
+
import { envelopeEnvelopeCertificateDownloadPdf } from "../funcs/envelopeEnvelopeCertificateDownloadPdf.js";
|
|
6
9
|
import { envelopeEnvelopeFind } from "../funcs/envelopeEnvelopeFind.js";
|
|
7
10
|
import { envelopeEnvelopeGetMany } from "../funcs/envelopeEnvelopeGetMany.js";
|
|
8
11
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
@@ -44,6 +47,40 @@ export class Envelope extends ClientSDK {
|
|
|
44
47
|
));
|
|
45
48
|
}
|
|
46
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Download envelope audit log PDF
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Download the audit log for a document as a PDF.
|
|
55
|
+
*/
|
|
56
|
+
async envelopeAuditLogDownloadPdf(
|
|
57
|
+
request: operations.EnvelopeAuditLogDownloadPdfRequest,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<operations.EnvelopeAuditLogDownloadPdfResponse> {
|
|
60
|
+
return unwrapAsync(envelopeEnvelopeAuditLogDownloadPdf(
|
|
61
|
+
this,
|
|
62
|
+
request,
|
|
63
|
+
options,
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Download envelope certificate PDF
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Download the signing certificate for a completed document as a PDF.
|
|
72
|
+
*/
|
|
73
|
+
async envelopeCertificateDownloadPdf(
|
|
74
|
+
request: operations.EnvelopeCertificateDownloadPdfRequest,
|
|
75
|
+
options?: RequestOptions,
|
|
76
|
+
): Promise<operations.EnvelopeCertificateDownloadPdfResponse> {
|
|
77
|
+
return unwrapAsync(envelopeEnvelopeCertificateDownloadPdf(
|
|
78
|
+
this,
|
|
79
|
+
request,
|
|
80
|
+
options,
|
|
81
|
+
));
|
|
82
|
+
}
|
|
83
|
+
|
|
47
84
|
/**
|
|
48
85
|
* Get multiple envelopes
|
|
49
86
|
*
|
|
@@ -60,4 +97,18 @@ export class Envelope extends ClientSDK {
|
|
|
60
97
|
options,
|
|
61
98
|
));
|
|
62
99
|
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Cancel envelope
|
|
103
|
+
*/
|
|
104
|
+
async envelopeCancel(
|
|
105
|
+
request: operations.EnvelopeCancelRequest,
|
|
106
|
+
options?: RequestOptions,
|
|
107
|
+
): Promise<operations.EnvelopeCancelResponse> {
|
|
108
|
+
return unwrapAsync(envelopeEnvelopeCancel(
|
|
109
|
+
this,
|
|
110
|
+
request,
|
|
111
|
+
options,
|
|
112
|
+
));
|
|
113
|
+
}
|
|
63
114
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf } from "../funcs/envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf.js";
|
|
6
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
7
|
+
import * as operations from "../models/operations/index.js";
|
|
8
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
9
|
+
|
|
10
|
+
export class EnvelopeRecipients extends ClientSDK {
|
|
11
|
+
/**
|
|
12
|
+
* Reject envelope recipient on behalf of
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Records a rejection on behalf of a recipient. Use this when a recipient has declined to sign outside of the platform. The rejection is flagged as external in the document audit log. By default the action is attributed to the API user; supply `actAsEmail` to attribute it to a specific team member.
|
|
16
|
+
*/
|
|
17
|
+
async envelopeRecipientRejectOnBehalfOf(
|
|
18
|
+
request: operations.EnvelopeRecipientRejectOnBehalfOfRequest,
|
|
19
|
+
options?: RequestOptions,
|
|
20
|
+
): Promise<operations.EnvelopeRecipientRejectOnBehalfOfResponse> {
|
|
21
|
+
return unwrapAsync(envelopeRecipientsEnvelopeRecipientRejectOnBehalfOf(
|
|
22
|
+
this,
|
|
23
|
+
request,
|
|
24
|
+
options,
|
|
25
|
+
));
|
|
26
|
+
}
|
|
27
|
+
}
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Document } from "./document.js";
|
|
|
7
7
|
import { Documents } from "./documents.js";
|
|
8
8
|
import { Embedding } from "./embedding.js";
|
|
9
9
|
import { Envelope } from "./envelope.js";
|
|
10
|
+
import { EnvelopeRecipients } from "./enveloperecipients.js";
|
|
10
11
|
import { Envelopes } from "./envelopes.js";
|
|
11
12
|
import { Folders } from "./folders.js";
|
|
12
13
|
import { Template } from "./template.js";
|
|
@@ -18,6 +19,11 @@ export class Documenso extends ClientSDK {
|
|
|
18
19
|
return (this._envelopes ??= new Envelopes(this._options));
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
private _envelopeRecipients?: EnvelopeRecipients;
|
|
23
|
+
get envelopeRecipients(): EnvelopeRecipients {
|
|
24
|
+
return (this._envelopeRecipients ??= new EnvelopeRecipients(this._options));
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
private _envelope?: Envelope;
|
|
22
28
|
get envelope(): Envelope {
|
|
23
29
|
return (this._envelope ??= new Envelope(this._options));
|
package/src/types/async.ts
CHANGED
|
@@ -21,16 +21,17 @@ export type APICall =
|
|
|
21
21
|
|
|
22
22
|
export class APIPromise<T> implements Promise<T> {
|
|
23
23
|
readonly #promise: Promise<[T, APICall]>;
|
|
24
|
-
|
|
24
|
+
#unwrapped: Promise<T> | null;
|
|
25
25
|
|
|
26
26
|
readonly [Symbol.toStringTag] = "APIPromise";
|
|
27
27
|
|
|
28
28
|
constructor(p: [T, APICall] | Promise<[T, APICall]>) {
|
|
29
29
|
this.#promise = p instanceof Promise ? p : Promise.resolve(p);
|
|
30
|
-
this.#unwrapped =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
this.#unwrapped = p instanceof Promise ? null : Promise.resolve(p[0]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#getUnwrapped(): Promise<T> {
|
|
34
|
+
return (this.#unwrapped ??= this.#promise.then(([value]) => value));
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
then<TResult1 = T, TResult2 = never>(
|
|
@@ -55,11 +56,11 @@ export class APIPromise<T> implements Promise<T> {
|
|
|
55
56
|
| null
|
|
56
57
|
| undefined,
|
|
57
58
|
): Promise<T | TResult> {
|
|
58
|
-
return this.#
|
|
59
|
+
return this.#getUnwrapped().catch(onrejected);
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
finally(onfinally?: (() => void) | null | undefined): Promise<T> {
|
|
62
|
-
return this.#
|
|
63
|
+
return this.#getUnwrapped().finally(onfinally);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
$inspect(): Promise<[T, APICall]> {
|
package/types/async.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../src/types/async.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GACf;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GACD;IACE,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GACD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEN,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;;IAI9C,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB;gBAEjC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../src/types/async.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GACf;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GACD;IACE,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GACD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEN,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,OAAO,CAAC,CAAC,CAAC;;IAI9C,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB;gBAEjC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IASnD,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,KAAK,EACjC,WAAW,CAAC,EACR,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GAChD,IAAI,GACJ,SAAS,EACb,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC,GACnD,IAAI,GACJ,SAAS,GACZ,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAO/B,KAAK,CAAC,OAAO,GAAG,KAAK,EACnB,UAAU,CAAC,EACP,CAAC,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GACjD,IAAI,GACJ,SAAS,GACZ,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;IAIvB,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhE,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;CAGlC"}
|
package/types/async.js
CHANGED
|
@@ -13,32 +13,33 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
-
var _APIPromise_promise, _APIPromise_unwrapped, _a;
|
|
16
|
+
var _APIPromise_instances, _APIPromise_promise, _APIPromise_unwrapped, _APIPromise_getUnwrapped, _a;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.APIPromise = void 0;
|
|
19
19
|
class APIPromise {
|
|
20
20
|
constructor(p) {
|
|
21
|
+
_APIPromise_instances.add(this);
|
|
21
22
|
_APIPromise_promise.set(this, void 0);
|
|
22
23
|
_APIPromise_unwrapped.set(this, void 0);
|
|
23
24
|
this[_a] = "APIPromise";
|
|
24
25
|
__classPrivateFieldSet(this, _APIPromise_promise, p instanceof Promise ? p : Promise.resolve(p), "f");
|
|
25
|
-
__classPrivateFieldSet(this, _APIPromise_unwrapped, p instanceof Promise
|
|
26
|
-
? __classPrivateFieldGet(this, _APIPromise_promise, "f").then(([value]) => value)
|
|
27
|
-
: Promise.resolve(p[0]), "f");
|
|
26
|
+
__classPrivateFieldSet(this, _APIPromise_unwrapped, p instanceof Promise ? null : Promise.resolve(p[0]), "f");
|
|
28
27
|
}
|
|
29
28
|
then(onfulfilled, onrejected) {
|
|
30
29
|
return __classPrivateFieldGet(this, _APIPromise_promise, "f").then(onfulfilled ? ([value]) => onfulfilled(value) : void 0, onrejected);
|
|
31
30
|
}
|
|
32
31
|
catch(onrejected) {
|
|
33
|
-
return __classPrivateFieldGet(this,
|
|
32
|
+
return __classPrivateFieldGet(this, _APIPromise_instances, "m", _APIPromise_getUnwrapped).call(this).catch(onrejected);
|
|
34
33
|
}
|
|
35
34
|
finally(onfinally) {
|
|
36
|
-
return __classPrivateFieldGet(this,
|
|
35
|
+
return __classPrivateFieldGet(this, _APIPromise_instances, "m", _APIPromise_getUnwrapped).call(this).finally(onfinally);
|
|
37
36
|
}
|
|
38
37
|
$inspect() {
|
|
39
38
|
return __classPrivateFieldGet(this, _APIPromise_promise, "f");
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
exports.APIPromise = APIPromise;
|
|
43
|
-
_APIPromise_promise = new WeakMap(), _APIPromise_unwrapped = new WeakMap(), _a = Symbol.toStringTag
|
|
42
|
+
_APIPromise_promise = new WeakMap(), _APIPromise_unwrapped = new WeakMap(), _APIPromise_instances = new WeakSet(), _a = Symbol.toStringTag, _APIPromise_getUnwrapped = function _APIPromise_getUnwrapped() {
|
|
43
|
+
return (__classPrivateFieldSet(this, _APIPromise_unwrapped, __classPrivateFieldGet(this, _APIPromise_unwrapped, "f") ?? __classPrivateFieldGet(this, _APIPromise_promise, "f").then(([value]) => value), "f"));
|
|
44
|
+
};
|
|
44
45
|
//# sourceMappingURL=async.js.map
|
package/types/async.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.js","sourceRoot":"","sources":["../src/types/async.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;AAmBH,MAAa,UAAU;IAMrB,YAAY,CAAuC
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../src/types/async.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;AAmBH,MAAa,UAAU;IAMrB,YAAY,CAAuC;;QAL1C,sCAAgC;QACzC,wCAA8B;QAErB,QAAoB,GAAG,YAAY,CAAC;QAG3C,uBAAA,IAAI,uBAAY,CAAC,YAAY,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAA,CAAC;QAC9D,uBAAA,IAAI,yBAAc,CAAC,YAAY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAA,CAAC;IACxE,CAAC;IAMD,IAAI,CACF,WAGa,EACb,UAGa;QAEb,OAAO,uBAAA,IAAI,2BAAS,CAAC,IAAI,CACvB,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EACtD,UAAU,CACX,CAAC;IACJ,CAAC;IAED,KAAK,CACH,UAGa;QAEb,OAAO,uBAAA,IAAI,uDAAc,MAAlB,IAAI,CAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,CAAC,SAA2C;QACjD,OAAO,uBAAA,IAAI,uDAAc,MAAlB,IAAI,CAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ;QACN,OAAO,uBAAA,IAAI,2BAAS,CAAC;IACvB,CAAC;CACF;AA/CD,gCA+CC;wHA3CW,MAAM,CAAC,WAAW;IAQ1B,OAAO,CAAC,gHAAoB,uBAAA,IAAI,2BAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAA,CAAC,CAAC;AACtE,CAAC"}
|
package/lib/dlv.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param obj The object to walk
|
|
3
|
-
* @param key The key path to walk the object with
|
|
4
|
-
* @param def A default value to return if the result is undefined
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* dlv(obj, "a.b.c.d")
|
|
8
|
-
* @example
|
|
9
|
-
* dlv(object, ["a", "b", "c", "d"])
|
|
10
|
-
* @example
|
|
11
|
-
* dlv(object, "foo.bar.baz", "Hello, default value!")
|
|
12
|
-
*/
|
|
13
|
-
export declare function dlv<T = any>(obj: any, key: string | string[], def?: T, p?: number, undef?: never): T | undefined;
|
|
14
|
-
//# sourceMappingURL=dlv.d.ts.map
|
package/lib/dlv.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dlv.d.ts","sourceRoot":"","sources":["../src/lib/dlv.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,CAAC,GAAG,GAAG,EACzB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EACtB,GAAG,CAAC,EAAE,CAAC,EACP,CAAC,CAAC,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,KAAK,GACZ,CAAC,GAAG,SAAS,CAOf"}
|
package/lib/dlv.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.dlv = dlv;
|
|
7
|
-
/*
|
|
8
|
-
MIT License
|
|
9
|
-
|
|
10
|
-
Copyright (c) 2024 Jason Miller <jason@developit.ca> (http://jasonformat.com)
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
13
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
14
|
-
the Software without restriction, including without limitation the rights to
|
|
15
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
16
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
17
|
-
subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
24
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
25
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
26
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
27
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* @param obj The object to walk
|
|
31
|
-
* @param key The key path to walk the object with
|
|
32
|
-
* @param def A default value to return if the result is undefined
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* dlv(obj, "a.b.c.d")
|
|
36
|
-
* @example
|
|
37
|
-
* dlv(object, ["a", "b", "c", "d"])
|
|
38
|
-
* @example
|
|
39
|
-
* dlv(object, "foo.bar.baz", "Hello, default value!")
|
|
40
|
-
*/
|
|
41
|
-
function dlv(obj, key, def, p, undef) {
|
|
42
|
-
key = Array.isArray(key) ? key : key.split(".");
|
|
43
|
-
for (p = 0; p < key.length; p++) {
|
|
44
|
-
const k = key[p];
|
|
45
|
-
obj = k != null && obj ? obj[k] : undef;
|
|
46
|
-
}
|
|
47
|
-
return obj === undef ? def : obj;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=dlv.js.map
|
package/lib/dlv.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dlv.js","sourceRoot":"","sources":["../src/lib/dlv.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAqCH,kBAaC;AAhDD;;;;;;;;;;;;;;;;;;;;;EAqBE;AAEF;;;;;;;;;;;GAWG;AACH,SAAgB,GAAG,CACjB,GAAQ,EACR,GAAsB,EACtB,GAAO,EACP,CAAU,EACV,KAAa;IAEb,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,GAAG,GAAG,CAAC,IAAI,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnC,CAAC"}
|
package/lib/is-plain-object.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-plain-object.d.ts","sourceRoot":"","sources":["../src/lib/is-plain-object.ts"],"names":[],"mappings":"AA6BA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAa7D"}
|
package/lib/is-plain-object.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isPlainObject = isPlainObject;
|
|
7
|
-
/*
|
|
8
|
-
MIT License
|
|
9
|
-
|
|
10
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
13
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
14
|
-
the Software without restriction, including without limitation the rights to
|
|
15
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
16
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
17
|
-
subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
24
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
25
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
26
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
27
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
-
*/
|
|
29
|
-
// Taken from https://github.com/sindresorhus/is-plain-obj/blob/97f38e8836f86a642cce98fc6ab3058bc36df181/index.js
|
|
30
|
-
function isPlainObject(value) {
|
|
31
|
-
if (typeof value !== "object" || value === null) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const prototype = Object.getPrototypeOf(value);
|
|
35
|
-
return ((prototype === null ||
|
|
36
|
-
prototype === Object.prototype ||
|
|
37
|
-
Object.getPrototypeOf(prototype) === null) &&
|
|
38
|
-
!(Symbol.toStringTag in value) &&
|
|
39
|
-
!(Symbol.iterator in value));
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=is-plain-object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-plain-object.js","sourceRoot":"","sources":["../src/lib/is-plain-object.ts"],"names":[],"mappings":";AAAA;;GAEG;;AA2BH,sCAaC;AAtCD;;;;;;;;;;;;;;;;;;;;;EAqBE;AAEF,iHAAiH;AAEjH,SAAgB,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,CACL,CAAC,SAAS,KAAK,IAAI;QACjB,SAAS,KAAK,MAAM,CAAC,SAAS;QAC9B,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;QAC5C,CAAC,CAAC,MAAM,CAAC,WAAW,IAAI,KAAK,CAAC;QAC9B,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,CAC5B,CAAC;AACJ,CAAC"}
|
package/src/lib/dlv.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2024 Jason Miller <jason@developit.ca> (http://jasonformat.com)
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
11
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
12
|
-
the Software without restriction, including without limitation the rights to
|
|
13
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
14
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
-
subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
22
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
23
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
24
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
25
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param obj The object to walk
|
|
30
|
-
* @param key The key path to walk the object with
|
|
31
|
-
* @param def A default value to return if the result is undefined
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* dlv(obj, "a.b.c.d")
|
|
35
|
-
* @example
|
|
36
|
-
* dlv(object, ["a", "b", "c", "d"])
|
|
37
|
-
* @example
|
|
38
|
-
* dlv(object, "foo.bar.baz", "Hello, default value!")
|
|
39
|
-
*/
|
|
40
|
-
export function dlv<T = any>(
|
|
41
|
-
obj: any,
|
|
42
|
-
key: string | string[],
|
|
43
|
-
def?: T,
|
|
44
|
-
p?: number,
|
|
45
|
-
undef?: never,
|
|
46
|
-
): T | undefined {
|
|
47
|
-
key = Array.isArray(key) ? key : key.split(".");
|
|
48
|
-
for (p = 0; p < key.length; p++) {
|
|
49
|
-
const k = key[p];
|
|
50
|
-
obj = k != null && obj ? obj[k] : undef;
|
|
51
|
-
}
|
|
52
|
-
return obj === undef ? def : obj;
|
|
53
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
11
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
12
|
-
the Software without restriction, including without limitation the rights to
|
|
13
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
14
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
15
|
-
subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
22
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
23
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
24
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
25
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
// Taken from https://github.com/sindresorhus/is-plain-obj/blob/97f38e8836f86a642cce98fc6ab3058bc36df181/index.js
|
|
29
|
-
|
|
30
|
-
export function isPlainObject(value: unknown): value is object {
|
|
31
|
-
if (typeof value !== "object" || value === null) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const prototype = Object.getPrototypeOf(value);
|
|
36
|
-
return (
|
|
37
|
-
(prototype === null ||
|
|
38
|
-
prototype === Object.prototype ||
|
|
39
|
-
Object.getPrototypeOf(prototype) === null) &&
|
|
40
|
-
!(Symbol.toStringTag in value) &&
|
|
41
|
-
!(Symbol.iterator in value)
|
|
42
|
-
);
|
|
43
|
-
}
|