@effect/platform 0.69.10 → 0.69.12
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/HttpApiScalar/package.json +6 -0
- package/dist/cjs/HttpApiError.js +1 -1
- package/dist/cjs/HttpApiScalar.js +59 -0
- package/dist/cjs/HttpApiScalar.js.map +1 -0
- package/dist/cjs/HttpApiSwagger.js +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/internal/httpApiScalar.js +2 -0
- package/dist/cjs/internal/httpApiScalar.js.map +1 -0
- package/dist/cjs/internal/{apiSwagger.js → httpApiSwagger.js} +1 -1
- package/dist/cjs/internal/httpApiSwagger.js.map +1 -0
- package/dist/dts/HttpApiScalar.d.ts +106 -0
- package/dist/dts/HttpApiScalar.d.ts.map +1 -0
- package/dist/dts/index.d.ts +4 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/internal/httpApiScalar.d.ts +2 -0
- package/dist/dts/internal/httpApiScalar.d.ts.map +1 -0
- package/dist/dts/internal/httpApiSwagger.d.ts +2 -0
- package/dist/dts/internal/httpApiSwagger.d.ts.map +1 -0
- package/dist/esm/HttpApiError.js +1 -1
- package/dist/esm/HttpApiScalar.js +49 -0
- package/dist/esm/HttpApiScalar.js.map +1 -0
- package/dist/esm/HttpApiSwagger.js +1 -1
- package/dist/esm/HttpApiSwagger.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/httpApiScalar.js +2 -0
- package/dist/esm/internal/httpApiScalar.js.map +1 -0
- package/dist/esm/internal/{apiSwagger.js → httpApiSwagger.js} +1 -1
- package/dist/esm/internal/httpApiSwagger.js.map +1 -0
- package/package.json +10 -2
- package/src/HttpApiError.ts +1 -1
- package/src/HttpApiScalar.ts +187 -0
- package/src/HttpApiSwagger.ts +1 -1
- package/src/index.ts +5 -0
- package/src/internal/httpApiScalar.ts +4 -0
- package/dist/cjs/internal/apiSwagger.js.map +0 -1
- package/dist/dts/internal/apiSwagger.d.ts +0 -2
- package/dist/dts/internal/apiSwagger.d.ts.map +0 -1
- package/dist/esm/internal/apiSwagger.js.map +0 -1
- /package/src/internal/{apiSwagger.ts → httpApiSwagger.ts} +0 -0
package/dist/cjs/HttpApiError.js
CHANGED
|
@@ -46,7 +46,7 @@ class HttpApiDecodeError extends /*#__PURE__*/Schema.TaggedError()("HttpApiDecod
|
|
|
46
46
|
message: Schema.String
|
|
47
47
|
}, /*#__PURE__*/HttpApiSchema.annotations({
|
|
48
48
|
status: 400,
|
|
49
|
-
description: "
|
|
49
|
+
description: "The request did not match the expected schema"
|
|
50
50
|
})) {
|
|
51
51
|
/**
|
|
52
52
|
* @since 1.0.0
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.layer = void 0;
|
|
7
|
+
var Effect = _interopRequireWildcard(require("effect/Effect"));
|
|
8
|
+
var _HttpApi = require("./HttpApi.js");
|
|
9
|
+
var _HttpApiBuilder = require("./HttpApiBuilder.js");
|
|
10
|
+
var HttpServerResponse = _interopRequireWildcard(require("./HttpServerResponse.js"));
|
|
11
|
+
var internal = _interopRequireWildcard(require("./internal/httpApiScalar.js"));
|
|
12
|
+
var OpenApi = _interopRequireWildcard(require("./OpenApi.js"));
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
/**
|
|
16
|
+
* @since 1.0.0
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
* @category layers
|
|
22
|
+
*/
|
|
23
|
+
const layer = options => _HttpApiBuilder.Router.use(router => Effect.gen(function* () {
|
|
24
|
+
const {
|
|
25
|
+
api
|
|
26
|
+
} = yield* _HttpApi.Api;
|
|
27
|
+
const spec = OpenApi.fromApi(api);
|
|
28
|
+
const source = options?.source;
|
|
29
|
+
const defaultScript = internal.javascript;
|
|
30
|
+
const src = source ? typeof source === "string" ? source : source.type === "cdn" ? `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${source.version ?? "latest"}/dist/browser/standalone.min.js` : null : null;
|
|
31
|
+
const scalarConfig = {
|
|
32
|
+
_integration: "http",
|
|
33
|
+
...options?.scalar
|
|
34
|
+
};
|
|
35
|
+
const response = HttpServerResponse.html(`<!doctype html>
|
|
36
|
+
<html>
|
|
37
|
+
<head>
|
|
38
|
+
<meta charset="utf-8" />
|
|
39
|
+
<title>${spec.info.title}</title>
|
|
40
|
+
${!spec.info.description ? "" : `<meta name="description" content="${spec.info.description}"/>`}
|
|
41
|
+
${!spec.info.description ? "" : `<meta name="og:description" content="${spec.info.description}"/>`}
|
|
42
|
+
<meta
|
|
43
|
+
name="viewport"
|
|
44
|
+
content="width=device-width, initial-scale=1" />
|
|
45
|
+
</head>
|
|
46
|
+
<body>
|
|
47
|
+
<script id="api-reference" type="application/json">
|
|
48
|
+
${JSON.stringify(spec)}
|
|
49
|
+
</script>
|
|
50
|
+
<script>
|
|
51
|
+
document.getElementById('api-reference').dataset.configuration = JSON.stringify(${JSON.stringify(scalarConfig)})
|
|
52
|
+
</script>
|
|
53
|
+
${src ? `<script src="${src}" crossorigin></script>` : `<script>${defaultScript}</script>`}
|
|
54
|
+
</body>
|
|
55
|
+
</html>`);
|
|
56
|
+
yield* router.get(options?.path ?? "/docs", Effect.succeed(response));
|
|
57
|
+
}));
|
|
58
|
+
exports.layer = layer;
|
|
59
|
+
//# sourceMappingURL=HttpApiScalar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpApiScalar.js","names":["Effect","_interopRequireWildcard","require","_HttpApi","_HttpApiBuilder","HttpServerResponse","internal","OpenApi","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","layer","options","Router","use","router","gen","api","Api","spec","fromApi","source","defaultScript","javascript","src","type","version","scalarConfig","_integration","scalar","response","html","info","title","description","JSON","stringify","path","succeed","exports"],"sources":["../../src/HttpApiScalar.ts"],"sourcesContent":[null],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,uBAAA,CAAAC,OAAA;AAAuC,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA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AY,EAAE,MAAM;IACpB,GAAGhB,OAAO,EAAEiB;GACb;EAED,MAAMC,QAAQ,GAAG1C,kBAAkB,CAAC2C,IAAI,CAAC;;;;aAIlCZ,IAAI,CAACa,IAAI,CAACC,KAAK;MAEpB,CAACd,IAAI,CAACa,IAAI,CAACE,WAAW,GAClB,EAAE,GACF,qCAAqCf,IAAI,CAACa,IAAI,CAACE,WAAW,KAChE;MAEE,CAACf,IAAI,CAACa,IAAI,CAACE,WAAW,GAClB,EAAE,GACF,wCAAwCf,IAAI,CAACa,IAAI,CAACE,WAAW,KACnE;;;;;;;QAOEC,IAAI,CAACC,SAAS,CAACjB,IAAI,CAAC;;;wFAG4DgB,IAAI,CAACC,SAAS,CAACT,YAAY,CAAC;;MAG5GH,GAAG,GACC,gBAAgBA,GAAG,yBAAyB,GAC5C,WAAWF,aAAa,WAC9B;;QAEE,CAAC;EACH,OAAOP,MAAM,CAAChB,GAAG,CAACa,OAAO,EAAEyB,IAAI,IAAI,OAAO,EAAEtD,MAAM,CAACuD,OAAO,CAACR,QAAQ,CAAC,CAAC;AACvE,CAAC,CAAC,CACH;AAAAS,OAAA,CAAA5B,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ var Effect = _interopRequireWildcard(require("effect/Effect"));
|
|
|
8
8
|
var _HttpApi = require("./HttpApi.js");
|
|
9
9
|
var _HttpApiBuilder = require("./HttpApiBuilder.js");
|
|
10
10
|
var HttpServerResponse = _interopRequireWildcard(require("./HttpServerResponse.js"));
|
|
11
|
-
var internal = _interopRequireWildcard(require("./internal/
|
|
11
|
+
var internal = _interopRequireWildcard(require("./internal/httpApiSwagger.js"));
|
|
12
12
|
var OpenApi = _interopRequireWildcard(require("./OpenApi.js"));
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WorkerRunner = exports.WorkerError = exports.Worker = exports.UrlParams = exports.Transferable = exports.Terminal = exports.Template = exports.Socket = exports.Runtime = exports.PlatformLogger = exports.PlatformConfigProvider = exports.Path = exports.OpenApiJsonSchema = exports.OpenApi = exports.Multipart = exports.KeyValueStore = exports.HttpTraceContext = exports.HttpServerResponse = exports.HttpServerRespondable = exports.HttpServerRequest = exports.HttpServerError = exports.HttpServer = exports.HttpRouter = exports.HttpPlatform = exports.HttpMultiplex = exports.HttpMiddleware = exports.HttpMethod = exports.HttpIncomingMessage = exports.HttpClientResponse = exports.HttpClientRequest = exports.HttpClientError = exports.HttpClient = exports.HttpBody = exports.HttpApp = exports.HttpApiSwagger = exports.HttpApiSecurity = exports.HttpApiSchema = exports.HttpApiMiddleware = exports.HttpApiGroup = exports.HttpApiError = exports.HttpApiEndpoint = exports.HttpApiClient = exports.HttpApiBuilder = exports.HttpApi = exports.Headers = exports.FileSystem = exports.FetchHttpClient = exports.Etag = exports.Error = exports.Effectify = exports.Cookies = exports.CommandExecutor = exports.Command = void 0;
|
|
6
|
+
exports.WorkerRunner = exports.WorkerError = exports.Worker = exports.UrlParams = exports.Transferable = exports.Terminal = exports.Template = exports.Socket = exports.Runtime = exports.PlatformLogger = exports.PlatformConfigProvider = exports.Path = exports.OpenApiJsonSchema = exports.OpenApi = exports.Multipart = exports.KeyValueStore = exports.HttpTraceContext = exports.HttpServerResponse = exports.HttpServerRespondable = exports.HttpServerRequest = exports.HttpServerError = exports.HttpServer = exports.HttpRouter = exports.HttpPlatform = exports.HttpMultiplex = exports.HttpMiddleware = exports.HttpMethod = exports.HttpIncomingMessage = exports.HttpClientResponse = exports.HttpClientRequest = exports.HttpClientError = exports.HttpClient = exports.HttpBody = exports.HttpApp = exports.HttpApiSwagger = exports.HttpApiSecurity = exports.HttpApiSchema = exports.HttpApiScalar = exports.HttpApiMiddleware = exports.HttpApiGroup = exports.HttpApiError = exports.HttpApiEndpoint = exports.HttpApiClient = exports.HttpApiBuilder = exports.HttpApi = exports.Headers = exports.FileSystem = exports.FetchHttpClient = exports.Etag = exports.Error = exports.Effectify = exports.Cookies = exports.CommandExecutor = exports.Command = void 0;
|
|
7
7
|
var _Command = _interopRequireWildcard(require("./Command.js"));
|
|
8
8
|
exports.Command = _Command;
|
|
9
9
|
var _CommandExecutor = _interopRequireWildcard(require("./CommandExecutor.js"));
|
|
@@ -36,6 +36,8 @@ var _HttpApiGroup = _interopRequireWildcard(require("./HttpApiGroup.js"));
|
|
|
36
36
|
exports.HttpApiGroup = _HttpApiGroup;
|
|
37
37
|
var _HttpApiMiddleware = _interopRequireWildcard(require("./HttpApiMiddleware.js"));
|
|
38
38
|
exports.HttpApiMiddleware = _HttpApiMiddleware;
|
|
39
|
+
var _HttpApiScalar = _interopRequireWildcard(require("./HttpApiScalar.js"));
|
|
40
|
+
exports.HttpApiScalar = _HttpApiScalar;
|
|
39
41
|
var _HttpApiSchema = _interopRequireWildcard(require("./HttpApiSchema.js"));
|
|
40
42
|
exports.HttpApiSchema = _HttpApiSchema;
|
|
41
43
|
var _HttpApiSecurity = _interopRequireWildcard(require("./HttpApiSecurity.js"));
|