@dra2020/dra-types 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Dave's Redistricting
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # dra-types
2
+ Types shared between DRA client, server and cli
package/dist/all.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dra-types';
@@ -0,0 +1,22 @@
1
+ export interface Comment {
2
+ userid: string;
3
+ text: string;
4
+ date: string;
5
+ }
6
+ export interface CommentList {
7
+ id: string;
8
+ [commentid: string]: Comment | string;
9
+ }
10
+ export declare type LikeType = 'like' | 'love' | 'wow' | 'angry' | 'funny';
11
+ export interface Like {
12
+ date: string;
13
+ type: LikeType;
14
+ }
15
+ export interface LikeList {
16
+ id: string;
17
+ [userid: string]: Like | string;
18
+ }
19
+ export interface UserLikes {
20
+ id: string;
21
+ [aid: string]: Like | string;
22
+ }
@@ -0,0 +1,115 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory();
4
+ else if(typeof define === 'function' && define.amd)
5
+ define([], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["dra-types"] = factory();
8
+ else
9
+ root["dra-types"] = factory();
10
+ })(global, function() {
11
+ return /******/ (function(modules) { // webpackBootstrap
12
+ /******/ // The module cache
13
+ /******/ var installedModules = {};
14
+ /******/
15
+ /******/ // The require function
16
+ /******/ function __webpack_require__(moduleId) {
17
+ /******/
18
+ /******/ // Check if module is in cache
19
+ /******/ if(installedModules[moduleId]) {
20
+ /******/ return installedModules[moduleId].exports;
21
+ /******/ }
22
+ /******/ // Create a new module (and put it into the cache)
23
+ /******/ var module = installedModules[moduleId] = {
24
+ /******/ i: moduleId,
25
+ /******/ l: false,
26
+ /******/ exports: {}
27
+ /******/ };
28
+ /******/
29
+ /******/ // Execute the module function
30
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
+ /******/
32
+ /******/ // Flag the module as loaded
33
+ /******/ module.l = true;
34
+ /******/
35
+ /******/ // Return the exports of the module
36
+ /******/ return module.exports;
37
+ /******/ }
38
+ /******/
39
+ /******/
40
+ /******/ // expose the modules object (__webpack_modules__)
41
+ /******/ __webpack_require__.m = modules;
42
+ /******/
43
+ /******/ // expose the module cache
44
+ /******/ __webpack_require__.c = installedModules;
45
+ /******/
46
+ /******/ // define getter function for harmony exports
47
+ /******/ __webpack_require__.d = function(exports, name, getter) {
48
+ /******/ if(!__webpack_require__.o(exports, name)) {
49
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
50
+ /******/ }
51
+ /******/ };
52
+ /******/
53
+ /******/ // define __esModule on exports
54
+ /******/ __webpack_require__.r = function(exports) {
55
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
+ /******/ }
58
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
59
+ /******/ };
60
+ /******/
61
+ /******/ // create a fake namespace object
62
+ /******/ // mode & 1: value is a module id, require it
63
+ /******/ // mode & 2: merge all properties of value into the ns
64
+ /******/ // mode & 4: return value when already ns object
65
+ /******/ // mode & 8|1: behave like require
66
+ /******/ __webpack_require__.t = function(value, mode) {
67
+ /******/ if(mode & 1) value = __webpack_require__(value);
68
+ /******/ if(mode & 8) return value;
69
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70
+ /******/ var ns = Object.create(null);
71
+ /******/ __webpack_require__.r(ns);
72
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74
+ /******/ return ns;
75
+ /******/ };
76
+ /******/
77
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
78
+ /******/ __webpack_require__.n = function(module) {
79
+ /******/ var getter = module && module.__esModule ?
80
+ /******/ function getDefault() { return module['default']; } :
81
+ /******/ function getModuleExports() { return module; };
82
+ /******/ __webpack_require__.d(getter, 'a', getter);
83
+ /******/ return getter;
84
+ /******/ };
85
+ /******/
86
+ /******/ // Object.prototype.hasOwnProperty.call
87
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88
+ /******/
89
+ /******/ // __webpack_public_path__
90
+ /******/ __webpack_require__.p = "";
91
+ /******/
92
+ /******/
93
+ /******/ // Load entry module and return exports
94
+ /******/ return __webpack_require__(__webpack_require__.s = "./lib/all.ts");
95
+ /******/ })
96
+ /************************************************************************/
97
+ /******/ ({
98
+
99
+ /***/ "./lib/all.ts":
100
+ /*!********************!*\
101
+ !*** ./lib/all.ts ***!
102
+ \********************/
103
+ /*! no static exports found */
104
+ /***/ (function(module, exports, __webpack_require__) {
105
+
106
+ "use strict";
107
+
108
+ Object.defineProperty(exports, "__esModule", { value: true });
109
+
110
+
111
+ /***/ })
112
+
113
+ /******/ });
114
+ });
115
+ //# sourceMappingURL=dra-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://dra-types/webpack/universalModuleDefinition","webpack://dra-types/webpack/bootstrap"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA","file":"dra-types.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"dra-types\"] = factory();\n\telse\n\t\troot[\"dra-types\"] = factory();\n})(global, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./lib/all.ts\");\n"],"sourceRoot":""}
package/lib/all.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './dra-types';
@@ -0,0 +1,38 @@
1
+ // Type for single comment
2
+ export interface Comment
3
+ {
4
+ userid: string;
5
+ text: string;
6
+ date: string;
7
+ }
8
+
9
+ // Comment record associated with a map
10
+ export interface CommentList
11
+ {
12
+ id: string;
13
+ [commentid: string]: Comment | string; // Really just Comment but make TypeScript happy
14
+ }
15
+
16
+ // Supported like types
17
+ export type LikeType = 'like' | 'love' | 'wow' | 'angry' | 'funny';
18
+
19
+ // Like record for an individual like
20
+ export interface Like
21
+ {
22
+ date: string;
23
+ type: LikeType;
24
+ }
25
+
26
+ // Record for likes associated with a map
27
+ export interface LikeList
28
+ {
29
+ id: string;
30
+ [userid: string]: Like | string; // Really just Like but make TypeScript happy
31
+ }
32
+
33
+ // Record for likes an individual user has performed
34
+ export interface UserLikes
35
+ {
36
+ id: string;
37
+ [aid: string]: Like | string; // Really just Like but make TypeScript happy
38
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@dra2020/dra-types",
3
+ "version": "1.0.1",
4
+ "description": "Shared types used between client and server.",
5
+ "main": "dist/dra-types.js",
6
+ "types": "./dist/all.d.ts",
7
+ "scripts": {
8
+ "test": "echo \"No test defined.\"",
9
+ "build": "webpack",
10
+ "webpack": "node_modules/.bin/webpack"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/dra2020/dra-types.git"
15
+ },
16
+ "keywords": [
17
+ "Typescript"
18
+ ],
19
+ "author": "Terry Crowley",
20
+ "license": "MIT",
21
+ "bugs": {
22
+ "url": "https://github.com/dra2020/dra-types/issues"
23
+ },
24
+ "homepage": "https://github.com/dra2020/dra-types#readme",
25
+ "devDependencies": {
26
+ "@types/node": "12.7.2",
27
+ "source-map-loader": "^0.2.4",
28
+ "ts-loader": "^6.1.2",
29
+ "tsify": "^4.0.1",
30
+ "typescript": "^3.6.3",
31
+ "webpack": "^4.40.2",
32
+ "webpack-cli": "^3.3.9"
33
+ },
34
+ "dependencies": {}
35
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "files": [
3
+ "lib/all.ts",
4
+ "lib/dra-types.ts"
5
+ ],
6
+
7
+ "include": [
8
+ "types/**/*"
9
+ ],
10
+
11
+ "compilerOptions": {
12
+ "sourceMap": true,
13
+ "noImplicitAny": true,
14
+ "target": "es6",
15
+ "module": "commonjs",
16
+ "declaration": true,
17
+ "declarationDir": "dist/",
18
+ "types": [
19
+ "node"
20
+ ]
21
+ }
22
+ }
@@ -0,0 +1,35 @@
1
+ var libConfig = {
2
+ entry: {
3
+ library: './lib/all.ts'
4
+ },
5
+ target: 'node',
6
+ mode: 'development',
7
+ output: {
8
+ library: 'dra-types',
9
+ libraryTarget: 'umd',
10
+ path: __dirname + '/dist',
11
+ filename: 'dra-types.js'
12
+ },
13
+
14
+ // Enable source maps
15
+ devtool: "source-map",
16
+
17
+ externals: {
18
+ },
19
+
20
+
21
+ module: {
22
+ rules: [
23
+ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/ },
24
+ { test: /\.json$/, loader: 'json-loader' },
25
+ { test: /\.js$/, enforce: "pre", loader: "source-map-loader" }
26
+ ]
27
+ },
28
+
29
+ resolve: {
30
+ extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"]
31
+ }
32
+
33
+ };
34
+
35
+ module.exports = [ libConfig ];