@greensecurity/javascript-sdk 0.9.1 → 0.11.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 +81 -16
- package/bin/mcp-server.js +39384 -0
- package/bin/mcp-server.js.map +301 -0
- package/funcs/organizationsGetFacility.d.ts +2 -1
- package/funcs/organizationsGetFacility.d.ts.map +1 -1
- package/funcs/organizationsGetFacility.js +11 -7
- package/funcs/organizationsGetFacility.js.map +1 -1
- package/funcs/organizationsListOrSearchFacilities.d.ts +2 -1
- package/funcs/organizationsListOrSearchFacilities.d.ts.map +1 -1
- package/funcs/organizationsListOrSearchFacilities.js +11 -7
- package/funcs/organizationsListOrSearchFacilities.js.map +1 -1
- package/funcs/userGetCurrentUser.d.ts +2 -1
- package/funcs/userGetCurrentUser.d.ts.map +1 -1
- package/funcs/userGetCurrentUser.js +10 -6
- package/funcs/userGetCurrentUser.js.map +1 -1
- package/funcs/userGetUserById.d.ts +2 -1
- package/funcs/userGetUserById.d.ts.map +1 -1
- package/funcs/userGetUserById.js +11 -7
- package/funcs/userGetUserById.js.map +1 -1
- package/funcs/userLogsUserIntoTheSystem.d.ts +2 -1
- package/funcs/userLogsUserIntoTheSystem.d.ts.map +1 -1
- package/funcs/userLogsUserIntoTheSystem.js +11 -7
- package/funcs/userLogsUserIntoTheSystem.js.map +1 -1
- package/funcs/userMagiclink.d.ts +17 -0
- package/funcs/userMagiclink.d.ts.map +1 -0
- package/funcs/userMagiclink.js +115 -0
- package/funcs/userMagiclink.js.map +1 -0
- package/funcs/userPassword.d.ts +18 -0
- package/funcs/userPassword.d.ts.map +1 -0
- package/funcs/userPassword.js +116 -0
- package/funcs/userPassword.js.map +1 -0
- package/funcs/userPasswordResetRequest.d.ts +17 -0
- package/funcs/userPasswordResetRequest.d.ts.map +1 -0
- package/funcs/userPasswordResetRequest.js +115 -0
- package/funcs/userPasswordResetRequest.js.map +1 -0
- package/funcs/vendorsCreateVendorRegistration.d.ts +2 -1
- package/funcs/vendorsCreateVendorRegistration.d.ts.map +1 -1
- package/funcs/vendorsCreateVendorRegistration.js +11 -7
- package/funcs/vendorsCreateVendorRegistration.js.map +1 -1
- package/funcs/vendorsListVendorJobTitles.d.ts +2 -1
- package/funcs/vendorsListVendorJobTitles.d.ts.map +1 -1
- package/funcs/vendorsListVendorJobTitles.js +11 -7
- package/funcs/vendorsListVendorJobTitles.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +5 -5
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/lib/files.js.map +1 -1
- package/lib/sdks.d.ts +1 -1
- package/lib/sdks.d.ts.map +1 -1
- package/mcp-server/build.d.mts.map +1 -0
- package/mcp-server/build.mjs +14 -0
- package/mcp-server/build.mjs.map +1 -0
- package/mcp-server/cli/start/command.d.ts +2 -0
- package/mcp-server/cli/start/command.d.ts.map +1 -0
- package/mcp-server/cli/start/command.js +99 -0
- package/mcp-server/cli/start/command.js.map +1 -0
- package/mcp-server/cli/start/impl.d.ts +15 -0
- package/mcp-server/cli/start/impl.d.ts.map +1 -0
- package/mcp-server/cli/start/impl.js +97 -0
- package/mcp-server/cli/start/impl.js.map +1 -0
- package/mcp-server/cli.d.ts +6 -0
- package/mcp-server/cli.d.ts.map +1 -0
- package/mcp-server/cli.js +10 -0
- package/mcp-server/cli.js.map +1 -0
- package/mcp-server/console-logger.d.ts +7 -0
- package/mcp-server/console-logger.d.ts.map +1 -0
- package/mcp-server/console-logger.js +59 -0
- package/mcp-server/console-logger.js.map +1 -0
- package/mcp-server/mcp-server.d.ts +2 -0
- package/mcp-server/mcp-server.d.ts.map +1 -0
- package/mcp-server/mcp-server.js +29 -0
- package/mcp-server/mcp-server.js.map +1 -0
- package/mcp-server/resources.d.ts +27 -0
- package/mcp-server/resources.d.ts.map +1 -0
- package/mcp-server/resources.js +51 -0
- package/mcp-server/resources.js.map +1 -0
- package/mcp-server/scopes.d.ts +3 -0
- package/mcp-server/scopes.d.ts.map +1 -0
- package/mcp-server/scopes.js +8 -0
- package/mcp-server/scopes.js.map +1 -0
- package/mcp-server/server.d.ts +11 -0
- package/mcp-server/server.d.ts.map +1 -0
- package/mcp-server/server.js +44 -0
- package/mcp-server/server.js.map +1 -0
- package/mcp-server/shared.d.ts +7 -0
- package/mcp-server/shared.d.ts.map +1 -0
- package/mcp-server/shared.js +98 -0
- package/mcp-server/shared.js.map +1 -0
- package/mcp-server/tools/organizationsGetFacility.d.ts +8 -0
- package/mcp-server/tools/organizationsGetFacility.d.ts.map +1 -0
- package/mcp-server/tools/organizationsGetFacility.js +64 -0
- package/mcp-server/tools/organizationsGetFacility.js.map +1 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.d.ts +8 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.d.ts.map +1 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.js +77 -0
- package/mcp-server/tools/organizationsListOrSearchFacilities.js.map +1 -0
- package/mcp-server/tools/userGetCurrentUser.d.ts +3 -0
- package/mcp-server/tools/userGetCurrentUser.d.ts.map +1 -0
- package/mcp-server/tools/userGetCurrentUser.js +26 -0
- package/mcp-server/tools/userGetCurrentUser.js.map +1 -0
- package/mcp-server/tools/userGetUserById.d.ts +8 -0
- package/mcp-server/tools/userGetUserById.d.ts.map +1 -0
- package/mcp-server/tools/userGetUserById.js +64 -0
- package/mcp-server/tools/userGetUserById.js.map +1 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.d.ts +8 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.d.ts.map +1 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.js +94 -0
- package/mcp-server/tools/userLogsUserIntoTheSystem.js.map +1 -0
- package/mcp-server/tools/userMagiclink.d.ts +8 -0
- package/mcp-server/tools/userMagiclink.d.ts.map +1 -0
- package/mcp-server/tools/userMagiclink.js +64 -0
- package/mcp-server/tools/userMagiclink.js.map +1 -0
- package/mcp-server/tools/userPassword.d.ts +8 -0
- package/mcp-server/tools/userPassword.d.ts.map +1 -0
- package/mcp-server/tools/userPassword.js +65 -0
- package/mcp-server/tools/userPassword.js.map +1 -0
- package/mcp-server/tools/userPasswordResetRequest.d.ts +8 -0
- package/mcp-server/tools/userPasswordResetRequest.d.ts.map +1 -0
- package/mcp-server/tools/userPasswordResetRequest.js +64 -0
- package/mcp-server/tools/userPasswordResetRequest.js.map +1 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.d.ts +8 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.d.ts.map +1 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.js +64 -0
- package/mcp-server/tools/vendorsCreateVendorRegistration.js.map +1 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.d.ts +8 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.d.ts.map +1 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.js +64 -0
- package/mcp-server/tools/vendorsListVendorJobTitles.js.map +1 -0
- package/mcp-server/tools.d.ts +25 -0
- package/mcp-server/tools.d.ts.map +1 -0
- package/mcp-server/tools.js +74 -0
- package/mcp-server/tools.js.map +1 -0
- package/models/operations/index.d.ts +3 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +3 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/magiclink.d.ts +57 -0
- package/models/operations/magiclink.d.ts.map +1 -0
- package/models/operations/magiclink.js +96 -0
- package/models/operations/magiclink.js.map +1 -0
- package/models/operations/password.d.ts +59 -0
- package/models/operations/password.d.ts.map +1 -0
- package/models/operations/password.js +107 -0
- package/models/operations/password.js.map +1 -0
- package/models/operations/passwordresetrequest.d.ts +57 -0
- package/models/operations/passwordresetrequest.d.ts.map +1 -0
- package/models/operations/passwordresetrequest.js +96 -0
- package/models/operations/passwordresetrequest.js.map +1 -0
- package/package.json +14 -2
- package/react-query/index.d.ts +3 -0
- package/react-query/index.d.ts.map +1 -1
- package/react-query/index.js +3 -0
- package/react-query/index.js.map +1 -1
- package/react-query/userMagiclink.d.ts +23 -0
- package/react-query/userMagiclink.d.ts.map +1 -0
- package/react-query/userMagiclink.js +47 -0
- package/react-query/userMagiclink.js.map +1 -0
- package/react-query/userPassword.d.ts +24 -0
- package/react-query/userPassword.d.ts.map +1 -0
- package/react-query/userPassword.js +48 -0
- package/react-query/userPassword.js.map +1 -0
- package/react-query/userPasswordResetRequest.d.ts +23 -0
- package/react-query/userPasswordResetRequest.d.ts.map +1 -0
- package/react-query/userPasswordResetRequest.js +47 -0
- package/react-query/userPasswordResetRequest.js.map +1 -0
- package/sdk/user.d.ts +22 -0
- package/sdk/user.d.ts.map +1 -1
- package/sdk/user.js +31 -0
- package/sdk/user.js.map +1 -1
- package/src/funcs/organizationsGetFacility.ts +37 -8
- package/src/funcs/organizationsListOrSearchFacilities.ts +35 -8
- package/src/funcs/userGetCurrentUser.ts +33 -7
- package/src/funcs/userGetUserById.ts +36 -8
- package/src/funcs/userLogsUserIntoTheSystem.ts +36 -8
- package/src/funcs/userMagiclink.ts +162 -0
- package/src/funcs/userPassword.ts +163 -0
- package/src/funcs/userPasswordResetRequest.ts +163 -0
- package/src/funcs/vendorsCreateVendorRegistration.ts +36 -8
- package/src/funcs/vendorsListVendorJobTitles.ts +37 -8
- package/src/lib/config.ts +5 -5
- package/src/lib/files.ts +1 -1
- package/src/lib/sdks.ts +1 -1
- package/src/mcp-server/cli/start/command.ts +67 -0
- package/src/mcp-server/cli/start/impl.ts +123 -0
- package/src/mcp-server/cli.ts +13 -0
- package/src/mcp-server/console-logger.ts +71 -0
- package/src/mcp-server/mcp-server.ts +26 -0
- package/src/mcp-server/resources.ts +96 -0
- package/src/mcp-server/scopes.ts +7 -0
- package/src/mcp-server/server.ts +52 -0
- package/src/mcp-server/shared.ts +75 -0
- package/src/mcp-server/tools/organizationsGetFacility.ts +37 -0
- package/src/mcp-server/tools/organizationsListOrSearchFacilities.ts +52 -0
- package/src/mcp-server/tools/userGetCurrentUser.ts +30 -0
- package/src/mcp-server/tools/userGetUserById.ts +37 -0
- package/src/mcp-server/tools/userLogsUserIntoTheSystem.ts +67 -0
- package/src/mcp-server/tools/userMagiclink.ts +37 -0
- package/src/mcp-server/tools/userPassword.ts +38 -0
- package/src/mcp-server/tools/userPasswordResetRequest.ts +37 -0
- package/src/mcp-server/tools/vendorsCreateVendorRegistration.ts +38 -0
- package/src/mcp-server/tools/vendorsListVendorJobTitles.ts +37 -0
- package/src/mcp-server/tools.ts +116 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/magiclink.ts +127 -0
- package/src/models/operations/password.ts +140 -0
- package/src/models/operations/passwordresetrequest.ts +131 -0
- package/src/react-query/index.ts +3 -0
- package/src/react-query/userMagiclink.ts +88 -0
- package/src/react-query/userPassword.ts +89 -0
- package/src/react-query/userPasswordResetRequest.ts +89 -0
- package/src/sdk/user.ts +55 -0
- package/src/types/async.ts +68 -0
- package/types/async.d.ts +23 -0
- package/types/async.d.ts.map +1 -0
- package/types/async.js +44 -0
- package/types/async.js.map +1 -0
- package/.devcontainer/README.md +0 -35
- package/docs/sdks/greensecurity/README.md +0 -14
- package/docs/sdks/organizations/README.md +0 -252
- package/docs/sdks/user/README.md +0 -348
- package/docs/sdks/vendors/README.md +0 -219
|
@@ -0,0 +1,140 @@
|
|
|
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 { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type PasswordRequestBody = {
|
|
12
|
+
paswordResetToken: string;
|
|
13
|
+
password: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The request was successful, and the server has returned the requested resource in the response body.
|
|
18
|
+
*/
|
|
19
|
+
export type PasswordResponseBody = {
|
|
20
|
+
success?: boolean | null | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const PasswordRequestBody$inboundSchema: z.ZodType<
|
|
25
|
+
PasswordRequestBody,
|
|
26
|
+
z.ZodTypeDef,
|
|
27
|
+
unknown
|
|
28
|
+
> = z.object({
|
|
29
|
+
pasword_reset_token: z.string(),
|
|
30
|
+
password: z.string(),
|
|
31
|
+
}).transform((v) => {
|
|
32
|
+
return remap$(v, {
|
|
33
|
+
"pasword_reset_token": "paswordResetToken",
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export type PasswordRequestBody$Outbound = {
|
|
39
|
+
pasword_reset_token: string;
|
|
40
|
+
password: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const PasswordRequestBody$outboundSchema: z.ZodType<
|
|
45
|
+
PasswordRequestBody$Outbound,
|
|
46
|
+
z.ZodTypeDef,
|
|
47
|
+
PasswordRequestBody
|
|
48
|
+
> = z.object({
|
|
49
|
+
paswordResetToken: z.string(),
|
|
50
|
+
password: z.string(),
|
|
51
|
+
}).transform((v) => {
|
|
52
|
+
return remap$(v, {
|
|
53
|
+
paswordResetToken: "pasword_reset_token",
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
60
|
+
*/
|
|
61
|
+
export namespace PasswordRequestBody$ {
|
|
62
|
+
/** @deprecated use `PasswordRequestBody$inboundSchema` instead. */
|
|
63
|
+
export const inboundSchema = PasswordRequestBody$inboundSchema;
|
|
64
|
+
/** @deprecated use `PasswordRequestBody$outboundSchema` instead. */
|
|
65
|
+
export const outboundSchema = PasswordRequestBody$outboundSchema;
|
|
66
|
+
/** @deprecated use `PasswordRequestBody$Outbound` instead. */
|
|
67
|
+
export type Outbound = PasswordRequestBody$Outbound;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function passwordRequestBodyToJSON(
|
|
71
|
+
passwordRequestBody: PasswordRequestBody,
|
|
72
|
+
): string {
|
|
73
|
+
return JSON.stringify(
|
|
74
|
+
PasswordRequestBody$outboundSchema.parse(passwordRequestBody),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function passwordRequestBodyFromJSON(
|
|
79
|
+
jsonString: string,
|
|
80
|
+
): SafeParseResult<PasswordRequestBody, SDKValidationError> {
|
|
81
|
+
return safeParse(
|
|
82
|
+
jsonString,
|
|
83
|
+
(x) => PasswordRequestBody$inboundSchema.parse(JSON.parse(x)),
|
|
84
|
+
`Failed to parse 'PasswordRequestBody' from JSON`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** @internal */
|
|
89
|
+
export const PasswordResponseBody$inboundSchema: z.ZodType<
|
|
90
|
+
PasswordResponseBody,
|
|
91
|
+
z.ZodTypeDef,
|
|
92
|
+
unknown
|
|
93
|
+
> = z.object({
|
|
94
|
+
success: z.nullable(z.boolean()).optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/** @internal */
|
|
98
|
+
export type PasswordResponseBody$Outbound = {
|
|
99
|
+
success?: boolean | null | undefined;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/** @internal */
|
|
103
|
+
export const PasswordResponseBody$outboundSchema: z.ZodType<
|
|
104
|
+
PasswordResponseBody$Outbound,
|
|
105
|
+
z.ZodTypeDef,
|
|
106
|
+
PasswordResponseBody
|
|
107
|
+
> = z.object({
|
|
108
|
+
success: z.nullable(z.boolean()).optional(),
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @internal
|
|
113
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
114
|
+
*/
|
|
115
|
+
export namespace PasswordResponseBody$ {
|
|
116
|
+
/** @deprecated use `PasswordResponseBody$inboundSchema` instead. */
|
|
117
|
+
export const inboundSchema = PasswordResponseBody$inboundSchema;
|
|
118
|
+
/** @deprecated use `PasswordResponseBody$outboundSchema` instead. */
|
|
119
|
+
export const outboundSchema = PasswordResponseBody$outboundSchema;
|
|
120
|
+
/** @deprecated use `PasswordResponseBody$Outbound` instead. */
|
|
121
|
+
export type Outbound = PasswordResponseBody$Outbound;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function passwordResponseBodyToJSON(
|
|
125
|
+
passwordResponseBody: PasswordResponseBody,
|
|
126
|
+
): string {
|
|
127
|
+
return JSON.stringify(
|
|
128
|
+
PasswordResponseBody$outboundSchema.parse(passwordResponseBody),
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function passwordResponseBodyFromJSON(
|
|
133
|
+
jsonString: string,
|
|
134
|
+
): SafeParseResult<PasswordResponseBody, SDKValidationError> {
|
|
135
|
+
return safeParse(
|
|
136
|
+
jsonString,
|
|
137
|
+
(x) => PasswordResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
138
|
+
`Failed to parse 'PasswordResponseBody' from JSON`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type PasswordResetRequestRequestBody = {
|
|
11
|
+
email: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The request was successful, and the server has returned the requested resource in the response body.
|
|
16
|
+
*/
|
|
17
|
+
export type PasswordResetRequestResponseBody = {
|
|
18
|
+
success: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const PasswordResetRequestRequestBody$inboundSchema: z.ZodType<
|
|
23
|
+
PasswordResetRequestRequestBody,
|
|
24
|
+
z.ZodTypeDef,
|
|
25
|
+
unknown
|
|
26
|
+
> = z.object({
|
|
27
|
+
email: z.string(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export type PasswordResetRequestRequestBody$Outbound = {
|
|
32
|
+
email: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const PasswordResetRequestRequestBody$outboundSchema: z.ZodType<
|
|
37
|
+
PasswordResetRequestRequestBody$Outbound,
|
|
38
|
+
z.ZodTypeDef,
|
|
39
|
+
PasswordResetRequestRequestBody
|
|
40
|
+
> = z.object({
|
|
41
|
+
email: z.string(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
47
|
+
*/
|
|
48
|
+
export namespace PasswordResetRequestRequestBody$ {
|
|
49
|
+
/** @deprecated use `PasswordResetRequestRequestBody$inboundSchema` instead. */
|
|
50
|
+
export const inboundSchema = PasswordResetRequestRequestBody$inboundSchema;
|
|
51
|
+
/** @deprecated use `PasswordResetRequestRequestBody$outboundSchema` instead. */
|
|
52
|
+
export const outboundSchema = PasswordResetRequestRequestBody$outboundSchema;
|
|
53
|
+
/** @deprecated use `PasswordResetRequestRequestBody$Outbound` instead. */
|
|
54
|
+
export type Outbound = PasswordResetRequestRequestBody$Outbound;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function passwordResetRequestRequestBodyToJSON(
|
|
58
|
+
passwordResetRequestRequestBody: PasswordResetRequestRequestBody,
|
|
59
|
+
): string {
|
|
60
|
+
return JSON.stringify(
|
|
61
|
+
PasswordResetRequestRequestBody$outboundSchema.parse(
|
|
62
|
+
passwordResetRequestRequestBody,
|
|
63
|
+
),
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function passwordResetRequestRequestBodyFromJSON(
|
|
68
|
+
jsonString: string,
|
|
69
|
+
): SafeParseResult<PasswordResetRequestRequestBody, SDKValidationError> {
|
|
70
|
+
return safeParse(
|
|
71
|
+
jsonString,
|
|
72
|
+
(x) => PasswordResetRequestRequestBody$inboundSchema.parse(JSON.parse(x)),
|
|
73
|
+
`Failed to parse 'PasswordResetRequestRequestBody' from JSON`,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** @internal */
|
|
78
|
+
export const PasswordResetRequestResponseBody$inboundSchema: z.ZodType<
|
|
79
|
+
PasswordResetRequestResponseBody,
|
|
80
|
+
z.ZodTypeDef,
|
|
81
|
+
unknown
|
|
82
|
+
> = z.object({
|
|
83
|
+
success: z.boolean(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export type PasswordResetRequestResponseBody$Outbound = {
|
|
88
|
+
success: boolean;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** @internal */
|
|
92
|
+
export const PasswordResetRequestResponseBody$outboundSchema: z.ZodType<
|
|
93
|
+
PasswordResetRequestResponseBody$Outbound,
|
|
94
|
+
z.ZodTypeDef,
|
|
95
|
+
PasswordResetRequestResponseBody
|
|
96
|
+
> = z.object({
|
|
97
|
+
success: z.boolean(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
103
|
+
*/
|
|
104
|
+
export namespace PasswordResetRequestResponseBody$ {
|
|
105
|
+
/** @deprecated use `PasswordResetRequestResponseBody$inboundSchema` instead. */
|
|
106
|
+
export const inboundSchema = PasswordResetRequestResponseBody$inboundSchema;
|
|
107
|
+
/** @deprecated use `PasswordResetRequestResponseBody$outboundSchema` instead. */
|
|
108
|
+
export const outboundSchema = PasswordResetRequestResponseBody$outboundSchema;
|
|
109
|
+
/** @deprecated use `PasswordResetRequestResponseBody$Outbound` instead. */
|
|
110
|
+
export type Outbound = PasswordResetRequestResponseBody$Outbound;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function passwordResetRequestResponseBodyToJSON(
|
|
114
|
+
passwordResetRequestResponseBody: PasswordResetRequestResponseBody,
|
|
115
|
+
): string {
|
|
116
|
+
return JSON.stringify(
|
|
117
|
+
PasswordResetRequestResponseBody$outboundSchema.parse(
|
|
118
|
+
passwordResetRequestResponseBody,
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function passwordResetRequestResponseBodyFromJSON(
|
|
124
|
+
jsonString: string,
|
|
125
|
+
): SafeParseResult<PasswordResetRequestResponseBody, SDKValidationError> {
|
|
126
|
+
return safeParse(
|
|
127
|
+
jsonString,
|
|
128
|
+
(x) => PasswordResetRequestResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
129
|
+
`Failed to parse 'PasswordResetRequestResponseBody' from JSON`,
|
|
130
|
+
);
|
|
131
|
+
}
|
package/src/react-query/index.ts
CHANGED
|
@@ -10,5 +10,8 @@ export * from "./organizationsListOrSearchFacilities.js";
|
|
|
10
10
|
export * from "./userGetCurrentUser.js";
|
|
11
11
|
export * from "./userGetUserById.js";
|
|
12
12
|
export * from "./userLogsUserIntoTheSystem.js";
|
|
13
|
+
export * from "./userMagiclink.js";
|
|
14
|
+
export * from "./userPassword.js";
|
|
15
|
+
export * from "./userPasswordResetRequest.js";
|
|
13
16
|
export * from "./vendorsCreateVendorRegistration.js";
|
|
14
17
|
export * from "./vendorsListVendorJobTitles.js";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
MutationKey,
|
|
7
|
+
useMutation,
|
|
8
|
+
UseMutationResult,
|
|
9
|
+
} from "@tanstack/react-query";
|
|
10
|
+
import { GreenSecurityCore } from "../core.js";
|
|
11
|
+
import { userMagiclink } from "../funcs/userMagiclink.js";
|
|
12
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
13
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
16
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
17
|
+
import { MutationHookOptions } from "./_types.js";
|
|
18
|
+
|
|
19
|
+
export type UserMagiclinkMutationVariables = {
|
|
20
|
+
request: operations.MagiclinkRequestBody;
|
|
21
|
+
options?: RequestOptions;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type UserMagiclinkMutationData = operations.MagiclinkResponseBody;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Magic link
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* It sends an email with a magic link to allow the user to log in.
|
|
31
|
+
*/
|
|
32
|
+
export function useUserMagiclinkMutation(
|
|
33
|
+
options?: MutationHookOptions<
|
|
34
|
+
UserMagiclinkMutationData,
|
|
35
|
+
Error,
|
|
36
|
+
UserMagiclinkMutationVariables
|
|
37
|
+
>,
|
|
38
|
+
): UseMutationResult<
|
|
39
|
+
UserMagiclinkMutationData,
|
|
40
|
+
Error,
|
|
41
|
+
UserMagiclinkMutationVariables
|
|
42
|
+
> {
|
|
43
|
+
const client = useGreenSecurityContext();
|
|
44
|
+
return useMutation({
|
|
45
|
+
...buildUserMagiclinkMutation(client, options),
|
|
46
|
+
...options,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function mutationKeyUserMagiclink(): MutationKey {
|
|
51
|
+
return ["@greensecurity/javascript-sdk", "user", "magiclink"];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function buildUserMagiclinkMutation(
|
|
55
|
+
client$: GreenSecurityCore,
|
|
56
|
+
hookOptions?: RequestOptions,
|
|
57
|
+
): {
|
|
58
|
+
mutationKey: MutationKey;
|
|
59
|
+
mutationFn: (
|
|
60
|
+
variables: UserMagiclinkMutationVariables,
|
|
61
|
+
) => Promise<UserMagiclinkMutationData>;
|
|
62
|
+
} {
|
|
63
|
+
return {
|
|
64
|
+
mutationKey: mutationKeyUserMagiclink(),
|
|
65
|
+
mutationFn: function userMagiclinkMutationFn({
|
|
66
|
+
request,
|
|
67
|
+
options,
|
|
68
|
+
}): Promise<UserMagiclinkMutationData> {
|
|
69
|
+
const mergedOptions = {
|
|
70
|
+
...hookOptions,
|
|
71
|
+
...options,
|
|
72
|
+
fetchOptions: {
|
|
73
|
+
...hookOptions?.fetchOptions,
|
|
74
|
+
...options?.fetchOptions,
|
|
75
|
+
signal: combineSignals(
|
|
76
|
+
hookOptions?.fetchOptions?.signal,
|
|
77
|
+
options?.fetchOptions?.signal,
|
|
78
|
+
),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
return unwrapAsync(userMagiclink(
|
|
82
|
+
client$,
|
|
83
|
+
request,
|
|
84
|
+
mergedOptions,
|
|
85
|
+
));
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
MutationKey,
|
|
7
|
+
useMutation,
|
|
8
|
+
UseMutationResult,
|
|
9
|
+
} from "@tanstack/react-query";
|
|
10
|
+
import { GreenSecurityCore } from "../core.js";
|
|
11
|
+
import { userPassword } from "../funcs/userPassword.js";
|
|
12
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
13
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
16
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
17
|
+
import { MutationHookOptions } from "./_types.js";
|
|
18
|
+
|
|
19
|
+
export type UserPasswordMutationVariables = {
|
|
20
|
+
request: operations.PasswordRequestBody;
|
|
21
|
+
options?: RequestOptions;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type UserPasswordMutationData = operations.PasswordResponseBody;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Password reset
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Resets the a user's password using a password_reset_id that was sent to them via email.
|
|
31
|
+
* See /users/passwordresetrequest to initiate a password reset flow.
|
|
32
|
+
*/
|
|
33
|
+
export function useUserPasswordMutation(
|
|
34
|
+
options?: MutationHookOptions<
|
|
35
|
+
UserPasswordMutationData,
|
|
36
|
+
Error,
|
|
37
|
+
UserPasswordMutationVariables
|
|
38
|
+
>,
|
|
39
|
+
): UseMutationResult<
|
|
40
|
+
UserPasswordMutationData,
|
|
41
|
+
Error,
|
|
42
|
+
UserPasswordMutationVariables
|
|
43
|
+
> {
|
|
44
|
+
const client = useGreenSecurityContext();
|
|
45
|
+
return useMutation({
|
|
46
|
+
...buildUserPasswordMutation(client, options),
|
|
47
|
+
...options,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function mutationKeyUserPassword(): MutationKey {
|
|
52
|
+
return ["@greensecurity/javascript-sdk", "user", "password"];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function buildUserPasswordMutation(
|
|
56
|
+
client$: GreenSecurityCore,
|
|
57
|
+
hookOptions?: RequestOptions,
|
|
58
|
+
): {
|
|
59
|
+
mutationKey: MutationKey;
|
|
60
|
+
mutationFn: (
|
|
61
|
+
variables: UserPasswordMutationVariables,
|
|
62
|
+
) => Promise<UserPasswordMutationData>;
|
|
63
|
+
} {
|
|
64
|
+
return {
|
|
65
|
+
mutationKey: mutationKeyUserPassword(),
|
|
66
|
+
mutationFn: function userPasswordMutationFn({
|
|
67
|
+
request,
|
|
68
|
+
options,
|
|
69
|
+
}): Promise<UserPasswordMutationData> {
|
|
70
|
+
const mergedOptions = {
|
|
71
|
+
...hookOptions,
|
|
72
|
+
...options,
|
|
73
|
+
fetchOptions: {
|
|
74
|
+
...hookOptions?.fetchOptions,
|
|
75
|
+
...options?.fetchOptions,
|
|
76
|
+
signal: combineSignals(
|
|
77
|
+
hookOptions?.fetchOptions?.signal,
|
|
78
|
+
options?.fetchOptions?.signal,
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return unwrapAsync(userPassword(
|
|
83
|
+
client$,
|
|
84
|
+
request,
|
|
85
|
+
mergedOptions,
|
|
86
|
+
));
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
MutationKey,
|
|
7
|
+
useMutation,
|
|
8
|
+
UseMutationResult,
|
|
9
|
+
} from "@tanstack/react-query";
|
|
10
|
+
import { GreenSecurityCore } from "../core.js";
|
|
11
|
+
import { userPasswordResetRequest } from "../funcs/userPasswordResetRequest.js";
|
|
12
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
13
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
14
|
+
import * as operations from "../models/operations/index.js";
|
|
15
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
16
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
17
|
+
import { MutationHookOptions } from "./_types.js";
|
|
18
|
+
|
|
19
|
+
export type UserPasswordResetRequestMutationVariables = {
|
|
20
|
+
request: operations.PasswordResetRequestRequestBody;
|
|
21
|
+
options?: RequestOptions;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type UserPasswordResetRequestMutationData =
|
|
25
|
+
operations.PasswordResetRequestResponseBody;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Password reset request
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* It sends an email with a link for resetting a user's password.
|
|
32
|
+
*/
|
|
33
|
+
export function useUserPasswordResetRequestMutation(
|
|
34
|
+
options?: MutationHookOptions<
|
|
35
|
+
UserPasswordResetRequestMutationData,
|
|
36
|
+
Error,
|
|
37
|
+
UserPasswordResetRequestMutationVariables
|
|
38
|
+
>,
|
|
39
|
+
): UseMutationResult<
|
|
40
|
+
UserPasswordResetRequestMutationData,
|
|
41
|
+
Error,
|
|
42
|
+
UserPasswordResetRequestMutationVariables
|
|
43
|
+
> {
|
|
44
|
+
const client = useGreenSecurityContext();
|
|
45
|
+
return useMutation({
|
|
46
|
+
...buildUserPasswordResetRequestMutation(client, options),
|
|
47
|
+
...options,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function mutationKeyUserPasswordResetRequest(): MutationKey {
|
|
52
|
+
return ["@greensecurity/javascript-sdk", "user", "passwordResetRequest"];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function buildUserPasswordResetRequestMutation(
|
|
56
|
+
client$: GreenSecurityCore,
|
|
57
|
+
hookOptions?: RequestOptions,
|
|
58
|
+
): {
|
|
59
|
+
mutationKey: MutationKey;
|
|
60
|
+
mutationFn: (
|
|
61
|
+
variables: UserPasswordResetRequestMutationVariables,
|
|
62
|
+
) => Promise<UserPasswordResetRequestMutationData>;
|
|
63
|
+
} {
|
|
64
|
+
return {
|
|
65
|
+
mutationKey: mutationKeyUserPasswordResetRequest(),
|
|
66
|
+
mutationFn: function userPasswordResetRequestMutationFn({
|
|
67
|
+
request,
|
|
68
|
+
options,
|
|
69
|
+
}): Promise<UserPasswordResetRequestMutationData> {
|
|
70
|
+
const mergedOptions = {
|
|
71
|
+
...hookOptions,
|
|
72
|
+
...options,
|
|
73
|
+
fetchOptions: {
|
|
74
|
+
...hookOptions?.fetchOptions,
|
|
75
|
+
...options?.fetchOptions,
|
|
76
|
+
signal: combineSignals(
|
|
77
|
+
hookOptions?.fetchOptions?.signal,
|
|
78
|
+
options?.fetchOptions?.signal,
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
return unwrapAsync(userPasswordResetRequest(
|
|
83
|
+
client$,
|
|
84
|
+
request,
|
|
85
|
+
mergedOptions,
|
|
86
|
+
));
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
package/src/sdk/user.ts
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
import { userGetCurrentUser } from "../funcs/userGetCurrentUser.js";
|
|
6
6
|
import { userGetUserById } from "../funcs/userGetUserById.js";
|
|
7
7
|
import { userLogsUserIntoTheSystem } from "../funcs/userLogsUserIntoTheSystem.js";
|
|
8
|
+
import { userMagiclink } from "../funcs/userMagiclink.js";
|
|
9
|
+
import { userPassword } from "../funcs/userPassword.js";
|
|
10
|
+
import { userPasswordResetRequest } from "../funcs/userPasswordResetRequest.js";
|
|
8
11
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
9
12
|
import * as components from "../models/components/index.js";
|
|
10
13
|
import * as operations from "../models/operations/index.js";
|
|
@@ -89,4 +92,56 @@ export class User extends ClientSDK {
|
|
|
89
92
|
options,
|
|
90
93
|
));
|
|
91
94
|
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Magic link
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* It sends an email with a magic link to allow the user to log in.
|
|
101
|
+
*/
|
|
102
|
+
async magiclink(
|
|
103
|
+
request: operations.MagiclinkRequestBody,
|
|
104
|
+
options?: RequestOptions,
|
|
105
|
+
): Promise<operations.MagiclinkResponseBody> {
|
|
106
|
+
return unwrapAsync(userMagiclink(
|
|
107
|
+
this,
|
|
108
|
+
request,
|
|
109
|
+
options,
|
|
110
|
+
));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Password reset request
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* It sends an email with a link for resetting a user's password.
|
|
118
|
+
*/
|
|
119
|
+
async passwordResetRequest(
|
|
120
|
+
request: operations.PasswordResetRequestRequestBody,
|
|
121
|
+
options?: RequestOptions,
|
|
122
|
+
): Promise<operations.PasswordResetRequestResponseBody> {
|
|
123
|
+
return unwrapAsync(userPasswordResetRequest(
|
|
124
|
+
this,
|
|
125
|
+
request,
|
|
126
|
+
options,
|
|
127
|
+
));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Password reset
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* Resets the a user's password using a password_reset_id that was sent to them via email.
|
|
135
|
+
* See /users/passwordresetrequest to initiate a password reset flow.
|
|
136
|
+
*/
|
|
137
|
+
async password(
|
|
138
|
+
request: operations.PasswordRequestBody,
|
|
139
|
+
options?: RequestOptions,
|
|
140
|
+
): Promise<operations.PasswordResponseBody> {
|
|
141
|
+
return unwrapAsync(userPassword(
|
|
142
|
+
this,
|
|
143
|
+
request,
|
|
144
|
+
options,
|
|
145
|
+
));
|
|
146
|
+
}
|
|
92
147
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export type APICall =
|
|
6
|
+
| {
|
|
7
|
+
status: "complete";
|
|
8
|
+
request: Request;
|
|
9
|
+
response: Response;
|
|
10
|
+
}
|
|
11
|
+
| {
|
|
12
|
+
status: "request-error";
|
|
13
|
+
request: Request;
|
|
14
|
+
response?: undefined;
|
|
15
|
+
}
|
|
16
|
+
| {
|
|
17
|
+
status: "invalid";
|
|
18
|
+
request?: undefined;
|
|
19
|
+
response?: undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export class APIPromise<T> implements Promise<T> {
|
|
23
|
+
readonly #promise: Promise<[T, APICall]>;
|
|
24
|
+
readonly #unwrapped: Promise<T>;
|
|
25
|
+
|
|
26
|
+
readonly [Symbol.toStringTag] = "APIPromise";
|
|
27
|
+
|
|
28
|
+
constructor(p: [T, APICall] | Promise<[T, APICall]>) {
|
|
29
|
+
this.#promise = p instanceof Promise ? p : Promise.resolve(p);
|
|
30
|
+
this.#unwrapped =
|
|
31
|
+
p instanceof Promise
|
|
32
|
+
? this.#promise.then(([value]) => value)
|
|
33
|
+
: Promise.resolve(p[0]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
then<TResult1 = T, TResult2 = never>(
|
|
37
|
+
onfulfilled?:
|
|
38
|
+
| ((value: T) => TResult1 | PromiseLike<TResult1>)
|
|
39
|
+
| null
|
|
40
|
+
| undefined,
|
|
41
|
+
onrejected?:
|
|
42
|
+
| ((reason: any) => TResult2 | PromiseLike<TResult2>)
|
|
43
|
+
| null
|
|
44
|
+
| undefined,
|
|
45
|
+
): Promise<TResult1 | TResult2> {
|
|
46
|
+
return this.#promise.then(
|
|
47
|
+
onfulfilled ? ([value]) => onfulfilled(value) : void 0,
|
|
48
|
+
onrejected,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
catch<TResult = never>(
|
|
53
|
+
onrejected?:
|
|
54
|
+
| ((reason: any) => TResult | PromiseLike<TResult>)
|
|
55
|
+
| null
|
|
56
|
+
| undefined,
|
|
57
|
+
): Promise<T | TResult> {
|
|
58
|
+
return this.#unwrapped.catch(onrejected);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
finally(onfinally?: (() => void) | null | undefined): Promise<T> {
|
|
62
|
+
return this.#unwrapped.finally(onfinally);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
$inspect(): Promise<[T, APICall]> {
|
|
66
|
+
return this.#promise;
|
|
67
|
+
}
|
|
68
|
+
}
|
package/types/async.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type APICall = {
|
|
2
|
+
status: "complete";
|
|
3
|
+
request: Request;
|
|
4
|
+
response: Response;
|
|
5
|
+
} | {
|
|
6
|
+
status: "request-error";
|
|
7
|
+
request: Request;
|
|
8
|
+
response?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
status: "invalid";
|
|
11
|
+
request?: undefined;
|
|
12
|
+
response?: undefined;
|
|
13
|
+
};
|
|
14
|
+
export declare class APIPromise<T> implements Promise<T> {
|
|
15
|
+
#private;
|
|
16
|
+
readonly [Symbol.toStringTag] = "APIPromise";
|
|
17
|
+
constructor(p: [T, APICall] | Promise<[T, APICall]>);
|
|
18
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
19
|
+
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<T | TResult>;
|
|
20
|
+
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
|
|
21
|
+
$inspect(): Promise<[T, APICall]>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=async.d.ts.map
|