@scalar/types 0.5.8 → 0.5.10
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/CHANGELOG.md +15 -0
- package/dist/snippetz/index.d.ts +1 -1
- package/dist/snippetz/index.d.ts.map +1 -1
- package/dist/snippetz/index.js.map +2 -2
- package/dist/snippetz/snippetz.d.ts +1 -1
- package/dist/snippetz/snippetz.d.ts.map +1 -1
- package/dist/snippetz/snippetz.js.map +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @scalar/types
|
|
2
2
|
|
|
3
|
+
## 0.5.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
#### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- **@scalar/helpers@0.2.9**
|
|
10
|
+
- [#7894](https://github.com/scalar/scalar/pull/7894): fix: the import and export of redirect to proxy
|
|
11
|
+
|
|
12
|
+
## 0.5.9
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#7866](https://github.com/scalar/scalar/pull/7866): chore: expose har types
|
|
17
|
+
|
|
3
18
|
## 0.5.8
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/snippetz/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { AvailableClient, AvailableClients, ClientId, FormDataParam, HarRequest, Plugin, PluginConfiguration, PostDataCommon, Target, TargetId, } from './snippetz.js';
|
|
1
|
+
export type { AvailableClient, AvailableClients, ClientId, FormDataParam, HarRequest, HarResponse, Plugin, PluginConfiguration, PostDataCommon, Target, TargetId, } from './snippetz.js';
|
|
2
2
|
export { AVAILABLE_CLIENTS, GROUPED_CLIENTS } from './snippetz.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/snippetz/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,QAAQ,GACT,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/snippetz/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,UAAU,EACV,WAAW,EACX,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,QAAQ,GACT,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/snippetz/index.ts"],
|
|
4
|
-
"sourcesContent": ["export type {\n AvailableClient,\n AvailableClients,\n ClientId,\n FormDataParam,\n HarRequest,\n Plugin,\n PluginConfiguration,\n PostDataCommon,\n Target,\n TargetId,\n} from './snippetz'\nexport { AVAILABLE_CLIENTS, GROUPED_CLIENTS } from './snippetz'\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export type {\n AvailableClient,\n AvailableClients,\n ClientId,\n FormDataParam,\n HarRequest,\n HarResponse,\n Plugin,\n PluginConfiguration,\n PostDataCommon,\n Target,\n TargetId,\n} from './snippetz'\nexport { AVAILABLE_CLIENTS, GROUPED_CLIENTS } from './snippetz'\n"],
|
|
5
|
+
"mappings": "AAaA,SAAS,mBAAmB,uBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Request as HarRequest } from 'har-format';
|
|
2
|
-
export type { Param as FormDataParam, PostDataCommon, Request as HarRequest, } from 'har-format';
|
|
2
|
+
export type { Param as FormDataParam, PostDataCommon, Request as HarRequest, Response as HarResponse, } from 'har-format';
|
|
3
3
|
/**
|
|
4
4
|
* Maps programming languages and environments to their available HTTP clients.
|
|
5
5
|
* Each key is a target (language/environment), and each value is an array of
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../../src/snippetz/snippetz.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,YAAY,EACV,KAAK,IAAI,aAAa,EACtB,cAAc,EACd,OAAO,IAAI,UAAU,
|
|
1
|
+
{"version":3,"file":"snippetz.d.ts","sourceRoot":"","sources":["../../src/snippetz/snippetz.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,YAAY,CAAA;AAEvD,YAAY,EACV,KAAK,IAAI,aAAa,EACtB,cAAc,EACd,OAAO,IAAI,UAAU,EACrB,QAAQ,IAAI,WAAW,GACxB,MAAM,YAAY,CAAA;AAEnB;;;;;;GAMG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;CAsBlB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,iBAAiB,gkWAE7B,CAAA;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,iBAAiB,CAAA;AAEvD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,eAAe,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAE9E;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;KAClB,CAAC,IAAI,QAAQ,GAAG;QACf,6CAA6C;QAC7C,GAAG,EAAE,CAAC,CAAA;QACN,0CAA0C;QAC1C,KAAK,EAAE,MAAM,CAAA;QACb,iDAAiD;QACjD,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;QACpB,oDAAoD;QACpD,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB;CACF,CAAC,QAAQ,CAAC,CAAA;AAEX;;;;GAIG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,uDAAuD;IACvD,MAAM,EAAE,QAAQ,CAAA;IAChB,2DAA2D;IAC3D,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC1B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,EAAE,mBAAmB,KAAK,MAAM,CAAA;CACzF,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,iDAAiD;IACjD,IAAI,CAAC,EAAE;QACL,QAAQ,EAAE,MAAM,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;CACF,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/snippetz/snippetz.ts"],
|
|
4
|
-
"sourcesContent": ["import { objectEntries } from '@scalar/helpers/object/object-entries'\nimport type { Request as HarRequest } from 'har-format'\n\nexport type {\n Param as FormDataParam,\n PostDataCommon,\n Request as HarRequest,\n} from 'har-format'\n\n/**\n * Maps programming languages and environments to their available HTTP clients.\n * Each key is a target (language/environment), and each value is an array of\n * client identifiers in the format `target/client`.\n *\n * This is the source of truth for all supported code generation targets.\n */\nexport const GROUPED_CLIENTS = {\n c: ['libcurl'],\n clojure: ['clj_http'],\n csharp: ['httpclient', 'restsharp'],\n dart: ['http'],\n fsharp: ['httpclient'],\n go: ['native'],\n http: ['http1.1'],\n java: ['asynchttp', 'nethttp', 'okhttp', 'unirest'],\n js: ['axios', 'fetch', 'jquery', 'ofetch', 'xhr'],\n kotlin: ['okhttp'],\n node: ['axios', 'fetch', 'ofetch', 'undici'],\n objc: ['nsurlsession'],\n ocaml: ['cohttp'],\n php: ['curl', 'guzzle'],\n powershell: ['restmethod', 'webrequest'],\n python: ['python3', 'requests', 'httpx_sync', 'httpx_async'],\n r: ['httr'],\n ruby: ['native'],\n rust: ['reqwest'],\n shell: ['curl', 'httpie', 'wget'],\n swift: ['nsurlsession'],\n} as const\n\n/**\n * Flat array of all available client identifiers.\n * Each identifier follows the format `target/client` (e.g., `js/fetch`, `python/requests`).\n */\nexport const AVAILABLE_CLIENTS = objectEntries(GROUPED_CLIENTS).flatMap(([group, clients]) =>\n clients.map((client) => `${group}/${client}` as const),\n)\n\n/**\n * All available client identifiers in array format\n * @example\n * ```typescript\n * const clients: AvailableClients = ['js/fetch', 'python/requests', 'shell/curl']\n * ```\n */\nexport type AvailableClients = typeof AVAILABLE_CLIENTS\n\n/**\n * A single available client identifier.\n * @example\n * ```typescript\n * const client: AvailableClient = 'js/fetch'\n * ```\n */\nexport type AvailableClient = AvailableClients[number]\n\n/**\n * A programming language or environment identifier.\n * @example\n * ```typescript\n * const targetId: TargetId = 'js'\n * ```\n */\nexport type TargetId = keyof typeof GROUPED_CLIENTS\n\n/**\n * Extracts the client name from a full client identifier for a given target.\n * For example, for target `js`, this extracts `fetch` from `js/fetch`.\n *\n * @template T - The target identifier (e.g., `js`, `python`)\n */\nexport type ClientId<T extends TargetId> = (typeof GROUPED_CLIENTS)[T][number]\n\n/**\n * Configuration for a specific target (language/environment).\n * Contains metadata about the target and its available clients.\n */\nexport type Target = {\n [K in TargetId]: {\n /** The unique identifier for this target. */\n key: K\n /** Human-readable name for the target. */\n title: string\n /** The default client to use for this target. */\n default: ClientId<K>\n /** All available client plugins for this target. */\n clients: Plugin[]\n }\n}[TargetId]\n\n/**\n * A code generation plugin for a specific HTTP client.\n * Each plugin knows how to convert an HTTP request into source code\n * for its target language and client library.\n */\nexport type Plugin = {\n /** The language or environment this plugin targets. */\n target: TargetId\n /** The identifier of the HTTP client within the target. */\n client: ClientId<TargetId>\n /** Human-readable name for the client. */\n title: string\n /** Generates source code for the given HTTP request. */\n generate: (request?: Partial<HarRequest>, configuration?: PluginConfiguration) => string\n}\n\n/**\n * Optional configuration that can be passed to any code generation plugin.\n * Plugins may use this to customize the generated code.\n */\nexport type PluginConfiguration = {\n /** Credentials for HTTP Basic Authentication. */\n auth?: {\n username: string\n password: string\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import { objectEntries } from '@scalar/helpers/object/object-entries'\nimport type { Request as HarRequest } from 'har-format'\n\nexport type {\n Param as FormDataParam,\n PostDataCommon,\n Request as HarRequest,\n Response as HarResponse,\n} from 'har-format'\n\n/**\n * Maps programming languages and environments to their available HTTP clients.\n * Each key is a target (language/environment), and each value is an array of\n * client identifiers in the format `target/client`.\n *\n * This is the source of truth for all supported code generation targets.\n */\nexport const GROUPED_CLIENTS = {\n c: ['libcurl'],\n clojure: ['clj_http'],\n csharp: ['httpclient', 'restsharp'],\n dart: ['http'],\n fsharp: ['httpclient'],\n go: ['native'],\n http: ['http1.1'],\n java: ['asynchttp', 'nethttp', 'okhttp', 'unirest'],\n js: ['axios', 'fetch', 'jquery', 'ofetch', 'xhr'],\n kotlin: ['okhttp'],\n node: ['axios', 'fetch', 'ofetch', 'undici'],\n objc: ['nsurlsession'],\n ocaml: ['cohttp'],\n php: ['curl', 'guzzle'],\n powershell: ['restmethod', 'webrequest'],\n python: ['python3', 'requests', 'httpx_sync', 'httpx_async'],\n r: ['httr'],\n ruby: ['native'],\n rust: ['reqwest'],\n shell: ['curl', 'httpie', 'wget'],\n swift: ['nsurlsession'],\n} as const\n\n/**\n * Flat array of all available client identifiers.\n * Each identifier follows the format `target/client` (e.g., `js/fetch`, `python/requests`).\n */\nexport const AVAILABLE_CLIENTS = objectEntries(GROUPED_CLIENTS).flatMap(([group, clients]) =>\n clients.map((client) => `${group}/${client}` as const),\n)\n\n/**\n * All available client identifiers in array format\n * @example\n * ```typescript\n * const clients: AvailableClients = ['js/fetch', 'python/requests', 'shell/curl']\n * ```\n */\nexport type AvailableClients = typeof AVAILABLE_CLIENTS\n\n/**\n * A single available client identifier.\n * @example\n * ```typescript\n * const client: AvailableClient = 'js/fetch'\n * ```\n */\nexport type AvailableClient = AvailableClients[number]\n\n/**\n * A programming language or environment identifier.\n * @example\n * ```typescript\n * const targetId: TargetId = 'js'\n * ```\n */\nexport type TargetId = keyof typeof GROUPED_CLIENTS\n\n/**\n * Extracts the client name from a full client identifier for a given target.\n * For example, for target `js`, this extracts `fetch` from `js/fetch`.\n *\n * @template T - The target identifier (e.g., `js`, `python`)\n */\nexport type ClientId<T extends TargetId> = (typeof GROUPED_CLIENTS)[T][number]\n\n/**\n * Configuration for a specific target (language/environment).\n * Contains metadata about the target and its available clients.\n */\nexport type Target = {\n [K in TargetId]: {\n /** The unique identifier for this target. */\n key: K\n /** Human-readable name for the target. */\n title: string\n /** The default client to use for this target. */\n default: ClientId<K>\n /** All available client plugins for this target. */\n clients: Plugin[]\n }\n}[TargetId]\n\n/**\n * A code generation plugin for a specific HTTP client.\n * Each plugin knows how to convert an HTTP request into source code\n * for its target language and client library.\n */\nexport type Plugin = {\n /** The language or environment this plugin targets. */\n target: TargetId\n /** The identifier of the HTTP client within the target. */\n client: ClientId<TargetId>\n /** Human-readable name for the client. */\n title: string\n /** Generates source code for the given HTTP request. */\n generate: (request?: Partial<HarRequest>, configuration?: PluginConfiguration) => string\n}\n\n/**\n * Optional configuration that can be passed to any code generation plugin.\n * Plugins may use this to customize the generated code.\n */\nexport type PluginConfiguration = {\n /** Credentials for HTTP Basic Authentication. */\n auth?: {\n username: string\n password: string\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAiBvB,MAAM,kBAAkB;AAAA,EAC7B,GAAG,CAAC,SAAS;AAAA,EACb,SAAS,CAAC,UAAU;AAAA,EACpB,QAAQ,CAAC,cAAc,WAAW;AAAA,EAClC,MAAM,CAAC,MAAM;AAAA,EACb,QAAQ,CAAC,YAAY;AAAA,EACrB,IAAI,CAAC,QAAQ;AAAA,EACb,MAAM,CAAC,SAAS;AAAA,EAChB,MAAM,CAAC,aAAa,WAAW,UAAU,SAAS;AAAA,EAClD,IAAI,CAAC,SAAS,SAAS,UAAU,UAAU,KAAK;AAAA,EAChD,QAAQ,CAAC,QAAQ;AAAA,EACjB,MAAM,CAAC,SAAS,SAAS,UAAU,QAAQ;AAAA,EAC3C,MAAM,CAAC,cAAc;AAAA,EACrB,OAAO,CAAC,QAAQ;AAAA,EAChB,KAAK,CAAC,QAAQ,QAAQ;AAAA,EACtB,YAAY,CAAC,cAAc,YAAY;AAAA,EACvC,QAAQ,CAAC,WAAW,YAAY,cAAc,aAAa;AAAA,EAC3D,GAAG,CAAC,MAAM;AAAA,EACV,MAAM,CAAC,QAAQ;AAAA,EACf,MAAM,CAAC,SAAS;AAAA,EAChB,OAAO,CAAC,QAAQ,UAAU,MAAM;AAAA,EAChC,OAAO,CAAC,cAAc;AACxB;AAMO,MAAM,oBAAoB,cAAc,eAAe,EAAE;AAAA,EAAQ,CAAC,CAAC,OAAO,OAAO,MACtF,QAAQ,IAAI,CAAC,WAAW,GAAG,KAAK,IAAI,MAAM,EAAW;AACvD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scalar",
|
|
17
17
|
"references"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.5.
|
|
19
|
+
"version": "0.5.10",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=20"
|
|
22
22
|
},
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"nanoid": "^5.1.6",
|
|
63
63
|
"type-fest": "^5.3.1",
|
|
64
64
|
"zod": "^4.3.5",
|
|
65
|
-
"@scalar/helpers": "0.2.
|
|
65
|
+
"@scalar/helpers": "0.2.9"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/har-format": "^1.2.15",
|