@snowplow/snowtype 0.1.0 → 0.1.2

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.
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SnowtypeMissingLockError = exports.SnowtypeWriteLockError = exports.SnowtypeAuthError = exports.SnowtypeMissingOptionsError = exports.SnowtypeOptionError = exports.SnowtypeInternalError = exports.SnowtypeConfigInvalidError = exports.SnowtypeConfigMissingError = exports.SnowtypeConfigExistsError = exports.SnowtypeError = void 0;
4
- const ERROR_CODES = {
5
- AuthError: 'Authentication failed. Check if your API key and organization ID are correct.',
6
- ConfigAlreadyExists: `Snowtype config file already exists.`,
7
- ConfigNotExists: `Snowtype config file does not exist in current directory. Start with running 'init'.`,
8
- ConfigInvalid: `Snowtype config exists but it is invalid.`,
9
- InternalError: 'An internal error occured.',
10
- InvalidOption: 'Invalid option provided.',
11
- MissingOptions: 'Action called with no options.',
12
- WriteLockFile: 'Failed writing lock file.',
13
- MissingLockFile: 'Missing lockfile. You might need to run `snowtype generate` first.'
14
- };
15
- const BUG_PROMPT = 'Please report a bug.';
16
- class SnowtypeError extends Error {
17
- code;
18
- constructor(code, message = '') {
19
- const errMessage = ERROR_CODES[code].concat(message);
20
- super(errMessage);
21
- // hide this constructor calls from the stack
22
- Error.captureStackTrace(this, this.constructor);
23
- this.name = this.constructor.name;
24
- this.code = code;
25
- }
26
- }
27
- exports.SnowtypeError = SnowtypeError;
28
- class SnowtypeConfigExistsError extends SnowtypeError {
29
- constructor() {
30
- super('ConfigAlreadyExists');
31
- }
32
- }
33
- exports.SnowtypeConfigExistsError = SnowtypeConfigExistsError;
34
- class SnowtypeConfigMissingError extends SnowtypeError {
35
- constructor() {
36
- super('ConfigNotExists');
37
- }
38
- }
39
- exports.SnowtypeConfigMissingError = SnowtypeConfigMissingError;
40
- class SnowtypeConfigInvalidError extends SnowtypeError {
41
- constructor(message) {
42
- super('ConfigInvalid', message);
43
- }
44
- }
45
- exports.SnowtypeConfigInvalidError = SnowtypeConfigInvalidError;
46
- class SnowtypeInternalError extends SnowtypeError {
47
- constructor(message) {
48
- super('InternalError', message.concat(BUG_PROMPT));
49
- }
50
- }
51
- exports.SnowtypeInternalError = SnowtypeInternalError;
52
- class SnowtypeOptionError extends SnowtypeError {
53
- constructor(option, value) {
54
- const msg = `Value ${value} is an invalid ${option}.`;
55
- super('InvalidOption', msg);
56
- }
57
- }
58
- exports.SnowtypeOptionError = SnowtypeOptionError;
59
- class SnowtypeMissingOptionsError extends SnowtypeError {
60
- constructor() {
61
- super('MissingOptions');
62
- }
63
- }
64
- exports.SnowtypeMissingOptionsError = SnowtypeMissingOptionsError;
65
- class SnowtypeAuthError extends SnowtypeError {
66
- constructor() {
67
- super('AuthError');
68
- }
69
- }
70
- exports.SnowtypeAuthError = SnowtypeAuthError;
71
- class SnowtypeWriteLockError extends SnowtypeError {
72
- constructor() {
73
- super('WriteLockFile');
74
- }
75
- }
76
- exports.SnowtypeWriteLockError = SnowtypeWriteLockError;
77
- class SnowtypeMissingLockError extends SnowtypeError {
78
- constructor() {
79
- super('MissingLockFile');
80
- }
81
- }
82
- exports.SnowtypeMissingLockError = SnowtypeMissingLockError;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceIgluSchemaPart = exports.splitIgluSchemaUrlParts = exports.hashSHA256 = void 0;
4
- const js_sha256_1 = require("js-sha256");
5
- function hashSHA256(content) {
6
- const hash = js_sha256_1.sha256.create();
7
- hash.update(content);
8
- const hashHex = hash.hex();
9
- return hashHex;
10
- }
11
- exports.hashSHA256 = hashSHA256;
12
- function splitIgluSchemaUrlParts(schema) {
13
- /* Remove iglu: prefix to allow for it to be either included or not */
14
- const schemaFormat = schema.replace("iglu:", "");
15
- const [vendor, name, format, version] = schemaFormat.split("/");
16
- return { vendor, name, format, version };
17
- }
18
- exports.splitIgluSchemaUrlParts = splitIgluSchemaUrlParts;
19
- function replaceIgluSchemaPart(schema, { vendor, name, format, version }) {
20
- const schemaFormat = schema.replace("iglu:", "");
21
- const [initialVendor, initialName, initialFormat, initialVersion] = schemaFormat.split("/");
22
- return `iglu:${vendor || initialVendor}/${name || initialName}/${format || initialFormat}/${version || initialVersion}`;
23
- }
24
- exports.replaceIgluSchemaPart = replaceIgluSchemaPart;
package/dist/version.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PKG_VERSION = void 0;
4
- exports.PKG_VERSION = "0.1.0";