@effect/platform 0.93.1 → 0.93.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"httpApiSwagger.js","names":["javascript","css"],"sources":["../../../src/internal/httpApiSwagger.ts"],"sourcesContent":[null],"mappings":"AAAA,oBAEA,gBACA,MAAO,MAAM,CAAAA,UAAU,CAAG,m1lpDAAm1lpD,CAE72lpD,gBACA,MAAO,MAAM,CAAAC,GAAG,CAAG,wopJAAwopJ","ignoreList":[]}
1
+ {"version":3,"file":"httpApiSwagger.js","names":["javascript","css"],"sources":["../../../src/internal/httpApiSwagger.ts"],"sourcesContent":[null],"mappings":"AAAA,oBAEA,gBACA,MAAO,MAAM,CAAAA,UAAU,CAAG,s7iuDAAs7iuD,CAEh9iuD,gBACA,MAAO,MAAM,CAAAC,GAAG,CAAG,otvJAAotvJ","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/platform",
3
- "version": "0.93.1",
3
+ "version": "0.93.3",
4
4
  "description": "Unified interfaces for common platform-specific services",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,7 +16,7 @@
16
16
  "multipasta": "^0.2.7"
17
17
  },
18
18
  "peerDependencies": {
19
- "effect": "^3.19.3"
19
+ "effect": "^3.19.4"
20
20
  },
21
21
  "publishConfig": {
22
22
  "provenance": true
@@ -23,26 +23,13 @@ export type ScalarThemeId =
23
23
  | "purple"
24
24
  | "solarized"
25
25
  | "bluePlanet"
26
- | "deepSpace"
27
26
  | "saturn"
28
27
  | "kepler"
29
28
  | "mars"
29
+ | "deepSpace"
30
+ | "laserwave"
30
31
  | "none"
31
32
 
32
- /**
33
- * @since 1.0.0
34
- * @category model
35
- *
36
- * cdn: `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${source.version}/dist/browser/standalone.min.js`
37
- */
38
- export type ScalarScriptSource =
39
- | string
40
- | { type: "default" }
41
- | {
42
- type: "cdn"
43
- version?: "latest" | (string & {})
44
- }
45
-
46
33
  /**
47
34
  * @see https://github.com/scalar/scalar/blob/main/documentation/configuration.md
48
35
  *
@@ -55,9 +42,7 @@ export type ScalarConfig = {
55
42
  /** The layout to use for the references */
56
43
  layout?: "modern" | "classic"
57
44
  /** URL to a request proxy for the API client */
58
- proxy?: string
59
- /** Whether the spec input should show */
60
- isEditable?: boolean
45
+ proxyUrl?: string
61
46
  /** Whether to show the sidebar */
62
47
  showSidebar?: boolean
63
48
  /**
@@ -66,12 +51,6 @@ export type ScalarConfig = {
66
51
  * Default: `false`
67
52
  */
68
53
  hideModels?: boolean
69
- /**
70
- * Whether to show the “Download OpenAPI Document” button
71
- *
72
- * Default: `false`
73
- */
74
- hideDownloadButton?: boolean
75
54
  /**
76
55
  * Whether to show the “Test Request” button
77
56
  *
@@ -124,25 +103,21 @@ export type ScalarConfig = {
124
103
 
125
104
  const makeHandler = (options: {
126
105
  readonly api: HttpApi.HttpApi.Any
127
- readonly source?: ScalarScriptSource
106
+ readonly source: {
107
+ readonly _tag: "Cdn"
108
+ readonly version?: string | undefined
109
+ } | {
110
+ readonly _tag: "Inline"
111
+ readonly source: string
112
+ }
128
113
  readonly scalar?: ScalarConfig
129
114
  }) => {
130
115
  const spec = OpenApi.fromApi(options.api as any)
131
116
 
132
117
  const source = options?.source
133
- const defaultScript = internal.javascript
134
- const src: string | null = source
135
- ? typeof source === "string"
136
- ? source
137
- : source.type === "cdn"
138
- ? `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${
139
- source.version ?? "latest"
140
- }/dist/browser/standalone.min.js`
141
- : null
142
- : null
143
118
 
144
119
  const scalarConfig = {
145
- _integration: "http",
120
+ _integration: "html",
146
121
  ...options?.scalar
147
122
  }
148
123
 
@@ -173,9 +148,11 @@ const makeHandler = (options: {
173
148
  document.getElementById('api-reference').dataset.configuration = JSON.stringify(${Html.escapeJson(scalarConfig)})
174
149
  </script>
175
150
  ${
176
- src
177
- ? `<script src="${src}" crossorigin></script>`
178
- : `<script>${defaultScript}</script>`
151
+ source._tag === "Cdn"
152
+ ? `<script src="${`https://cdn.jsdelivr.net/npm/@scalar/api-reference@${
153
+ source.version ?? "latest"
154
+ }/dist/browser/standalone.min.js`}" crossorigin></script>`
155
+ : `<script>${source.source}</script>`
179
156
  }
180
157
  </body>
181
158
  </html>`)
@@ -189,16 +166,42 @@ const makeHandler = (options: {
189
166
  */
190
167
  export const layer = (options?: {
191
168
  readonly path?: `/${string}` | undefined
192
- readonly source?: ScalarScriptSource
193
169
  readonly scalar?: ScalarConfig
194
170
  }): Layer.Layer<never, never, Api> =>
195
- Router.use((router) =>
196
- Effect.gen(function*() {
197
- const { api } = yield* Api
198
- const handler = makeHandler({ ...options, api })
199
- yield* router.get(options?.path ?? "/docs", handler)
171
+ Router.use(Effect.fnUntraced(function*(router) {
172
+ const { api } = yield* Api
173
+ const handler = makeHandler({
174
+ ...options,
175
+ api,
176
+ source: {
177
+ _tag: "Inline",
178
+ source: internal.javascript
179
+ }
200
180
  })
201
- )
181
+ yield* router.get(options?.path ?? "/docs", handler)
182
+ }))
183
+
184
+ /**
185
+ * @since 1.0.0
186
+ * @category layers
187
+ */
188
+ export const layerCdn = (options?: {
189
+ readonly path?: `/${string}` | undefined
190
+ readonly scalar?: ScalarConfig
191
+ readonly version?: string | undefined
192
+ }): Layer.Layer<never, never, Api> =>
193
+ Router.use(Effect.fnUntraced(function*(router) {
194
+ const { api } = yield* Api
195
+ const handler = makeHandler({
196
+ ...options,
197
+ api,
198
+ source: {
199
+ _tag: "Cdn",
200
+ version: options?.version
201
+ }
202
+ })
203
+ yield* router.get(options?.path ?? "/docs", handler)
204
+ }))
202
205
 
203
206
  /**
204
207
  * @since 1.0.0
@@ -208,7 +211,6 @@ export const layerHttpLayerRouter: (
208
211
  options: {
209
212
  readonly api: HttpApi.HttpApi.Any
210
213
  readonly path: `/${string}`
211
- readonly source?: ScalarScriptSource
212
214
  readonly scalar?: ScalarConfig
213
215
  }
214
216
  ) => Layer.Layer<
@@ -218,10 +220,47 @@ export const layerHttpLayerRouter: (
218
220
  > = Effect.fnUntraced(function*(options: {
219
221
  readonly api: HttpApi.HttpApi.Any
220
222
  readonly path: `/${string}`
221
- readonly source?: ScalarScriptSource
222
223
  readonly scalar?: ScalarConfig
223
224
  }) {
224
225
  const router = yield* HttpLayerRouter.HttpRouter
225
- const handler = makeHandler(options)
226
+ const handler = makeHandler({
227
+ ...options,
228
+ source: {
229
+ _tag: "Inline",
230
+ source: internal.javascript
231
+ }
232
+ })
233
+ yield* router.add("GET", options.path, handler)
234
+ }, Layer.effectDiscard)
235
+
236
+ /**
237
+ * @since 1.0.0
238
+ * @category layers
239
+ */
240
+ export const layerHttpLayerRouterCdn: (
241
+ options: {
242
+ readonly api: HttpApi.HttpApi.Any
243
+ readonly path: `/${string}`
244
+ readonly version?: string | undefined
245
+ readonly scalar?: ScalarConfig
246
+ }
247
+ ) => Layer.Layer<
248
+ never,
249
+ never,
250
+ HttpLayerRouter.HttpRouter
251
+ > = Effect.fnUntraced(function*(options: {
252
+ readonly api: HttpApi.HttpApi.Any
253
+ readonly path: `/${string}`
254
+ readonly version?: string | undefined
255
+ readonly scalar?: ScalarConfig
256
+ }) {
257
+ const router = yield* HttpLayerRouter.HttpRouter
258
+ const handler = makeHandler({
259
+ ...options,
260
+ source: {
261
+ _tag: "Cdn",
262
+ version: options?.version
263
+ }
264
+ })
226
265
  yield* router.add("GET", options.path, handler)
227
266
  }, Layer.effectDiscard)