twenty 0.2.0 → 2.46.0
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/CONTRIBUTING.md +166 -0
- package/LICENSE +21 -0
- package/README.md +64 -57
- package/dist/app-template/.nvmrc +1 -0
- package/dist/app-template/.oxlintrc.json +37 -0
- package/dist/app-template/AGENTS.md +70 -0
- package/dist/app-template/CHANGELOG.md +7 -0
- package/dist/app-template/README.md +34 -0
- package/dist/app-template/SETUP.md +47 -0
- package/dist/app-template/github/workflows/cd.yml +42 -0
- package/dist/app-template/github/workflows/ci.yml +60 -0
- package/dist/app-template/github/workflows/publish.yml +52 -0
- package/dist/app-template/gitignore +43 -0
- package/dist/app-template/locales/en.json +1 -0
- package/dist/app-template/package.json +36 -0
- package/dist/app-template/public/logo.svg +7 -0
- package/dist/app-template/src/__tests__/application-config.test.ts +14 -0
- package/dist/app-template/src/__tests__/global-setup.ts +56 -0
- package/dist/app-template/src/__tests__/run-twenty.ts +66 -0
- package/dist/app-template/src/__tests__/schema.integration-test.ts +46 -0
- package/dist/app-template/src/application-config.ts +13 -0
- package/dist/app-template/src/constants/universal-identifiers.ts +12 -0
- package/dist/app-template/src/default-role.ts +16 -0
- package/dist/app-template/src/front-components/main-page.tsx +287 -0
- package/dist/app-template/src/logic-functions/health-check.ts +11 -0
- package/dist/app-template/src/navigation-menu-items/main-page.navigation-menu-item.ts +19 -0
- package/dist/app-template/src/page-layouts/main-page.page-layout.ts +42 -0
- package/dist/app-template/tsconfig.json +37 -0
- package/dist/app-template/tsconfig.spec.json +9 -0
- package/dist/app-template/vitest.config.ts +31 -0
- package/dist/app-template/vitest.unit.config.ts +14 -0
- package/dist/app-template/yarn.lock +3374 -0
- package/dist/app-template/yarnrc.yml +1 -0
- package/dist/app-worker.cjs +1 -0
- package/dist/chunks/application-DuIJE2qG.cjs +5 -0
- package/dist/chunks/assert-pull-paths-BuQ1ZRvQ.cjs +1 -0
- package/dist/chunks/build-CX6FBrbu.cjs +1 -0
- package/dist/chunks/build-pull-entities-zwArrVMk.cjs +5 -0
- package/dist/chunks/build-source-manifest-CLKH5vzc.cjs +2 -0
- package/dist/chunks/build-source-snapshot-CbGsy1-v.cjs +206 -0
- package/dist/chunks/check-node-requirement-mqwNPktb.cjs +1 -0
- package/dist/chunks/cli-error-CSsayo0u.cjs +1 -0
- package/dist/chunks/cli-version.constant-aSp8WZDh.cjs +1 -0
- package/dist/chunks/collect-watch-inputs-B9jWG4W0.cjs +1 -0
- package/dist/chunks/compile-application-translations-B59jYVWc.cjs +1 -0
- package/dist/chunks/config-file-mode.constant-DLBzKKUl.cjs +1 -0
- package/dist/chunks/confirm-in-terminal-BxEM5lxE.cjs +1 -0
- package/dist/chunks/constants-CL6mrTMT-B748cNNG.cjs +23 -0
- package/dist/chunks/constants-Cf5-CwMu.cjs +1 -0
- package/dist/chunks/convert-to-label-BPBLtc_O.cjs +1 -0
- package/dist/chunks/create-app-not-installed-error-Cc8YZqI7.cjs +1 -0
- package/dist/chunks/create-cancelled-error-DgrNfOv2.cjs +1 -0
- package/dist/chunks/create-http-status-error-D3gy3DzB.cjs +1 -0
- package/dist/chunks/create-metadata-client-ChjDalSi.cjs +6 -0
- package/dist/chunks/create-pull-base-write-rxjcKtD-.cjs +1 -0
- package/dist/chunks/create-rest-client-eAfOFfDA.cjs +58 -0
- package/dist/chunks/create-tooling-failure-DLI5FlQP.cjs +1 -0
- package/dist/chunks/credential-kind-labels.constant-CKdoQF8o.cjs +1 -0
- package/dist/chunks/extract-manifest-from-file-j-Y9wNas.cjs +1 -0
- package/dist/chunks/fetch-metadata-inspection-Dp034TpK.cjs +1 -0
- package/dist/chunks/fetch-signed-in-identity-BhvaL3zp.cjs +1 -0
- package/dist/chunks/fetch-workspace-id-DJStmf_V.cjs +1 -0
- package/dist/chunks/find-remote-D48r20g0.cjs +1 -0
- package/dist/chunks/format-app-duration-gu2oRLB4.cjs +1 -0
- package/dist/chunks/format-body-VcKL4WXt.cjs +1 -0
- package/dist/chunks/format-data-value-B6rIbpJv.cjs +1 -0
- package/dist/chunks/format-details-COEwKz_M.cjs +2 -0
- package/dist/chunks/format-metadata-fields-DJnTg1R9.cjs +2 -0
- package/dist/chunks/format-metadata-owner-yUeocnwY.cjs +1 -0
- package/dist/chunks/format-table-4drtI5sP.cjs +2 -0
- package/dist/chunks/fs-utils-Bl1fQcaJ.cjs +2 -0
- package/dist/chunks/generate-application-client-CCVLjxTj.cjs +1 -0
- package/dist/chunks/get-app-plan-summary-B0uwHXbO.cjs +8 -0
- package/dist/chunks/get-config-path-C-D-QHuX.cjs +1 -0
- package/dist/chunks/get-credential-kind-JI9heHe2.cjs +1 -0
- package/dist/chunks/get-function-input-schema-GNk3NRLJ-Bfph1o9z.cjs +1 -0
- package/dist/chunks/get-tooling-error-context-C69TBSej.cjs +1 -0
- package/dist/chunks/global-flags.constant-8GfW0sNU.cjs +1 -0
- package/dist/chunks/has-yarn-plug-and-play-X3ay5Xl0.cjs +1 -0
- package/dist/chunks/is-access-token-expiring-gICPXsbO.cjs +1 -0
- package/dist/chunks/is-application-not-found-error-mNeGbxmT.cjs +1 -0
- package/dist/chunks/is-exported-manifest-CriNOWvx.cjs +1 -0
- package/dist/chunks/is-inside-directory-t3ixLQDr.cjs +1 -0
- package/dist/chunks/is-interaction-allowed-ycbAFMIj.cjs +1 -0
- package/dist/chunks/is-same-universal-identifier-BCBib3RP.cjs +1 -0
- package/dist/chunks/is-supported-locale-BAjnKnKj.cjs +20 -0
- package/dist/chunks/kebab-case-D0usAzG-.cjs +1 -0
- package/dist/chunks/list-application-source-files-jEau5Rie.cjs +1 -0
- package/dist/chunks/metadata-D9sQOTRK.cjs +1 -0
- package/dist/chunks/metadata-page.constant-BkG4ndrO.cjs +1 -0
- package/dist/chunks/oauth-timing.constant-BClMQcKn.cjs +1 -0
- package/dist/chunks/open-browser-LPuVspT7.cjs +1 -0
- package/dist/chunks/package-CdYv4LEx.cjs +1 -0
- package/dist/chunks/parse-api-url-BllxRdpE.cjs +1 -0
- package/dist/chunks/parse-app-export-BkfflyUY.cjs +1 -0
- package/dist/chunks/parse-graphql-response-CtP9KTS2.cjs +1 -0
- package/dist/chunks/parse-json-input-CvMTKAWw.cjs +1 -0
- package/dist/chunks/print-typescript-value-DhElcFzI.cjs +3 -0
- package/dist/chunks/pull-source-eoiJwFb9.cjs +1 -0
- package/dist/chunks/read-app-identity-SeleQ_D6.cjs +1 -0
- package/dist/chunks/read-application-identity-BFg_p84F.cjs +1 -0
- package/dist/chunks/read-command-values-uSJqBG_E.cjs +1 -0
- package/dist/chunks/read-config-DUJ27809.cjs +1 -0
- package/dist/chunks/read-input-value-Cxgh_r2g.cjs +1 -0
- package/dist/chunks/read-source-identity-C8LG1v6U.cjs +1 -0
- package/dist/chunks/read-watch-input-stamp-BxeOb0vI.cjs +1 -0
- package/dist/chunks/record-pull-base-BbxvlnU8.cjs +1 -0
- package/dist/chunks/record-typecheck-config-inputs-BDqkKCrj.cjs +1 -0
- package/dist/chunks/request-oauth-tokens-C4KKlTQT.cjs +1 -0
- package/dist/chunks/request-timeout-milliseconds.constant-DtyQHrll.cjs +1 -0
- package/dist/chunks/require-approval-fhegB1ap.cjs +1 -0
- package/dist/chunks/resolve-app-project-D5ZXIpsG.cjs +1 -0
- package/dist/chunks/resolve-inside-sdk-p-16gKb4.cjs +1 -0
- package/dist/chunks/resolve-metadata-object-QoDi-Aik.cjs +1 -0
- package/dist/chunks/resolve-project-typescript-CDY8BbmP.cjs +1 -0
- package/dist/chunks/resolve-request-url-jC5kYwkn.cjs +1 -0
- package/dist/chunks/resolve-source-sdk-mK-f4q55.cjs +1 -0
- package/dist/chunks/result-item-limit.constant-CDrOhiWD.cjs +1 -0
- package/dist/chunks/run-api-graphql-command-Biy0WqXa.cjs +1 -0
- package/dist/chunks/run-api-rest-command-D9kdQceV.cjs +1 -0
- package/dist/chunks/run-app-add-command-DcTQg7Si.cjs +163 -0
- package/dist/chunks/run-app-apply-command-DwLPPJ-Y.cjs +2 -0
- package/dist/chunks/run-app-build-command-BRYb0one.cjs +2 -0
- package/dist/chunks/run-app-dev-command-CVeh9Gab.cjs +2 -0
- package/dist/chunks/run-app-exec-command-DKLNLbL5.cjs +3 -0
- package/dist/chunks/run-app-init-command-CJj8_spC.cjs +2 -0
- package/dist/chunks/run-app-logs-command-Dusb8K-W.cjs +9 -0
- package/dist/chunks/run-app-operation-BWrY9YZK.cjs +1 -0
- package/dist/chunks/run-app-plan-command-C0_3e332.cjs +1 -0
- package/dist/chunks/run-app-pull-command-DcZqs8gR.cjs +3 -0
- package/dist/chunks/run-app-typecheck-command-C8LqpOej.cjs +1 -0
- package/dist/chunks/run-app-uninstall-command-ncWS_k-p.cjs +2 -0
- package/dist/chunks/run-auth-login-command-_zDgRcth.cjs +1 -0
- package/dist/chunks/run-auth-logout-command-BO6O7GVi.cjs +2 -0
- package/dist/chunks/run-auth-status-command-Cj-vqoHg.cjs +1 -0
- package/dist/chunks/run-auth-token-command-D4geJ-rx.cjs +1 -0
- package/dist/chunks/run-cli-c9TOR0zj.cjs +23 -0
- package/dist/chunks/run-commands-command-C6gvMpQ_.cjs +2 -0
- package/dist/chunks/run-data-get-command-jDEU4EG1.cjs +1 -0
- package/dist/chunks/run-data-list-command-EnCdbuzc.cjs +1 -0
- package/dist/chunks/run-doctor-command-DnJ6io-m.cjs +2 -0
- package/dist/chunks/run-metadata-field-describe-command-vJngpw2S.cjs +3 -0
- package/dist/chunks/run-metadata-field-list-command-CR4w7fI6.cjs +3 -0
- package/dist/chunks/run-metadata-object-describe-command-CHP8K-W2.cjs +3 -0
- package/dist/chunks/run-metadata-object-list-command-BqXMcAp6.cjs +2 -0
- package/dist/chunks/run-open-command-DKl8acw0.cjs +1 -0
- package/dist/chunks/run-remote-list-command-DeAzr5Mn.cjs +1 -0
- package/dist/chunks/run-remote-remove-command-D0C5sWjP.cjs +2 -0
- package/dist/chunks/run-remote-rename-command-Byq9WRHd.cjs +1 -0
- package/dist/chunks/run-remote-use-command-B6VVDlMG.cjs +1 -0
- package/dist/chunks/run-version-command-BmSk8PUV.cjs +1 -0
- package/dist/chunks/select-target-C1VZjf-A.cjs +1 -0
- package/dist/chunks/sign-in-to-remote-again-CW8HPSTP.cjs +1 -0
- package/dist/chunks/sign-in-with-browser-C3kC6uP2.cjs +1 -0
- package/dist/chunks/style-BR52fK4V.cjs +1 -0
- package/dist/chunks/target-environment-variable.constant-D7z8AihP.cjs +1 -0
- package/dist/chunks/to-cli-error-BBYf_wqo.cjs +1 -0
- package/dist/chunks/to-public-target-CIAwoOKL.cjs +1 -0
- package/dist/chunks/to-worker-output-diagnostics-lprh9b0l.cjs +2 -0
- package/dist/chunks/typecheck-application-DGrovgX9.cjs +2 -0
- package/dist/chunks/undici-D3mKdfwl.cjs +95 -0
- package/dist/chunks/update-config-BkKBEfAp.cjs +1 -0
- package/dist/chunks/utils-B8EXJeaX-DK3gCslL.cjs +33 -0
- package/dist/chunks/validate-app-path-Dau-PC0a.cjs +1 -0
- package/dist/chunks/validate-remote-name-w-qnr43w.cjs +1 -0
- package/dist/chunks/write-config-atomically-DRWTukU-.cjs +1 -0
- package/dist/cli.cjs +2 -0
- package/docs/commands.md +564 -0
- package/package.json +41 -18
- package/src/app/README.md +43 -0
- package/src/app/add/README.md +69 -0
- package/src/app/bundles/README.md +85 -0
- package/src/app/client/README.md +62 -0
- package/src/app/dev/README.md +35 -0
- package/src/app/exec/README.md +48 -0
- package/src/app/function-logs/README.md +44 -0
- package/src/app/manifest/README.md +74 -0
- package/src/app/pull/README.md +28 -0
- package/src/app/source/README.md +33 -0
- package/src/app/typecheck/README.md +67 -0
- package/.npmignore +0 -2
- package/bin/twenty +0 -2
- package/index.js +0 -118
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Application typechecking
|
|
2
|
+
|
|
3
|
+
The CLI typechecks applications using their own TypeScript installation.
|
|
4
|
+
See the [app tooling overview](../README.md) for package ownership.
|
|
5
|
+
|
|
6
|
+
The internal `typecheckSource` worker request checks the app's source and compiler
|
|
7
|
+
configuration. `bundleSnapshot` runs this typecheck after bundling. A failed check
|
|
8
|
+
discards that build's snapshot. Public build, typecheck, plan, apply and uninstall
|
|
9
|
+
commands use this pipeline.
|
|
10
|
+
|
|
11
|
+
## Compiler ownership
|
|
12
|
+
|
|
13
|
+
The globally installed CLI resolves `typescript` from the app's `node_modules`
|
|
14
|
+
or a workspace ancestor. It never falls back to its own parser dependency,
|
|
15
|
+
`NODE_PATH` or Node's global package folders. Apps keep TypeScript in their
|
|
16
|
+
development dependencies; neither apps nor the SDK depend on the CLI.
|
|
17
|
+
|
|
18
|
+
Missing TypeScript returns `TYPESCRIPT_NOT_INSTALLED`. An incomplete installation,
|
|
19
|
+
missing compiler API or unsupported Plug'n'Play installation returns
|
|
20
|
+
`TOOLING_UNSUPPORTED`. The resolved compiler entry must belong to the app's
|
|
21
|
+
TypeScript installation so checks use the project's compiler version.
|
|
22
|
+
|
|
23
|
+
TypeScript is loaded only in the child worker. Its public JavaScript compiler API
|
|
24
|
+
is required. The CLI uses the installed compiler's diagnostic categories and
|
|
25
|
+
message formatter, so diagnostics follow the project's compiler version. The CLI
|
|
26
|
+
parser used for source loading remains independent.
|
|
27
|
+
|
|
28
|
+
## Compiler contract
|
|
29
|
+
|
|
30
|
+
- Read the app's `tsconfig.json`, preserve its project references and force
|
|
31
|
+
`noEmit: true`. Do not write JavaScript, declarations or build information.
|
|
32
|
+
- Configuration read/parse errors fail the check, including missing configs,
|
|
33
|
+
invalid options and missing extended configs. Source diagnostics use TS codes,
|
|
34
|
+
project-relative paths and one-based line and column numbers.
|
|
35
|
+
- Unbuilt project references fail with TS6305, including diagnostics without a
|
|
36
|
+
source location. Build the referenced projects separately; this check does not
|
|
37
|
+
build them or silently ignore their errors.
|
|
38
|
+
- Build warnings remain alongside typecheck diagnostics. Failure never holds a
|
|
39
|
+
snapshot for upload, and cleanup preserves unrelated snapshots.
|
|
40
|
+
- Check cancellation before and after the synchronous compiler work. A busy
|
|
41
|
+
compiler cannot process IPC cancellation mid-call; the worker grace
|
|
42
|
+
period and forced termination remain the fallback.
|
|
43
|
+
|
|
44
|
+
Different compiler versions can produce different diagnostics. Align compiler
|
|
45
|
+
versions when comparing CLI results with another tool. See the
|
|
46
|
+
[build requirements](../../../docs/commands.md#build-and-check-an-app) for
|
|
47
|
+
configuration and project-reference troubleshooting.
|
|
48
|
+
|
|
49
|
+
## Verification
|
|
50
|
+
|
|
51
|
+
From `packages/twenty-cli`, after building the shared and SDK dependencies:
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
node ../../node_modules/vitest/vitest.mjs run --config vitest.config.ts src/app/typecheck src/app/snapshots --maxWorkers=1
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The typecheck suite compares the SDK reference, the CLI implementation
|
|
58
|
+
and the production worker with the same compiler. It also tests absent and hoisted
|
|
59
|
+
compilers, global-path fallback, incomplete installations and actual TypeScript
|
|
60
|
+
5.9.3 versus 5.7.3 behavior. The 5.7.3 compiler comes from the SDK's
|
|
61
|
+
ts-morph dependency for this test only.
|
|
62
|
+
|
|
63
|
+
Snapshot parity runs both real typecheck phases, with no compiler bypass.
|
|
64
|
+
The app fixture supplies only the SDK's authoring/runtime exports. The apply
|
|
65
|
+
contract exercises CLI snapshots against a local HTTP fixture.
|
|
66
|
+
For the fresh CLI template, parity compares successful builds with the test
|
|
67
|
+
setup included and Vitest configuration files excluded.
|
package/.npmignore
DELETED
package/bin/twenty
DELETED
package/index.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
var dns = require('dns');
|
|
2
|
-
var request = require('request');
|
|
3
|
-
|
|
4
|
-
var ipRegexStr = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' +
|
|
5
|
-
'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' +
|
|
6
|
-
'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' +
|
|
7
|
-
'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
|
|
8
|
-
var ipRegex = new RegExp(ipRegexStr);
|
|
9
|
-
|
|
10
|
-
var toRad = function(num) {
|
|
11
|
-
return num * (Math.PI / 180);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
var getIpInfo = function(server, callback) {
|
|
15
|
-
var ipinfo = function(p, cb) {
|
|
16
|
-
request('http://ipinfo.io/' + p, function(err, response, body) {
|
|
17
|
-
var json;
|
|
18
|
-
try {
|
|
19
|
-
json = JSON.parse(body);
|
|
20
|
-
} catch(error) {
|
|
21
|
-
return cb(error, null);
|
|
22
|
-
}
|
|
23
|
-
cb(err, json);
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
if (!server) {
|
|
28
|
-
return ipinfo('json', callback);
|
|
29
|
-
} else if (!server.match(ipRegex)) {
|
|
30
|
-
return dns.lookup(server, function(err, data) {
|
|
31
|
-
ipinfo(data, callback);
|
|
32
|
-
});
|
|
33
|
-
} else {
|
|
34
|
-
return ipinfo(server, callback);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var ipDistance = function(lat1, lon1, lat2, lon2) {
|
|
39
|
-
// Earth radius in km
|
|
40
|
-
var r = 6371;
|
|
41
|
-
|
|
42
|
-
var dLat = toRad(lat2 - lat1);
|
|
43
|
-
var dLon = toRad(lon2 - lon1);
|
|
44
|
-
lat1 = toRad(lat1);
|
|
45
|
-
lat2 = toRad(lat2);
|
|
46
|
-
|
|
47
|
-
var a = Math.sin(dLat / 2.0) * Math.sin(dLat / 2.0) +
|
|
48
|
-
Math.sin(dLon / 2.0) * Math.sin(dLon / 2.0) * Math.cos(lat1) * Math.cos(lat2);
|
|
49
|
-
var c = 2.0 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0 - a));
|
|
50
|
-
return r * c;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
var findDistance = function(ip1, ip2, callback) {
|
|
54
|
-
var lat1, lon1, lat2, lon2;
|
|
55
|
-
|
|
56
|
-
getIpInfo(ip1, function(err, data1) {
|
|
57
|
-
var coords1 = data1.loc.split(',');
|
|
58
|
-
lat1 = Number(coords1[0]);
|
|
59
|
-
lon1 = Number(coords1[1]);
|
|
60
|
-
getIpInfo(ip2, function(err, data2) {
|
|
61
|
-
var coords2 = data2.loc.split(',');
|
|
62
|
-
lat2 = Number(coords2[0]);
|
|
63
|
-
lon2 = Number(coords2[1]);
|
|
64
|
-
|
|
65
|
-
var dist = ipDistance(lat1, lon1, lat2, lon2);
|
|
66
|
-
callback(null, dist);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
var cli = function() {
|
|
72
|
-
var yargs = require('yargs')
|
|
73
|
-
.usage('Usage: $0 [command] [options]')
|
|
74
|
-
.command('distance <loc1> [loc2]', 'Compute the approx. distance between IPs/URLs')
|
|
75
|
-
.option('json', {
|
|
76
|
-
alias: 'j',
|
|
77
|
-
describe: 'Return data as json',
|
|
78
|
-
})
|
|
79
|
-
.example('$0', 'Get location info for your IP address')
|
|
80
|
-
.example('$0 -j', 'Get location info for your IP as json')
|
|
81
|
-
.example('$0 distance 8.8.8.8', 'Get distance from your IP to given IP')
|
|
82
|
-
.example('$0 distance stackabuse.com google.com', 'Get the distance between two given URLs')
|
|
83
|
-
.help('help')
|
|
84
|
-
.alias('h', 'help')
|
|
85
|
-
.epilog('Copyright 2016 Scott Robinson');
|
|
86
|
-
|
|
87
|
-
var argv = yargs.argv;
|
|
88
|
-
|
|
89
|
-
if (argv.loc1) {
|
|
90
|
-
findDistance(argv.loc1, argv.loc2, function(err, distance) {
|
|
91
|
-
console.log(String(distance.toFixed(2)) + ' km');
|
|
92
|
-
});
|
|
93
|
-
} else if (argv.json) {
|
|
94
|
-
getIpInfo(argv._[0], function(err, data) {
|
|
95
|
-
console.log(JSON.stringify(data, null, 4));
|
|
96
|
-
});
|
|
97
|
-
} else {
|
|
98
|
-
getIpInfo(argv._[0], function(err, data) {
|
|
99
|
-
if (err) {
|
|
100
|
-
console.log('Error:', err.message);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
console.log('IP:', data.ip);
|
|
105
|
-
console.log('Hostname:', data.hostname || '-');
|
|
106
|
-
console.log('City:', data.city || '-');
|
|
107
|
-
console.log('Region:', data.region || '-');
|
|
108
|
-
console.log('Postal:', data.postal || '-');
|
|
109
|
-
console.log('Country:', data.country || '-');
|
|
110
|
-
console.log('Coordinates:', data.loc || '-');
|
|
111
|
-
console.log('ISP:', data.org || '-');
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
exports.info = getIpInfo;
|
|
117
|
-
exports.distance = findDistance;
|
|
118
|
-
exports.cli = cli;
|