@graphql-markdown/telemetry 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,13 +1,18 @@
1
1
  # @graphql-markdown/telemetry
2
2
 
3
- Anonymous, opt-out usage telemetry for GraphQL-Markdown. Internal package: it is used by the CLI, the Docusaurus plugin and the Nuxt theme, not meant to be called directly.
3
+ [![Latest Version](https://img.shields.io/npm/v/@graphql-markdown/telemetry?style=flat)](https://www.npmjs.com/package/@graphql-markdown/telemetry)
4
+ [![JSR](https://jsr.io/badges/@graphql-markdown/telemetry)](https://jsr.io/@graphql-markdown/telemetry)
5
+ [![GitHub License](https://img.shields.io/github/license/graphql-markdown/graphql-markdown?style=flat)](https://raw.githubusercontent.com/graphql-markdown/graphql-markdown/main/LICENSE)
6
+ [![Mutation Score](https://img.shields.io/endpoint?label=mutation%20score&style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fgraphql-markdown%2Fgraphql-markdown%2Fmain%3Fmodule%3Dtelemetry)](https://dashboard.stryker-mutator.io/reports/github.com/graphql-markdown/graphql-markdown/main?module=telemetry)
7
+
8
+ Anonymous, opt-out usage telemetry for [GraphQL-Markdown](https://graphql-markdown.dev). Internal package: it is used by the CLI, the Docusaurus plugin, the Nuxt theme and the `create-graphql-markdown-docs` scaffolder, not meant to be called directly.
4
9
 
5
10
  - No runtime dependencies.
6
11
  - Sends one event per distinct configuration; values are masked (URLs, paths and custom strings never leave the machine) and schema content is never read.
7
12
  - No identifier of any kind is stored or sent.
8
13
  - Opt out with `DO_NOT_TRACK=1`, `GRAPHQL_MARKDOWN_TELEMETRY_DISABLED=1`, `telemetry: false` or `--no-telemetry`.
9
14
  - Disabled automatically in test runners (`VITEST`, `JEST_WORKER_ID`, `NODE_TEST_CONTEXT`, `NODE_ENV=test`).
10
- - Events are sent to the Cloudflare Worker ingest (`gqlmd-telemetry.graphql-markdown.workers.dev`, see github.com/graphql-markdown/telemetry); set `GRAPHQL_MARKDOWN_TELEMETRY_ENDPOINT` to override it.
15
+ - Events are sent to the Cloudflare Worker ingest (`gqlmd-telemetry.graphql-markdown.workers.dev`, see [graphql-markdown/telemetry](https://github.com/graphql-markdown/telemetry)); set `GRAPHQL_MARKDOWN_TELEMETRY_ENDPOINT` to override it.
11
16
  - `GRAPHQL_MARKDOWN_TELEMETRY_DEBUG=1` prints the exact payload to stderr instead of sending it.
12
17
 
13
18
  ## Usage
@@ -45,7 +50,11 @@ Your config:
45
50
  "homepage": "./intro.md",
46
51
  "formatter": "@graphql-markdown/docusaurus",
47
52
  "skipDocDirective": ["@internal"],
48
- "groupByDirective": { "directive": "doc", "field": "category", "fallback": "Common" },
53
+ "groupByDirective": {
54
+ "directive": "doc",
55
+ "field": "category",
56
+ "fallback": "Common"
57
+ },
49
58
  "printTypeOptions": { "deprecated": "group", "typeBadges": true },
50
59
  "metatags": [{ "name": "robots", "content": "noindex" }],
51
60
  "loaders": { "UrlLoader": "@graphql-tools/url-loader" }
@@ -59,7 +68,7 @@ What is sent (CLI options `{ "force": true }`, trigger `cli`, GraphQL 16):
59
68
  "v": 1,
60
69
  "event": "config",
61
70
  "pkg": "@graphql-markdown/cli",
62
- "pkgVersion": "0.1.0",
71
+ "pkgVersion": "0.1",
63
72
  "nodeMajor": 24,
64
73
  "graphqlMajor": 16,
65
74
  "os": "darwin",
@@ -76,9 +85,7 @@ What is sent (CLI options `{ "force": true }`, trigger `cli`, GraphQL 16):
76
85
  "linkRoot": "<path>",
77
86
  "homepage": "<path>",
78
87
  "formatter": "@graphql-markdown/docusaurus",
79
- "skipDocDirective": [
80
- "<string>"
81
- ],
88
+ "skipDocDirective": ["<string>"],
82
89
  "groupByDirective": {
83
90
  "directive": "<string>",
84
91
  "field": "<string>",
@@ -88,12 +95,7 @@ What is sent (CLI options `{ "force": true }`, trigger `cli`, GraphQL 16):
88
95
  "deprecated": "group",
89
96
  "typeBadges": true
90
97
  },
91
- "metatags": [
92
- {
93
- "<key:0>": "<string>",
94
- "<key:1>": "<string>"
95
- }
96
- ],
98
+ "metatags": "<object>",
97
99
  "loaders": {
98
100
  "UrlLoader": "@graphql-tools/url-loader"
99
101
  }
@@ -108,12 +110,23 @@ What is sent (CLI options `{ "force": true }`, trigger `cli`, GraphQL 16):
108
110
  Masking rules:
109
111
 
110
112
  - `<url>`, `<git>`, `<github>`: the kind of a schema pointer, or a URL value (for example `baseURL`). The host, path and any headers are never sent.
111
- - `<file:sdl>`, `<file:json>`, `<file:code>`, `<glob>`, `<inline-sdl>`, `<unknown>`: the kind of a schema pointer (for example `schema`). The pointer itself is never sent.
113
+ - `<file:sdl>`, `<file:json>`, `<file:code>`, `<glob>`, `<inline-sdl>`, `<unknown>`: the kind of a schema pointer (for example `schema`). The pointer itself is never sent. Several pointers of one kind are sent as a single token (`"<glob>"`), and mixed kinds as a list of distinct tokens, so the number of pointers is not sent either; `loader` follows the same rule.
112
114
  - `<custom-formatter>`: a third-party or local `formatter` or `mdxParser`. Only presets and `@graphql-markdown/*` packages are kept as-is.
113
115
  - `<path>`: a filesystem path (for example `rootPath`, `linkRoot`, `homepage`).
114
- - `<string>`: a custom string (for example directive names, field names, fallback labels, metatag values).
115
- - `<key:n>`: a custom object key, replaced by its position (for example metatag names). Only present when a custom key is used.
116
+ - `<string>`: a custom string (for example directive names, field names, fallback labels).
117
+ - `<key:n>`: a custom object key, replaced by its position. Only present when a custom key is used.
118
+ - `<object>`: a value reduced to the fact that it is set (for example `metatags`, whatever the number of tags).
116
119
 
117
120
  No identifier, IP address, schema content or path is ever included. Names from the allowlist (such as the formatter and loader names, or boolean and enum options) are kept as-is.
118
121
 
119
122
  To print your own payload instead of sending it, set `GRAPHQL_MARKDOWN_TELEMETRY_DEBUG=1`. The exact payload is written to stderr.
123
+
124
+ ## Documentation
125
+
126
+ - [Telemetry](https://graphql-markdown.dev/docs/telemetry)
127
+
128
+ ## License
129
+
130
+ GraphQL-Markdown packages are 100% free and open-source, under the [MIT license](https://github.com/graphql-markdown/graphql-markdown/blob/main/LICENSE).
131
+
132
+ This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/graphql-markdown/graphql-markdown) to thank us for our work. By contributing to the Treeware forest, you'll be creating employment for local families and restoring wildlife habitats.
@@ -1,5 +1,5 @@
1
- import type { CiInfo } from "./ci";
2
- import type { TelemetryState } from "./state";
1
+ import type { CiInfo } from "./ci.ts";
2
+ import type { TelemetryState } from "./state.ts";
3
3
  export declare const FULL_NOTICE = "\u2139 GraphQL-Markdown collects anonymous usage data to help improve the tool.\n Sent: package/Node versions, OS, schema loader type, the settings you use,\n and the page count, duration and error type of each run.\n Custom strings, URLs and paths are masked; schema content is never sent.\n Details: https://graphql-markdown.dev/docs/telemetry\n Opt out: `gqlmd telemetry disable` or DO_NOT_TRACK=1\n";
4
4
  /** Whether the full notice is due (never in CI, where it is not recorded). */
5
5
  export declare const isNoticeDue: (state: TelemetryState | null | undefined, ci?: CiInfo) => boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"disclaimer.d.ts","sourceRoot":"","sources":["../src/disclaimer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,WAAW,4ZAMvB,CAAC;AAKF,8EAA8E;AAC9E,eAAO,MAAM,WAAW,UACf,cAAc,GAAG,IAAI,GAAG,SAAS,OACpC,MAAM,KACT,OAEF,CAAC;AAIF,mDAAmD;AACnD,eAAO,MAAM,eAAe,QAAO,IAElC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UACnB,cAAc,GAAG,IAAI,GAAG,SAAS,MACpC,MAAM,iBACK,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KACtC,OAeF,CAAC"}
1
+ {"version":3,"file":"disclaimer.d.ts","sourceRoot":"","sources":["../src/disclaimer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,WAAW,4ZAMvB,CAAC;AAKF,8EAA8E;AAC9E,eAAO,MAAM,WAAW,UACf,cAAc,GAAG,IAAI,GAAG,SAAS,OACpC,MAAM,KACT,OAEF,CAAC;AAIF,mDAAmD;AACnD,eAAO,MAAM,eAAe,QAAO,IAElC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,UACnB,cAAc,GAAG,IAAI,GAAG,SAAS,MACpC,MAAM,iBACK,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KACtC,OAeF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.printDisclaimer = exports.resetDisclaimer = exports.isNoticeDue = exports.FULL_NOTICE = void 0;
4
- const constants_1 = require("./constants");
4
+ const constants_ts_1 = require("./constants.js");
5
5
  exports.FULL_NOTICE = `ℹ GraphQL-Markdown collects anonymous usage data to help improve the tool.
6
6
  Sent: package/Node versions, OS, schema loader type, the settings you use,
7
7
  and the page count, duration and error type of each run.
@@ -12,7 +12,7 @@ exports.FULL_NOTICE = `ℹ GraphQL-Markdown collects anonymous usage data to hel
12
12
  const SHORT_NOTICE = "ℹ Anonymous telemetry enabled. Opt out: gqlmd telemetry disable\n";
13
13
  /** Whether the full notice is due (never in CI, where it is not recorded). */
14
14
  const isNoticeDue = (state, ci = { ci: false }) => {
15
- return !ci.ci && (!state || state.noticeVersion < constants_1.NOTICE_VERSION);
15
+ return !ci.ci && (!state || state.noticeVersion < constants_ts_1.NOTICE_VERSION);
16
16
  };
17
17
  exports.isNoticeDue = isNoticeDue;
18
18
  let printed = false;
package/dist/enabled.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { TelemetryTrigger } from "@graphql-markdown/types";
2
- import type { TelemetryState } from "./state";
2
+ import type { TelemetryState } from "./state.ts";
3
3
  export interface EnabledContext {
4
4
  /** Entry point; without it only `telemetry: true` enables (programmatic). */
5
5
  trigger?: TelemetryTrigger;
@@ -1 +1 @@
1
- {"version":3,"file":"enabled.d.ts","sourceRoot":"","sources":["../src/enabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,SAAS,MAAM,CAAC,UAAU,KAAiB,MAElE,CAAC;AAQF;;;GAGG;AACH,eAAO,MAAM,SAAS,SACf,cAAc,KAClB;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAmCjE,CAAC"}
1
+ {"version":3,"file":"enabled.d.ts","sourceRoot":"","sources":["../src/enabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,SAAS,MAAM,CAAC,UAAU,KAAiB,MAElE,CAAC;AAQF;;;GAGG;AACH,eAAO,MAAM,SAAS,SACf,cAAc,KAClB;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAmCjE,CAAC"}
package/dist/enabled.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isEnabled = exports.getEndpoint = void 0;
4
- const constants_1 = require("./constants");
4
+ const constants_ts_1 = require("./constants.js");
5
5
  const getEndpoint = (env = process.env) => {
6
- return env.GRAPHQL_MARKDOWN_TELEMETRY_ENDPOINT ?? constants_1.DEFAULT_ENDPOINT;
6
+ return env.GRAPHQL_MARKDOWN_TELEMETRY_ENDPOINT ?? constants_ts_1.DEFAULT_ENDPOINT;
7
7
  };
8
8
  exports.getEndpoint = getEndpoint;
9
9
  const isSet = (value) => {
package/dist/index.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- export { NOTICE_VERSION, DEFAULT_ENDPOINT } from "./constants";
2
- export { resolveConfigDir } from "./config-dir";
3
- export { readState, writeState, getStatePath } from "./state";
4
- export type { TelemetryState } from "./state";
5
- export { detectCi } from "./ci";
6
- export type { CiInfo } from "./ci";
7
- export { isEnabled, getEndpoint } from "./enabled";
8
- export type { EnabledContext } from "./enabled";
9
- export { classifyPointer } from "./loader";
10
- export type { LoaderKind } from "./loader";
11
- export { sanitizeConfig, CONFIG_RULES, CLI_RULES } from "./sanitize";
12
- export type { Rule, SanitizeResult } from "./sanitize";
13
- export { buildPayload, fingerprint } from "./payload";
14
- export type { PayloadInput } from "./payload";
15
- export { errorTypeOf, ERROR_TYPES, NO_SCHEMA_ERROR, POST_ERROR_PREFIX, } from "./error-type";
16
- export { printDisclaimer, isNoticeDue, resetDisclaimer, FULL_NOTICE, } from "./disclaimer";
17
- export { track, encodeBody } from "./track";
18
- export type { TrackInput } from "./track";
1
+ export { NOTICE_VERSION, DEFAULT_ENDPOINT } from "./constants.ts";
2
+ export { resolveConfigDir } from "./config-dir.ts";
3
+ export { readState, writeState, getStatePath } from "./state.ts";
4
+ export type { TelemetryState } from "./state.ts";
5
+ export { detectCi } from "./ci.ts";
6
+ export type { CiInfo } from "./ci.ts";
7
+ export { isEnabled, getEndpoint } from "./enabled.ts";
8
+ export type { EnabledContext } from "./enabled.ts";
9
+ export { classifyPointer } from "./loader.ts";
10
+ export type { LoaderKind } from "./loader.ts";
11
+ export { sanitizeConfig, CONFIG_RULES, CLI_RULES } from "./sanitize.ts";
12
+ export type { Rule, SanitizeResult } from "./sanitize.ts";
13
+ export { buildPayload, fingerprint } from "./payload.ts";
14
+ export type { PayloadInput } from "./payload.ts";
15
+ export { errorTypeOf, ERROR_TYPES, NO_SCHEMA_ERROR, POST_ERROR_PREFIX, } from "./error-type.ts";
16
+ export { printDisclaimer, isNoticeDue, resetDisclaimer, FULL_NOTICE, } from "./disclaimer.ts";
17
+ export { track, encodeBody } from "./track.ts";
18
+ export type { TrackInput } from "./track.ts";
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,YAAY,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,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AAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACxE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,39 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.encodeBody = exports.track = exports.FULL_NOTICE = exports.resetDisclaimer = exports.isNoticeDue = exports.printDisclaimer = exports.POST_ERROR_PREFIX = exports.NO_SCHEMA_ERROR = exports.ERROR_TYPES = exports.errorTypeOf = exports.fingerprint = exports.buildPayload = exports.CLI_RULES = exports.CONFIG_RULES = exports.sanitizeConfig = exports.classifyPointer = exports.getEndpoint = exports.isEnabled = exports.detectCi = exports.getStatePath = exports.writeState = exports.readState = exports.resolveConfigDir = exports.DEFAULT_ENDPOINT = exports.NOTICE_VERSION = void 0;
4
- var constants_1 = require("./constants");
5
- Object.defineProperty(exports, "NOTICE_VERSION", { enumerable: true, get: function () { return constants_1.NOTICE_VERSION; } });
6
- Object.defineProperty(exports, "DEFAULT_ENDPOINT", { enumerable: true, get: function () { return constants_1.DEFAULT_ENDPOINT; } });
7
- var config_dir_1 = require("./config-dir");
8
- Object.defineProperty(exports, "resolveConfigDir", { enumerable: true, get: function () { return config_dir_1.resolveConfigDir; } });
9
- var state_1 = require("./state");
10
- Object.defineProperty(exports, "readState", { enumerable: true, get: function () { return state_1.readState; } });
11
- Object.defineProperty(exports, "writeState", { enumerable: true, get: function () { return state_1.writeState; } });
12
- Object.defineProperty(exports, "getStatePath", { enumerable: true, get: function () { return state_1.getStatePath; } });
13
- var ci_1 = require("./ci");
14
- Object.defineProperty(exports, "detectCi", { enumerable: true, get: function () { return ci_1.detectCi; } });
15
- var enabled_1 = require("./enabled");
16
- Object.defineProperty(exports, "isEnabled", { enumerable: true, get: function () { return enabled_1.isEnabled; } });
17
- Object.defineProperty(exports, "getEndpoint", { enumerable: true, get: function () { return enabled_1.getEndpoint; } });
18
- var loader_1 = require("./loader");
19
- Object.defineProperty(exports, "classifyPointer", { enumerable: true, get: function () { return loader_1.classifyPointer; } });
20
- var sanitize_1 = require("./sanitize");
21
- Object.defineProperty(exports, "sanitizeConfig", { enumerable: true, get: function () { return sanitize_1.sanitizeConfig; } });
22
- Object.defineProperty(exports, "CONFIG_RULES", { enumerable: true, get: function () { return sanitize_1.CONFIG_RULES; } });
23
- Object.defineProperty(exports, "CLI_RULES", { enumerable: true, get: function () { return sanitize_1.CLI_RULES; } });
24
- var payload_1 = require("./payload");
25
- Object.defineProperty(exports, "buildPayload", { enumerable: true, get: function () { return payload_1.buildPayload; } });
26
- Object.defineProperty(exports, "fingerprint", { enumerable: true, get: function () { return payload_1.fingerprint; } });
27
- var error_type_1 = require("./error-type");
28
- Object.defineProperty(exports, "errorTypeOf", { enumerable: true, get: function () { return error_type_1.errorTypeOf; } });
29
- Object.defineProperty(exports, "ERROR_TYPES", { enumerable: true, get: function () { return error_type_1.ERROR_TYPES; } });
30
- Object.defineProperty(exports, "NO_SCHEMA_ERROR", { enumerable: true, get: function () { return error_type_1.NO_SCHEMA_ERROR; } });
31
- Object.defineProperty(exports, "POST_ERROR_PREFIX", { enumerable: true, get: function () { return error_type_1.POST_ERROR_PREFIX; } });
32
- var disclaimer_1 = require("./disclaimer");
33
- Object.defineProperty(exports, "printDisclaimer", { enumerable: true, get: function () { return disclaimer_1.printDisclaimer; } });
34
- Object.defineProperty(exports, "isNoticeDue", { enumerable: true, get: function () { return disclaimer_1.isNoticeDue; } });
35
- Object.defineProperty(exports, "resetDisclaimer", { enumerable: true, get: function () { return disclaimer_1.resetDisclaimer; } });
36
- Object.defineProperty(exports, "FULL_NOTICE", { enumerable: true, get: function () { return disclaimer_1.FULL_NOTICE; } });
37
- var track_1 = require("./track");
38
- Object.defineProperty(exports, "track", { enumerable: true, get: function () { return track_1.track; } });
39
- Object.defineProperty(exports, "encodeBody", { enumerable: true, get: function () { return track_1.encodeBody; } });
4
+ var constants_ts_1 = require("./constants.js");
5
+ Object.defineProperty(exports, "NOTICE_VERSION", { enumerable: true, get: function () { return constants_ts_1.NOTICE_VERSION; } });
6
+ Object.defineProperty(exports, "DEFAULT_ENDPOINT", { enumerable: true, get: function () { return constants_ts_1.DEFAULT_ENDPOINT; } });
7
+ var config_dir_ts_1 = require("./config-dir.js");
8
+ Object.defineProperty(exports, "resolveConfigDir", { enumerable: true, get: function () { return config_dir_ts_1.resolveConfigDir; } });
9
+ var state_ts_1 = require("./state.js");
10
+ Object.defineProperty(exports, "readState", { enumerable: true, get: function () { return state_ts_1.readState; } });
11
+ Object.defineProperty(exports, "writeState", { enumerable: true, get: function () { return state_ts_1.writeState; } });
12
+ Object.defineProperty(exports, "getStatePath", { enumerable: true, get: function () { return state_ts_1.getStatePath; } });
13
+ var ci_ts_1 = require("./ci.js");
14
+ Object.defineProperty(exports, "detectCi", { enumerable: true, get: function () { return ci_ts_1.detectCi; } });
15
+ var enabled_ts_1 = require("./enabled.js");
16
+ Object.defineProperty(exports, "isEnabled", { enumerable: true, get: function () { return enabled_ts_1.isEnabled; } });
17
+ Object.defineProperty(exports, "getEndpoint", { enumerable: true, get: function () { return enabled_ts_1.getEndpoint; } });
18
+ var loader_ts_1 = require("./loader.js");
19
+ Object.defineProperty(exports, "classifyPointer", { enumerable: true, get: function () { return loader_ts_1.classifyPointer; } });
20
+ var sanitize_ts_1 = require("./sanitize.js");
21
+ Object.defineProperty(exports, "sanitizeConfig", { enumerable: true, get: function () { return sanitize_ts_1.sanitizeConfig; } });
22
+ Object.defineProperty(exports, "CONFIG_RULES", { enumerable: true, get: function () { return sanitize_ts_1.CONFIG_RULES; } });
23
+ Object.defineProperty(exports, "CLI_RULES", { enumerable: true, get: function () { return sanitize_ts_1.CLI_RULES; } });
24
+ var payload_ts_1 = require("./payload.js");
25
+ Object.defineProperty(exports, "buildPayload", { enumerable: true, get: function () { return payload_ts_1.buildPayload; } });
26
+ Object.defineProperty(exports, "fingerprint", { enumerable: true, get: function () { return payload_ts_1.fingerprint; } });
27
+ var error_type_ts_1 = require("./error-type.js");
28
+ Object.defineProperty(exports, "errorTypeOf", { enumerable: true, get: function () { return error_type_ts_1.errorTypeOf; } });
29
+ Object.defineProperty(exports, "ERROR_TYPES", { enumerable: true, get: function () { return error_type_ts_1.ERROR_TYPES; } });
30
+ Object.defineProperty(exports, "NO_SCHEMA_ERROR", { enumerable: true, get: function () { return error_type_ts_1.NO_SCHEMA_ERROR; } });
31
+ Object.defineProperty(exports, "POST_ERROR_PREFIX", { enumerable: true, get: function () { return error_type_ts_1.POST_ERROR_PREFIX; } });
32
+ var disclaimer_ts_1 = require("./disclaimer.js");
33
+ Object.defineProperty(exports, "printDisclaimer", { enumerable: true, get: function () { return disclaimer_ts_1.printDisclaimer; } });
34
+ Object.defineProperty(exports, "isNoticeDue", { enumerable: true, get: function () { return disclaimer_ts_1.isNoticeDue; } });
35
+ Object.defineProperty(exports, "resetDisclaimer", { enumerable: true, get: function () { return disclaimer_ts_1.resetDisclaimer; } });
36
+ Object.defineProperty(exports, "FULL_NOTICE", { enumerable: true, get: function () { return disclaimer_ts_1.FULL_NOTICE; } });
37
+ var track_ts_1 = require("./track.js");
38
+ Object.defineProperty(exports, "track", { enumerable: true, get: function () { return track_ts_1.track; } });
39
+ Object.defineProperty(exports, "encodeBody", { enumerable: true, get: function () { return track_ts_1.encodeBody; } });
package/dist/loader.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export type LoaderKind = "code-file" | "file-json" | "file-sdl" | "git" | "github" | "glob" | "inline-sdl" | "unknown" | "url";
2
- /** Classifies a schema pointer; the pointer itself is never returned. */
2
+ /**
3
+ * Classifies a schema pointer; the pointer itself is never returned. Kinds are
4
+ * distinct, and a single kind is not wrapped in a list: the number of pointers
5
+ * could single out a user.
6
+ */
3
7
  export declare const classifyPointer: (pointer: unknown) => LoaderKind | LoaderKind[];
4
8
  /** Classifies a schema pointer into mask token(s) for the config slot. */
5
9
  export declare const maskPointer: (pointer: unknown) => string[] | string;
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,WAAW,GACX,UAAU,GACV,KAAK,GACL,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,SAAS,GACT,KAAK,CAAC;AA2DV,yEAAyE;AACzE,eAAO,MAAM,eAAe,YACjB,OAAO,KACf,UAAU,GAAG,UAAU,EAMzB,CAAC;AAcF,0EAA0E;AAC1E,eAAO,MAAM,WAAW,YAAa,OAAO,KAAG,MAAM,EAAE,GAAG,MAOzD,CAAC"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,WAAW,GACX,WAAW,GACX,UAAU,GACV,KAAK,GACL,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,SAAS,GACT,KAAK,CAAC;AA2DV;;;;GAIG;AACH,eAAO,MAAM,eAAe,YACjB,OAAO,KACf,UAAU,GAAG,UAAU,EAOzB,CAAC;AAcF,0EAA0E;AAC1E,eAAO,MAAM,WAAW,YAAa,OAAO,KAAG,MAAM,EAAE,GAAG,MAOzD,CAAC"}
package/dist/loader.js CHANGED
@@ -47,13 +47,16 @@ const classifyEntry = (pointer) => {
47
47
  }
48
48
  return [classifyOne(pointer)];
49
49
  };
50
- /** Classifies a schema pointer; the pointer itself is never returned. */
50
+ /**
51
+ * Classifies a schema pointer; the pointer itself is never returned. Kinds are
52
+ * distinct, and a single kind is not wrapped in a list: the number of pointers
53
+ * could single out a user.
54
+ */
51
55
  const classifyPointer = (pointer) => {
52
- if (Array.isArray(pointer)) {
53
- return pointer.flatMap(classifyEntry);
54
- }
55
- const kinds = classifyEntry(pointer);
56
- return kinds.length === 1 ? kinds[0] : kinds;
56
+ const kinds = new Set(Array.isArray(pointer)
57
+ ? pointer.flatMap(classifyEntry)
58
+ : classifyEntry(pointer));
59
+ return kinds.size === 1 ? [...kinds][0] : [...kinds];
57
60
  };
58
61
  exports.classifyPointer = classifyPointer;
59
62
  const MASKS = {
@@ -1 +1 @@
1
- {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../src/payload.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAMjC,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3B,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAkED,eAAO,MAAM,YAAY,UAAW,YAAY,KAAG,gBAmDlD,CAAC;AA0BF,sEAAsE;AACtE,eAAO,MAAM,WAAW,YAAa,gBAAgB,KAAG,MAMvD,CAAC"}
1
+ {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../src/payload.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAMjC,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC3B,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AA6ED,eAAO,MAAM,YAAY,UAAW,YAAY,KAAG,gBAmDlD,CAAC;AA0BF,sEAAsE;AACtE,eAAO,MAAM,WAAW,YAAa,gBAAgB,KAAG,MAMvD,CAAC"}
package/dist/payload.js CHANGED
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fingerprint = exports.buildPayload = void 0;
4
4
  const node_crypto_1 = require("node:crypto");
5
5
  const node_fs_1 = require("node:fs");
6
- const ci_1 = require("./ci");
7
- const loader_1 = require("./loader");
8
- const sanitize_1 = require("./sanitize");
6
+ const ci_ts_1 = require("./ci.js");
7
+ const loader_ts_1 = require("./loader.js");
8
+ const sanitize_ts_1 = require("./sanitize.js");
9
9
  const detectPm = (env) => {
10
10
  const name = /^(npm|pnpm|yarn|bun)\//.exec(env.npm_config_user_agent ?? "");
11
11
  return name?.[1] ?? "unknown";
@@ -29,7 +29,7 @@ const isContainer = (env) => {
29
29
  env.REMOTE_CONTAINERS !== undefined);
30
30
  };
31
31
  const applySanitizedSection = (payload, section, source, rules) => {
32
- const result = (0, sanitize_1.sanitizeConfig)(source, rules);
32
+ const result = (0, sanitize_ts_1.sanitizeConfig)(source, rules);
33
33
  if (section === "config") {
34
34
  payload.config = result.value;
35
35
  }
@@ -37,7 +37,7 @@ const applySanitizedSection = (payload, section, source, rules) => {
37
37
  payload.cli = result.value;
38
38
  }
39
39
  if (payload.loader === undefined && source.schema !== undefined) {
40
- payload.loader = (0, loader_1.classifyPointer)(source.schema);
40
+ payload.loader = (0, loader_ts_1.classifyPointer)(source.schema);
41
41
  }
42
42
  return result.unknownKeys;
43
43
  };
@@ -55,15 +55,25 @@ const applyGenerateFields = (payload, input) => {
55
55
  payload.errorType = errorType;
56
56
  }
57
57
  };
58
+ const VERSION_RE = /^(\d{1,4}\.\d{1,4})(?:\.\d{1,4})?(?:-(alpha|beta|rc|canary|next)(?:\.\d{1,3})?(?![0-9A-Za-z]))?/;
59
+ /** Reduces a package version to `major.minor` (patch and prerelease dropped), else "unknown". */
60
+ const truncateVersion = (value) => {
61
+ const m = VERSION_RE.exec(value);
62
+ if (m === null)
63
+ return "unknown";
64
+ if (m[2])
65
+ return m[1];
66
+ return /^\d{1,4}\.\d{1,4}(\.\d{1,4})?$/.test(value) ? m[1] : "unknown";
67
+ };
58
68
  const buildPayload = (input) => {
59
69
  const env = input.env ?? process.env;
60
- const { ci, ciProvider } = (0, ci_1.detectCi)(env);
70
+ const { ci, ciProvider } = (0, ci_ts_1.detectCi)(env);
61
71
  const major = input.graphqlMajor;
62
72
  const payload = {
63
73
  v: 1,
64
74
  event: input.event ?? "config",
65
75
  pkg: input.pkg,
66
- pkgVersion: input.pkgVersion,
76
+ pkgVersion: truncateVersion(input.pkgVersion),
67
77
  nodeMajor: Number.parseInt(process.versions.node, 10),
68
78
  graphqlMajor: typeof major === "number" &&
69
79
  Number.isInteger(major) &&
@@ -84,10 +94,10 @@ const buildPayload = (input) => {
84
94
  }
85
95
  let unknownKeys = 0;
86
96
  if (input.config) {
87
- unknownKeys += applySanitizedSection(payload, "config", input.config, sanitize_1.CONFIG_RULES);
97
+ unknownKeys += applySanitizedSection(payload, "config", input.config, sanitize_ts_1.CONFIG_RULES);
88
98
  }
89
99
  if (input.cli) {
90
- unknownKeys += applySanitizedSection(payload, "cli", input.cli, sanitize_1.CLI_RULES);
100
+ unknownKeys += applySanitizedSection(payload, "cli", input.cli, sanitize_ts_1.CLI_RULES);
91
101
  }
92
102
  if (unknownKeys > 0) {
93
103
  payload.unknownKeys = unknownKeys;
@@ -1,3 +1,4 @@
1
+ import type { CliOptions, ConfigOptions } from "@graphql-markdown/types";
1
2
  export type Rule = {
2
3
  kind: "any";
3
4
  } | {
@@ -30,197 +31,8 @@ export interface SanitizeResult {
30
31
  value: Record<string, unknown>;
31
32
  unknownKeys: number;
32
33
  }
33
- export declare const CONFIG_RULES: {
34
- readonly baseURL: {
35
- kind: "url";
36
- };
37
- readonly customDirective: {
38
- readonly kind: "map";
39
- readonly value: {
40
- kind: "any";
41
- };
42
- };
43
- readonly decorators: {
44
- readonly kind: "map";
45
- readonly value: {
46
- kind: "any";
47
- };
48
- };
49
- readonly diffMethod: Rule;
50
- readonly docOptions: {
51
- readonly kind: "object";
52
- readonly fields: {
53
- readonly frontMatter: {
54
- readonly kind: "map";
55
- readonly value: {
56
- kind: "any";
57
- };
58
- };
59
- readonly index: {
60
- kind: "scalar";
61
- };
62
- readonly generatorFrameworkName: {
63
- kind: "string";
64
- };
65
- readonly generatorFrameworkVersion: {
66
- kind: "string";
67
- };
68
- readonly categorySort: {
69
- readonly kind: "enum";
70
- readonly values: readonly ["natural"];
71
- };
72
- readonly sectionHeaderId: {
73
- kind: "scalar";
74
- };
75
- };
76
- };
77
- readonly force: {
78
- kind: "scalar";
79
- };
80
- readonly groupByDirective: {
81
- readonly kind: "object";
82
- readonly fields: {
83
- readonly directive: {
84
- kind: "string";
85
- };
86
- readonly field: {
87
- kind: "string";
88
- };
89
- readonly fallback: {
90
- kind: "string";
91
- };
92
- };
93
- };
94
- readonly homepage: {
95
- kind: "path";
96
- };
97
- readonly id: {
98
- kind: "string";
99
- };
100
- readonly linkRoot: {
101
- kind: "path";
102
- };
103
- readonly loaders: {
104
- readonly kind: "loaders";
105
- };
106
- readonly formatter: {
107
- kind: "formatter";
108
- };
109
- readonly mdxParser: {
110
- kind: "formatter";
111
- };
112
- readonly metatags: {
113
- readonly kind: "map";
114
- readonly value: {
115
- kind: "string";
116
- };
117
- };
118
- readonly onlyDocDirective: {
119
- kind: "string";
120
- };
121
- readonly outputAdapter: {
122
- readonly kind: "opaque";
123
- };
124
- readonly pretty: {
125
- kind: "scalar";
126
- };
127
- readonly printTypeOptions: {
128
- readonly kind: "object";
129
- readonly fields: {
130
- readonly deprecated: Rule;
131
- readonly exampleSection: {
132
- readonly kind: "map";
133
- readonly value: {
134
- kind: "string";
135
- };
136
- };
137
- readonly hierarchy: Rule;
138
- readonly parentTypePrefix: {
139
- kind: "scalar";
140
- };
141
- readonly typeBadges: {
142
- kind: "scalar";
143
- };
144
- };
145
- };
146
- readonly rootPath: {
147
- kind: "path";
148
- };
149
- readonly schema: {
150
- kind: "pointer";
151
- };
152
- readonly skipDocDirective: {
153
- kind: "string";
154
- };
155
- readonly telemetry: {
156
- kind: "scalar";
157
- };
158
- readonly tmpDir: {
159
- kind: "path";
160
- };
161
- };
162
- export declare const CLI_RULES: {
163
- readonly base: {
164
- kind: "url";
165
- };
166
- readonly config: {
167
- kind: "scalar";
168
- };
169
- readonly deprecated: Rule;
170
- readonly diff: Rule;
171
- readonly force: {
172
- kind: "scalar";
173
- };
174
- readonly groupByDirective: {
175
- kind: "string";
176
- };
177
- readonly homepage: {
178
- kind: "path";
179
- };
180
- readonly index: {
181
- kind: "scalar";
182
- };
183
- readonly link: {
184
- kind: "path";
185
- };
186
- readonly hierarchy: Rule;
187
- readonly formatter: {
188
- kind: "formatter";
189
- };
190
- readonly mdxParser: {
191
- kind: "formatter";
192
- };
193
- readonly noParentType: {
194
- kind: "scalar";
195
- };
196
- readonly noTypeBadges: {
197
- kind: "scalar";
198
- };
199
- readonly noSectionId: {
200
- kind: "scalar";
201
- };
202
- readonly pretty: {
203
- kind: "scalar";
204
- };
205
- readonly root: {
206
- kind: "path";
207
- };
208
- readonly schema: {
209
- kind: "pointer";
210
- };
211
- readonly skip: {
212
- kind: "string";
213
- };
214
- readonly only: {
215
- kind: "string";
216
- };
217
- readonly tmp: {
218
- kind: "path";
219
- };
220
- readonly telemetry: {
221
- kind: "scalar";
222
- };
223
- };
34
+ export declare const CONFIG_RULES: Readonly<Record<keyof ConfigOptions, Rule>>;
35
+ export declare const CLI_RULES: Readonly<Record<keyof CliOptions, Rule>>;
224
36
  /**
225
37
  * Sanitizes a config source. Top-level keys without a rule are dropped and
226
38
  * counted in `unknownKeys`.
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,IAAI,GACZ;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,SA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AAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AA8BD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,aAAa,EAAE,IAAI,CAAC,CA8CpE,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,UAAU,EAAE,IAAI,CAAC,CAuB9D,CAAC;AAoLF;;;GAGG;AACH,eAAO,MAAM,cAAc,UAClB,OAAO,SACP,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,KAC1B,cAmBF,CAAC"}
package/dist/sanitize.js CHANGED
@@ -1,10 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sanitizeConfig = exports.CLI_RULES = exports.CONFIG_RULES = void 0;
4
- const loader_1 = require("./loader");
5
- const schema_1 = require("./schema");
4
+ const loader_ts_1 = require("./loader.js");
5
+ const schema_ts_1 = require("./schema.js");
6
6
  const MAX_DEPTH = 8;
7
7
  const FORMATTER_PACKAGE = /^@graphql-markdown\/[a-z0-9-]+(\/[a-z0-9-]+)*$/;
8
+ /**
9
+ * `graphql-config`'s `project.extension()` decorates the returned extension
10
+ * object with these project-level fields (schema, documents, include,
11
+ * exclude) regardless of whether the user's config sets them. `schema` is a
12
+ * real graphql-markdown option and has its own rule; the other three are
13
+ * graphql-config plumbing, not graphql-markdown options, so they are dropped
14
+ * silently here rather than inflating `unknownKeys` on every run.
15
+ */
16
+ const GRAPHQL_CONFIG_PROJECT_KEYS = new Set([
17
+ "documents",
18
+ "include",
19
+ "exclude",
20
+ ]);
8
21
  const scalar = { kind: "scalar" };
9
22
  const string = { kind: "string" };
10
23
  const path = { kind: "path" };
@@ -15,12 +28,12 @@ const pointer = { kind: "pointer" };
15
28
  const enumOf = (values) => {
16
29
  return { kind: "enum", values };
17
30
  };
18
- const deprecated = enumOf(schema_1.DEPRECATED_OPTIONS);
31
+ const deprecated = enumOf(schema_ts_1.DEPRECATED_OPTIONS);
19
32
  exports.CONFIG_RULES = {
20
33
  baseURL: url,
21
34
  customDirective: { kind: "map", value: any },
22
35
  decorators: { kind: "map", value: any },
23
- diffMethod: enumOf(schema_1.DIFF_METHODS),
36
+ diffMethod: enumOf(schema_ts_1.DIFF_METHODS),
24
37
  docOptions: {
25
38
  kind: "object",
26
39
  fields: {
@@ -43,7 +56,7 @@ exports.CONFIG_RULES = {
43
56
  loaders: { kind: "loaders" },
44
57
  formatter,
45
58
  mdxParser: formatter,
46
- metatags: { kind: "map", value: string },
59
+ metatags: { kind: "opaque" }, // the number and shape of tags are not sent
47
60
  onlyDocDirective: string,
48
61
  outputAdapter: { kind: "opaque" },
49
62
  pretty: scalar,
@@ -52,7 +65,7 @@ exports.CONFIG_RULES = {
52
65
  fields: {
53
66
  deprecated,
54
67
  exampleSection: { kind: "map", value: string },
55
- hierarchy: enumOf(schema_1.HIERARCHIES),
68
+ hierarchy: enumOf(schema_ts_1.HIERARCHIES),
56
69
  parentTypePrefix: scalar,
57
70
  typeBadges: scalar,
58
71
  },
@@ -67,13 +80,13 @@ exports.CLI_RULES = {
67
80
  base: url,
68
81
  config: scalar,
69
82
  deprecated,
70
- diff: enumOf(schema_1.DIFF_METHODS),
83
+ diff: enumOf(schema_ts_1.DIFF_METHODS),
71
84
  force: scalar,
72
85
  groupByDirective: string,
73
86
  homepage: path,
74
87
  index: scalar,
75
88
  link: path,
76
- hierarchy: enumOf(schema_1.HIERARCHIES),
89
+ hierarchy: enumOf(schema_ts_1.HIERARCHIES),
77
90
  formatter,
78
91
  mdxParser: formatter,
79
92
  noParentType: scalar,
@@ -102,14 +115,14 @@ const isPlainObject = (value) => {
102
115
  return proto === Object.prototype || proto === null;
103
116
  };
104
117
  const sanitizeFormatter = (value) => {
105
- if (schema_1.FORMATTER_PRESETS.includes(value) ||
118
+ if (schema_ts_1.FORMATTER_PRESETS.includes(value) ||
106
119
  FORMATTER_PACKAGE.test(value)) {
107
120
  return value;
108
121
  }
109
122
  return "<custom-formatter>";
110
123
  };
111
124
  const sanitizeLoaderName = (value) => {
112
- return schema_1.KNOWN_LOADERS.includes(value)
125
+ return schema_ts_1.KNOWN_LOADERS.includes(value)
113
126
  ? value
114
127
  : "<custom-loader>";
115
128
  };
@@ -214,7 +227,7 @@ const sanitizeValue = (value, rule, depth) => {
214
227
  };
215
228
  const sanitizeByRule = (value, rule, depth) => {
216
229
  if (rule.kind === "pointer") {
217
- return (0, loader_1.maskPointer)(value);
230
+ return (0, loader_ts_1.maskPointer)(value);
218
231
  }
219
232
  if (rule.kind === "loaders") {
220
233
  return sanitizeLoaders(value, depth);
@@ -246,6 +259,9 @@ const sanitizeConfig = (value, rules) => {
246
259
  return result;
247
260
  }
248
261
  for (const [key, item] of Object.entries(value)) {
262
+ if (GRAPHQL_CONFIG_PROJECT_KEYS.has(key)) {
263
+ continue;
264
+ }
249
265
  if (!Object.hasOwn(rules, key)) {
250
266
  result.unknownKeys += 1;
251
267
  continue;
package/dist/schema.d.ts CHANGED
@@ -17,20 +17,20 @@ export declare const MASK_TOKENS: readonly ["<url>", "<path>", "<string>", "<fun
17
17
  /** Pattern of masked object keys, e.g. `<key:0>`. */
18
18
  export declare const KEY_TOKEN_PATTERN: string;
19
19
  export declare const ALLOWLIST: {
20
- readonly events: readonly ["config", "create_scaffold", "create_wire"];
21
- readonly triggers: readonly ["cli", "create", "docusaurus", "nuxt", "programmatic"];
22
- readonly ciProviders: readonly ["github-actions", "gitlab", "circleci", "azure-pipelines", "jenkins", "bitbucket", "buildkite", "travis", "vercel", "netlify", "cloudflare-pages", "aws-codebuild", "teamcity", "appveyor", "drone", "render", "other"];
23
- readonly packageManagers: readonly ["npm", "pnpm", "yarn", "bun", "unknown"];
24
- readonly loaderKinds: readonly ["url", "file-sdl", "file-json", "git", "github", "glob", "code-file", "inline-sdl", "unknown"];
25
- readonly modes: readonly ["scaffold", "wire"];
26
- readonly diffMethods: readonly ["FORCE", "NONE"];
27
- readonly deprecatedOptions: readonly ["default", "group", "skip"];
28
- readonly hierarchies: readonly ["api", "entity", "flat"];
29
- readonly formatterPresets: readonly ["docfx", "docusaurus", "fumadocs", "honkit", "hugo", "mdbook", "mdx", "mkdocs", "starlight", "vocs"];
20
+ readonly events: typeof EVENTS;
21
+ readonly triggers: typeof TRIGGERS;
22
+ readonly ciProviders: typeof CI_PROVIDERS;
23
+ readonly packageManagers: typeof PACKAGE_MANAGERS;
24
+ readonly loaderKinds: typeof LOADER_KINDS;
25
+ readonly modes: typeof MODES;
26
+ readonly diffMethods: typeof DIFF_METHODS;
27
+ readonly deprecatedOptions: typeof DEPRECATED_OPTIONS;
28
+ readonly hierarchies: typeof HIERARCHIES;
29
+ readonly formatterPresets: typeof FORMATTER_PRESETS;
30
30
  readonly formatterPackagePattern: "^@graphql-markdown/[a-z0-9-]+(/[a-z0-9-]+)*$";
31
- readonly knownLoaders: readonly ["UrlLoader", "JsonFileLoader", "GraphQLFileLoader", "CodeFileLoader", "GitLoader", "GithubLoader", "ApolloEngineLoader", "PrismaLoader", "@graphql-tools/url-loader", "@graphql-tools/json-file-loader", "@graphql-tools/graphql-file-loader", "@graphql-tools/code-file-loader", "@graphql-tools/git-loader", "@graphql-tools/github-loader", "@graphql-tools/apollo-engine-loader", "@graphql-tools/prisma-loader"];
32
- readonly maskTokens: readonly ["<url>", "<path>", "<string>", "<function>", "<object>", "<custom-loader>", "<custom-formatter>", "<git>", "<github>", "<file:sdl>", "<file:json>", "<file:code>", "<glob>", "<inline-sdl>", "<unknown>"];
33
- readonly keyTokenPattern: string;
31
+ readonly knownLoaders: typeof KNOWN_LOADERS;
32
+ readonly maskTokens: typeof MASK_TOKENS;
33
+ readonly keyTokenPattern: typeof KEY_TOKEN_PATTERN;
34
34
  readonly graphqlMajorUnknown: "unknown";
35
35
  };
36
36
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema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B,cAAc,EACd,2BAA2B,EAC3B,iCAAiC,EACjC,oCAAoC,EACpC,iCAAiC,EACjC,2BAA2B,EAC3B,8BAA8B,EAC9B,qCAAqC,EACrC,8BAA8B,CACtB,CAAC;AACX,eAAO,MAAM,WAAW,YACtB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,OAAO,EACP,UAAU,EACV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,CACH,CAAC;AACX,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,QAA0B,CAAC;AAEzD,eAAO,MAAM,SAAS;aACpB,MAAM;aACN,QAAQ;aACR,WAAW;aACX,eAAe;aACf,WAAW;aACX,KAAK;aACL,WAAW;aACX,iBAAiB;aACjB,WAAW;aACX,gBAAgB;aAChB,uBAAuB,EAAE,8CAA8C;aACvE,YAAY;aACZ,UAAU;aACV,eAAe;aACf,mBAAmB,EAAE,SAAS;CACtB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,MAAM,YAAI,QAAQ,EAAE,iBAAiB,EAAE,aAAa,CAAU,CAAC;AAC5E,eAAO,MAAM,QAAQ,YACnB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,cAAc,CACN,CAAC;AACX,eAAO,MAAM,YAAY,YACvB,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,CACC,CAAC;AACX,eAAO,MAAM,gBAAgB,YAC3B,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,SAAS,CACD,CAAC;AACX,eA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AAE,OAAO,YAAY,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,OAAO,gBAAgB,CAAC;IAClD,QAAQ,CAAC,WAAW,EAAE,OAAO,YAAY,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,OAAO,YAAY,CAAC;IAC1C,QAAQ,CAAC,iBAAiB,EAAE,OAAO,kBAAkB,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,OAAO,WAAW,CAAC;IACzC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,iBAAiB,CAAC;IACpD,QAAQ,CAAC,uBAAuB,EAAE,8CAA8C,CAAC;IACjF,QAAQ,CAAC,YAAY,EAAE,OAAO,aAAa,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,OAAO,WAAW,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,OAAO,iBAAiB,CAAC;IACnD,QAAQ,CAAC,mBAAmB,EAAE,SAAS,CAAC;CAiBhC,CAAC"}
package/dist/state.js CHANGED
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeState = exports.readState = exports.getStatePath = void 0;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const node_path_1 = require("node:path");
6
- const config_dir_1 = require("./config-dir");
7
- const constants_1 = require("./constants");
8
- const getStatePath = (dir = (0, config_dir_1.resolveConfigDir)()) => {
6
+ const config_dir_ts_1 = require("./config-dir.js");
7
+ const constants_ts_1 = require("./constants.js");
8
+ const getStatePath = (dir = (0, config_dir_ts_1.resolveConfigDir)()) => {
9
9
  return (0, node_path_1.join)(dir, "telemetry.json");
10
10
  };
11
11
  exports.getStatePath = getStatePath;
@@ -57,7 +57,7 @@ const writeState = (next, path = (0, exports.getStatePath)()) => {
57
57
  };
58
58
  const merged = [
59
59
  ...new Set([...base.lastSentConfigs, ...(next.lastSentConfigs ?? [])]),
60
- ].slice(-constants_1.MAX_SENT_CONFIGS);
60
+ ].slice(-constants_ts_1.MAX_SENT_CONFIGS);
61
61
  const state = { ...base, ...next, lastSentConfigs: merged };
62
62
  if (state.reason === undefined) {
63
63
  delete state.reason;
package/dist/track.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { PayloadInput } from "./payload";
1
+ import type { PayloadInput } from "./payload.ts";
2
2
  export interface TrackInput extends Omit<PayloadInput, "noStateBefore"> {
3
3
  /** Value of the `telemetry` option. */
4
4
  option?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../src/track.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC;IACrE,uCAAuC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,iEAAiE;AACjE,eAAO,MAAM,UAAU,SACf,MAAM,KACX;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CASnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,UAAiB,UAAU,KAAG,OAAO,CAAC,IAAI,CA2D3D,CAAC"}
1
+ {"version":3,"file":"track.d.ts","sourceRoot":"","sources":["../src/track.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC;IACrE,uCAAuC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,iEAAiE;AACjE,eAAO,MAAM,UAAU,SACf,MAAM,KACX;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CASnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,UAAiB,UAAU,KAAG,OAAO,CAAC,IAAI,CA2D3D,CAAC"}
package/dist/track.js CHANGED
@@ -2,18 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.track = exports.encodeBody = void 0;
4
4
  const node_zlib_1 = require("node:zlib");
5
- const ci_1 = require("./ci");
6
- const constants_1 = require("./constants");
7
- const disclaimer_1 = require("./disclaimer");
8
- const enabled_1 = require("./enabled");
9
- const payload_1 = require("./payload");
10
- const state_1 = require("./state");
5
+ const ci_ts_1 = require("./ci.js");
6
+ const constants_ts_1 = require("./constants.js");
7
+ const disclaimer_ts_1 = require("./disclaimer.js");
8
+ const enabled_ts_1 = require("./enabled.js");
9
+ const payload_ts_1 = require("./payload.js");
10
+ const state_ts_1 = require("./state.js");
11
11
  /** Builds the request body, gzipped above the size threshold. */
12
12
  const encodeBody = (json) => {
13
13
  const headers = {
14
14
  "Content-Type": "application/json",
15
15
  };
16
- if (Buffer.byteLength(json) > constants_1.GZIP_THRESHOLD) {
16
+ if (Buffer.byteLength(json) > constants_ts_1.GZIP_THRESHOLD) {
17
17
  headers["Content-Encoding"] = "gzip";
18
18
  return { body: (0, node_zlib_1.gzipSync)(json), headers };
19
19
  }
@@ -26,9 +26,9 @@ exports.encodeBody = encodeBody;
26
26
  const track = async (input) => {
27
27
  try {
28
28
  const env = input.env ?? process.env;
29
- const statePath = input.statePath ?? (0, state_1.getStatePath)();
30
- const state = (0, state_1.readState)(statePath);
31
- const decision = (0, enabled_1.isEnabled)({
29
+ const statePath = input.statePath ?? (0, state_ts_1.getStatePath)();
30
+ const state = (0, state_ts_1.readState)(statePath);
31
+ const decision = (0, enabled_ts_1.isEnabled)({
32
32
  trigger: input.trigger,
33
33
  option: input.option,
34
34
  state,
@@ -37,12 +37,12 @@ const track = async (input) => {
37
37
  if (!decision.enabled) {
38
38
  return;
39
39
  }
40
- const ci = (0, ci_1.detectCi)(env);
41
- if ((0, disclaimer_1.printDisclaimer)(state, ci, input.onFullNotice)) {
40
+ const ci = (0, ci_ts_1.detectCi)(env);
41
+ if ((0, disclaimer_ts_1.printDisclaimer)(state, ci, input.onFullNotice)) {
42
42
  // Nothing is sent when the notice cannot be recorded.
43
- (0, state_1.writeState)({ enabled: true, noticeVersion: constants_1.NOTICE_VERSION }, statePath);
43
+ (0, state_ts_1.writeState)({ enabled: true, noticeVersion: constants_ts_1.NOTICE_VERSION }, statePath);
44
44
  }
45
- const payload = (0, payload_1.buildPayload)({
45
+ const payload = (0, payload_ts_1.buildPayload)({
46
46
  ...input,
47
47
  env,
48
48
  trigger: decision.trigger,
@@ -56,24 +56,24 @@ const track = async (input) => {
56
56
  }
57
57
  // Generate events carry a duration, so their fingerprint never repeats.
58
58
  const dedupe = payload.event !== "generate";
59
- const fp = (0, payload_1.fingerprint)(payload);
59
+ const fp = (0, payload_ts_1.fingerprint)(payload);
60
60
  if (dedupe && state?.lastSentConfigs.includes(fp)) {
61
61
  return;
62
62
  }
63
63
  const { body, headers } = (0, exports.encodeBody)(json);
64
- const response = await fetch((0, enabled_1.getEndpoint)(env), {
64
+ const response = await fetch((0, enabled_ts_1.getEndpoint)(env), {
65
65
  method: "POST",
66
66
  headers,
67
67
  body,
68
- signal: AbortSignal.timeout(constants_1.TIMEOUT_MS),
68
+ signal: AbortSignal.timeout(constants_ts_1.TIMEOUT_MS),
69
69
  });
70
70
  if (response.status === 202) {
71
71
  if (dedupe) {
72
- (0, state_1.writeState)({ lastSentConfigs: [fp] }, statePath);
72
+ (0, state_ts_1.writeState)({ lastSentConfigs: [fp] }, statePath);
73
73
  }
74
74
  }
75
75
  else if (response.status === 410) {
76
- (0, state_1.writeState)({ enabled: false, reason: "sunset" }, statePath);
76
+ (0, state_ts_1.writeState)({ enabled: false, reason: "sunset" }, statePath);
77
77
  }
78
78
  }
79
79
  catch {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@graphql-markdown/telemetry",
3
3
  "homepage": "https://graphql-markdown.dev",
4
- "description": "GraphQL-Markdown anonymous usage telemetry.",
4
+ "description": "Anonymous, opt-out usage telemetry for the GraphQL-Markdown CLI.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/graphql-markdown/graphql-markdown/issues"
7
7
  },
8
- "version": "0.1.0",
8
+ "version": "0.2.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -55,8 +55,8 @@
55
55
  "build": "tsgo --build",
56
56
  "lint": "eslint --config ../../packages/tooling-config/eslint/config.ts \"{src,tests}/**/*.{ts,js,json,gql}\"",
57
57
  "lint:fix": "eslint --config ../../packages/tooling-config/eslint/config.ts \"{src,tests}/**/*.{ts,js,json,gql}\" --fix",
58
- "prettier": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" --check",
59
- "prettier:fix": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" --write",
58
+ "prettier": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" README.md --check",
59
+ "prettier:fix": "prettier \"{src,tests,assets}/**/*.{ts,js,json,md,gql}\" README.md --write",
60
60
  "ts:check": "tsgo --noEmit",
61
61
  "test": "vitest run --passWithNoTests",
62
62
  "test:unit": "vitest run --passWithNoTests tests/unit",
@@ -65,17 +65,17 @@
65
65
  "test:watch": "vitest --watch"
66
66
  },
67
67
  "dependencies": {
68
- "@graphql-markdown/types": "^1.17.0"
68
+ "@graphql-markdown/types": "^1.17.1"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@graphql-markdown/tooling-config": "^1.0.0",
72
- "@stryker-mutator/api": "10.0.0"
72
+ "@stryker-mutator/api": "10.1.1"
73
73
  },
74
74
  "directories": {
75
75
  "test": "tests"
76
76
  },
77
77
  "engines": {
78
- "node": ">=22.12.0"
78
+ "node": ">=22.18.0"
79
79
  },
80
80
  "publishConfig": {
81
81
  "access": "public"