@efffrida/gplayapi 0.0.9 → 0.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"device.js","names":["FileSystem","Effect","Schema","PropertiesFile","Device","Class","UserReadableName","String","NumberFromString","CellOperator","Client","Features","transform","Array","encode","features","join","decode","str","split","extensions","HasFiveWayNavigation","BooleanFromString","HasHardKeyboard","Keyboard","Locales","locales","Navigation","Platforms","libs","Roaming","ScreenLayout","SharedLibraries","SimCountry","pipe","optional","SimOperator","TimeZone","TouchScreen","fromPropertiesFile","path","gen","fileSystem","content","readFileString","properties","getProperties","device","decodeUnknown","userAgent","deviceProperties","api","versionCode","sdk","hardware","product","platformVersionRelease","model","buildId","isWideScreen","supportedAbis","devicePropertiesString","Object","entries","map","k","v"],"sources":["../../src/internal/device.ts"],"sourcesContent":[null],"mappings":"AAGA,OAAO,KAAKA,UAAU,MAAM,6BAA6B;AACzD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,cAAc,MAAM,iBAAiB;AAEjD;AACA,OAAM,MAAOC,MAAO,sBAAQF,MAAM,CAACG,KAAK,CAAS,QAAQ,CAAC,CAAC;EACvDC,gBAAgB,EAAEJ,MAAM,CAACK,MAAM;EAC/B,kBAAkB,EAAEL,MAAM,CAACK,MAAM;EACjC,aAAa,EAAEL,MAAM,CAACK,MAAM;EAC5B,cAAc,EAAEL,MAAM,CAACK,MAAM;EAC7B,mBAAmB,EAAEL,MAAM,CAACK,MAAM;EAClC,gBAAgB,EAAEL,MAAM,CAACK,MAAM;EAC/B,UAAU,EAAEL,MAAM,CAACK,MAAM;EACzB,oBAAoB,EAAEL,MAAM,CAACK,MAAM;EACnC,aAAa,EAAEL,MAAM,CAACK,MAAM;EAC5B,eAAe,EAAEL,MAAM,CAACK,MAAM;EAC9B,aAAa,EAAEL,MAAM,C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IAC/C,MAAM2C,OAAO,GAAG,OAAOD,UAAU,CAACE,cAAc,CAACJ,IAAI,CAAC;IACtD,MAAMK,UAAU,GAAG1C,cAAc,CAAC2C,aAAa,CAACH,OAAO,CAAC;IACxD,MAAMI,MAAM,GAAG,OAAO7C,MAAM,CAAC8C,aAAa,CAAC5C,MAAM,CAAC,CAACyC,UAAU,CAAC;IAC9D,OAAOE,MAAM;EACjB,CAAC,CAAC;EAEN,IAAWE,SAASA,CAAA;IAChB,MAAMC,gBAAgB,GAAG;MACrBC,GAAG,EAAE,CAAC;MACNC,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC;MACpCC,GAAG,EAAE,IAAI,CAAC,uBAAuB,CAAC;MAClCN,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC;MAC5BO,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC;MAChCC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC;MAC9BC,sBAAsB,EAAE,IAAI,CAAC,uBAAuB,CAAC;MACrDC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC;MAC1BC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC;MACzBC,YAAY,EAAE,CAAC;MACfC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC5C,IAAI,CAAC,GAAG;KAC5C;IAED,MAAM6C,sBAAsB,GAAGC,MAAM,CAACC,OAAO,CAACb,gBAAgB,CAAC,CAC1Dc,GAAG,CAAC,CAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,KAAK,GAAGD,CAAC,IAAIC,CAAC,EAAE,CAAC,CAC5BlD,IAAI,CAAC,GAAG,CAAC;IAEd,OAAO,kBAAkB,IAAI,CAAC,uBAAuB,CAAC,KAAK6C,sBAAsB,GAAG;EACxF","ignoreList":[]}
1
+ {"version":3,"file":"device.js","names":["Effect","FileSystem","Path","Schema","SchemaGetter","SchemaTransformation","internalAuth","StringArrayFromString","suspend","splitter","split","separator","joiner","transform","arr","join","make","encode","decode","String","pipe","decodeTo","Array","BooleanFromString","Literals","Boolean","str","bool","AndroidDevice","Class","UserReadableName","NumberFromString","CellOperator","Client","Features","HasFiveWayNavigation","HasHardKeyboard","Keyboard","Locales","Navigation","Platforms","Roaming","ScreenLayout","SharedLibraries","SimCountry","optional","SimOperator","TimeZone","TouchScreen","authHeadersCache","undefined","fromPropertiesFile","fnUntraced","file","decodeDevice","decodeUnknownEffect","decodePropertiesFile","decodeEffect","Record","splitKeyValue","keyValueSeparator","fileSystem","content","readFileString","properties","EmbeddedPixel7a","flatMap","path","fromFileUrl","URL","import","meta","url","userAgent","deviceProperties","api","versionCode","sdk","device","hardware","product","platformVersionRelease","model","buildId","isWideScreen","supportedAbis","devicePropertiesString","Object","entries","map","k","v","authHeaders","gen","self"],"sources":["../../src/internal/device.ts"],"sourcesContent":[null],"mappings":"AAIA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,YAAY,MAAM,qBAAqB;AACnD,OAAO,KAAKC,oBAAoB,MAAM,6BAA6B;AAEnE,OAAO,KAAKC,YAAY,MAAM,WAAW;AAEzC;AACA,OAAO,MAAMC,qBAAqB,gBAAGJ,MAAM,CAACK,OAAO,CAAC,MAAK;EACrD,MAAMC,QAAQ,GAAGL,YAAY,CAACM,KAAK,CAAC;IAAEC,SAAS,EAAE;EAAG,CAAE,CAAC;EACvD,MAAMC,MAAM,GAAGR,YAAY,CAACS,SAAS,CAAEC,GAA0B,IAAKA,GAAG,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC;EACpF,MAAMF,SAAS,GAAGR,oBAAoB,CAACW,IAAI,CAAC;IAAEC,MAAM,EAAEL,MAAM;IAAEM,MAAM,EAAET;EAAQ,CAAE,CAAC;EACjF,OAAON,MAAM,CAACgB,MAAM,CAACC,IAAI,CAACjB,MAA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C,GAAG;KAC5C;IAED,MAAMuE,sBAAsB,GAAGC,MAAM,CAACC,OAAO,CAACd,gBAAgB,CAAC,CAC1De,GAAG,CAAC,CAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,KAAK,GAAGD,CAAC,IAAIC,CAAC,EAAE,CAAC,CAC5B5E,IAAI,CAAC,GAAG,CAAC;IAEd,OAAO,kBAAkB,IAAI,CAAC,uBAAuB,CAAC,KAAKuE,sBAAsB,GAAG;EACxF;EAEgBM,WAAW,gBAIvB5F,MAAM,CAAC6F,GAAG,CAAC;IAAEC,IAAI,EAAE;EAAI,CAAE,EAAE,aAAS;IACpC,IAAI,IAAI,CAAC7C,gBAAgB,EAAE;MACvB,OAAO,IAAI,CAACA,gBAAgB;IAChC,CAAC,MAAM;MACH,MAAM2C,WAAW,GAAG,OAAOtF,YAAY,CAACsF,WAAW,CAAC,IAAI,CAAC;MACzD,IAAI,CAAC3C,gBAAgB,GAAG2C,WAAW;MACnC,OAAO,IAAI,CAAC3C,gBAAgB;IAChC;EACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,15 +1,15 @@
1
- import * as Protobuf from "@bufbuild/protobuf";
2
- import * as HttpClientError from "@effect/platform/HttpClientError";
3
- import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
4
- import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
5
1
  import * as Effect from "effect/Effect";
6
2
  import * as Function from "effect/Function";
7
3
  import * as Predicate from "effect/Predicate";
4
+ import * as HttpClientError from "effect/unstable/http/HttpClientError";
5
+ import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
6
+ import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
7
+ import * as Protobuf from "@bufbuild/protobuf";
8
8
  import { ResponseWrapperSchema } from "../generated/GooglePlay_pb.js";
9
9
  /** @internal */
10
10
  export const encodeRequest = /*#__PURE__*/Function.dual(
11
11
  // Data first if the first argument is an http request
12
- arguments_ => Predicate.hasProperty(arguments_[0], HttpClientRequest.TypeId),
12
+ arguments_ => HttpClientRequest.isHttpClientRequest(arguments_[0]),
13
13
  /*#__PURE__*/
14
14
  // Body implementation
15
15
  Effect.fn("encodeRequest")(function* (request, description, body, options) {
@@ -19,11 +19,12 @@ Effect.fn("encodeRequest")(function* (request, description, body, options) {
19
19
  try: () => Protobuf.toBinary(description, Protobuf.create(description, body), options ?? {
20
20
  writeUnknownFields: true
21
21
  }),
22
- catch: cause => new HttpClientError.RequestError({
23
- cause,
24
- request,
25
- reason: "Encode",
26
- description: `Could not encode message of type ${messageType}`
22
+ catch: cause => new HttpClientError.HttpClientError({
23
+ reason: new HttpClientError.EncodeError({
24
+ description: `Could not encode message of type ${messageType}`,
25
+ request,
26
+ cause
27
+ })
27
28
  })
28
29
  });
29
30
  const applyBody = HttpClientRequest.bodyUint8Array(bytes, "application/x-protobuf");
@@ -43,20 +44,22 @@ Effect.fn("decodeResponse")(function* (response, protobufDescription, options) {
43
44
  try: () => Protobuf.fromBinary(protobufDescription, new Uint8Array(arrayBuffer), options ?? {
44
45
  readUnknownFields: true
45
46
  }),
46
- catch: cause => new HttpClientError.ResponseError({
47
- cause,
48
- response,
49
- reason: "Decode",
50
- request: response.request,
51
- description: `Could not decode message of type ${messageType}`
47
+ catch: cause => new HttpClientError.HttpClientError({
48
+ reason: new HttpClientError.DecodeError({
49
+ description: `Could not decode message of type ${messageType}`,
50
+ request: response.request,
51
+ response,
52
+ cause
53
+ })
52
54
  })
53
55
  });
54
56
  if (Predicate.isUndefined(message)) {
55
- return yield* new HttpClientError.ResponseError({
56
- response,
57
- reason: "Decode",
58
- request: response.request,
59
- description: `Message of type ${messageType} is missing`
57
+ return yield* new HttpClientError.HttpClientError({
58
+ reason: new HttpClientError.DecodeError({
59
+ description: `Message of type ${messageType} is missing`,
60
+ request: response.request,
61
+ response
62
+ })
60
63
  });
61
64
  }
62
65
  return message;
@@ -70,20 +73,22 @@ arguments_ => Predicate.hasProperty(arguments_[0], HttpClientResponse.TypeId),
70
73
  Effect.fn("decodeResponse")(function* (response, extractPayload, options) {
71
74
  const responseWrapper = yield* decodeResponse(response, ResponseWrapperSchema, options);
72
75
  if (Predicate.isNotUndefined(responseWrapper.commands?.displayErrorMessage)) {
73
- return yield* new HttpClientError.ResponseError({
74
- response,
75
- reason: "Decode",
76
- request: response.request,
77
- description: responseWrapper.commands.displayErrorMessage
76
+ return yield* new HttpClientError.HttpClientError({
77
+ reason: new HttpClientError.DecodeError({
78
+ description: responseWrapper.commands.displayErrorMessage,
79
+ request: response.request,
80
+ response
81
+ })
78
82
  });
79
83
  }
80
84
  const extracted = responseWrapper.payload?.[extractPayload];
81
85
  if (Predicate.isUndefined(extracted)) {
82
- return yield* new HttpClientError.ResponseError({
83
- response,
84
- reason: "Decode",
85
- request: response.request,
86
- description: `ResponseWrapper has no payload of type ${extractPayload}`
86
+ return yield* new HttpClientError.HttpClientError({
87
+ reason: new HttpClientError.DecodeError({
88
+ description: `ResponseWrapper has no payload of type ${extractPayload}`,
89
+ request: response.request,
90
+ response
91
+ })
87
92
  });
88
93
  }
89
94
  return extracted;
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","names":["Protobuf","HttpClientError","HttpClientRequest","HttpClientResponse","Effect","Function","Predicate","ResponseWrapperSchema","encodeRequest","dual","arguments_","hasProperty","TypeId","fn","request","description","body","options","messageType","name","annotateCurrentSpan","bytes","try","toBinary","create","writeUnknownFields","catch","cause","RequestError","reason","applyBody","bodyUint8Array","decodeResponse","response","protobufDescription","arrayBuffer","message","fromBinary","Uint8Array","readUnknownFields","ResponseError","isUndefined","decodeResponseFromResponseWrapper","extractPayload","responseWrapper","isNotUndefined","commands","displayErrorMessage","extracted","payload"],"sources":["../../src/internal/http.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,oBAAoB;AAC9C,OAAO,KAAKC,eAAe,MAAM,kCAAkC;AACnE,OAAO,KAAKC,iBAAiB,MAAM,oCAAoC;AACvE,OAAO,KAAKC,kBAAkB,MAAM,qCA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CAACS,MAAM,CAAC;AAAA;AAE/E;AACAR,MAAM,CAACS,EAAE,CAAC,gBAAgB,CAAC,CAAC,WAMxBoB,QAA+C,EAC/CU,cAA8B,EAC9B1B,OAAyD;EAGzD,MAAM2B,eAAe,GAAG,OAAOZ,cAAc,CAACC,QAAQ,EAAE1B,qBAAqB,EAAEU,OAAO,CAAC;EAEvF,IAAIX,SAAS,CAACuC,cAAc,CAACD,eAAe,CAACE,QAAQ,EAAEC,mBAAmB,CAAC,EAAE;IACzE,OAAO,OAAO,IAAI9C,eAAe,CAACuC,aAAa,CAAC;MAC5CP,QAAQ;MACRJ,MAAM,EAAE,QAAQ;MAChBf,OAAO,EAAEmB,QAAQ,CAACnB,OAAO;MACzBC,WAAW,EAAE6B,eAAe,CAACE,QAAQ,CAACC;KACzC,CAAC;EACN;EAEA,MAAMC,SAAS,GAAGJ,eAAe,CAACK,OAAO,GAAGN,cAAc,CAAC;EAC3D,IAAIrC,SAAS,CAACmC,WAAW,CAACO,SAAS,CAAC,EAAE;IAClC,OAAO,OAAO,IAAI/C,eAAe,CAACuC,aAAa,CAAC;MAC5CP,QAAQ;MACRJ,MAAM,EAAE,QAAQ;MAChBf,OAAO,EAAEmB,QAAQ,CAACnB,OAAO;MACzBC,WAAW,EAAE,0CAA0C4B,cAAc;KACxE,CAAC;EACN;EAEA,OAAOK,SAAgB;AAC3B,CAAC,CAAC,CACL","ignoreList":[]}
1
+ {"version":3,"file":"http.js","names":["Effect","Function","Predicate","HttpClientError","HttpClientRequest","HttpClientResponse","Protobuf","ResponseWrapperSchema","encodeRequest","dual","arguments_","isHttpClientRequest","fn","request","description","body","options","messageType","name","annotateCurrentSpan","bytes","try","toBinary","create","writeUnknownFields","catch","cause","reason","EncodeError","applyBody","bodyUint8Array","decodeResponse","hasProperty","TypeId","response","protobufDescription","arrayBuffer","message","fromBinary","Uint8Array","readUnknownFields","DecodeError","isUndefined","decodeResponseFromResponseWrapper","extractPayload","responseWrapper","isNotUndefined","commands","displayErr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CAAC,CAAC,CACL","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efffrida/gplayapi",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Google play api",
5
5
  "keywords": [
6
6
  "effect-ts",
@@ -37,26 +37,17 @@
37
37
  "access": "public",
38
38
  "provenance": true
39
39
  },
40
- "dependencies": {
41
- "properties-file": "5.0.4"
42
- },
43
40
  "devDependencies": {
44
41
  "@bufbuild/buf": "1.69.0",
45
42
  "@bufbuild/protobuf": "2.12.0",
46
- "@effect/cluster": "0.58.2",
47
- "@effect/experimental": "0.60.0",
48
- "@effect/platform": "0.96.1",
49
- "@effect/platform-node": "0.106.0",
50
- "@effect/rpc": "0.75.1",
51
- "@effect/sql": "0.51.1",
52
- "@effect/workflow": "0.18.1",
53
- "@types/node": "25.7.0",
54
- "effect": "3.21.2"
43
+ "@effect/platform-node": "4.0.0-beta.66",
44
+ "@types/node": "25.9.0",
45
+ "effect": "4.0.0-beta.66",
46
+ "ioredis": "5.10.1"
55
47
  },
56
48
  "peerDependencies": {
57
49
  "@bufbuild/protobuf": "2.12.0",
58
- "@effect/platform": "0.96.1",
59
- "effect": "3.21.2"
50
+ "effect": "4.0.0-beta.66"
60
51
  },
61
52
  "tags": [
62
53
  "frida.re",
@@ -5,129 +5,189 @@
5
5
  * @since 1.0.0
6
6
  */
7
7
 
8
- import type * as PlatformError from "@effect/platform/Error";
9
- import type * as HttpClientError from "@effect/platform/HttpClientError";
8
+ import type * as PlatformError from "effect/PlatformError";
9
+ import type * as Schema from "effect/Schema";
10
10
  import type * as Scope from "effect/Scope";
11
+ import type * as HttpClientError from "effect/unstable/http/HttpClientError";
11
12
 
12
- import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
13
- import * as FileSystem from "@effect/platform/FileSystem";
14
- import * as HttpClient from "@effect/platform/HttpClient";
15
- import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
16
- import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
17
13
  import * as Array from "effect/Array";
18
14
  import * as Effect from "effect/Effect";
15
+ import * as FileSystem from "effect/FileSystem";
19
16
  import * as Function from "effect/Function";
20
- import * as Layer from "effect/Layer";
21
- import * as Sink from "effect/Sink";
22
17
  import * as Stream from "effect/Stream";
23
- import * as url from "node:url";
18
+ import * as HttpClient from "effect/unstable/http/HttpClient";
19
+ import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
20
+ import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
21
+
22
+ import type { AndroidDevice } from "./internal/device.ts";
24
23
 
25
24
  import {
26
25
  BulkDetailsRequestSchema,
27
26
  type BulkDetailsResponse,
28
27
  type BuyResponse,
28
+ type DeliveryResponse,
29
29
  type DetailsResponse,
30
30
  } from "./generated/GooglePlay_pb.ts";
31
- import { makeHttpClient } from "./internal/auth.ts";
32
- import { Device } from "./internal/device.ts";
33
31
  import { decodeResponseFromResponseWrapper, encodeRequest } from "./internal/http.ts";
34
32
 
35
- export {
36
- /**
37
- * @since 1.0.0
38
- * @category Auth
39
- */
40
- makeHttpClient,
41
- } from "./internal/auth.ts";
33
+ /** @internal */
34
+ const fdfeBase = "https://android.clients.google.com/fdfe";
42
35
 
43
36
  export {
44
37
  /**
45
38
  * @since 1.0.0
46
39
  * @category Device
47
40
  */
48
- Device,
41
+ AndroidDevice,
49
42
  } from "./internal/device.ts";
50
43
 
51
- /**
52
- * @since 1.0.0
53
- * @category Auth
54
- */
55
- export const defaultHttpClient = Function.pipe(
56
- Device.fromPropertiesFile(url.fileURLToPath(new URL("../devices/arm64_xxhdpi.properties", import.meta.url))),
57
- Effect.map(makeHttpClient),
58
- Layer.unwrapEffect,
59
- Layer.provide(FetchHttpClient.layer)
60
- );
61
-
62
44
  /**
63
45
  * @since 1.0.0
64
46
  * @category API
65
47
  */
66
- export const details = (
67
- bundleIdentifier: string
68
- ): Effect.Effect<DetailsResponse, HttpClientError.HttpClientError, HttpClient.HttpClient> =>
69
- Effect.flatMap(
70
- HttpClient.get("/fdfe/details", { urlParams: { doc: bundleIdentifier } }),
71
- decodeResponseFromResponseWrapper("detailsResponse")
72
- );
48
+ export const details = Function.dual<
49
+ (
50
+ device: AndroidDevice
51
+ ) => (
52
+ bundleIdentifier: string
53
+ ) => Effect.Effect<DetailsResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>,
54
+ (
55
+ bundleIdentifier: string,
56
+ device: AndroidDevice
57
+ ) => Effect.Effect<DetailsResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
58
+ >(
59
+ 2,
60
+ Effect.fnUntraced(function* (bundleIdentifier: string, device: AndroidDevice) {
61
+ const decoderDetailsResponse = decodeResponseFromResponseWrapper("detailsResponse");
62
+ const httpRequest = HttpClientRequest.get("/details", {
63
+ urlParams: { doc: bundleIdentifier },
64
+ headers: yield* device.authHeaders,
65
+ }).pipe(HttpClientRequest.prependUrl(fdfeBase));
66
+
67
+ const httpResponse = yield* HttpClient.execute(httpRequest);
68
+ const pbResponse = yield* decoderDetailsResponse(httpResponse);
69
+ return pbResponse;
70
+ })
71
+ );
73
72
 
74
73
  /**
75
74
  * @since 1.0.0
76
75
  * @category API
77
76
  */
78
- export const bulkDetails = (
79
- bundleIdentifier: string
80
- ): Effect.Effect<BulkDetailsResponse, HttpClientError.HttpClientError, HttpClient.HttpClient> =>
81
- Function.pipe(
82
- HttpClientRequest.post("/fdfe/bulkDetails"),
83
- encodeRequest(BulkDetailsRequestSchema, {
77
+ export const bulkDetails = Function.dual<
78
+ (
79
+ device: AndroidDevice
80
+ ) => (
81
+ bundleIdentifier: string
82
+ ) => Effect.Effect<
83
+ BulkDetailsResponse,
84
+ HttpClientError.HttpClientError | Schema.SchemaError,
85
+ HttpClient.HttpClient
86
+ >,
87
+ (
88
+ bundleIdentifier: string,
89
+ device: AndroidDevice
90
+ ) => Effect.Effect<BulkDetailsResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
91
+ >(
92
+ 2,
93
+ Effect.fnUntraced(function* (bundleIdentifier: string, device: AndroidDevice) {
94
+ const decoderBulkDetailsResponse = decodeResponseFromResponseWrapper("bulkDetailsResponse");
95
+ const encoderBulkDetailsRequest = encodeRequest(BulkDetailsRequestSchema, {
84
96
  includeDetails: true,
85
97
  includeChildDocs: true,
86
98
  DocId: [bundleIdentifier],
87
- }),
88
- Effect.flatMap(HttpClient.execute),
89
- Effect.flatMap(decodeResponseFromResponseWrapper("bulkDetailsResponse"))
90
- );
99
+ });
100
+
101
+ const httpRequest = HttpClientRequest.post("/bulkDetails", {
102
+ headers: yield* device.authHeaders,
103
+ }).pipe(HttpClientRequest.prependUrl(fdfeBase));
104
+
105
+ const pbRequest = yield* encoderBulkDetailsRequest(httpRequest);
106
+ const httpResponse = yield* HttpClient.execute(pbRequest);
107
+ const pbResponse = yield* decoderBulkDetailsResponse(httpResponse);
108
+ return pbResponse;
109
+ })
110
+ );
91
111
 
92
112
  /**
93
113
  * @since 1.0.0
94
114
  * @category API
95
115
  */
96
- export const purchase = (
97
- bundleIdentifier: string,
98
- options: {
99
- offerType: number;
100
- versionCode: number | bigint;
101
- certificateHash?: string | undefined;
102
- }
103
- ): Effect.Effect<BuyResponse, HttpClientError.HttpClientError, HttpClient.HttpClient> =>
104
- Effect.flatMap(
105
- HttpClient.post("/fdfe/purchase", {
116
+ export const purchase = Function.dual<
117
+ (
118
+ device: AndroidDevice
119
+ ) => (
120
+ bundleIdentifier: string,
121
+ options: { offerType: number; versionCode: number | bigint; certificateHash?: string }
122
+ ) => Effect.Effect<BuyResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>,
123
+ (
124
+ bundleIdentifier: string,
125
+ options: { offerType: number; versionCode: number | bigint; certificateHash?: string },
126
+ device: AndroidDevice
127
+ ) => Effect.Effect<BuyResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
128
+ >(
129
+ 3,
130
+ Effect.fnUntraced(function* (
131
+ bundleIdentifier: string,
132
+ options: { offerType: number; versionCode: number | bigint; certificateHash?: string },
133
+ device: AndroidDevice
134
+ ) {
135
+ const decoderBuyResponse = decodeResponseFromResponseWrapper("buyResponse");
136
+ const httpRequest = HttpClientRequest.post("/purchase", {
137
+ headers: yield* device.authHeaders,
106
138
  urlParams: {
107
139
  doc: bundleIdentifier,
108
140
  ch: options.certificateHash ?? "",
109
141
  ot: options.offerType.toString(),
110
142
  vc: options.versionCode.toString(),
111
143
  },
112
- }),
113
- decodeResponseFromResponseWrapper("buyResponse")
114
- );
144
+ }).pipe(HttpClientRequest.prependUrl(fdfeBase));
145
+
146
+ const httpResponse = yield* HttpClient.execute(httpRequest);
147
+ const pbResponse = yield* decoderBuyResponse(httpResponse);
148
+ return pbResponse;
149
+ })
150
+ );
115
151
 
116
152
  /**
117
153
  * @since 1.0.0
118
154
  * @category API
119
155
  */
120
- export const delivery = (
121
- bundleIdentifier: string,
122
- options: {
123
- offerType: number;
124
- deliveryToken: string;
125
- versionCode: number | bigint;
126
- certificateHash?: string | undefined;
127
- }
128
- ) =>
129
- Effect.flatMap(
130
- HttpClient.get("/fdfe/delivery", {
156
+ export const delivery = Function.dual<
157
+ (device: AndroidDevice) => (
158
+ bundleIdentifier: string,
159
+ options: {
160
+ offerType: number;
161
+ deliveryToken: string;
162
+ versionCode: number | bigint;
163
+ certificateHash?: string | undefined;
164
+ }
165
+ ) => Effect.Effect<DeliveryResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>,
166
+ (
167
+ bundleIdentifier: string,
168
+ options: {
169
+ offerType: number;
170
+ deliveryToken: string;
171
+ versionCode: number | bigint;
172
+ certificateHash?: string | undefined;
173
+ },
174
+ device: AndroidDevice
175
+ ) => Effect.Effect<DeliveryResponse, HttpClientError.HttpClientError | Schema.SchemaError, HttpClient.HttpClient>
176
+ >(
177
+ 3,
178
+ Effect.fnUntraced(function* (
179
+ bundleIdentifier: string,
180
+ options: {
181
+ offerType: number;
182
+ deliveryToken: string;
183
+ versionCode: number | bigint;
184
+ certificateHash?: string | undefined;
185
+ },
186
+ device: AndroidDevice
187
+ ) {
188
+ const decoderDeliveryResponse = decodeResponseFromResponseWrapper("deliveryResponse");
189
+ const httpRequest = HttpClientRequest.get("/delivery", {
190
+ headers: yield* device.authHeaders,
131
191
  urlParams: {
132
192
  doc: bundleIdentifier,
133
193
  dtok: options.deliveryToken,
@@ -135,34 +195,41 @@ export const delivery = (
135
195
  ot: options.offerType.toString(),
136
196
  vc: options.versionCode.toString(),
137
197
  },
138
- }),
139
- decodeResponseFromResponseWrapper("deliveryResponse")
140
- );
198
+ }).pipe(HttpClientRequest.prependUrl(fdfeBase));
199
+
200
+ const httpResponse = yield* HttpClient.execute(httpRequest);
201
+ const pbResponse = yield* decoderDeliveryResponse(httpResponse);
202
+ return pbResponse;
203
+ })
204
+ );
141
205
 
142
206
  /**
143
207
  * @since 1.0.0
144
208
  * @category API
145
209
  */
146
- export const download = Effect.fnUntraced(function* (bundleIdentifier: string): Effect.fn.Return<
210
+ export const download = Effect.fnUntraced(function* (
211
+ device: AndroidDevice,
212
+ bundleIdentifier: string
213
+ ): Effect.fn.Return<
147
214
  Array.NonEmptyReadonlyArray<{
148
215
  url: string;
149
216
  name: string;
150
217
  file: string;
151
- size: number | bigint;
218
+ size: bigint;
152
219
  integrity: { sha1: string } | { sha256: string };
153
220
  }>,
154
- PlatformError.PlatformError | HttpClientError.HttpClientError,
221
+ PlatformError.PlatformError | HttpClientError.HttpClientError | Schema.SchemaError,
155
222
  HttpClient.HttpClient | FileSystem.FileSystem | Scope.Scope
156
223
  > {
157
224
  const fileSystem = yield* FileSystem.FileSystem;
158
225
 
159
- const { item } = yield* details(bundleIdentifier);
160
- const { encodedDeliveryToken } = yield* purchase(bundleIdentifier, {
226
+ const { item } = yield* details(device)(bundleIdentifier);
227
+ const { encodedDeliveryToken } = yield* purchase(device)(bundleIdentifier, {
161
228
  offerType: item?.offer[0].offerType ?? 1,
162
229
  versionCode: item?.details?.appDetails?.versionCode ?? 0,
163
230
  });
164
231
 
165
- const deliveryResult = yield* delivery(bundleIdentifier, {
232
+ const deliveryResult = yield* delivery(device)(bundleIdentifier, {
166
233
  deliveryToken: encodedDeliveryToken,
167
234
  offerType: item?.offer[0].offerType ?? 1,
168
235
  versionCode: item?.details?.appDetails?.versionCode ?? 0,
@@ -170,36 +237,31 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
170
237
 
171
238
  const mainDeliveryData = deliveryResult?.appDeliveryData;
172
239
  if (mainDeliveryData === undefined) {
173
- return yield* Effect.dieMessage("No delivery data available");
240
+ return yield* Effect.die("No delivery data available");
174
241
  }
175
242
 
176
- const digestSink = (
177
- algorithm: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512"
178
- ): Sink.Sink<string, Uint8Array, never, never, never> => {
179
- const toHex = (buffer: ArrayBuffer): string =>
180
- Array.fromIterable(new Uint8Array(buffer))
181
- .map((b) => b.toString(16).padStart(2, "0"))
182
- .join("");
183
-
184
- const digestToHex = (data: BufferSource): Effect.Effect<string, never, never> =>
185
- Effect.map(
186
- Effect.promise(() => crypto.subtle.digest(algorithm, data)),
187
- toHex
243
+ const digest =
244
+ (algorithm: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512") =>
245
+ <E, R>(stream: Stream.Stream<Uint8Array, E, R>): Effect.Effect<string, E, R> =>
246
+ stream.pipe(
247
+ Stream.mkUint8Array,
248
+ Effect.flatMap((buffer) =>
249
+ Effect.promise(() => crypto.subtle.digest(algorithm, buffer as BufferSource))
250
+ ),
251
+ Effect.map((digestBuffer) =>
252
+ Array.fromIterable(new Uint8Array(digestBuffer))
253
+ .map((b) => b.toString(16).padStart(2, "0"))
254
+ .join("")
255
+ )
188
256
  );
189
257
 
190
- return Sink.mapEffect(
191
- Sink.foldLeft(Buffer.alloc(0), (acc, chunk: Uint8Array) => Buffer.concat([acc, chunk])),
192
- digestToHex
193
- );
194
- };
195
-
196
258
  const main = Effect.gen(function* () {
197
259
  const file = yield* fileSystem.makeTempFileScoped({ suffix: ".apk" });
198
260
  const integrity = Buffer.from(mainDeliveryData.sha256, "base64url").toString("hex");
199
- const stream = HttpClientResponse.stream(HttpClient.get(mainDeliveryData.downloadUrl));
200
- const downloadedIntegrity = yield* Stream.run(
201
- stream,
202
- Sink.zipRight(fileSystem.sink(file), digestSink("SHA-256"), { concurrent: true })
261
+ const downloadedIntegrity = yield* HttpClient.get(mainDeliveryData.downloadUrl).pipe(
262
+ HttpClientResponse.stream,
263
+ Stream.tapSink(fileSystem.sink(file)),
264
+ digest("SHA-256")
203
265
  );
204
266
 
205
267
  yield* Effect.logDebug(
@@ -207,7 +269,7 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
207
269
  );
208
270
 
209
271
  if (downloadedIntegrity !== integrity) {
210
- return yield* Effect.dieMessage(
272
+ return yield* Effect.die(
211
273
  `Downloaded main APK integrity mismatch: expected ${integrity}, got ${downloadedIntegrity}`
212
274
  );
213
275
  }
@@ -225,10 +287,10 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
225
287
  Effect.gen(function* () {
226
288
  const file = yield* fileSystem.makeTempFileScoped({ suffix: ".apk" });
227
289
  const integrity = Buffer.from(split.sha256, "base64url").toString("hex");
228
- const stream = HttpClientResponse.stream(HttpClient.get(split.downloadUrl));
229
- const downloadedIntegrity = yield* Stream.run(
230
- stream,
231
- Sink.zipRight(fileSystem.sink(file), digestSink("SHA-256"), { concurrent: true })
290
+ const downloadedIntegrity = yield* HttpClient.get(split.downloadUrl).pipe(
291
+ HttpClientResponse.stream,
292
+ Stream.tapSink(fileSystem.sink(file)),
293
+ digest("SHA-256")
232
294
  );
233
295
 
234
296
  yield* Effect.logDebug(
@@ -236,7 +298,7 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
236
298
  );
237
299
 
238
300
  if (downloadedIntegrity !== integrity) {
239
- return yield* Effect.dieMessage(
301
+ return yield* Effect.die(
240
302
  `Downloaded split ${split.name} integrity mismatch: expected ${integrity}, got ${downloadedIntegrity}`
241
303
  );
242
304
  }
@@ -257,10 +319,10 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
257
319
  const name = `${typeStr}.${expansion.versionCode}.${bundleIdentifier}.obb`;
258
320
  const file = yield* fileSystem.makeTempFileScoped({ suffix: ".obb" });
259
321
  const integrity = Buffer.from(expansion.sha1, "base64url").toString("hex");
260
- const stream = HttpClientResponse.stream(HttpClient.get(expansion.downloadUrl));
261
- const downloadedIntegrity = yield* Stream.run(
262
- stream,
263
- Sink.zipRight(fileSystem.sink(file), digestSink("SHA-1"), { concurrent: true })
322
+ const downloadedIntegrity = yield* HttpClient.get(expansion.downloadUrl).pipe(
323
+ HttpClientResponse.stream,
324
+ Stream.tapSink(fileSystem.sink(file)),
325
+ digest("SHA-1")
264
326
  );
265
327
 
266
328
  yield* Effect.logDebug(
@@ -268,7 +330,7 @@ export const download = Effect.fnUntraced(function* (bundleIdentifier: string):
268
330
  );
269
331
 
270
332
  if (downloadedIntegrity !== integrity) {
271
- return yield* Effect.dieMessage(
333
+ return yield* Effect.die(
272
334
  `Downloaded expansion file ${name} integrity mismatch: expected ${integrity}, got ${downloadedIntegrity}`
273
335
  );
274
336
  }