@mtth/stl-errors 0.2.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/lib/types.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Virtual (type-level) key used to store tag information. We don't use a symbol
3
+ * to allow type-checking to work across compatible versions of this library.
4
+ */
5
+ const errorCodeTag = '@mtth/stl-errors:errorCodeTag+v1';
6
+ export {};
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@mtth/stl-errors",
3
+ "version": "0.2.0",
4
+ "repository": "github:mtth/sdk.ts",
5
+ "description": "Standard errors",
6
+ "keywords": [
7
+ "stl"
8
+ ],
9
+ "author": "Matthieu Monsch <mtth@apache.org>",
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "files": [
13
+ "lib/",
14
+ "resources/"
15
+ ],
16
+ "exports": "./lib/index.js",
17
+ "types": "./lib/index.d.ts",
18
+ "dependencies": {
19
+ "change-case": "^5.4.4"
20
+ },
21
+ "scripts": {
22
+ "build": "tsc -p src",
23
+ "clean": "rm -rf lib node_modules out",
24
+ "fix": "prettier --write",
25
+ "test": "vitest",
26
+ "watch": "tsc -b -w src test"
27
+ }
28
+ }
@@ -0,0 +1,17 @@
1
+ $id: resource://mtth@stl-errors/schemas/error-status.yaml
2
+ type: string
3
+ enum:
4
+ - UNKNOWN
5
+ - INTERNAL
6
+ - UNIMPLEMENTED
7
+ - UNAVAILABLE
8
+ - DEADLINE_EXCEEDED
9
+ - ABORTED
10
+ - INVALID_ARGUMENT
11
+ - UNAUTHENTICATED
12
+ - PERMISSION_DENIED
13
+ - NOT_FOUND
14
+ - ALREADY_EXISTS
15
+ - FAILED_PRECONDITION
16
+ - RESOURCE_EXHAUSTED
17
+ - CANCELLED
@@ -0,0 +1,13 @@
1
+ $id: resource://mtth@stl-errors/schemas/error.yaml
2
+ type: object
3
+ required:
4
+ - message
5
+ additionalProperties: false
6
+ properties:
7
+ message:
8
+ type: string
9
+ code:
10
+ type: string
11
+ tags:
12
+ type: object
13
+ additionalProperties: true
@@ -0,0 +1,11 @@
1
+ $id: resource://mtth@stl-errors/schemas/failure.yaml
2
+ type: object
3
+ required:
4
+ - status
5
+ - error
6
+ additionalProperties: false
7
+ properties:
8
+ status:
9
+ $ref: error-status.yaml
10
+ error:
11
+ $ref: error.yaml