@closerplatform/spinner-auth 0.11.288

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/.dockerignore ADDED
@@ -0,0 +1,3 @@
1
+ .git
2
+ .gitlab-ci.yml
3
+ *.md
package/Dockerfile ADDED
@@ -0,0 +1,18 @@
1
+ FROM node:14.5.0-alpine3.12
2
+
3
+ RUN apk add --no-cache python3 py3-pip
4
+ RUN python3 -m pip install pyyaml
5
+
6
+ WORKDIR /tmp/generator
7
+
8
+ COPY generator/package-lock.json .
9
+ COPY generator/package.json .
10
+
11
+ RUN npm ci
12
+ RUN npm set unsafe-perm true
13
+
14
+ WORKDIR /tmp
15
+
16
+ COPY . .
17
+
18
+ CMD ["./build_local.sh"]
package/Pipfile ADDED
@@ -0,0 +1,12 @@
1
+ [[source]]
2
+ name = "pypi"
3
+ url = "https://pypi.org/simple"
4
+ verify_ssl = true
5
+
6
+ [dev-packages]
7
+
8
+ [packages]
9
+ pyyaml = "*"
10
+
11
+ [requires]
12
+ python_version = "2.7"
package/Pipfile.lock ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "_meta": {
3
+ "hash": {
4
+ "sha256": "a6078021503c4a2cf63fef1404f3eda2dac2efc2344ada5295a89ca1b7fdef19"
5
+ },
6
+ "pipfile-spec": 6,
7
+ "requires": {
8
+ "python_version": "2.7"
9
+ },
10
+ "sources": [
11
+ {
12
+ "name": "pypi",
13
+ "url": "https://pypi.org/simple",
14
+ "verify_ssl": true
15
+ }
16
+ ]
17
+ },
18
+ "default": {
19
+ "pyyaml": {
20
+ "hashes": [
21
+ "sha256:1adecc22f88d38052fb787d959f003811ca858b799590a5eaa70e63dca50308c",
22
+ "sha256:436bc774ecf7c103814098159fbb84c2715d25980175292c648f2da143909f95",
23
+ "sha256:460a5a4248763f6f37ea225d19d5c205677d8d525f6a83357ca622ed541830c2",
24
+ "sha256:5a22a9c84653debfbf198d02fe592c176ea548cccce47553f35f466e15cf2fd4",
25
+ "sha256:7a5d3f26b89d688db27822343dfa25c599627bc92093e788956372285c6298ad",
26
+ "sha256:9372b04a02080752d9e6f990179a4ab840227c6e2ce15b95e1278456664cf2ba",
27
+ "sha256:a5dcbebee834eaddf3fa7366316b880ff4062e4bcc9787b78c7fbb4a26ff2dd1",
28
+ "sha256:aee5bab92a176e7cd034e57f46e9df9a9862a71f8f37cad167c6fc74c65f5b4e",
29
+ "sha256:c51f642898c0bacd335fc119da60baae0824f2cde95b0330b56c0553439f0673",
30
+ "sha256:c68ea4d3ba1705da1e0d85da6684ac657912679a649e8868bd850d2c299cce13",
31
+ "sha256:e23d0cc5299223dcc37885dae624f382297717e459ea24053709675a976a3e19"
32
+ ],
33
+ "index": "pypi",
34
+ "version": "==5.1"
35
+ }
36
+ },
37
+ "develop": {}
38
+ }
package/build_local.sh ADDED
@@ -0,0 +1,30 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ if [[ -z ${PROJECT_NAME} ]]; then
6
+ echo '$PROJECT_NAME not set' ; exit 1
7
+ fi
8
+ if [[ -z ${YAML_FILE} ]]; then
9
+ echo '$YAML_FILE not set' ; exit 1
10
+ fi
11
+ if [[ -z ${VERSION_FILE} ]]; then
12
+ echo '$VERSION_FILE not set' ; exit 1
13
+ fi
14
+ if [[ -z ${CLASS_NAME} ]]; then
15
+ echo '$CLASS_NAME not set' ; exit 1
16
+ fi
17
+
18
+ WORKDIR=wd
19
+
20
+ mkdir -p ${WORKDIR} src
21
+
22
+ python3 generator/tools/yaml2json3.py < ${YAML_FILE} > ${WORKDIR}/api.json
23
+ ./generator/index.js < ${WORKDIR}/api.json > src/index.ts
24
+ export PROJECT_VERSION=$(cat ${VERSION_FILE})
25
+
26
+ python3 generator/tools/makePackageJson.py > package.json
27
+
28
+ npm run clean --unsafe-perm
29
+ npm install --unsafe-perm
30
+ npm publish --unsafe-perm
@@ -0,0 +1,52 @@
1
+ /**
2
+ * NOTE: This file is auto generated.
3
+ * Do not edit the file manually.
4
+ */
5
+ export declare class AuthClient {
6
+ private baseUrl;
7
+ private http;
8
+ apiKey: string;
9
+ constructor(baseUrl?: string, http?: {
10
+ fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
11
+ });
12
+ /**
13
+ * Internal backend call to verify apiKey.
14
+ * @method
15
+ * @name AuthClient#verifyApiKey
16
+ * @param {string} xApiKey -
17
+ */
18
+ verifyApiKey(xApiKey: string): Promise<UserId> & verifyApiKey.CallBacks;
19
+ verifyApiKeyURL(xApiKey: string): string;
20
+ /**
21
+ * Internal backend call to verify user id.
22
+ * @method
23
+ * @name AuthClient#verifyId
24
+ */
25
+ verifyId(): Promise<UserId> & verifyId.CallBacks;
26
+ verifyIdURL(): string;
27
+ }
28
+ export declare class UserId {
29
+ id: string;
30
+ constructor(args: UserId.Args);
31
+ }
32
+ export declare module UserId {
33
+ interface Args {
34
+ id: string;
35
+ }
36
+ }
37
+ export declare module verifyApiKey {
38
+ type HttpCodes = "200" | "401";
39
+ interface CallBacks {
40
+ on200: (cb: (data: UserId, response: Response) => void) => Promise<UserId> & verifyApiKey.CallBacks;
41
+ on401: (cb: (data: any, response: Response) => void) => Promise<UserId> & verifyApiKey.CallBacks;
42
+ onUnhandled: (cb: (data: any, response: Response) => void) => Promise<UserId> & verifyApiKey.CallBacks;
43
+ }
44
+ }
45
+ export declare module verifyId {
46
+ type HttpCodes = "200" | "401";
47
+ interface CallBacks {
48
+ on200: (cb: (data: UserId, response: Response) => void) => Promise<UserId> & verifyId.CallBacks;
49
+ on401: (cb: (data: any, response: Response) => void) => Promise<UserId> & verifyId.CallBacks;
50
+ onUnhandled: (cb: (data: any, response: Response) => void) => Promise<UserId> & verifyId.CallBacks;
51
+ }
52
+ }
package/dist/index.js ADDED
@@ -0,0 +1,174 @@
1
+ /* tslint: disable */
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /**
5
+ * NOTE: This file is auto generated.
6
+ * Do not edit the file manually.
7
+ */
8
+ var AuthClient = (function () {
9
+ function AuthClient(baseUrl, http) {
10
+ this.baseUrl = baseUrl ? baseUrl : '';
11
+ this.http = http ? http : window;
12
+ }
13
+ /**
14
+ * Internal backend call to verify apiKey.
15
+ * @method
16
+ * @name AuthClient#verifyApiKey
17
+ * @param {string} xApiKey -
18
+ */
19
+ AuthClient.prototype.verifyApiKey = function (xApiKey) {
20
+ var headerParameters = {};
21
+ var path = this.verifyApiKeyURL(xApiKey);
22
+ headerParameters['Content-Type'] = 'application/json';
23
+ headerParameters['X-Api-Key'] = this.apiKey;
24
+ if (xApiKey === undefined || xApiKey === null) {
25
+ throw { reason: "The parameter 'xApiKey' must be defined." };
26
+ }
27
+ if (xApiKey !== undefined) {
28
+ headerParameters['X-Api-Key'] = xApiKey;
29
+ }
30
+ var callBacks = {};
31
+ var unhandledCallback = undefined;
32
+ var fetchPromise = this.http.fetch(path, {
33
+ method: 'GET',
34
+ headers: headerParameters,
35
+ credentials: 'include'
36
+ }).then(function (response) {
37
+ return response.text().then(function (data) {
38
+ var parsedData = data;
39
+ var contentType = response.headers.get("content-type");
40
+ var status = response.status.toString();
41
+ try {
42
+ parsedData = JSON.parse(data);
43
+ }
44
+ catch (exc) {
45
+ if (contentType && contentType.indexOf("application/json") !== -1) {
46
+ console.error("Server sent non-JSON content with 'application/json' Content-Type header:", data);
47
+ throw { response: response, body: data, reason: "Failed to parse JSON: " + data };
48
+ }
49
+ }
50
+ if (typeof callBacks[status] === "function") {
51
+ var callback = callBacks[status];
52
+ if (status === "200") {
53
+ callback(new UserId(parsedData));
54
+ }
55
+ if (status === "401") {
56
+ callback(parsedData);
57
+ }
58
+ }
59
+ else if (typeof unhandledCallback === "function") {
60
+ unhandledCallback(parsedData, response);
61
+ }
62
+ if (status === "200") {
63
+ return new UserId(parsedData);
64
+ }
65
+ if (callBacks[status] === undefined && unhandledCallback === undefined) {
66
+ throw { response: response, body: data, reason: "Response code" };
67
+ }
68
+ });
69
+ });
70
+ var fetchPromiseWithCallbacks = fetchPromise;
71
+ fetchPromiseWithCallbacks.on200 = function (cb) {
72
+ callBacks["200"] = cb;
73
+ return fetchPromiseWithCallbacks;
74
+ };
75
+ fetchPromiseWithCallbacks.on401 = function (cb) {
76
+ callBacks["401"] = cb;
77
+ return fetchPromiseWithCallbacks;
78
+ };
79
+ fetchPromiseWithCallbacks.onUnhandled = function (cb) {
80
+ unhandledCallback = cb;
81
+ return fetchPromiseWithCallbacks;
82
+ };
83
+ return fetchPromiseWithCallbacks;
84
+ };
85
+ AuthClient.prototype.verifyApiKeyURL = function (xApiKey) {
86
+ var queryParameters = {};
87
+ var path = this.baseUrl + '/users/byApiKey';
88
+ if (xApiKey === undefined || xApiKey === null) {
89
+ throw { reason: "The parameter 'xApiKey' must be defined." };
90
+ }
91
+ return path;
92
+ };
93
+ /**
94
+ * Internal backend call to verify user id.
95
+ * @method
96
+ * @name AuthClient#verifyId
97
+ */
98
+ AuthClient.prototype.verifyId = function () {
99
+ var headerParameters = {};
100
+ var path = this.verifyIdURL();
101
+ headerParameters['Content-Type'] = 'application/json';
102
+ headerParameters['X-Api-Key'] = this.apiKey;
103
+ var callBacks = {};
104
+ var unhandledCallback = undefined;
105
+ var fetchPromise = this.http.fetch(path, {
106
+ method: 'GET',
107
+ headers: headerParameters,
108
+ credentials: 'include'
109
+ }).then(function (response) {
110
+ return response.text().then(function (data) {
111
+ var parsedData = data;
112
+ var contentType = response.headers.get("content-type");
113
+ var status = response.status.toString();
114
+ try {
115
+ parsedData = JSON.parse(data);
116
+ }
117
+ catch (exc) {
118
+ if (contentType && contentType.indexOf("application/json") !== -1) {
119
+ console.error("Server sent non-JSON content with 'application/json' Content-Type header:", data);
120
+ throw { response: response, body: data, reason: "Failed to parse JSON: " + data };
121
+ }
122
+ }
123
+ if (typeof callBacks[status] === "function") {
124
+ var callback = callBacks[status];
125
+ if (status === "200") {
126
+ callback(new UserId(parsedData));
127
+ }
128
+ if (status === "401") {
129
+ callback(parsedData);
130
+ }
131
+ }
132
+ else if (typeof unhandledCallback === "function") {
133
+ unhandledCallback(parsedData, response);
134
+ }
135
+ if (status === "200") {
136
+ return new UserId(parsedData);
137
+ }
138
+ if (callBacks[status] === undefined && unhandledCallback === undefined) {
139
+ throw { response: response, body: data, reason: "Response code" };
140
+ }
141
+ });
142
+ });
143
+ var fetchPromiseWithCallbacks = fetchPromise;
144
+ fetchPromiseWithCallbacks.on200 = function (cb) {
145
+ callBacks["200"] = cb;
146
+ return fetchPromiseWithCallbacks;
147
+ };
148
+ fetchPromiseWithCallbacks.on401 = function (cb) {
149
+ callBacks["401"] = cb;
150
+ return fetchPromiseWithCallbacks;
151
+ };
152
+ fetchPromiseWithCallbacks.onUnhandled = function (cb) {
153
+ unhandledCallback = cb;
154
+ return fetchPromiseWithCallbacks;
155
+ };
156
+ return fetchPromiseWithCallbacks;
157
+ };
158
+ AuthClient.prototype.verifyIdURL = function () {
159
+ var queryParameters = {};
160
+ var path = this.baseUrl + '/users/byId';
161
+ return path;
162
+ };
163
+ return AuthClient;
164
+ }());
165
+ exports.AuthClient = AuthClient;
166
+ var UserId = (function () {
167
+ function UserId(args) {
168
+ if (typeof (args.id) === 'undefined' || args.id === null)
169
+ throw '`id` property is required';
170
+ this.id = args.id;
171
+ }
172
+ return UserId;
173
+ }());
174
+ exports.UserId = UserId;
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@closerplatform/spinner-auth",
3
+ "version": "0.11.288",
4
+ "private": false,
5
+ "description": "",
6
+ "main": "./dist/index.js",
7
+ "typings": "./dist/index.d.ts",
8
+ "scripts": {
9
+ "clean": "rm -rf dist node_modules",
10
+ "prepublish": "./node_modules/.bin/tsc"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "config": {
16
+ "unsafe-perm": true
17
+ },
18
+ "author": "",
19
+ "license": "ISC",
20
+ "devDependencies": {
21
+ "@types/es6-shim": "0.31.32",
22
+ "typescript": "~2.2.1"
23
+ }
24
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "target": "es5",
5
+ "module": "commonjs",
6
+ "noImplicitAny": false,
7
+ "outDir": "dist/"
8
+ },
9
+ "include": [
10
+ "src/**/*",
11
+ "typings/**/*"
12
+ ],
13
+ "exclude": [
14
+ "dist",
15
+ "node_modules"
16
+ ],
17
+ "typeRoots": [
18
+ "./typings",
19
+ "./node_modules/@types"
20
+ ]
21
+ }
package/tslint.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "rules": {
3
+ "adjacent-overload-signatures": true,
4
+ "arrow-parens": true,
5
+ "class-name": true,
6
+ "comment-format": [true, "check-space"],
7
+ "curly": true,
8
+ "eofline": true,
9
+ "forin": true,
10
+ "indent": [true, "spaces", 2],
11
+ "max-line-length": [true, 120],
12
+ "max-file-line-count": [true, 500],
13
+ "member-access": false,
14
+ "member-ordering": false,
15
+ "new-parens": true,
16
+ "no-angle-bracket-type-assertion": true,
17
+ "no-any": false,
18
+ "no-arg": true,
19
+ "no-bitwise": true,
20
+ "no-conditional-assignment": true,
21
+ "no-consecutive-blank-lines": true,
22
+ "no-constructor-vars": true,
23
+ "no-default-export": true,
24
+ "no-duplicate-key": true,
25
+ "no-duplicate-variable": true,
26
+ "no-empty": true,
27
+ "no-eval": true,
28
+ "no-inferrable-types": true,
29
+ "no-internal-module": true,
30
+ "no-invalid-this": true,
31
+ "no-null-keyword": true,
32
+ "no-reference": true,
33
+ "no-require-imports": false,
34
+ "no-shadowed-variable": true,
35
+ "no-string-literal": false,
36
+ "no-switch-case-fall-through": true,
37
+ "no-trailing-whitespace": true,
38
+ "no-unreachable": true,
39
+ "no-unsafe-finally": true,
40
+ "no-unused-expression": true,
41
+ "no-unused-new": true,
42
+ "no-unused-variable": false,
43
+ "no-use-before-declare": true,
44
+ "no-var-keyword": true,
45
+ "no-var-requires": false,
46
+ "object-literal-shorthand": true,
47
+ "one-line": [true, "check-open-brace", "check-whitespace"],
48
+ "one-variable-per-declaration": true,
49
+ "ordered-imports": true,
50
+ "quotemark": [true, "double"],
51
+ "restrict-plus-operands": false,
52
+ "semicolon": true,
53
+ "switch-default": true,
54
+ "triple-equals": true,
55
+ "typedef-whitespace": [true, {
56
+ "call-signature": "nospace",
57
+ "index-signature": "nospace",
58
+ "parameter": "nospace",
59
+ "property-declaration": "nospace",
60
+ "variable-declaration": "nospace"
61
+ }],
62
+ "use-isnan": true,
63
+ "use-strict": true,
64
+ "variable-name": [true, "ban-keywords"],
65
+ "whitespace": [true,
66
+ "check-branch",
67
+ "check-decl",
68
+ "check-operator",
69
+ "check-separator",
70
+ "check-type"
71
+ ]
72
+ }
73
+ }
@@ -0,0 +1,38 @@
1
+ interface Symbol {
2
+ toString(): string;
3
+ valueOf(): Object;
4
+ }
5
+
6
+ interface SymbolConstructor {
7
+ prototype: Symbol;
8
+ (description?: string|number): symbol;
9
+ for(key: string): symbol;
10
+ keyFor(sym: symbol): string;
11
+ }
12
+
13
+ declare var Symbol: SymbolConstructor;
14
+
15
+ interface SymbolConstructor {
16
+ hasInstance: symbol;
17
+ isConcatSpreadable: symbol;
18
+ match: symbol;
19
+ replace: symbol;
20
+ search: symbol;
21
+ species: symbol;
22
+ split: symbol;
23
+ toPrimitive: symbol;
24
+ toStringTag: symbol;
25
+ unscopables: symbol;
26
+ }
27
+
28
+ interface Symbol {
29
+ [Symbol.toStringTag]: "Symbol";
30
+ }
31
+
32
+ interface SymbolConstructor {
33
+ iterator: symbol;
34
+ }
35
+
36
+ interface IterableIterator<T> extends Iterator<T> {
37
+ [Symbol.iterator](): IterableIterator<T>;
38
+ }
@@ -0,0 +1 @@
1
+ {"/opt/yarn-v1.22.4/lib/cli.js":["6ce0bd7a5a5a69059850f861cf5ab1a46f3b0680",0,2268688]}