@shware/http 2.6.0 → 2.6.1
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 +2 -0
- package/dist/error/reason.cjs.map +1 -1
- package/dist/error/reason.d.cts +1 -64
- package/dist/error/reason.d.ts +1 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,8 @@ By default, `ErrorInfo.reason` accepts any `string`. You can use TypeScript [dec
|
|
|
53
53
|
|
|
54
54
|
```typescript
|
|
55
55
|
// e.g. shware-http.d.ts
|
|
56
|
+
import '@shware/http'; // Required: makes this file a module so that `declare module` augments rather than replaces
|
|
57
|
+
|
|
56
58
|
declare module '@shware/http' {
|
|
57
59
|
interface ErrorReason {
|
|
58
60
|
ACCOUNT_BLOCKED: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/error/reason.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/error/reason.ts"],"sourcesContent":["// oxlint-disable-next-line typescript/no-empty-object-type\nexport interface ErrorReason {}\n\nexport type ResolvedErrorReason = keyof ErrorReason extends never ? string : keyof ErrorReason;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/error/reason.d.cts
CHANGED
|
@@ -1,68 +1,5 @@
|
|
|
1
|
-
interface NetworkErrorReason {
|
|
2
|
-
DNS_ERROR: string;
|
|
3
|
-
MISCONFIGURATION: string;
|
|
4
|
-
CONNECTION_ERROR: string;
|
|
5
|
-
}
|
|
6
|
-
interface StatusErrorReason {
|
|
7
|
-
OK: string;
|
|
8
|
-
CANCELLED: string;
|
|
9
|
-
UNKNOWN: string;
|
|
10
|
-
INVALID_ARGUMENT: string;
|
|
11
|
-
DEADLINE_EXCEEDED: string;
|
|
12
|
-
NOT_FOUND: string;
|
|
13
|
-
ALREADY_EXISTS: string;
|
|
14
|
-
PERMISSION_DENIED: string;
|
|
15
|
-
RESOURCE_EXHAUSTED: string;
|
|
16
|
-
FAILED_PRECONDITION: string;
|
|
17
|
-
ABORTED: string;
|
|
18
|
-
OUT_OF_RANGE: string;
|
|
19
|
-
UNIMPLEMENTED: string;
|
|
20
|
-
INTERNAL: string;
|
|
21
|
-
UNAVAILABLE: string;
|
|
22
|
-
DATA_LOSS: string;
|
|
23
|
-
UNAUTHENTICATED: string;
|
|
24
|
-
}
|
|
25
|
-
interface AuthenticationErrorReason {
|
|
26
|
-
ACCOUNT_LOCKED: string;
|
|
27
|
-
ACCOUNT_EXPIRED: string;
|
|
28
|
-
ACCOUNT_INACTIVE: string;
|
|
29
|
-
ACCOUNT_DISABLED: string;
|
|
30
|
-
ACCOUNT_SUSPENDED: string;
|
|
31
|
-
ACCESS_DENIED: string;
|
|
32
|
-
ACCESS_TOKEN_REQUIRED: string;
|
|
33
|
-
PASSWORD_MISMATCH: string;
|
|
34
|
-
USERNAME_ALREADY_EXISTS: string;
|
|
35
|
-
VERIFICATION_CODE_MISMATCH: string;
|
|
36
|
-
VERIFICATION_CODE_SEND_FAILED: string;
|
|
37
|
-
}
|
|
38
|
-
interface ModerationErrorReason {
|
|
39
|
-
POSSIBLY_SENSITIVE: string;
|
|
40
|
-
ADULT_CONTENT: string;
|
|
41
|
-
NUDITY_CONTENT: string;
|
|
42
|
-
SEXUAL_CONTENT: string;
|
|
43
|
-
BLOODY_CONTENT: string;
|
|
44
|
-
WEAPON_CONTENT: string;
|
|
45
|
-
POLITICS_CONTENT: string;
|
|
46
|
-
VIOLENCE_CONTENT: string;
|
|
47
|
-
ABUSE_CONTENT: string;
|
|
48
|
-
ADVERTISEMENT_CONTENT: string;
|
|
49
|
-
CONTRABAND_CONTENT: string;
|
|
50
|
-
SPAM_CONTENT: string;
|
|
51
|
-
MEANINGLESS_CONTENT: string;
|
|
52
|
-
UNSAFE_TEXT_DETECTED: string;
|
|
53
|
-
}
|
|
54
|
-
interface MultipartErrorReason {
|
|
55
|
-
MAX_UPLOAD_SIZE_EXCEEDED: string;
|
|
56
|
-
MEDIA_TYPE_NOT_SUPPORTED: string;
|
|
57
|
-
MEDIA_TYPE_NOT_ACCEPTABLE: string;
|
|
58
|
-
}
|
|
59
|
-
interface AppErrorReason {
|
|
60
|
-
RATE_LIMIT_EXCEEDED: string;
|
|
61
|
-
INSUFFICIENT_CREDITS: string;
|
|
62
|
-
ALREADY_SUBSCRIBED_AT_OTHER_PLATFORM: string;
|
|
63
|
-
}
|
|
64
1
|
interface ErrorReason {
|
|
65
2
|
}
|
|
66
3
|
type ResolvedErrorReason = keyof ErrorReason extends never ? string : keyof ErrorReason;
|
|
67
4
|
|
|
68
|
-
export type {
|
|
5
|
+
export type { ErrorReason, ResolvedErrorReason };
|
package/dist/error/reason.d.ts
CHANGED
|
@@ -1,68 +1,5 @@
|
|
|
1
|
-
interface NetworkErrorReason {
|
|
2
|
-
DNS_ERROR: string;
|
|
3
|
-
MISCONFIGURATION: string;
|
|
4
|
-
CONNECTION_ERROR: string;
|
|
5
|
-
}
|
|
6
|
-
interface StatusErrorReason {
|
|
7
|
-
OK: string;
|
|
8
|
-
CANCELLED: string;
|
|
9
|
-
UNKNOWN: string;
|
|
10
|
-
INVALID_ARGUMENT: string;
|
|
11
|
-
DEADLINE_EXCEEDED: string;
|
|
12
|
-
NOT_FOUND: string;
|
|
13
|
-
ALREADY_EXISTS: string;
|
|
14
|
-
PERMISSION_DENIED: string;
|
|
15
|
-
RESOURCE_EXHAUSTED: string;
|
|
16
|
-
FAILED_PRECONDITION: string;
|
|
17
|
-
ABORTED: string;
|
|
18
|
-
OUT_OF_RANGE: string;
|
|
19
|
-
UNIMPLEMENTED: string;
|
|
20
|
-
INTERNAL: string;
|
|
21
|
-
UNAVAILABLE: string;
|
|
22
|
-
DATA_LOSS: string;
|
|
23
|
-
UNAUTHENTICATED: string;
|
|
24
|
-
}
|
|
25
|
-
interface AuthenticationErrorReason {
|
|
26
|
-
ACCOUNT_LOCKED: string;
|
|
27
|
-
ACCOUNT_EXPIRED: string;
|
|
28
|
-
ACCOUNT_INACTIVE: string;
|
|
29
|
-
ACCOUNT_DISABLED: string;
|
|
30
|
-
ACCOUNT_SUSPENDED: string;
|
|
31
|
-
ACCESS_DENIED: string;
|
|
32
|
-
ACCESS_TOKEN_REQUIRED: string;
|
|
33
|
-
PASSWORD_MISMATCH: string;
|
|
34
|
-
USERNAME_ALREADY_EXISTS: string;
|
|
35
|
-
VERIFICATION_CODE_MISMATCH: string;
|
|
36
|
-
VERIFICATION_CODE_SEND_FAILED: string;
|
|
37
|
-
}
|
|
38
|
-
interface ModerationErrorReason {
|
|
39
|
-
POSSIBLY_SENSITIVE: string;
|
|
40
|
-
ADULT_CONTENT: string;
|
|
41
|
-
NUDITY_CONTENT: string;
|
|
42
|
-
SEXUAL_CONTENT: string;
|
|
43
|
-
BLOODY_CONTENT: string;
|
|
44
|
-
WEAPON_CONTENT: string;
|
|
45
|
-
POLITICS_CONTENT: string;
|
|
46
|
-
VIOLENCE_CONTENT: string;
|
|
47
|
-
ABUSE_CONTENT: string;
|
|
48
|
-
ADVERTISEMENT_CONTENT: string;
|
|
49
|
-
CONTRABAND_CONTENT: string;
|
|
50
|
-
SPAM_CONTENT: string;
|
|
51
|
-
MEANINGLESS_CONTENT: string;
|
|
52
|
-
UNSAFE_TEXT_DETECTED: string;
|
|
53
|
-
}
|
|
54
|
-
interface MultipartErrorReason {
|
|
55
|
-
MAX_UPLOAD_SIZE_EXCEEDED: string;
|
|
56
|
-
MEDIA_TYPE_NOT_SUPPORTED: string;
|
|
57
|
-
MEDIA_TYPE_NOT_ACCEPTABLE: string;
|
|
58
|
-
}
|
|
59
|
-
interface AppErrorReason {
|
|
60
|
-
RATE_LIMIT_EXCEEDED: string;
|
|
61
|
-
INSUFFICIENT_CREDITS: string;
|
|
62
|
-
ALREADY_SUBSCRIBED_AT_OTHER_PLATFORM: string;
|
|
63
|
-
}
|
|
64
1
|
interface ErrorReason {
|
|
65
2
|
}
|
|
66
3
|
type ResolvedErrorReason = keyof ErrorReason extends never ? string : keyof ErrorReason;
|
|
67
4
|
|
|
68
|
-
export type {
|
|
5
|
+
export type { ErrorReason, ResolvedErrorReason };
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @example\n * import { Details, Status } from '@repo/error';\n *\n * Status.adapter = () => new Error('Error');\n *\n * const details = Details.new()\n * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })\n * .errorInfo({ reason: 'ACCOUNT_LOCKED' });\n *\n * throw Status.alreadyExists('xxx').error(details);\n */\n\nexport {\n LoginTimeoutError,\n LoginCanceledError,\n CheckoutCreateError,\n PurchaseError,\n} from './error/index';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @example\n * import { Details, Status } from '@repo/error';\n *\n * Status.adapter = () => new Error('Error');\n *\n * const details = Details.new()\n * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })\n * .errorInfo({ reason: 'ACCOUNT_LOCKED' });\n *\n * throw Status.alreadyExists('xxx').error(details);\n */\n\nexport {\n LoginTimeoutError,\n LoginCanceledError,\n CheckoutCreateError,\n PurchaseError,\n} from './error/index';\nexport type { ErrorReason, ResolvedErrorReason } from './error/reason';\nexport {\n DetailType,\n Details,\n type ErrorInfo,\n type RetryInfo,\n type DebugInfo,\n type QuotaFailure,\n type PreconditionFailure,\n type BadRequest,\n type RequestInfo,\n type ResourceInfo,\n type Help,\n type LocalizedMessage,\n type Detail,\n} from './error/detail';\nexport { Status, StatusError, type ErrorBody } from './error/status';\nexport { getErrorReason, getErrorMessage, getFieldViolations } from './error/parse';\nexport {\n Items,\n Pages,\n Cursor,\n pageParamsSchema,\n initialPageParam,\n getPreviousPageParam,\n getNextPageParam,\n} from './response';\nexport type {\n Empty,\n EntityId,\n Entity,\n Response,\n InitParams,\n NextParams,\n PrevParams,\n PageParams,\n ParentPageParams,\n Page,\n InfinitePageData,\n} from './response';\n\nexport { UidGenerator, uid } from './snowflake';\n\nexport * as MAX_LENGTH from './max-length/index';\nexport { timing } from './utils/timing';\nexport { ISO_3601_1, type ISO3166CountryCode } from './iso/iso_3601_1';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,mBAKO;AAEP,oBAcO;AACP,oBAAoD;AACpD,mBAAoE;AACpE,sBAQO;AAeP,uBAAkC;AAElC,iBAA4B;AAC5B,oBAAuB;AACvB,wBAAoD;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CheckoutCreateError, LoginCanceledError, LoginTimeoutError, PurchaseError } from './error/index.cjs';
|
|
2
|
-
export {
|
|
2
|
+
export { ErrorReason, ResolvedErrorReason } from './error/reason.cjs';
|
|
3
3
|
export { BadRequest, DebugInfo, Detail, DetailType, Details, ErrorInfo, Help, LocalizedMessage, PreconditionFailure, QuotaFailure, RequestInfo, ResourceInfo, RetryInfo } from './error/detail.cjs';
|
|
4
4
|
export { ErrorBody, Status, StatusError } from './error/status.cjs';
|
|
5
5
|
export { getErrorMessage, getErrorReason, getFieldViolations } from './error/parse.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { CheckoutCreateError, LoginCanceledError, LoginTimeoutError, PurchaseError } from './error/index.js';
|
|
2
|
-
export {
|
|
2
|
+
export { ErrorReason, ResolvedErrorReason } from './error/reason.js';
|
|
3
3
|
export { BadRequest, DebugInfo, Detail, DetailType, Details, ErrorInfo, Help, LocalizedMessage, PreconditionFailure, QuotaFailure, RequestInfo, ResourceInfo, RetryInfo } from './error/detail.js';
|
|
4
4
|
export { ErrorBody, Status, StatusError } from './error/status.js';
|
|
5
5
|
export { getErrorMessage, getErrorReason, getFieldViolations } from './error/parse.js';
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @example\n * import { Details, Status } from '@repo/error';\n *\n * Status.adapter = () => new Error('Error');\n *\n * const details = Details.new()\n * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })\n * .errorInfo({ reason: 'ACCOUNT_LOCKED' });\n *\n * throw Status.alreadyExists('xxx').error(details);\n */\n\nexport {\n LoginTimeoutError,\n LoginCanceledError,\n CheckoutCreateError,\n PurchaseError,\n} from './error/index';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @example\n * import { Details, Status } from '@repo/error';\n *\n * Status.adapter = () => new Error('Error');\n *\n * const details = Details.new()\n * .requestInfo({ requestId: '1234567890', servingData: '/v1/tests' })\n * .errorInfo({ reason: 'ACCOUNT_LOCKED' });\n *\n * throw Status.alreadyExists('xxx').error(details);\n */\n\nexport {\n LoginTimeoutError,\n LoginCanceledError,\n CheckoutCreateError,\n PurchaseError,\n} from './error/index';\nexport type { ErrorReason, ResolvedErrorReason } from './error/reason';\nexport {\n DetailType,\n Details,\n type ErrorInfo,\n type RetryInfo,\n type DebugInfo,\n type QuotaFailure,\n type PreconditionFailure,\n type BadRequest,\n type RequestInfo,\n type ResourceInfo,\n type Help,\n type LocalizedMessage,\n type Detail,\n} from './error/detail';\nexport { Status, StatusError, type ErrorBody } from './error/status';\nexport { getErrorReason, getErrorMessage, getFieldViolations } from './error/parse';\nexport {\n Items,\n Pages,\n Cursor,\n pageParamsSchema,\n initialPageParam,\n getPreviousPageParam,\n getNextPageParam,\n} from './response';\nexport type {\n Empty,\n EntityId,\n Entity,\n Response,\n InitParams,\n NextParams,\n PrevParams,\n PageParams,\n ParentPageParams,\n Page,\n InfinitePageData,\n} from './response';\n\nexport { UidGenerator, uid } from './snowflake';\n\nexport * as MAX_LENGTH from './max-length/index';\nexport { timing } from './utils/timing';\nexport { ISO_3601_1, type ISO3166CountryCode } from './iso/iso_3601_1';\n"],"mappings":";AAaA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,OAYK;AACP,SAAS,QAAQ,mBAAmC;AACpD,SAAS,gBAAgB,iBAAiB,0BAA0B;AACpE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAeP,SAAS,cAAc,WAAW;AAElC,YAAY,gBAAgB;AAC5B,SAAS,cAAc;AACvB,SAAS,kBAA2C;","names":[]}
|