@greensecurity/javascript-sdk 0.45.0-beta.11 → 0.45.0-beta.12
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 +1 -4
- package/dist/commonjs/__tests__/lookups.test.js +0 -21
- package/dist/commonjs/__tests__/lookups.test.js.map +1 -1
- package/dist/commonjs/__tests__/vendors.test.js +1 -1
- package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +9 -11
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/usersUpdateUser.d.ts +0 -6
- package/dist/commonjs/funcs/usersUpdateUser.d.ts.map +1 -1
- package/dist/commonjs/funcs/usersUpdateUser.js +0 -6
- package/dist/commonjs/funcs/usersUpdateUser.js.map +1 -1
- package/dist/commonjs/funcs/vendorsCreateVendor.d.ts +0 -4
- package/dist/commonjs/funcs/vendorsCreateVendor.d.ts.map +1 -1
- package/dist/commonjs/funcs/vendorsCreateVendor.js +0 -4
- package/dist/commonjs/funcs/vendorsCreateVendor.js.map +1 -1
- package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts +1 -9
- package/dist/commonjs/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
- package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js +1 -9
- package/dist/commonjs/funcs/vendorsUpdateVendorDetails.js.map +1 -1
- package/dist/commonjs/index.extras.d.ts +0 -6
- package/dist/commonjs/index.extras.d.ts.map +1 -1
- package/dist/commonjs/index.extras.js +0 -6
- package/dist/commonjs/index.extras.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +4 -4
- package/dist/commonjs/lib/config.js +4 -4
- package/dist/commonjs/models/operations/createvendorcompany.d.ts +1 -7
- package/dist/commonjs/models/operations/createvendorcompany.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createvendorcompany.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +0 -1
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +0 -1
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/react-query/index.d.ts +0 -1
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +0 -1
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/usersUpdateUser.d.ts +0 -6
- package/dist/commonjs/react-query/usersUpdateUser.d.ts.map +1 -1
- package/dist/commonjs/react-query/usersUpdateUser.js +0 -6
- package/dist/commonjs/react-query/usersUpdateUser.js.map +1 -1
- package/dist/commonjs/react-query/vendorsCreateVendor.d.ts +0 -4
- package/dist/commonjs/react-query/vendorsCreateVendor.d.ts.map +1 -1
- package/dist/commonjs/react-query/vendorsCreateVendor.js +0 -4
- package/dist/commonjs/react-query/vendorsCreateVendor.js.map +1 -1
- package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts +1 -9
- package/dist/commonjs/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
- package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js +1 -9
- package/dist/commonjs/react-query/vendorsUpdateVendorDetails.js.map +1 -1
- package/dist/commonjs/sdk/lookups.d.ts +0 -22
- package/dist/commonjs/sdk/lookups.d.ts.map +1 -1
- package/dist/commonjs/sdk/lookups.js +0 -25
- package/dist/commonjs/sdk/lookups.js.map +1 -1
- package/dist/commonjs/sdk/users.d.ts +0 -6
- package/dist/commonjs/sdk/users.d.ts.map +1 -1
- package/dist/commonjs/sdk/users.js +0 -6
- package/dist/commonjs/sdk/users.js.map +1 -1
- package/dist/commonjs/sdk/vendors.d.ts +1 -13
- package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
- package/dist/commonjs/sdk/vendors.js +1 -13
- package/dist/commonjs/sdk/vendors.js.map +1 -1
- package/dist/esm/__tests__/lookups.test.js +0 -21
- package/dist/esm/__tests__/lookups.test.js.map +1 -1
- package/dist/esm/__tests__/vendors.test.js +1 -1
- package/dist/esm/__tests__/vendors.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +9 -11
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/usersUpdateUser.d.ts +0 -6
- package/dist/esm/funcs/usersUpdateUser.d.ts.map +1 -1
- package/dist/esm/funcs/usersUpdateUser.js +0 -6
- package/dist/esm/funcs/usersUpdateUser.js.map +1 -1
- package/dist/esm/funcs/vendorsCreateVendor.d.ts +0 -4
- package/dist/esm/funcs/vendorsCreateVendor.d.ts.map +1 -1
- package/dist/esm/funcs/vendorsCreateVendor.js +0 -4
- package/dist/esm/funcs/vendorsCreateVendor.js.map +1 -1
- package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts +1 -9
- package/dist/esm/funcs/vendorsUpdateVendorDetails.d.ts.map +1 -1
- package/dist/esm/funcs/vendorsUpdateVendorDetails.js +1 -9
- package/dist/esm/funcs/vendorsUpdateVendorDetails.js.map +1 -1
- package/dist/esm/index.extras.d.ts +0 -6
- package/dist/esm/index.extras.d.ts.map +1 -1
- package/dist/esm/index.extras.js +0 -6
- package/dist/esm/index.extras.js.map +1 -1
- package/dist/esm/lib/config.d.ts +4 -4
- package/dist/esm/lib/config.js +4 -4
- package/dist/esm/models/operations/createvendorcompany.d.ts +1 -7
- package/dist/esm/models/operations/createvendorcompany.d.ts.map +1 -1
- package/dist/esm/models/operations/createvendorcompany.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +0 -1
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +0 -1
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/react-query/index.d.ts +0 -1
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +0 -1
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/usersUpdateUser.d.ts +0 -6
- package/dist/esm/react-query/usersUpdateUser.d.ts.map +1 -1
- package/dist/esm/react-query/usersUpdateUser.js +0 -6
- package/dist/esm/react-query/usersUpdateUser.js.map +1 -1
- package/dist/esm/react-query/vendorsCreateVendor.d.ts +0 -4
- package/dist/esm/react-query/vendorsCreateVendor.d.ts.map +1 -1
- package/dist/esm/react-query/vendorsCreateVendor.js +0 -4
- package/dist/esm/react-query/vendorsCreateVendor.js.map +1 -1
- package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts +1 -9
- package/dist/esm/react-query/vendorsUpdateVendorDetails.d.ts.map +1 -1
- package/dist/esm/react-query/vendorsUpdateVendorDetails.js +1 -9
- package/dist/esm/react-query/vendorsUpdateVendorDetails.js.map +1 -1
- package/dist/esm/sdk/lookups.d.ts +0 -22
- package/dist/esm/sdk/lookups.d.ts.map +1 -1
- package/dist/esm/sdk/lookups.js +0 -25
- package/dist/esm/sdk/lookups.js.map +1 -1
- package/dist/esm/sdk/users.d.ts +0 -6
- package/dist/esm/sdk/users.d.ts.map +1 -1
- package/dist/esm/sdk/users.js +0 -6
- package/dist/esm/sdk/users.js.map +1 -1
- package/dist/esm/sdk/vendors.d.ts +1 -13
- package/dist/esm/sdk/vendors.d.ts.map +1 -1
- package/dist/esm/sdk/vendors.js +1 -13
- package/dist/esm/sdk/vendors.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/lookups.test.ts +0 -24
- package/src/__tests__/vendors.test.ts +1 -1
- package/src/__tests__/zones.test.ts +9 -11
- package/src/funcs/usersUpdateUser.ts +0 -6
- package/src/funcs/vendorsCreateVendor.ts +0 -4
- package/src/funcs/vendorsUpdateVendorDetails.ts +1 -9
- package/src/index.extras.ts +0 -8
- package/src/lib/config.ts +4 -4
- package/src/models/operations/createvendorcompany.ts +1 -7
- package/src/models/operations/index.ts +0 -1
- package/src/react-query/index.ts +0 -1
- package/src/react-query/usersUpdateUser.ts +0 -6
- package/src/react-query/vendorsCreateVendor.ts +0 -4
- package/src/react-query/vendorsUpdateVendorDetails.ts +1 -9
- package/src/sdk/lookups.ts +0 -33
- package/src/sdk/users.ts +0 -6
- package/src/sdk/vendors.ts +1 -13
- package/dist/commonjs/admin-funcs/dismissCommunication.d.ts +0 -3
- package/dist/commonjs/admin-funcs/dismissCommunication.d.ts.map +0 -1
- package/dist/commonjs/admin-funcs/dismissCommunication.js +0 -20
- package/dist/commonjs/admin-funcs/dismissCommunication.js.map +0 -1
- package/dist/commonjs/admin-funcs/listCommunications.d.ts +0 -3
- package/dist/commonjs/admin-funcs/listCommunications.d.ts.map +0 -1
- package/dist/commonjs/admin-funcs/listCommunications.js +0 -25
- package/dist/commonjs/admin-funcs/listCommunications.js.map +0 -1
- package/dist/commonjs/funcs/lookupsLookupPostalCode.d.ts +0 -35
- package/dist/commonjs/funcs/lookupsLookupPostalCode.d.ts.map +0 -1
- package/dist/commonjs/funcs/lookupsLookupPostalCode.js +0 -140
- package/dist/commonjs/funcs/lookupsLookupPostalCode.js.map +0 -1
- package/dist/commonjs/models/operations/lookuppostalcode.d.ts +0 -59
- package/dist/commonjs/models/operations/lookuppostalcode.d.ts.map +0 -1
- package/dist/commonjs/models/operations/lookuppostalcode.js +0 -81
- package/dist/commonjs/models/operations/lookuppostalcode.js.map +0 -1
- package/dist/commonjs/react-query/lookupsLookupPostalCode.core.d.ts +0 -16
- package/dist/commonjs/react-query/lookupsLookupPostalCode.core.d.ts.map +0 -1
- package/dist/commonjs/react-query/lookupsLookupPostalCode.core.js +0 -43
- package/dist/commonjs/react-query/lookupsLookupPostalCode.core.js.map +0 -1
- package/dist/commonjs/react-query/lookupsLookupPostalCode.d.ts +0 -71
- package/dist/commonjs/react-query/lookupsLookupPostalCode.d.ts.map +0 -1
- package/dist/commonjs/react-query/lookupsLookupPostalCode.js +0 -95
- package/dist/commonjs/react-query/lookupsLookupPostalCode.js.map +0 -1
- package/dist/esm/admin-funcs/dismissCommunication.d.ts +0 -3
- package/dist/esm/admin-funcs/dismissCommunication.d.ts.map +0 -1
- package/dist/esm/admin-funcs/dismissCommunication.js +0 -17
- package/dist/esm/admin-funcs/dismissCommunication.js.map +0 -1
- package/dist/esm/admin-funcs/listCommunications.d.ts +0 -3
- package/dist/esm/admin-funcs/listCommunications.d.ts.map +0 -1
- package/dist/esm/admin-funcs/listCommunications.js +0 -22
- package/dist/esm/admin-funcs/listCommunications.js.map +0 -1
- package/dist/esm/funcs/lookupsLookupPostalCode.d.ts +0 -35
- package/dist/esm/funcs/lookupsLookupPostalCode.d.ts.map +0 -1
- package/dist/esm/funcs/lookupsLookupPostalCode.js +0 -104
- package/dist/esm/funcs/lookupsLookupPostalCode.js.map +0 -1
- package/dist/esm/models/operations/lookuppostalcode.d.ts +0 -59
- package/dist/esm/models/operations/lookuppostalcode.d.ts.map +0 -1
- package/dist/esm/models/operations/lookuppostalcode.js +0 -43
- package/dist/esm/models/operations/lookuppostalcode.js.map +0 -1
- package/dist/esm/react-query/lookupsLookupPostalCode.core.d.ts +0 -16
- package/dist/esm/react-query/lookupsLookupPostalCode.core.d.ts.map +0 -1
- package/dist/esm/react-query/lookupsLookupPostalCode.core.js +0 -38
- package/dist/esm/react-query/lookupsLookupPostalCode.core.js.map +0 -1
- package/dist/esm/react-query/lookupsLookupPostalCode.d.ts +0 -71
- package/dist/esm/react-query/lookupsLookupPostalCode.d.ts.map +0 -1
- package/dist/esm/react-query/lookupsLookupPostalCode.js +0 -85
- package/dist/esm/react-query/lookupsLookupPostalCode.js.map +0 -1
- package/src/admin-funcs/dismissCommunication.ts +0 -20
- package/src/admin-funcs/listCommunications.ts +0 -29
- package/src/funcs/lookupsLookupPostalCode.ts +0 -193
- package/src/models/operations/lookuppostalcode.ts +0 -118
- package/src/react-query/lookupsLookupPostalCode.core.ts +0 -82
- package/src/react-query/lookupsLookupPostalCode.ts +0 -177
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
QueryClient,
|
|
7
|
-
QueryFunctionContext,
|
|
8
|
-
QueryKey,
|
|
9
|
-
} from "@tanstack/react-query";
|
|
10
|
-
import { GreenSecurityCore } from "../core.js";
|
|
11
|
-
import { lookupsLookupPostalCode } from "../funcs/lookupsLookupPostalCode.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
|
-
export type LookupsLookupPostalCodeQueryData =
|
|
17
|
-
operations.LookupPostalCodeLookupPostalCodeOk;
|
|
18
|
-
|
|
19
|
-
export function prefetchLookupsLookupPostalCode(
|
|
20
|
-
queryClient: QueryClient,
|
|
21
|
-
client$: GreenSecurityCore,
|
|
22
|
-
request: operations.LookupPostalCodeRequest,
|
|
23
|
-
options?: RequestOptions,
|
|
24
|
-
): Promise<void> {
|
|
25
|
-
return queryClient.prefetchQuery({
|
|
26
|
-
...buildLookupsLookupPostalCodeQuery(
|
|
27
|
-
client$,
|
|
28
|
-
request,
|
|
29
|
-
options,
|
|
30
|
-
),
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function buildLookupsLookupPostalCodeQuery(
|
|
35
|
-
client$: GreenSecurityCore,
|
|
36
|
-
request: operations.LookupPostalCodeRequest,
|
|
37
|
-
options?: RequestOptions,
|
|
38
|
-
): {
|
|
39
|
-
queryKey: QueryKey;
|
|
40
|
-
queryFn: (
|
|
41
|
-
context: QueryFunctionContext,
|
|
42
|
-
) => Promise<LookupsLookupPostalCodeQueryData>;
|
|
43
|
-
} {
|
|
44
|
-
return {
|
|
45
|
-
queryKey: queryKeyLookupsLookupPostalCode({
|
|
46
|
-
postalCode: request.postalCode,
|
|
47
|
-
state: request.state,
|
|
48
|
-
country: request.country,
|
|
49
|
-
}),
|
|
50
|
-
queryFn: async function lookupsLookupPostalCodeQueryFn(
|
|
51
|
-
ctx,
|
|
52
|
-
): Promise<LookupsLookupPostalCodeQueryData> {
|
|
53
|
-
const sig = combineSignals(
|
|
54
|
-
ctx.signal,
|
|
55
|
-
options?.signal,
|
|
56
|
-
options?.fetchOptions?.signal,
|
|
57
|
-
);
|
|
58
|
-
const mergedOptions = {
|
|
59
|
-
...options?.fetchOptions,
|
|
60
|
-
...options,
|
|
61
|
-
signal: sig,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
return unwrapAsync(lookupsLookupPostalCode(
|
|
65
|
-
client$,
|
|
66
|
-
request,
|
|
67
|
-
mergedOptions,
|
|
68
|
-
));
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function queryKeyLookupsLookupPostalCode(
|
|
74
|
-
parameters: { postalCode: string; state: string; country: string },
|
|
75
|
-
): QueryKey {
|
|
76
|
-
return [
|
|
77
|
-
"@greensecurity/javascript-sdk",
|
|
78
|
-
"lookups",
|
|
79
|
-
"lookupPostalCode",
|
|
80
|
-
parameters,
|
|
81
|
-
];
|
|
82
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
InvalidateQueryFilters,
|
|
7
|
-
QueryClient,
|
|
8
|
-
useQuery,
|
|
9
|
-
UseQueryResult,
|
|
10
|
-
useSuspenseQuery,
|
|
11
|
-
UseSuspenseQueryResult,
|
|
12
|
-
} from "@tanstack/react-query";
|
|
13
|
-
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
14
|
-
import {
|
|
15
|
-
ConnectionError,
|
|
16
|
-
InvalidRequestError,
|
|
17
|
-
RequestAbortedError,
|
|
18
|
-
RequestTimeoutError,
|
|
19
|
-
UnexpectedClientError,
|
|
20
|
-
} from "../models/errors/httpclienterrors.js";
|
|
21
|
-
import * as errors from "../models/errors/index.js";
|
|
22
|
-
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
-
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
-
import * as operations from "../models/operations/index.js";
|
|
25
|
-
import { useGreenSecurityContext } from "./_context.js";
|
|
26
|
-
import {
|
|
27
|
-
QueryHookOptions,
|
|
28
|
-
SuspenseQueryHookOptions,
|
|
29
|
-
TupleToPrefixes,
|
|
30
|
-
} from "./_types.js";
|
|
31
|
-
import {
|
|
32
|
-
buildLookupsLookupPostalCodeQuery,
|
|
33
|
-
LookupsLookupPostalCodeQueryData,
|
|
34
|
-
prefetchLookupsLookupPostalCode,
|
|
35
|
-
queryKeyLookupsLookupPostalCode,
|
|
36
|
-
} from "./lookupsLookupPostalCode.core.js";
|
|
37
|
-
export {
|
|
38
|
-
buildLookupsLookupPostalCodeQuery,
|
|
39
|
-
type LookupsLookupPostalCodeQueryData,
|
|
40
|
-
prefetchLookupsLookupPostalCode,
|
|
41
|
-
queryKeyLookupsLookupPostalCode,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export type LookupsLookupPostalCodeQueryError =
|
|
45
|
-
| errors.ApiErrorResponse
|
|
46
|
-
| GreenSecurityError
|
|
47
|
-
| ResponseValidationError
|
|
48
|
-
| ConnectionError
|
|
49
|
-
| RequestAbortedError
|
|
50
|
-
| RequestTimeoutError
|
|
51
|
-
| InvalidRequestError
|
|
52
|
-
| UnexpectedClientError
|
|
53
|
-
| SDKValidationError;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Check a postal code against a state and country
|
|
57
|
-
*
|
|
58
|
-
* @remarks
|
|
59
|
-
* Cross-checks a postal code against a state/province and country, the same check
|
|
60
|
-
* every write path that stores a US or Canadian address enforces server-side (e.g.
|
|
61
|
-
* `PUT /users/{id}`, `PUT /vendors/{vendor_id_or_me}`). Useful for validating an
|
|
62
|
-
* address before submitting it elsewhere.
|
|
63
|
-
*
|
|
64
|
-
* `status` is one of:
|
|
65
|
-
* - `ok` — the postal code belongs to the given state/province.
|
|
66
|
-
* - `invalid` — the postal code is not shaped like a real one for the given country.
|
|
67
|
-
* - `mismatch` — the postal code is well-formed but belongs to a different state or
|
|
68
|
-
* province. `expected_states` names the state(s) it actually maps to.
|
|
69
|
-
* - `unknown` — nothing to check against (an unsupported country, or a postal code
|
|
70
|
-
* absent from the US ZIP dataset). Treated as acceptable by every write path that
|
|
71
|
-
* uses this check.
|
|
72
|
-
*
|
|
73
|
-
* Only the US and Canada have a real code-to-subdivision map; every other country
|
|
74
|
-
* always returns `unknown`.
|
|
75
|
-
*/
|
|
76
|
-
export function useLookupsLookupPostalCode(
|
|
77
|
-
request: operations.LookupPostalCodeRequest,
|
|
78
|
-
options?: QueryHookOptions<
|
|
79
|
-
LookupsLookupPostalCodeQueryData,
|
|
80
|
-
LookupsLookupPostalCodeQueryError
|
|
81
|
-
>,
|
|
82
|
-
): UseQueryResult<
|
|
83
|
-
LookupsLookupPostalCodeQueryData,
|
|
84
|
-
LookupsLookupPostalCodeQueryError
|
|
85
|
-
> {
|
|
86
|
-
const client = useGreenSecurityContext();
|
|
87
|
-
return useQuery({
|
|
88
|
-
...buildLookupsLookupPostalCodeQuery(
|
|
89
|
-
client,
|
|
90
|
-
request,
|
|
91
|
-
options,
|
|
92
|
-
),
|
|
93
|
-
...options,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Check a postal code against a state and country
|
|
99
|
-
*
|
|
100
|
-
* @remarks
|
|
101
|
-
* Cross-checks a postal code against a state/province and country, the same check
|
|
102
|
-
* every write path that stores a US or Canadian address enforces server-side (e.g.
|
|
103
|
-
* `PUT /users/{id}`, `PUT /vendors/{vendor_id_or_me}`). Useful for validating an
|
|
104
|
-
* address before submitting it elsewhere.
|
|
105
|
-
*
|
|
106
|
-
* `status` is one of:
|
|
107
|
-
* - `ok` — the postal code belongs to the given state/province.
|
|
108
|
-
* - `invalid` — the postal code is not shaped like a real one for the given country.
|
|
109
|
-
* - `mismatch` — the postal code is well-formed but belongs to a different state or
|
|
110
|
-
* province. `expected_states` names the state(s) it actually maps to.
|
|
111
|
-
* - `unknown` — nothing to check against (an unsupported country, or a postal code
|
|
112
|
-
* absent from the US ZIP dataset). Treated as acceptable by every write path that
|
|
113
|
-
* uses this check.
|
|
114
|
-
*
|
|
115
|
-
* Only the US and Canada have a real code-to-subdivision map; every other country
|
|
116
|
-
* always returns `unknown`.
|
|
117
|
-
*/
|
|
118
|
-
export function useLookupsLookupPostalCodeSuspense(
|
|
119
|
-
request: operations.LookupPostalCodeRequest,
|
|
120
|
-
options?: SuspenseQueryHookOptions<
|
|
121
|
-
LookupsLookupPostalCodeQueryData,
|
|
122
|
-
LookupsLookupPostalCodeQueryError
|
|
123
|
-
>,
|
|
124
|
-
): UseSuspenseQueryResult<
|
|
125
|
-
LookupsLookupPostalCodeQueryData,
|
|
126
|
-
LookupsLookupPostalCodeQueryError
|
|
127
|
-
> {
|
|
128
|
-
const client = useGreenSecurityContext();
|
|
129
|
-
return useSuspenseQuery({
|
|
130
|
-
...buildLookupsLookupPostalCodeQuery(
|
|
131
|
-
client,
|
|
132
|
-
request,
|
|
133
|
-
options,
|
|
134
|
-
),
|
|
135
|
-
...options,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function setLookupsLookupPostalCodeData(
|
|
140
|
-
client: QueryClient,
|
|
141
|
-
queryKeyBase: [
|
|
142
|
-
parameters: { postalCode: string; state: string; country: string },
|
|
143
|
-
],
|
|
144
|
-
data: LookupsLookupPostalCodeQueryData,
|
|
145
|
-
): LookupsLookupPostalCodeQueryData | undefined {
|
|
146
|
-
const key = queryKeyLookupsLookupPostalCode(...queryKeyBase);
|
|
147
|
-
|
|
148
|
-
return client.setQueryData<LookupsLookupPostalCodeQueryData>(key, data);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export function invalidateLookupsLookupPostalCode(
|
|
152
|
-
client: QueryClient,
|
|
153
|
-
queryKeyBase: TupleToPrefixes<
|
|
154
|
-
[parameters: { postalCode: string; state: string; country: string }]
|
|
155
|
-
>,
|
|
156
|
-
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
157
|
-
): Promise<void> {
|
|
158
|
-
return client.invalidateQueries({
|
|
159
|
-
...filters,
|
|
160
|
-
queryKey: [
|
|
161
|
-
"@greensecurity/javascript-sdk",
|
|
162
|
-
"lookups",
|
|
163
|
-
"lookupPostalCode",
|
|
164
|
-
...queryKeyBase,
|
|
165
|
-
],
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export function invalidateAllLookupsLookupPostalCode(
|
|
170
|
-
client: QueryClient,
|
|
171
|
-
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
172
|
-
): Promise<void> {
|
|
173
|
-
return client.invalidateQueries({
|
|
174
|
-
...filters,
|
|
175
|
-
queryKey: ["@greensecurity/javascript-sdk", "lookups", "lookupPostalCode"],
|
|
176
|
-
});
|
|
177
|
-
}
|