@malloydata/malloy 0.0.130-dev240311153734 → 0.0.130-dev240311192728

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2023 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ // eslint-disable-next-line no-restricted-imports
26
+ const utils_1 = require("./utils");
27
+ describe('model/utils', () => {
28
+ it('should generate deterministic hashes', () => {
29
+ const hash1 = (0, utils_1.generateHash)('test-content');
30
+ expect(hash1).toEqual('ab17568f-0362-503d-a9c6-76fb0b203636');
31
+ });
32
+ it('should generate unique hashes', () => {
33
+ const hash1 = (0, utils_1.generateHash)('test-content');
34
+ const hash2 = (0, utils_1.generateHash)('test-content-different');
35
+ expect(hash1).not.toEqual(hash2);
36
+ });
37
+ });
38
+ //# sourceMappingURL=utils.spec.js.map
@@ -0,0 +1,14 @@
1
+ /// <reference types="jest" />
2
+ /**
3
+ * Accepts databases in env, either via comma-separated dialect list
4
+ * (MALLOY_DATABASES=) or a single database (MALLOY_DATABASE=). returns either
5
+ * databases defined in env or a default list that was passed.
6
+ */
7
+ export declare function databasesFromEnvironmentOr(defaultDatabases: string[]): string[];
8
+ /**
9
+ * Confirms that one or more of the databases being tested overlaps with
10
+ * the databases a test suite can accept. If there is overlap, return a tuple
11
+ * of jest.describe and the dialects to be tested if there is no overlap,
12
+ * return a tuple if jest.describe.skip and the dialects to be tested
13
+ */
14
+ export declare function describeIfDatabaseAvailable(acceptableDatabases: string[]): [jest.Describe, string[]];
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 Google LLC
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining
6
+ * a copy of this software and associated documentation files
7
+ * (the "Software"), to deal in the Software without restriction,
8
+ * including without limitation the rights to use, copy, modify, merge,
9
+ * publish, distribute, sublicense, and/or sell copies of the Software,
10
+ * and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be
14
+ * included in all copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.describeIfDatabaseAvailable = exports.databasesFromEnvironmentOr = void 0;
26
+ /**
27
+ * Accepts databases in env, either via comma-separated dialect list
28
+ * (MALLOY_DATABASES=) or a single database (MALLOY_DATABASE=). returns either
29
+ * databases defined in env or a default list that was passed.
30
+ */
31
+ function databasesFromEnvironmentOr(defaultDatabases) {
32
+ return process.env['MALLOY_DATABASES']
33
+ ? process.env['MALLOY_DATABASES'].split(',')
34
+ : process.env['MALLOY_DATABASE']
35
+ ? [process.env['MALLOY_DATABASE']]
36
+ : defaultDatabases;
37
+ }
38
+ exports.databasesFromEnvironmentOr = databasesFromEnvironmentOr;
39
+ /**
40
+ * A replacement for [describe()] that mimics [describe.skip()]
41
+ */
42
+ const describeSkip = Object.assign((name, fn) => describe.skip(name, fn), {
43
+ skip: describe.skip,
44
+ // eslint-disable-next-line no-restricted-properties
45
+ only: describe.only,
46
+ each: (() => () => it.skip('skipped', () => { })),
47
+ });
48
+ /**
49
+ * Confirms that one or more of the databases being tested overlaps with
50
+ * the databases a test suite can accept. If there is overlap, return a tuple
51
+ * of jest.describe and the dialects to be tested if there is no overlap,
52
+ * return a tuple if jest.describe.skip and the dialects to be tested
53
+ */
54
+ function describeIfDatabaseAvailable(acceptableDatabases) {
55
+ const currentDatabases = databasesFromEnvironmentOr(acceptableDatabases);
56
+ const overlap = acceptableDatabases.filter(d => currentDatabases.includes(d));
57
+ return overlap.length > 0 ? [describe, overlap] : [describeSkip, overlap];
58
+ }
59
+ exports.describeIfDatabaseAvailable = describeIfDatabaseAvailable;
60
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,21 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.130-dev240311153734",
3
+ "version": "0.0.130-dev240311192728",
4
4
  "license": "MIT",
5
+ "exports": {
6
+ ".": "./dist/index.js",
7
+ "./test": "./dist/test/index.js"
8
+ },
9
+ "typesVersions": {
10
+ "*": {
11
+ "index": [
12
+ "./dist/index.d.ts"
13
+ ],
14
+ "test": [
15
+ "./dist/test/index.d.ts"
16
+ ]
17
+ }
18
+ },
5
19
  "main": "dist/index.js",
6
20
  "types": "dist/index.d.ts",
7
21
  "homepage": "https://github.com/malloydata/malloy#readme",