@graphql-markdown/telemetry 0.1.1 → 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
@@ -68,7 +68,7 @@ What is sent (CLI options `{ "force": true }`, trigger `cli`, GraphQL 16):
68
68
  "v": 1,
69
69
  "event": "config",
70
70
  "pkg": "@graphql-markdown/cli",
71
- "pkgVersion": "0.1.0",
71
+ "pkgVersion": "0.1",
72
72
  "nodeMajor": 24,
73
73
  "graphqlMajor": 16,
74
74
  "os": "darwin",
@@ -95,12 +95,7 @@ What is sent (CLI options `{ "force": true }`, trigger `cli`, GraphQL 16):
95
95
  "deprecated": "group",
96
96
  "typeBadges": true
97
97
  },
98
- "metatags": [
99
- {
100
- "<key:0>": "<string>",
101
- "<key:1>": "<string>"
102
- }
103
- ],
98
+ "metatags": "<object>",
104
99
  "loaders": {
105
100
  "UrlLoader": "@graphql-tools/url-loader"
106
101
  }
@@ -115,11 +110,12 @@ What is sent (CLI options `{ "force": true }`, trigger `cli`, GraphQL 16):
115
110
  Masking rules:
116
111
 
117
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.
118
- - `<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.
119
114
  - `<custom-formatter>`: a third-party or local `formatter` or `mdxParser`. Only presets and `@graphql-markdown/*` packages are kept as-is.
120
115
  - `<path>`: a filesystem path (for example `rootPath`, `linkRoot`, `homepage`).
121
- - `<string>`: a custom string (for example directive names, field names, fallback labels, metatag values).
122
- - `<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).
123
119
 
124
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.
125
121
 
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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AAM,YAAY,UAAW,YAAY,KAAG,gBAmDlD,CAAC;AA0BF,sEAAsE;AACtE,eAAO,MAAM,WAAW,YAAa,gBAAgB,KAAG,MAMvD,CAAC"}
package/dist/payload.js CHANGED
@@ -55,6 +55,16 @@ 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
70
  const { ci, ciProvider } = (0, ci_ts_1.detectCi)(env);
@@ -63,7 +73,7 @@ const buildPayload = (input) => {
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) &&
package/dist/sanitize.js CHANGED
@@ -56,7 +56,7 @@ exports.CONFIG_RULES = {
56
56
  loaders: { kind: "loaders" },
57
57
  formatter,
58
58
  mdxParser: formatter,
59
- metatags: { kind: "map", value: string },
59
+ metatags: { kind: "opaque" }, // the number and shape of tags are not sent
60
60
  onlyDocDirective: string,
61
61
  outputAdapter: { kind: "opaque" },
62
62
  pretty: scalar,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "bugs": {
6
6
  "url": "https://github.com/graphql-markdown/graphql-markdown/issues"
7
7
  },
8
- "version": "0.1.1",
8
+ "version": "0.2.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",