@effect/platform 0.82.7 → 0.83.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 (52) hide show
  1. package/dist/cjs/Error.js +60 -8
  2. package/dist/cjs/Error.js.map +1 -1
  3. package/dist/cjs/HttpClientError.js +1 -1
  4. package/dist/cjs/HttpClientError.js.map +1 -1
  5. package/dist/cjs/Ndjson.js +1 -5
  6. package/dist/cjs/Ndjson.js.map +1 -1
  7. package/dist/cjs/PlatformConfigProvider.js +1 -1
  8. package/dist/cjs/PlatformConfigProvider.js.map +1 -1
  9. package/dist/cjs/internal/fileSystem.js +8 -6
  10. package/dist/cjs/internal/fileSystem.js.map +1 -1
  11. package/dist/cjs/internal/keyValueStore.js +6 -6
  12. package/dist/cjs/internal/keyValueStore.js.map +1 -1
  13. package/dist/cjs/internal/path.js +6 -6
  14. package/dist/cjs/internal/path.js.map +1 -1
  15. package/dist/cjs/internal/platformConfigProvider.js +1 -1
  16. package/dist/cjs/internal/platformConfigProvider.js.map +1 -1
  17. package/dist/dts/Error.d.ts +54 -34
  18. package/dist/dts/Error.d.ts.map +1 -1
  19. package/dist/dts/Ndjson.d.ts +3 -0
  20. package/dist/dts/Ndjson.d.ts.map +1 -1
  21. package/dist/esm/Error.js +57 -7
  22. package/dist/esm/Error.js.map +1 -1
  23. package/dist/esm/HttpClientError.js +1 -1
  24. package/dist/esm/HttpClientError.js.map +1 -1
  25. package/dist/esm/Ndjson.js +1 -4
  26. package/dist/esm/Ndjson.js.map +1 -1
  27. package/dist/esm/PlatformConfigProvider.js +1 -1
  28. package/dist/esm/PlatformConfigProvider.js.map +1 -1
  29. package/dist/esm/internal/fileSystem.js +8 -6
  30. package/dist/esm/internal/fileSystem.js.map +1 -1
  31. package/dist/esm/internal/keyValueStore.js +6 -6
  32. package/dist/esm/internal/keyValueStore.js.map +1 -1
  33. package/dist/esm/internal/path.js +6 -6
  34. package/dist/esm/internal/path.js.map +1 -1
  35. package/dist/esm/internal/platformConfigProvider.js +1 -1
  36. package/dist/esm/internal/platformConfigProvider.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/Error.ts +76 -48
  39. package/src/HttpClientError.ts +1 -1
  40. package/src/Ndjson.ts +1 -1
  41. package/src/PlatformConfigProvider.ts +1 -1
  42. package/src/internal/fileSystem.ts +10 -8
  43. package/src/internal/keyValueStore.ts +7 -7
  44. package/src/internal/path.ts +21 -15
  45. package/src/internal/platformConfigProvider.ts +2 -2
  46. package/dist/cjs/internal/error.js +0 -20
  47. package/dist/cjs/internal/error.js.map +0 -1
  48. package/dist/dts/internal/error.d.ts +0 -2
  49. package/dist/dts/internal/error.d.ts.map +0 -1
  50. package/dist/esm/internal/error.js +0 -13
  51. package/dist/esm/internal/error.js.map +0 -1
  52. package/src/internal/error.ts +0 -21
@@ -247,8 +247,8 @@ export const layerSchema = <A, I, R>(
247
247
  }
248
248
 
249
249
  /** @internal */
250
- const storageError = (props: Omit<Parameters<typeof PlatformError.SystemError>[0], "reason" | "module">) =>
251
- PlatformError.SystemError({
250
+ const storageError = (props: Omit<ConstructorParameters<typeof PlatformError.SystemError>[0], "reason" | "module">) =>
251
+ new PlatformError.SystemError({
252
252
  reason: "PermissionDenied",
253
253
  module: "KeyValueStore",
254
254
  ...props
@@ -266,7 +266,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
266
266
  storageError({
267
267
  pathOrDescriptor: key,
268
268
  method: "get",
269
- message: `Unable to get item with key ${key}`
269
+ description: `Unable to get item with key ${key}`
270
270
  })
271
271
  }),
272
272
 
@@ -277,7 +277,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
277
277
  storageError({
278
278
  pathOrDescriptor: key,
279
279
  method: "set",
280
- message: `Unable to set item with key ${key}`
280
+ description: `Unable to set item with key ${key}`
281
281
  })
282
282
  }),
283
283
 
@@ -288,7 +288,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
288
288
  storageError({
289
289
  pathOrDescriptor: key,
290
290
  method: "remove",
291
- message: `Unable to remove item with key ${key}`
291
+ description: `Unable to remove item with key ${key}`
292
292
  })
293
293
  }),
294
294
 
@@ -298,7 +298,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
298
298
  storageError({
299
299
  pathOrDescriptor: "clear",
300
300
  method: "clear",
301
- message: `Unable to clear storage`
301
+ description: `Unable to clear storage`
302
302
  })
303
303
  }),
304
304
 
@@ -308,7 +308,7 @@ export const layerStorage = (evaluate: LazyArg<Storage>) =>
308
308
  storageError({
309
309
  pathOrDescriptor: "size",
310
310
  method: "size",
311
- message: `Unable to get size`
311
+ description: `Unable to get size`
312
312
  })
313
313
  })
314
314
  })
@@ -105,28 +105,34 @@ function _format(sep: string, pathObject: Partial<Api.Path.Parsed>) {
105
105
 
106
106
  function fromFileUrl(url: URL): Effect.Effect<string, BadArgument> {
107
107
  if (url.protocol !== "file:") {
108
- return Effect.fail(BadArgument({
109
- module: "Path",
110
- method: "fromFileUrl",
111
- message: "URL must be of scheme file"
112
- }))
108
+ return Effect.fail(
109
+ new BadArgument({
110
+ module: "Path",
111
+ method: "fromFileUrl",
112
+ description: "URL must be of scheme file"
113
+ })
114
+ )
113
115
  } else if (url.hostname !== "") {
114
- return Effect.fail(BadArgument({
115
- module: "Path",
116
- method: "fromFileUrl",
117
- message: "Invalid file URL host"
118
- }))
116
+ return Effect.fail(
117
+ new BadArgument({
118
+ module: "Path",
119
+ method: "fromFileUrl",
120
+ description: "Invalid file URL host"
121
+ })
122
+ )
119
123
  }
120
124
  const pathname = url.pathname
121
125
  for (let n = 0; n < pathname.length; n++) {
122
126
  if (pathname[n] === "%") {
123
127
  const third = pathname.codePointAt(n + 2)! | 0x20
124
128
  if (pathname[n + 1] === "2" && third === 102) {
125
- return Effect.fail(BadArgument({
126
- module: "Path",
127
- method: "fromFileUrl",
128
- message: "must not include encoded / characters"
129
- }))
129
+ return Effect.fail(
130
+ new BadArgument({
131
+ module: "Path",
132
+ method: "fromFileUrl",
133
+ description: "must not include encoded / characters"
134
+ })
135
+ )
130
136
  }
131
137
  }
132
138
  }
@@ -1,11 +1,11 @@
1
- import type { PlatformError } from "@effect/platform/Error"
2
- import * as FileSystem from "@effect/platform/FileSystem"
3
1
  import * as ConfigProvider from "effect/ConfigProvider"
4
2
  import * as Context from "effect/Context"
5
3
  import * as DefaultServices from "effect/DefaultServices"
6
4
  import * as Effect from "effect/Effect"
7
5
  import * as FiberRef from "effect/FiberRef"
8
6
  import * as Layer from "effect/Layer"
7
+ import type { PlatformError } from "../Error.js"
8
+ import * as FileSystem from "../FileSystem.js"
9
9
 
10
10
  /**
11
11
  * dot env ConfigProvider
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.systemError = exports.badArgument = exports.PlatformErrorTypeId = void 0;
7
- var Data = _interopRequireWildcard(require("effect/Data"));
8
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
- /** @internal */
10
- const PlatformErrorTypeId = exports.PlatformErrorTypeId = /*#__PURE__*/Symbol.for("@effect/platform/Error/PlatformErrorTypeId");
11
- const make = tag => props => Data.struct({
12
- [PlatformErrorTypeId]: PlatformErrorTypeId,
13
- _tag: tag,
14
- ...props
15
- });
16
- /** @internal */
17
- const badArgument = exports.badArgument = /*#__PURE__*/make("BadArgument");
18
- /** @internal */
19
- const systemError = exports.systemError = /*#__PURE__*/make("SystemError");
20
- //# sourceMappingURL=error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","names":["Data","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PlatformErrorTypeId","exports","Symbol","for","make","tag","props","struct","_tag","badArgument","systemError"],"sources":["../../../src/internal/error.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAmC,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAGnC;AACO,MAAMkB,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,gBAA8BE,MAAM,CAACC,GAAG,CACtE,4CAA4C,CAChB;AAE9B,MAAMC,IAAI,GACwBC,GAAc,IAAMC,KAAkD,IACpG5B,IAAI,CAAC6B,MAAM,CAAC;EACV,CAACP,mBAAmB,GAAGA,mBAAmB;EAC1CQ,IAAI,EAAEH,GAAG;EACT,GAAGC;CACC,CAAC;AAEX;AACO,MAAMG,WAAW,GAAAR,OAAA,CAAAQ,WAAA,gBAAGL,IAAI,CAAoB,aAAa,CAAC;AAEjE;AACO,MAAMM,WAAW,GAAAT,OAAA,CAAAS,WAAA,gBAAGN,IAAI,CAAoB,aAAa,CAAC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/internal/error.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- import * as Data from "effect/Data";
2
- /** @internal */
3
- export const PlatformErrorTypeId = /*#__PURE__*/Symbol.for("@effect/platform/Error/PlatformErrorTypeId");
4
- const make = tag => props => Data.struct({
5
- [PlatformErrorTypeId]: PlatformErrorTypeId,
6
- _tag: tag,
7
- ...props
8
- });
9
- /** @internal */
10
- export const badArgument = /*#__PURE__*/make("BadArgument");
11
- /** @internal */
12
- export const systemError = /*#__PURE__*/make("SystemError");
13
- //# sourceMappingURL=error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error.js","names":["Data","PlatformErrorTypeId","Symbol","for","make","tag","props","struct","_tag","badArgument","systemError"],"sources":["../../../src/internal/error.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,IAAI,MAAM,aAAa;AAGnC;AACA,OAAO,MAAMC,mBAAmB,gBAA8BC,MAAM,CAACC,GAAG,CACtE,4CAA4C,CAChB;AAE9B,MAAMC,IAAI,GACwBC,GAAc,IAAMC,KAAkD,IACpGN,IAAI,CAACO,MAAM,CAAC;EACV,CAACN,mBAAmB,GAAGA,mBAAmB;EAC1CO,IAAI,EAAEH,GAAG;EACT,GAAGC;CACC,CAAC;AAEX;AACA,OAAO,MAAMG,WAAW,gBAAGL,IAAI,CAAoB,aAAa,CAAC;AAEjE;AACA,OAAO,MAAMM,WAAW,gBAAGN,IAAI,CAAoB,aAAa,CAAC","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- import * as Data from "effect/Data"
2
- import type * as Error from "../Error.js"
3
-
4
- /** @internal */
5
- export const PlatformErrorTypeId: Error.PlatformErrorTypeId = Symbol.for(
6
- "@effect/platform/Error/PlatformErrorTypeId"
7
- ) as Error.PlatformErrorTypeId
8
-
9
- const make =
10
- <A extends Error.PlatformError>(tag: A["_tag"]) => (props: Omit<A, Error.PlatformError.ProvidedFields>): A =>
11
- Data.struct({
12
- [PlatformErrorTypeId]: PlatformErrorTypeId,
13
- _tag: tag,
14
- ...props
15
- } as A)
16
-
17
- /** @internal */
18
- export const badArgument = make<Error.BadArgument>("BadArgument")
19
-
20
- /** @internal */
21
- export const systemError = make<Error.SystemError>("SystemError")