@depup/octokit__endpoint 11.0.3-depup.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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -0
  3. package/changes.json +10 -0
  4. package/dist-bundle/index.js +346 -0
  5. package/dist-bundle/index.js.map +7 -0
  6. package/dist-src/defaults.js +17 -0
  7. package/dist-src/endpoint-with-defaults.js +9 -0
  8. package/dist-src/index.js +6 -0
  9. package/dist-src/merge.js +27 -0
  10. package/dist-src/parse.js +70 -0
  11. package/dist-src/util/add-query-parameters.js +16 -0
  12. package/dist-src/util/extract-url-variable-names.js +14 -0
  13. package/dist-src/util/is-plain-object.js +11 -0
  14. package/dist-src/util/lowercase-keys.js +12 -0
  15. package/dist-src/util/merge-deep.js +16 -0
  16. package/dist-src/util/omit.js +12 -0
  17. package/dist-src/util/remove-undefined-properties.js +11 -0
  18. package/dist-src/util/url-template.js +133 -0
  19. package/dist-src/version.js +4 -0
  20. package/dist-src/with-defaults.js +16 -0
  21. package/dist-types/defaults.d.ts +2 -0
  22. package/dist-types/endpoint-with-defaults.d.ts +3 -0
  23. package/dist-types/index.d.ts +1 -0
  24. package/dist-types/merge.d.ts +2 -0
  25. package/dist-types/parse.d.ts +2 -0
  26. package/dist-types/util/add-query-parameters.d.ts +4 -0
  27. package/dist-types/util/extract-url-variable-names.d.ts +1 -0
  28. package/dist-types/util/is-plain-object.d.ts +1 -0
  29. package/dist-types/util/lowercase-keys.d.ts +5 -0
  30. package/dist-types/util/merge-deep.d.ts +1 -0
  31. package/dist-types/util/omit.d.ts +5 -0
  32. package/dist-types/util/remove-undefined-properties.d.ts +1 -0
  33. package/dist-types/util/url-template.d.ts +3 -0
  34. package/dist-types/version.d.ts +1 -0
  35. package/dist-types/with-defaults.d.ts +2 -0
  36. package/package.json +65 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2018 Octokit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @depup/octokit__endpoint
2
+
3
+ > Dependency-bumped version of [@octokit/endpoint](https://www.npmjs.com/package/@octokit/endpoint)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/octokit__endpoint
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [@octokit/endpoint](https://www.npmjs.com/package/@octokit/endpoint) @ 11.0.3 |
17
+ | Processed | 2026-03-17 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 1 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | universal-user-agent | ^7.0.2 | ^7.0.3 |
26
+
27
+ ---
28
+
29
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@octokit/endpoint
30
+
31
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "bumped": {
3
+ "universal-user-agent": {
4
+ "from": "^7.0.2",
5
+ "to": "^7.0.3"
6
+ }
7
+ },
8
+ "timestamp": "2026-03-17T16:33:19.295Z",
9
+ "totalUpdated": 1
10
+ }
@@ -0,0 +1,346 @@
1
+ // pkg/dist-src/defaults.js
2
+ import { getUserAgent } from "universal-user-agent";
3
+
4
+ // pkg/dist-src/version.js
5
+ var VERSION = "0.0.0-development";
6
+
7
+ // pkg/dist-src/defaults.js
8
+ var userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
9
+ var DEFAULTS = {
10
+ method: "GET",
11
+ baseUrl: "https://api.github.com",
12
+ headers: {
13
+ accept: "application/vnd.github.v3+json",
14
+ "user-agent": userAgent
15
+ },
16
+ mediaType: {
17
+ format: ""
18
+ }
19
+ };
20
+
21
+ // pkg/dist-src/util/lowercase-keys.js
22
+ function lowercaseKeys(object) {
23
+ if (!object) {
24
+ return {};
25
+ }
26
+ return Object.keys(object).reduce((newObj, key) => {
27
+ newObj[key.toLowerCase()] = object[key];
28
+ return newObj;
29
+ }, {});
30
+ }
31
+
32
+ // pkg/dist-src/util/is-plain-object.js
33
+ function isPlainObject(value) {
34
+ if (typeof value !== "object" || value === null) return false;
35
+ if (Object.prototype.toString.call(value) !== "[object Object]") return false;
36
+ const proto = Object.getPrototypeOf(value);
37
+ if (proto === null) return true;
38
+ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
39
+ return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
40
+ }
41
+
42
+ // pkg/dist-src/util/merge-deep.js
43
+ function mergeDeep(defaults, options) {
44
+ const result = Object.assign({}, defaults);
45
+ Object.keys(options).forEach((key) => {
46
+ if (isPlainObject(options[key])) {
47
+ if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
48
+ else result[key] = mergeDeep(defaults[key], options[key]);
49
+ } else {
50
+ Object.assign(result, { [key]: options[key] });
51
+ }
52
+ });
53
+ return result;
54
+ }
55
+
56
+ // pkg/dist-src/util/remove-undefined-properties.js
57
+ function removeUndefinedProperties(obj) {
58
+ for (const key in obj) {
59
+ if (obj[key] === void 0) {
60
+ delete obj[key];
61
+ }
62
+ }
63
+ return obj;
64
+ }
65
+
66
+ // pkg/dist-src/merge.js
67
+ function merge(defaults, route, options) {
68
+ if (typeof route === "string") {
69
+ let [method, url] = route.split(" ");
70
+ options = Object.assign(url ? { method, url } : { url: method }, options);
71
+ } else {
72
+ options = Object.assign({}, route);
73
+ }
74
+ options.headers = lowercaseKeys(options.headers);
75
+ removeUndefinedProperties(options);
76
+ removeUndefinedProperties(options.headers);
77
+ const mergedOptions = mergeDeep(defaults || {}, options);
78
+ if (options.url === "/graphql") {
79
+ if (defaults && defaults.mediaType.previews?.length) {
80
+ mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
81
+ (preview) => !mergedOptions.mediaType.previews.includes(preview)
82
+ ).concat(mergedOptions.mediaType.previews);
83
+ }
84
+ mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
85
+ }
86
+ return mergedOptions;
87
+ }
88
+
89
+ // pkg/dist-src/util/add-query-parameters.js
90
+ function addQueryParameters(url, parameters) {
91
+ const separator = /\?/.test(url) ? "&" : "?";
92
+ const names = Object.keys(parameters);
93
+ if (names.length === 0) {
94
+ return url;
95
+ }
96
+ return url + separator + names.map((name) => {
97
+ if (name === "q") {
98
+ return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
99
+ }
100
+ return `${name}=${encodeURIComponent(parameters[name])}`;
101
+ }).join("&");
102
+ }
103
+
104
+ // pkg/dist-src/util/extract-url-variable-names.js
105
+ var urlVariableRegex = /\{[^{}}]+\}/g;
106
+ function removeNonChars(variableName) {
107
+ return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
108
+ }
109
+ function extractUrlVariableNames(url) {
110
+ const matches = url.match(urlVariableRegex);
111
+ if (!matches) {
112
+ return [];
113
+ }
114
+ return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
115
+ }
116
+
117
+ // pkg/dist-src/util/omit.js
118
+ function omit(object, keysToOmit) {
119
+ const result = { __proto__: null };
120
+ for (const key of Object.keys(object)) {
121
+ if (keysToOmit.indexOf(key) === -1) {
122
+ result[key] = object[key];
123
+ }
124
+ }
125
+ return result;
126
+ }
127
+
128
+ // pkg/dist-src/util/url-template.js
129
+ function encodeReserved(str) {
130
+ return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
131
+ if (!/%[0-9A-Fa-f]/.test(part)) {
132
+ part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
133
+ }
134
+ return part;
135
+ }).join("");
136
+ }
137
+ function encodeUnreserved(str) {
138
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
139
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
140
+ });
141
+ }
142
+ function encodeValue(operator, value, key) {
143
+ value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
144
+ if (key) {
145
+ return encodeUnreserved(key) + "=" + value;
146
+ } else {
147
+ return value;
148
+ }
149
+ }
150
+ function isDefined(value) {
151
+ return value !== void 0 && value !== null;
152
+ }
153
+ function isKeyOperator(operator) {
154
+ return operator === ";" || operator === "&" || operator === "?";
155
+ }
156
+ function getValues(context, operator, key, modifier) {
157
+ var value = context[key], result = [];
158
+ if (isDefined(value) && value !== "") {
159
+ if (typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") {
160
+ value = value.toString();
161
+ if (modifier && modifier !== "*") {
162
+ value = value.substring(0, parseInt(modifier, 10));
163
+ }
164
+ result.push(
165
+ encodeValue(operator, value, isKeyOperator(operator) ? key : "")
166
+ );
167
+ } else {
168
+ if (modifier === "*") {
169
+ if (Array.isArray(value)) {
170
+ value.filter(isDefined).forEach(function(value2) {
171
+ result.push(
172
+ encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
173
+ );
174
+ });
175
+ } else {
176
+ Object.keys(value).forEach(function(k) {
177
+ if (isDefined(value[k])) {
178
+ result.push(encodeValue(operator, value[k], k));
179
+ }
180
+ });
181
+ }
182
+ } else {
183
+ const tmp = [];
184
+ if (Array.isArray(value)) {
185
+ value.filter(isDefined).forEach(function(value2) {
186
+ tmp.push(encodeValue(operator, value2));
187
+ });
188
+ } else {
189
+ Object.keys(value).forEach(function(k) {
190
+ if (isDefined(value[k])) {
191
+ tmp.push(encodeUnreserved(k));
192
+ tmp.push(encodeValue(operator, value[k].toString()));
193
+ }
194
+ });
195
+ }
196
+ if (isKeyOperator(operator)) {
197
+ result.push(encodeUnreserved(key) + "=" + tmp.join(","));
198
+ } else if (tmp.length !== 0) {
199
+ result.push(tmp.join(","));
200
+ }
201
+ }
202
+ }
203
+ } else {
204
+ if (operator === ";") {
205
+ if (isDefined(value)) {
206
+ result.push(encodeUnreserved(key));
207
+ }
208
+ } else if (value === "" && (operator === "&" || operator === "?")) {
209
+ result.push(encodeUnreserved(key) + "=");
210
+ } else if (value === "") {
211
+ result.push("");
212
+ }
213
+ }
214
+ return result;
215
+ }
216
+ function parseUrl(template) {
217
+ return {
218
+ expand: expand.bind(null, template)
219
+ };
220
+ }
221
+ function expand(template, context) {
222
+ var operators = ["+", "#", ".", "/", ";", "?", "&"];
223
+ template = template.replace(
224
+ /\{([^\{\}]+)\}|([^\{\}]+)/g,
225
+ function(_, expression, literal) {
226
+ if (expression) {
227
+ let operator = "";
228
+ const values = [];
229
+ if (operators.indexOf(expression.charAt(0)) !== -1) {
230
+ operator = expression.charAt(0);
231
+ expression = expression.substr(1);
232
+ }
233
+ expression.split(/,/g).forEach(function(variable) {
234
+ var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
235
+ values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
236
+ });
237
+ if (operator && operator !== "+") {
238
+ var separator = ",";
239
+ if (operator === "?") {
240
+ separator = "&";
241
+ } else if (operator !== "#") {
242
+ separator = operator;
243
+ }
244
+ return (values.length !== 0 ? operator : "") + values.join(separator);
245
+ } else {
246
+ return values.join(",");
247
+ }
248
+ } else {
249
+ return encodeReserved(literal);
250
+ }
251
+ }
252
+ );
253
+ if (template === "/") {
254
+ return template;
255
+ } else {
256
+ return template.replace(/\/$/, "");
257
+ }
258
+ }
259
+
260
+ // pkg/dist-src/parse.js
261
+ function parse(options) {
262
+ let method = options.method.toUpperCase();
263
+ let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
264
+ let headers = Object.assign({}, options.headers);
265
+ let body;
266
+ let parameters = omit(options, [
267
+ "method",
268
+ "baseUrl",
269
+ "url",
270
+ "headers",
271
+ "request",
272
+ "mediaType"
273
+ ]);
274
+ const urlVariableNames = extractUrlVariableNames(url);
275
+ url = parseUrl(url).expand(parameters);
276
+ if (!/^http/.test(url)) {
277
+ url = options.baseUrl + url;
278
+ }
279
+ const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
280
+ const remainingParameters = omit(parameters, omittedParameters);
281
+ const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
282
+ if (!isBinaryRequest) {
283
+ if (options.mediaType.format) {
284
+ headers.accept = headers.accept.split(/,/).map(
285
+ (format) => format.replace(
286
+ /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
287
+ `application/vnd$1$2.${options.mediaType.format}`
288
+ )
289
+ ).join(",");
290
+ }
291
+ if (url.endsWith("/graphql")) {
292
+ if (options.mediaType.previews?.length) {
293
+ const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
294
+ headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
295
+ const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
296
+ return `application/vnd.github.${preview}-preview${format}`;
297
+ }).join(",");
298
+ }
299
+ }
300
+ }
301
+ if (["GET", "HEAD"].includes(method)) {
302
+ url = addQueryParameters(url, remainingParameters);
303
+ } else {
304
+ if ("data" in remainingParameters) {
305
+ body = remainingParameters.data;
306
+ } else {
307
+ if (Object.keys(remainingParameters).length) {
308
+ body = remainingParameters;
309
+ }
310
+ }
311
+ }
312
+ if (!headers["content-type"] && typeof body !== "undefined") {
313
+ headers["content-type"] = "application/json; charset=utf-8";
314
+ }
315
+ if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
316
+ body = "";
317
+ }
318
+ return Object.assign(
319
+ { method, url, headers },
320
+ typeof body !== "undefined" ? { body } : null,
321
+ options.request ? { request: options.request } : null
322
+ );
323
+ }
324
+
325
+ // pkg/dist-src/endpoint-with-defaults.js
326
+ function endpointWithDefaults(defaults, route, options) {
327
+ return parse(merge(defaults, route, options));
328
+ }
329
+
330
+ // pkg/dist-src/with-defaults.js
331
+ function withDefaults(oldDefaults, newDefaults) {
332
+ const DEFAULTS2 = merge(oldDefaults, newDefaults);
333
+ const endpoint2 = endpointWithDefaults.bind(null, DEFAULTS2);
334
+ return Object.assign(endpoint2, {
335
+ DEFAULTS: DEFAULTS2,
336
+ defaults: withDefaults.bind(null, DEFAULTS2),
337
+ merge: merge.bind(null, DEFAULTS2),
338
+ parse
339
+ });
340
+ }
341
+
342
+ // pkg/dist-src/index.js
343
+ var endpoint = withDefaults(null, DEFAULTS);
344
+ export {
345
+ endpoint
346
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../dist-src/defaults.js", "../dist-src/version.js", "../dist-src/util/lowercase-keys.js", "../dist-src/util/is-plain-object.js", "../dist-src/util/merge-deep.js", "../dist-src/util/remove-undefined-properties.js", "../dist-src/merge.js", "../dist-src/util/add-query-parameters.js", "../dist-src/util/extract-url-variable-names.js", "../dist-src/util/omit.js", "../dist-src/util/url-template.js", "../dist-src/parse.js", "../dist-src/endpoint-with-defaults.js", "../dist-src/with-defaults.js", "../dist-src/index.js"],
4
+ "sourcesContent": ["import { getUserAgent } from \"universal-user-agent\";\nimport { VERSION } from \"./version.js\";\nconst userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;\nconst DEFAULTS = {\n method: \"GET\",\n baseUrl: \"https://api.github.com\",\n headers: {\n accept: \"application/vnd.github.v3+json\",\n \"user-agent\": userAgent\n },\n mediaType: {\n format: \"\"\n }\n};\nexport {\n DEFAULTS\n};\n", "const VERSION = \"0.0.0-development\";\nexport {\n VERSION\n};\n", "function lowercaseKeys(object) {\n if (!object) {\n return {};\n }\n return Object.keys(object).reduce((newObj, key) => {\n newObj[key.toLowerCase()] = object[key];\n return newObj;\n }, {});\n}\nexport {\n lowercaseKeys\n};\n", "function isPlainObject(value) {\n if (typeof value !== \"object\" || value === null) return false;\n if (Object.prototype.toString.call(value) !== \"[object Object]\") return false;\n const proto = Object.getPrototypeOf(value);\n if (proto === null) return true;\n const Ctor = Object.prototype.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n return typeof Ctor === \"function\" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);\n}\nexport {\n isPlainObject\n};\n", "import { isPlainObject } from \"./is-plain-object.js\";\nfunction mergeDeep(defaults, options) {\n const result = Object.assign({}, defaults);\n Object.keys(options).forEach((key) => {\n if (isPlainObject(options[key])) {\n if (!(key in defaults)) Object.assign(result, { [key]: options[key] });\n else result[key] = mergeDeep(defaults[key], options[key]);\n } else {\n Object.assign(result, { [key]: options[key] });\n }\n });\n return result;\n}\nexport {\n mergeDeep\n};\n", "function removeUndefinedProperties(obj) {\n for (const key in obj) {\n if (obj[key] === void 0) {\n delete obj[key];\n }\n }\n return obj;\n}\nexport {\n removeUndefinedProperties\n};\n", "import { lowercaseKeys } from \"./util/lowercase-keys.js\";\nimport { mergeDeep } from \"./util/merge-deep.js\";\nimport { removeUndefinedProperties } from \"./util/remove-undefined-properties.js\";\nfunction merge(defaults, route, options) {\n if (typeof route === \"string\") {\n let [method, url] = route.split(\" \");\n options = Object.assign(url ? { method, url } : { url: method }, options);\n } else {\n options = Object.assign({}, route);\n }\n options.headers = lowercaseKeys(options.headers);\n removeUndefinedProperties(options);\n removeUndefinedProperties(options.headers);\n const mergedOptions = mergeDeep(defaults || {}, options);\n if (options.url === \"/graphql\") {\n if (defaults && defaults.mediaType.previews?.length) {\n mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(\n (preview) => !mergedOptions.mediaType.previews.includes(preview)\n ).concat(mergedOptions.mediaType.previews);\n }\n mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, \"\"));\n }\n return mergedOptions;\n}\nexport {\n merge\n};\n", "function addQueryParameters(url, parameters) {\n const separator = /\\?/.test(url) ? \"&\" : \"?\";\n const names = Object.keys(parameters);\n if (names.length === 0) {\n return url;\n }\n return url + separator + names.map((name) => {\n if (name === \"q\") {\n return \"q=\" + parameters.q.split(\"+\").map(encodeURIComponent).join(\"+\");\n }\n return `${name}=${encodeURIComponent(parameters[name])}`;\n }).join(\"&\");\n}\nexport {\n addQueryParameters\n};\n", "const urlVariableRegex = /\\{[^{}}]+\\}/g;\nfunction removeNonChars(variableName) {\n return variableName.replace(/(?:^\\W+)|(?:(?<!\\W)\\W+$)/g, \"\").split(/,/);\n}\nfunction extractUrlVariableNames(url) {\n const matches = url.match(urlVariableRegex);\n if (!matches) {\n return [];\n }\n return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);\n}\nexport {\n extractUrlVariableNames\n};\n", "function omit(object, keysToOmit) {\n const result = { __proto__: null };\n for (const key of Object.keys(object)) {\n if (keysToOmit.indexOf(key) === -1) {\n result[key] = object[key];\n }\n }\n return result;\n}\nexport {\n omit\n};\n", "function encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n return part;\n }).join(\"\");\n}\nfunction encodeUnreserved(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {\n return \"%\" + c.charCodeAt(0).toString(16).toUpperCase();\n });\n}\nfunction encodeValue(operator, value, key) {\n value = operator === \"+\" || operator === \"#\" ? encodeReserved(value) : encodeUnreserved(value);\n if (key) {\n return encodeUnreserved(key) + \"=\" + value;\n } else {\n return value;\n }\n}\nfunction isDefined(value) {\n return value !== void 0 && value !== null;\n}\nfunction isKeyOperator(operator) {\n return operator === \";\" || operator === \"&\" || operator === \"?\";\n}\nfunction getValues(context, operator, key, modifier) {\n var value = context[key], result = [];\n if (isDefined(value) && value !== \"\") {\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"bigint\" || typeof value === \"boolean\") {\n value = value.toString();\n if (modifier && modifier !== \"*\") {\n value = value.substring(0, parseInt(modifier, 10));\n }\n result.push(\n encodeValue(operator, value, isKeyOperator(operator) ? key : \"\")\n );\n } else {\n if (modifier === \"*\") {\n if (Array.isArray(value)) {\n value.filter(isDefined).forEach(function(value2) {\n result.push(\n encodeValue(operator, value2, isKeyOperator(operator) ? key : \"\")\n );\n });\n } else {\n Object.keys(value).forEach(function(k) {\n if (isDefined(value[k])) {\n result.push(encodeValue(operator, value[k], k));\n }\n });\n }\n } else {\n const tmp = [];\n if (Array.isArray(value)) {\n value.filter(isDefined).forEach(function(value2) {\n tmp.push(encodeValue(operator, value2));\n });\n } else {\n Object.keys(value).forEach(function(k) {\n if (isDefined(value[k])) {\n tmp.push(encodeUnreserved(k));\n tmp.push(encodeValue(operator, value[k].toString()));\n }\n });\n }\n if (isKeyOperator(operator)) {\n result.push(encodeUnreserved(key) + \"=\" + tmp.join(\",\"));\n } else if (tmp.length !== 0) {\n result.push(tmp.join(\",\"));\n }\n }\n }\n } else {\n if (operator === \";\") {\n if (isDefined(value)) {\n result.push(encodeUnreserved(key));\n }\n } else if (value === \"\" && (operator === \"&\" || operator === \"?\")) {\n result.push(encodeUnreserved(key) + \"=\");\n } else if (value === \"\") {\n result.push(\"\");\n }\n }\n return result;\n}\nfunction parseUrl(template) {\n return {\n expand: expand.bind(null, template)\n };\n}\nfunction expand(template, context) {\n var operators = [\"+\", \"#\", \".\", \"/\", \";\", \"?\", \"&\"];\n template = template.replace(\n /\\{([^\\{\\}]+)\\}|([^\\{\\}]+)/g,\n function(_, expression, literal) {\n if (expression) {\n let operator = \"\";\n const values = [];\n if (operators.indexOf(expression.charAt(0)) !== -1) {\n operator = expression.charAt(0);\n expression = expression.substr(1);\n }\n expression.split(/,/g).forEach(function(variable) {\n var tmp = /([^:\\*]*)(?::(\\d+)|(\\*))?/.exec(variable);\n values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));\n });\n if (operator && operator !== \"+\") {\n var separator = \",\";\n if (operator === \"?\") {\n separator = \"&\";\n } else if (operator !== \"#\") {\n separator = operator;\n }\n return (values.length !== 0 ? operator : \"\") + values.join(separator);\n } else {\n return values.join(\",\");\n }\n } else {\n return encodeReserved(literal);\n }\n }\n );\n if (template === \"/\") {\n return template;\n } else {\n return template.replace(/\\/$/, \"\");\n }\n}\nexport {\n parseUrl\n};\n", "import { addQueryParameters } from \"./util/add-query-parameters.js\";\nimport { extractUrlVariableNames } from \"./util/extract-url-variable-names.js\";\nimport { omit } from \"./util/omit.js\";\nimport { parseUrl } from \"./util/url-template.js\";\nfunction parse(options) {\n let method = options.method.toUpperCase();\n let url = (options.url || \"/\").replace(/:([a-z]\\w+)/g, \"{$1}\");\n let headers = Object.assign({}, options.headers);\n let body;\n let parameters = omit(options, [\n \"method\",\n \"baseUrl\",\n \"url\",\n \"headers\",\n \"request\",\n \"mediaType\"\n ]);\n const urlVariableNames = extractUrlVariableNames(url);\n url = parseUrl(url).expand(parameters);\n if (!/^http/.test(url)) {\n url = options.baseUrl + url;\n }\n const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat(\"baseUrl\");\n const remainingParameters = omit(parameters, omittedParameters);\n const isBinaryRequest = /application\\/octet-stream/i.test(headers.accept);\n if (!isBinaryRequest) {\n if (options.mediaType.format) {\n headers.accept = headers.accept.split(/,/).map(\n (format) => format.replace(\n /application\\/vnd(\\.\\w+)(\\.v3)?(\\.\\w+)?(\\+json)?$/,\n `application/vnd$1$2.${options.mediaType.format}`\n )\n ).join(\",\");\n }\n if (url.endsWith(\"/graphql\")) {\n if (options.mediaType.previews?.length) {\n const previewsFromAcceptHeader = headers.accept.match(/(?<![\\w-])[\\w-]+(?=-preview)/g) || [];\n headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {\n const format = options.mediaType.format ? `.${options.mediaType.format}` : \"+json\";\n return `application/vnd.github.${preview}-preview${format}`;\n }).join(\",\");\n }\n }\n }\n if ([\"GET\", \"HEAD\"].includes(method)) {\n url = addQueryParameters(url, remainingParameters);\n } else {\n if (\"data\" in remainingParameters) {\n body = remainingParameters.data;\n } else {\n if (Object.keys(remainingParameters).length) {\n body = remainingParameters;\n }\n }\n }\n if (!headers[\"content-type\"] && typeof body !== \"undefined\") {\n headers[\"content-type\"] = \"application/json; charset=utf-8\";\n }\n if ([\"PATCH\", \"PUT\"].includes(method) && typeof body === \"undefined\") {\n body = \"\";\n }\n return Object.assign(\n { method, url, headers },\n typeof body !== \"undefined\" ? { body } : null,\n options.request ? { request: options.request } : null\n );\n}\nexport {\n parse\n};\n", "import { DEFAULTS } from \"./defaults.js\";\nimport { merge } from \"./merge.js\";\nimport { parse } from \"./parse.js\";\nfunction endpointWithDefaults(defaults, route, options) {\n return parse(merge(defaults, route, options));\n}\nexport {\n endpointWithDefaults\n};\n", "import { endpointWithDefaults } from \"./endpoint-with-defaults.js\";\nimport { merge } from \"./merge.js\";\nimport { parse } from \"./parse.js\";\nfunction withDefaults(oldDefaults, newDefaults) {\n const DEFAULTS = merge(oldDefaults, newDefaults);\n const endpoint = endpointWithDefaults.bind(null, DEFAULTS);\n return Object.assign(endpoint, {\n DEFAULTS,\n defaults: withDefaults.bind(null, DEFAULTS),\n merge: merge.bind(null, DEFAULTS),\n parse\n });\n}\nexport {\n withDefaults\n};\n", "import { withDefaults } from \"./with-defaults.js\";\nimport { DEFAULTS } from \"./defaults.js\";\nconst endpoint = withDefaults(null, DEFAULTS);\nexport {\n endpoint\n};\n"],
5
+ "mappings": ";AAAA,SAAS,oBAAoB;;;ACA7B,IAAM,UAAU;;;ADEhB,IAAM,YAAY,uBAAuB,OAAO,IAAI,aAAa,CAAC;AAClE,IAAM,WAAW;AAAA,EACf,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,cAAc;AAAA,EAChB;AAAA,EACA,WAAW;AAAA,IACT,QAAQ;AAAA,EACV;AACF;;;AEbA,SAAS,cAAc,QAAQ;AAC7B,MAAI,CAAC,QAAQ;AACX,WAAO,CAAC;AAAA,EACV;AACA,SAAO,OAAO,KAAK,MAAM,EAAE,OAAO,CAAC,QAAQ,QAAQ;AACjD,WAAO,IAAI,YAAY,CAAC,IAAI,OAAO,GAAG;AACtC,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACP;;;ACRA,SAAS,cAAc,OAAO;AAC5B,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,MAAI,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,kBAAmB,QAAO;AACxE,QAAM,QAAQ,OAAO,eAAe,KAAK;AACzC,MAAI,UAAU,KAAM,QAAO;AAC3B,QAAM,OAAO,OAAO,UAAU,eAAe,KAAK,OAAO,aAAa,KAAK,MAAM;AACjF,SAAO,OAAO,SAAS,cAAc,gBAAgB,QAAQ,SAAS,UAAU,KAAK,IAAI,MAAM,SAAS,UAAU,KAAK,KAAK;AAC9H;;;ACNA,SAAS,UAAU,UAAU,SAAS;AACpC,QAAM,SAAS,OAAO,OAAO,CAAC,GAAG,QAAQ;AACzC,SAAO,KAAK,OAAO,EAAE,QAAQ,CAAC,QAAQ;AACpC,QAAI,cAAc,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AmB;AAAA,EACnD,OAAO;AACL,QAAI,UAAU,qBAAqB;AACjC,aAAO,oBAAoB;AAAA,IAC7B,OAAO;AACL,UAAI,OAAO,KAAK,mBAAmB,EAAE,QAAQ;AAC3C,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,MAAI,CAAC,QAAQ,cAAc,KAAK,OAAO,SAAS,aAAa;AAC3D,YAAQ,cAAc,IAAI;AAAA,EAC5B;AACA,MAAI,CAAC,SAAS,KAAK,EAAE,SAAS,MAAM,KAAK,OAAO,SAAS,aAAa;AACpE,WAAO;AAAA,EACT;AACA,SAAO,OAAO;AAAA,IACZ,EAAE,QAAQ,KAAK,QAAQ;AAAA,IACvB,OAAO,SAAS,cAAc,EAAE,KAAK,IAAI;AAAA,IACzC,QAAQ,UAAU,EAAE,SAAS,QAAQ,QAAQ,IAAI;AAAA,EACnD;AACF;;;AC/DA,SAAS,qBAAqB,UAAU,OAAO,SAAS;AACtD,SAAO,MAAM,MAAM,UAAU,OAAO,OAAO,CAAC;AAC9C;;;ACFA,SAAS,aAAa,aAAa,aAAa;AAC9C,QAAMA,YAAW,MAAM,aAAa,WAAW;AAC/C,QAAMC,YAAW,qBAAqB,KAAK,MAAMD,SAAQ;AACzD,SAAO,OAAO,OAAOC,WAAU;AAAA,IAC7B,UAAAD;AAAA,IACA,UAAU,aAAa,KAAK,MAAMA,SAAQ;AAAA,IAC1C,OAAO,MAAM,KAAK,MAAMA,SAAQ;AAAA,IAChC;AAAA,EACF,CAAC;AACH;;;ACVA,IAAM,WAAW,aAAa,MAAM,QAAQ;",
6
+ "names": ["DEFAULTS", "endpoint"]
7
+ }
@@ -0,0 +1,17 @@
1
+ import { getUserAgent } from "universal-user-agent";
2
+ import { VERSION } from "./version.js";
3
+ const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
4
+ const DEFAULTS = {
5
+ method: "GET",
6
+ baseUrl: "https://api.github.com",
7
+ headers: {
8
+ accept: "application/vnd.github.v3+json",
9
+ "user-agent": userAgent
10
+ },
11
+ mediaType: {
12
+ format: ""
13
+ }
14
+ };
15
+ export {
16
+ DEFAULTS
17
+ };
@@ -0,0 +1,9 @@
1
+ import { DEFAULTS } from "./defaults.js";
2
+ import { merge } from "./merge.js";
3
+ import { parse } from "./parse.js";
4
+ function endpointWithDefaults(defaults, route, options) {
5
+ return parse(merge(defaults, route, options));
6
+ }
7
+ export {
8
+ endpointWithDefaults
9
+ };
@@ -0,0 +1,6 @@
1
+ import { withDefaults } from "./with-defaults.js";
2
+ import { DEFAULTS } from "./defaults.js";
3
+ const endpoint = withDefaults(null, DEFAULTS);
4
+ export {
5
+ endpoint
6
+ };
@@ -0,0 +1,27 @@
1
+ import { lowercaseKeys } from "./util/lowercase-keys.js";
2
+ import { mergeDeep } from "./util/merge-deep.js";
3
+ import { removeUndefinedProperties } from "./util/remove-undefined-properties.js";
4
+ function merge(defaults, route, options) {
5
+ if (typeof route === "string") {
6
+ let [method, url] = route.split(" ");
7
+ options = Object.assign(url ? { method, url } : { url: method }, options);
8
+ } else {
9
+ options = Object.assign({}, route);
10
+ }
11
+ options.headers = lowercaseKeys(options.headers);
12
+ removeUndefinedProperties(options);
13
+ removeUndefinedProperties(options.headers);
14
+ const mergedOptions = mergeDeep(defaults || {}, options);
15
+ if (options.url === "/graphql") {
16
+ if (defaults && defaults.mediaType.previews?.length) {
17
+ mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(
18
+ (preview) => !mergedOptions.mediaType.previews.includes(preview)
19
+ ).concat(mergedOptions.mediaType.previews);
20
+ }
21
+ mergedOptions.mediaType.previews = (mergedOptions.mediaType.previews || []).map((preview) => preview.replace(/-preview/, ""));
22
+ }
23
+ return mergedOptions;
24
+ }
25
+ export {
26
+ merge
27
+ };
@@ -0,0 +1,70 @@
1
+ import { addQueryParameters } from "./util/add-query-parameters.js";
2
+ import { extractUrlVariableNames } from "./util/extract-url-variable-names.js";
3
+ import { omit } from "./util/omit.js";
4
+ import { parseUrl } from "./util/url-template.js";
5
+ function parse(options) {
6
+ let method = options.method.toUpperCase();
7
+ let url = (options.url || "/").replace(/:([a-z]\w+)/g, "{$1}");
8
+ let headers = Object.assign({}, options.headers);
9
+ let body;
10
+ let parameters = omit(options, [
11
+ "method",
12
+ "baseUrl",
13
+ "url",
14
+ "headers",
15
+ "request",
16
+ "mediaType"
17
+ ]);
18
+ const urlVariableNames = extractUrlVariableNames(url);
19
+ url = parseUrl(url).expand(parameters);
20
+ if (!/^http/.test(url)) {
21
+ url = options.baseUrl + url;
22
+ }
23
+ const omittedParameters = Object.keys(options).filter((option) => urlVariableNames.includes(option)).concat("baseUrl");
24
+ const remainingParameters = omit(parameters, omittedParameters);
25
+ const isBinaryRequest = /application\/octet-stream/i.test(headers.accept);
26
+ if (!isBinaryRequest) {
27
+ if (options.mediaType.format) {
28
+ headers.accept = headers.accept.split(/,/).map(
29
+ (format) => format.replace(
30
+ /application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/,
31
+ `application/vnd$1$2.${options.mediaType.format}`
32
+ )
33
+ ).join(",");
34
+ }
35
+ if (url.endsWith("/graphql")) {
36
+ if (options.mediaType.previews?.length) {
37
+ const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
38
+ headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
39
+ const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
40
+ return `application/vnd.github.${preview}-preview${format}`;
41
+ }).join(",");
42
+ }
43
+ }
44
+ }
45
+ if (["GET", "HEAD"].includes(method)) {
46
+ url = addQueryParameters(url, remainingParameters);
47
+ } else {
48
+ if ("data" in remainingParameters) {
49
+ body = remainingParameters.data;
50
+ } else {
51
+ if (Object.keys(remainingParameters).length) {
52
+ body = remainingParameters;
53
+ }
54
+ }
55
+ }
56
+ if (!headers["content-type"] && typeof body !== "undefined") {
57
+ headers["content-type"] = "application/json; charset=utf-8";
58
+ }
59
+ if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
60
+ body = "";
61
+ }
62
+ return Object.assign(
63
+ { method, url, headers },
64
+ typeof body !== "undefined" ? { body } : null,
65
+ options.request ? { request: options.request } : null
66
+ );
67
+ }
68
+ export {
69
+ parse
70
+ };
@@ -0,0 +1,16 @@
1
+ function addQueryParameters(url, parameters) {
2
+ const separator = /\?/.test(url) ? "&" : "?";
3
+ const names = Object.keys(parameters);
4
+ if (names.length === 0) {
5
+ return url;
6
+ }
7
+ return url + separator + names.map((name) => {
8
+ if (name === "q") {
9
+ return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
10
+ }
11
+ return `${name}=${encodeURIComponent(parameters[name])}`;
12
+ }).join("&");
13
+ }
14
+ export {
15
+ addQueryParameters
16
+ };
@@ -0,0 +1,14 @@
1
+ const urlVariableRegex = /\{[^{}}]+\}/g;
2
+ function removeNonChars(variableName) {
3
+ return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
4
+ }
5
+ function extractUrlVariableNames(url) {
6
+ const matches = url.match(urlVariableRegex);
7
+ if (!matches) {
8
+ return [];
9
+ }
10
+ return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
11
+ }
12
+ export {
13
+ extractUrlVariableNames
14
+ };
@@ -0,0 +1,11 @@
1
+ function isPlainObject(value) {
2
+ if (typeof value !== "object" || value === null) return false;
3
+ if (Object.prototype.toString.call(value) !== "[object Object]") return false;
4
+ const proto = Object.getPrototypeOf(value);
5
+ if (proto === null) return true;
6
+ const Ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
7
+ return typeof Ctor === "function" && Ctor instanceof Ctor && Function.prototype.call(Ctor) === Function.prototype.call(value);
8
+ }
9
+ export {
10
+ isPlainObject
11
+ };
@@ -0,0 +1,12 @@
1
+ function lowercaseKeys(object) {
2
+ if (!object) {
3
+ return {};
4
+ }
5
+ return Object.keys(object).reduce((newObj, key) => {
6
+ newObj[key.toLowerCase()] = object[key];
7
+ return newObj;
8
+ }, {});
9
+ }
10
+ export {
11
+ lowercaseKeys
12
+ };
@@ -0,0 +1,16 @@
1
+ import { isPlainObject } from "./is-plain-object.js";
2
+ function mergeDeep(defaults, options) {
3
+ const result = Object.assign({}, defaults);
4
+ Object.keys(options).forEach((key) => {
5
+ if (isPlainObject(options[key])) {
6
+ if (!(key in defaults)) Object.assign(result, { [key]: options[key] });
7
+ else result[key] = mergeDeep(defaults[key], options[key]);
8
+ } else {
9
+ Object.assign(result, { [key]: options[key] });
10
+ }
11
+ });
12
+ return result;
13
+ }
14
+ export {
15
+ mergeDeep
16
+ };
@@ -0,0 +1,12 @@
1
+ function omit(object, keysToOmit) {
2
+ const result = { __proto__: null };
3
+ for (const key of Object.keys(object)) {
4
+ if (keysToOmit.indexOf(key) === -1) {
5
+ result[key] = object[key];
6
+ }
7
+ }
8
+ return result;
9
+ }
10
+ export {
11
+ omit
12
+ };
@@ -0,0 +1,11 @@
1
+ function removeUndefinedProperties(obj) {
2
+ for (const key in obj) {
3
+ if (obj[key] === void 0) {
4
+ delete obj[key];
5
+ }
6
+ }
7
+ return obj;
8
+ }
9
+ export {
10
+ removeUndefinedProperties
11
+ };
@@ -0,0 +1,133 @@
1
+ function encodeReserved(str) {
2
+ return str.split(/(%[0-9A-Fa-f]{2})/g).map(function(part) {
3
+ if (!/%[0-9A-Fa-f]/.test(part)) {
4
+ part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
5
+ }
6
+ return part;
7
+ }).join("");
8
+ }
9
+ function encodeUnreserved(str) {
10
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
11
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
12
+ });
13
+ }
14
+ function encodeValue(operator, value, key) {
15
+ value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
16
+ if (key) {
17
+ return encodeUnreserved(key) + "=" + value;
18
+ } else {
19
+ return value;
20
+ }
21
+ }
22
+ function isDefined(value) {
23
+ return value !== void 0 && value !== null;
24
+ }
25
+ function isKeyOperator(operator) {
26
+ return operator === ";" || operator === "&" || operator === "?";
27
+ }
28
+ function getValues(context, operator, key, modifier) {
29
+ var value = context[key], result = [];
30
+ if (isDefined(value) && value !== "") {
31
+ if (typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") {
32
+ value = value.toString();
33
+ if (modifier && modifier !== "*") {
34
+ value = value.substring(0, parseInt(modifier, 10));
35
+ }
36
+ result.push(
37
+ encodeValue(operator, value, isKeyOperator(operator) ? key : "")
38
+ );
39
+ } else {
40
+ if (modifier === "*") {
41
+ if (Array.isArray(value)) {
42
+ value.filter(isDefined).forEach(function(value2) {
43
+ result.push(
44
+ encodeValue(operator, value2, isKeyOperator(operator) ? key : "")
45
+ );
46
+ });
47
+ } else {
48
+ Object.keys(value).forEach(function(k) {
49
+ if (isDefined(value[k])) {
50
+ result.push(encodeValue(operator, value[k], k));
51
+ }
52
+ });
53
+ }
54
+ } else {
55
+ const tmp = [];
56
+ if (Array.isArray(value)) {
57
+ value.filter(isDefined).forEach(function(value2) {
58
+ tmp.push(encodeValue(operator, value2));
59
+ });
60
+ } else {
61
+ Object.keys(value).forEach(function(k) {
62
+ if (isDefined(value[k])) {
63
+ tmp.push(encodeUnreserved(k));
64
+ tmp.push(encodeValue(operator, value[k].toString()));
65
+ }
66
+ });
67
+ }
68
+ if (isKeyOperator(operator)) {
69
+ result.push(encodeUnreserved(key) + "=" + tmp.join(","));
70
+ } else if (tmp.length !== 0) {
71
+ result.push(tmp.join(","));
72
+ }
73
+ }
74
+ }
75
+ } else {
76
+ if (operator === ";") {
77
+ if (isDefined(value)) {
78
+ result.push(encodeUnreserved(key));
79
+ }
80
+ } else if (value === "" && (operator === "&" || operator === "?")) {
81
+ result.push(encodeUnreserved(key) + "=");
82
+ } else if (value === "") {
83
+ result.push("");
84
+ }
85
+ }
86
+ return result;
87
+ }
88
+ function parseUrl(template) {
89
+ return {
90
+ expand: expand.bind(null, template)
91
+ };
92
+ }
93
+ function expand(template, context) {
94
+ var operators = ["+", "#", ".", "/", ";", "?", "&"];
95
+ template = template.replace(
96
+ /\{([^\{\}]+)\}|([^\{\}]+)/g,
97
+ function(_, expression, literal) {
98
+ if (expression) {
99
+ let operator = "";
100
+ const values = [];
101
+ if (operators.indexOf(expression.charAt(0)) !== -1) {
102
+ operator = expression.charAt(0);
103
+ expression = expression.substr(1);
104
+ }
105
+ expression.split(/,/g).forEach(function(variable) {
106
+ var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
107
+ values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
108
+ });
109
+ if (operator && operator !== "+") {
110
+ var separator = ",";
111
+ if (operator === "?") {
112
+ separator = "&";
113
+ } else if (operator !== "#") {
114
+ separator = operator;
115
+ }
116
+ return (values.length !== 0 ? operator : "") + values.join(separator);
117
+ } else {
118
+ return values.join(",");
119
+ }
120
+ } else {
121
+ return encodeReserved(literal);
122
+ }
123
+ }
124
+ );
125
+ if (template === "/") {
126
+ return template;
127
+ } else {
128
+ return template.replace(/\/$/, "");
129
+ }
130
+ }
131
+ export {
132
+ parseUrl
133
+ };
@@ -0,0 +1,4 @@
1
+ const VERSION = "11.0.3";
2
+ export {
3
+ VERSION
4
+ };
@@ -0,0 +1,16 @@
1
+ import { endpointWithDefaults } from "./endpoint-with-defaults.js";
2
+ import { merge } from "./merge.js";
3
+ import { parse } from "./parse.js";
4
+ function withDefaults(oldDefaults, newDefaults) {
5
+ const DEFAULTS = merge(oldDefaults, newDefaults);
6
+ const endpoint = endpointWithDefaults.bind(null, DEFAULTS);
7
+ return Object.assign(endpoint, {
8
+ DEFAULTS,
9
+ defaults: withDefaults.bind(null, DEFAULTS),
10
+ merge: merge.bind(null, DEFAULTS),
11
+ parse
12
+ });
13
+ }
14
+ export {
15
+ withDefaults
16
+ };
@@ -0,0 +1,2 @@
1
+ import type { EndpointDefaults } from "@octokit/types";
2
+ export declare const DEFAULTS: EndpointDefaults;
@@ -0,0 +1,3 @@
1
+ import type { EndpointOptions, RequestParameters, Route } from "@octokit/types";
2
+ import { DEFAULTS } from "./defaults.js";
3
+ export declare function endpointWithDefaults(defaults: typeof DEFAULTS, route: Route | EndpointOptions, options?: RequestParameters): import("@octokit/types").RequestOptions;
@@ -0,0 +1 @@
1
+ export declare const endpoint: import("@octokit/types").EndpointInterface<object>;
@@ -0,0 +1,2 @@
1
+ import type { EndpointDefaults, RequestParameters, Route } from "@octokit/types";
2
+ export declare function merge(defaults: EndpointDefaults | null, route?: Route | RequestParameters, options?: RequestParameters): EndpointDefaults;
@@ -0,0 +1,2 @@
1
+ import type { EndpointDefaults, RequestOptions } from "@octokit/types";
2
+ export declare function parse(options: EndpointDefaults): RequestOptions;
@@ -0,0 +1,4 @@
1
+ export declare function addQueryParameters(url: string, parameters: {
2
+ [x: string]: string | undefined;
3
+ q?: string;
4
+ }): string;
@@ -0,0 +1 @@
1
+ export declare function extractUrlVariableNames(url: string): string[];
@@ -0,0 +1 @@
1
+ export declare function isPlainObject(value: unknown): value is Object;
@@ -0,0 +1,5 @@
1
+ export declare function lowercaseKeys(object?: {
2
+ [key: string]: any;
3
+ }): {
4
+ [key: string]: any;
5
+ };
@@ -0,0 +1 @@
1
+ export declare function mergeDeep(defaults: any, options: any): object;
@@ -0,0 +1,5 @@
1
+ export declare function omit(object: {
2
+ [key: string]: any;
3
+ }, keysToOmit: string[]): {
4
+ [key: string]: any;
5
+ };
@@ -0,0 +1 @@
1
+ export declare function removeUndefinedProperties(obj: any): any;
@@ -0,0 +1,3 @@
1
+ export declare function parseUrl(template: string): {
2
+ expand: (context: object) => string;
3
+ };
@@ -0,0 +1 @@
1
+ export declare const VERSION = "11.0.3";
@@ -0,0 +1,2 @@
1
+ import type { EndpointInterface, RequestParameters, EndpointDefaults } from "@octokit/types";
2
+ export declare function withDefaults(oldDefaults: EndpointDefaults | null, newDefaults: RequestParameters): EndpointInterface;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@depup/octokit__endpoint",
3
+ "version": "11.0.3-depup.0",
4
+ "type": "module",
5
+ "description": "[DepUp] Turns REST API endpoints into generic request options",
6
+ "repository": "github:octokit/endpoint.js",
7
+ "keywords": [
8
+ "depup",
9
+ "dependency-bumped",
10
+ "updated-deps",
11
+ "@octokit/endpoint",
12
+ "octokit",
13
+ "github",
14
+ "api",
15
+ "rest"
16
+ ],
17
+ "author": "Gregor Martynus (https://github.com/gr2m)",
18
+ "license": "MIT",
19
+ "devDependencies": {
20
+ "@octokit/tsconfig": "^4.0.0",
21
+ "@types/node": "^24.0.0",
22
+ "@vitest/coverage-v8": "^3.0.0",
23
+ "esbuild": "^0.27.0",
24
+ "tinyglobby": "^0.2.15",
25
+ "prettier": "3.6.2",
26
+ "semantic-release-plugin-update-version-in-files": "^2.0.0",
27
+ "typescript": "^5.0.0",
28
+ "vitest": "^3.0.0"
29
+ },
30
+ "dependencies": {
31
+ "@octokit/types": "^16.0.0",
32
+ "universal-user-agent": "^7.0.3"
33
+ },
34
+ "engines": {
35
+ "node": ">= 20"
36
+ },
37
+ "files": [
38
+ "dist-*/**",
39
+ "bin/**",
40
+ "changes.json",
41
+ "README.md"
42
+ ],
43
+ "types": "./dist-types/index.d.ts",
44
+ "exports": {
45
+ ".": {
46
+ "types": "./dist-types/index.d.ts",
47
+ "import": "./dist-bundle/index.js",
48
+ "default": "./dist-bundle/index.js"
49
+ }
50
+ },
51
+ "sideEffects": false,
52
+ "depup": {
53
+ "changes": {
54
+ "universal-user-agent": {
55
+ "from": "^7.0.2",
56
+ "to": "^7.0.3"
57
+ }
58
+ },
59
+ "depsUpdated": 1,
60
+ "originalPackage": "@octokit/endpoint",
61
+ "originalVersion": "11.0.3",
62
+ "processedAt": "2026-03-17T16:33:24.642Z",
63
+ "smokeTest": "passed"
64
+ }
65
+ }