@ninetailed/experience.js-node 3.0.0-beta.15 → 3.0.0-beta.20
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/main.js +178 -0
- package/main.js.map +1 -0
- package/package.json +9 -12
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -14
- package/src/index.js.map +0 -1
- package/src/lib/Client/Client.d.ts +0 -14
- package/src/lib/Client/Client.js +0 -55
- package/src/lib/Client/Client.js.map +0 -1
- package/src/lib/Client/index.d.ts +0 -1
- package/src/lib/Client/index.js +0 -14
- package/src/lib/Client/index.js.map +0 -1
- package/src/lib/index.d.ts +0 -1
- package/src/lib/index.js +0 -6
- package/src/lib/index.js.map +0 -1
package/main.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ var __webpack_modules__ = ({
|
|
4
|
+
|
|
5
|
+
/***/ "./packages/sdks/nodejs/src/index.ts":
|
|
6
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
24
|
+
__exportStar(__webpack_require__("./packages/sdks/nodejs/src/lib/index.ts"), exports);
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/***/ }),
|
|
28
|
+
|
|
29
|
+
/***/ "./packages/sdks/nodejs/src/lib/Client/Client.ts":
|
|
30
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
34
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
35
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
36
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
37
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
38
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
39
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
43
|
+
exports.NinetailedAPIClient = void 0;
|
|
44
|
+
const uuid_1 = __webpack_require__("uuid");
|
|
45
|
+
const experience_js_shared_1 = __webpack_require__("@ninetailed/experience.js-shared");
|
|
46
|
+
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
|
47
|
+
function fetch(...args) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { default: fetch } = yield _importDynamic('node-fetch');
|
|
50
|
+
return fetch(...args);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
class NinetailedAPIClient extends experience_js_shared_1.NinetailedApiClient {
|
|
54
|
+
constructor(options) {
|
|
55
|
+
super(Object.assign(Object.assign({}, options), { fetchImpl: fetch }));
|
|
56
|
+
}
|
|
57
|
+
createIdentifyEvent(userId, traits, options) {
|
|
58
|
+
const messageId = (0, uuid_1.v4)();
|
|
59
|
+
const anonymousId = (options === null || options === void 0 ? void 0 : options.anonymousId) || userId;
|
|
60
|
+
const timestamp = (options === null || options === void 0 ? void 0 : options.timestamp) || Date.now();
|
|
61
|
+
return Object.assign(Object.assign({}, (0, experience_js_shared_1.buildIdentifyEvent)({
|
|
62
|
+
messageId,
|
|
63
|
+
ctx: this.buildRequestContext(),
|
|
64
|
+
userId,
|
|
65
|
+
traits,
|
|
66
|
+
timestamp,
|
|
67
|
+
})), { anonymousId });
|
|
68
|
+
}
|
|
69
|
+
sendIdentifyEvent(userId, traits, options) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const event = this.createIdentifyEvent(userId, traits, options);
|
|
72
|
+
yield this.upsertManyProfiles({ events: [event] });
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
buildRequestContext() {
|
|
76
|
+
const ctx = {
|
|
77
|
+
url: '',
|
|
78
|
+
referrer: '',
|
|
79
|
+
locale: '',
|
|
80
|
+
userAgent: '',
|
|
81
|
+
};
|
|
82
|
+
return ctx;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.NinetailedAPIClient = NinetailedAPIClient;
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/***/ }),
|
|
89
|
+
|
|
90
|
+
/***/ "./packages/sdks/nodejs/src/lib/Client/index.ts":
|
|
91
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
95
|
+
if (k2 === undefined) k2 = k;
|
|
96
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
97
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
98
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
99
|
+
}
|
|
100
|
+
Object.defineProperty(o, k2, desc);
|
|
101
|
+
}) : (function(o, m, k, k2) {
|
|
102
|
+
if (k2 === undefined) k2 = k;
|
|
103
|
+
o[k2] = m[k];
|
|
104
|
+
}));
|
|
105
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
106
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
107
|
+
};
|
|
108
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
109
|
+
__exportStar(__webpack_require__("./packages/sdks/nodejs/src/lib/Client/Client.ts"), exports);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
/***/ }),
|
|
113
|
+
|
|
114
|
+
/***/ "./packages/sdks/nodejs/src/lib/index.ts":
|
|
115
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
119
|
+
exports.NinetailedAPIClient = void 0;
|
|
120
|
+
var Client_1 = __webpack_require__("./packages/sdks/nodejs/src/lib/Client/index.ts");
|
|
121
|
+
Object.defineProperty(exports, "NinetailedAPIClient", ({ enumerable: true, get: function () { return Client_1.NinetailedAPIClient; } }));
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/***/ }),
|
|
125
|
+
|
|
126
|
+
/***/ "@ninetailed/experience.js-shared":
|
|
127
|
+
/***/ ((module) => {
|
|
128
|
+
|
|
129
|
+
module.exports = require("@ninetailed/experience.js-shared");
|
|
130
|
+
|
|
131
|
+
/***/ }),
|
|
132
|
+
|
|
133
|
+
/***/ "uuid":
|
|
134
|
+
/***/ ((module) => {
|
|
135
|
+
|
|
136
|
+
module.exports = require("uuid");
|
|
137
|
+
|
|
138
|
+
/***/ })
|
|
139
|
+
|
|
140
|
+
/******/ });
|
|
141
|
+
/************************************************************************/
|
|
142
|
+
/******/ // The module cache
|
|
143
|
+
/******/ var __webpack_module_cache__ = {};
|
|
144
|
+
/******/
|
|
145
|
+
/******/ // The require function
|
|
146
|
+
/******/ function __webpack_require__(moduleId) {
|
|
147
|
+
/******/ // Check if module is in cache
|
|
148
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
149
|
+
/******/ if (cachedModule !== undefined) {
|
|
150
|
+
/******/ return cachedModule.exports;
|
|
151
|
+
/******/ }
|
|
152
|
+
/******/ // Create a new module (and put it into the cache)
|
|
153
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
154
|
+
/******/ // no module.id needed
|
|
155
|
+
/******/ // no module.loaded needed
|
|
156
|
+
/******/ exports: {}
|
|
157
|
+
/******/ };
|
|
158
|
+
/******/
|
|
159
|
+
/******/ // Execute the module function
|
|
160
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
161
|
+
/******/
|
|
162
|
+
/******/ // Return the exports of the module
|
|
163
|
+
/******/ return module.exports;
|
|
164
|
+
/******/ }
|
|
165
|
+
/******/
|
|
166
|
+
/************************************************************************/
|
|
167
|
+
/******/
|
|
168
|
+
/******/ // startup
|
|
169
|
+
/******/ // Load entry module and return exports
|
|
170
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
171
|
+
/******/ var __webpack_exports__ = __webpack_require__("./packages/sdks/nodejs/src/index.ts");
|
|
172
|
+
/******/ var __webpack_export_target__ = exports;
|
|
173
|
+
/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i];
|
|
174
|
+
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true });
|
|
175
|
+
/******/
|
|
176
|
+
/******/ })()
|
|
177
|
+
;
|
|
178
|
+
//# sourceMappingURL=main.js.map
|
package/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,sFAAsB;;;;;;;;;;;;;;;;;;;;ACAtB,2CAAk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EAAE,EAAE;SACd,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AA3CD,kDA2CC;;;;;;;;;;;;;;;;;;;;;;;;ACjED,8FAAyB;;;;;;;;;;;ACAzB,qFAA+C;AAAtC,iIAAmB;;;;;;;;ACA5B;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://@ninetailed/experience.js/./packages/sdks/nodejs/src/index.ts","webpack://@ninetailed/experience.js/./packages/sdks/nodejs/src/lib/Client/Client.ts","webpack://@ninetailed/experience.js/./packages/sdks/nodejs/src/lib/Client/index.ts","webpack://@ninetailed/experience.js/./packages/sdks/nodejs/src/lib/index.ts","webpack://@ninetailed/experience.js/external commonjs \"@ninetailed/experience.js-shared\"","webpack://@ninetailed/experience.js/external commonjs \"uuid\"","webpack://@ninetailed/experience.js/webpack/bootstrap","webpack://@ninetailed/experience.js/webpack/before-startup","webpack://@ninetailed/experience.js/webpack/startup","webpack://@ninetailed/experience.js/webpack/after-startup"],"sourcesContent":["export * from './lib';\n","import { v4 as uuid } from 'uuid';\nimport {\n IdentifyEvent,\n Traits,\n buildIdentifyEvent,\n NinetailedRequestContext,\n NinetailedApiClient as BaseNinetailedAPIClient,\n NinetailedApiClientOptions,\n} from '@ninetailed/experience.js-shared';\n\nconst _importDynamic = new Function('modulePath', 'return import(modulePath)');\n\nasync function fetch(...args: unknown[]) {\n const { default: fetch } = await _importDynamic('node-fetch');\n return fetch(...args);\n}\n\ntype SendEventOptions = {\n anonymousId?: string;\n timestamp?: number;\n};\n\nexport class NinetailedAPIClient extends BaseNinetailedAPIClient {\n constructor(options: NinetailedApiClientOptions) {\n super({ ...options, fetchImpl: fetch });\n }\n\n public createIdentifyEvent(\n userId: string,\n traits: Traits,\n options?: SendEventOptions\n ): IdentifyEvent & { anonymousId: string } {\n const messageId = uuid();\n const anonymousId = options?.anonymousId || userId;\n const timestamp = options?.timestamp || Date.now();\n return {\n ...buildIdentifyEvent({\n messageId,\n ctx: this.buildRequestContext(),\n userId,\n traits,\n timestamp,\n }),\n anonymousId,\n };\n }\n\n public async sendIdentifyEvent(\n userId: string,\n traits: Traits,\n options?: SendEventOptions\n ) {\n const event = this.createIdentifyEvent(userId, traits, options);\n await this.upsertManyProfiles({ events: [event] });\n }\n\n private buildRequestContext() {\n const ctx: NinetailedRequestContext = {\n url: '',\n referrer: '',\n locale: '',\n userAgent: '',\n };\n return ctx;\n }\n}\n","export * from './Client';\n","export { NinetailedAPIClient } from './Client';\n","module.exports = require(\"@ninetailed/experience.js-shared\");","module.exports = require(\"uuid\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./packages/sdks/nodejs/src/index.ts\");\n",""],"names":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-node",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.20",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"i18n-iso-countries": "^7.3.0"
|
|
5
|
+
"diary": "0.3.1",
|
|
6
|
+
"i18n-iso-countries": "7.5.0",
|
|
7
|
+
"locale-enum": "1.1.1",
|
|
8
|
+
"node-fetch": "3.3.0",
|
|
9
|
+
"ts-toolbelt": "9.6.0",
|
|
10
|
+
"uuid": "8.3.2",
|
|
11
|
+
"zod": "3.19.1"
|
|
13
12
|
},
|
|
14
|
-
"main": "
|
|
15
|
-
"typings": "./src/index.d.ts",
|
|
16
|
-
"peerDependencies": {}
|
|
13
|
+
"main": "main.js"
|
|
17
14
|
}
|
package/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib';
|
package/src/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./lib"), exports);
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/sdks/nodejs/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IdentifyEvent, Traits, NinetailedApiClient as BaseNinetailedAPIClient, NinetailedApiClientOptions } from '@ninetailed/experience.js-shared';
|
|
2
|
-
declare type SendEventOptions = {
|
|
3
|
-
anonymousId?: string;
|
|
4
|
-
timestamp?: number;
|
|
5
|
-
};
|
|
6
|
-
export declare class NinetailedAPIClient extends BaseNinetailedAPIClient {
|
|
7
|
-
constructor(options: NinetailedApiClientOptions);
|
|
8
|
-
createIdentifyEvent(userId: string, traits: Traits, options?: SendEventOptions): IdentifyEvent & {
|
|
9
|
-
anonymousId: string;
|
|
10
|
-
};
|
|
11
|
-
sendIdentifyEvent(userId: string, traits: Traits, options?: SendEventOptions): Promise<void>;
|
|
12
|
-
private buildRequestContext;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
package/src/lib/Client/Client.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.NinetailedAPIClient = void 0;
|
|
13
|
-
const uuid_1 = require("uuid");
|
|
14
|
-
const experience_js_shared_1 = require("@ninetailed/experience.js-shared");
|
|
15
|
-
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
|
16
|
-
function fetch(...args) {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const { default: fetch } = yield _importDynamic('node-fetch');
|
|
19
|
-
return fetch(...args);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
class NinetailedAPIClient extends experience_js_shared_1.NinetailedApiClient {
|
|
23
|
-
constructor(options) {
|
|
24
|
-
super(Object.assign(Object.assign({}, options), { fetchImpl: fetch }));
|
|
25
|
-
}
|
|
26
|
-
createIdentifyEvent(userId, traits, options) {
|
|
27
|
-
const messageId = (0, uuid_1.v4)();
|
|
28
|
-
const anonymousId = (options === null || options === void 0 ? void 0 : options.anonymousId) || userId;
|
|
29
|
-
const timestamp = (options === null || options === void 0 ? void 0 : options.timestamp) || Date.now();
|
|
30
|
-
return Object.assign(Object.assign({}, (0, experience_js_shared_1.buildIdentifyEvent)({
|
|
31
|
-
messageId,
|
|
32
|
-
ctx: this.buildRequestContext(),
|
|
33
|
-
userId,
|
|
34
|
-
traits,
|
|
35
|
-
timestamp,
|
|
36
|
-
})), { anonymousId });
|
|
37
|
-
}
|
|
38
|
-
sendIdentifyEvent(userId, traits, options) {
|
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
const event = this.createIdentifyEvent(userId, traits, options);
|
|
41
|
-
yield this.upsertManyProfiles({ events: [event] });
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
buildRequestContext() {
|
|
45
|
-
const ctx = {
|
|
46
|
-
url: '',
|
|
47
|
-
referrer: '',
|
|
48
|
-
locale: '',
|
|
49
|
-
userAgent: '',
|
|
50
|
-
};
|
|
51
|
-
return ctx;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.NinetailedAPIClient = NinetailedAPIClient;
|
|
55
|
-
//# sourceMappingURL=Client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","sourceRoot":"","sources":["../../../../../../../packages/sdks/nodejs/src/lib/Client/Client.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAAkC;AAClC,2EAO0C;AAE1C,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,YAA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AAC;IACb,CAAC;CACF;AA3CD,kDA2CC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Client';
|
package/src/lib/Client/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./Client"), exports);
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/sdks/nodejs/src/lib/Client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB"}
|
package/src/lib/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { NinetailedAPIClient } from './Client';
|
package/src/lib/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NinetailedAPIClient = void 0;
|
|
4
|
-
var Client_1 = require("./Client");
|
|
5
|
-
Object.defineProperty(exports, "NinetailedAPIClient", { enumerable: true, get: function () { return Client_1.NinetailedAPIClient; } });
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
package/src/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/sdks/nodejs/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA"}
|