@quick-resto-frontend/app-store-app-version-checker 1.0.1
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/dist/index.d.mts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +27 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +23 -0
package/dist/index.d.mts
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
interface AppStoreResponse {
|
2
|
+
results: Array<AppStoreResponseResult>;
|
3
|
+
}
|
4
|
+
interface AppStoreResponseResult {
|
5
|
+
version: number;
|
6
|
+
}
|
7
|
+
|
8
|
+
declare class CantGetVersionError extends Error {
|
9
|
+
message: string;
|
10
|
+
constructor();
|
11
|
+
}
|
12
|
+
|
13
|
+
declare class AppStoreAppVersionChecker {
|
14
|
+
requestToApple(packageName: string): Promise<AppStoreResponse>;
|
15
|
+
checkIfCanGetVersionInAppStore(): Promise<void>;
|
16
|
+
}
|
17
|
+
|
18
|
+
export { AppStoreAppVersionChecker, type AppStoreResponse, type AppStoreResponseResult, CantGetVersionError };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
interface AppStoreResponse {
|
2
|
+
results: Array<AppStoreResponseResult>;
|
3
|
+
}
|
4
|
+
interface AppStoreResponseResult {
|
5
|
+
version: number;
|
6
|
+
}
|
7
|
+
|
8
|
+
declare class CantGetVersionError extends Error {
|
9
|
+
message: string;
|
10
|
+
constructor();
|
11
|
+
}
|
12
|
+
|
13
|
+
declare class AppStoreAppVersionChecker {
|
14
|
+
requestToApple(packageName: string): Promise<AppStoreResponse>;
|
15
|
+
checkIfCanGetVersionInAppStore(): Promise<void>;
|
16
|
+
}
|
17
|
+
|
18
|
+
export { AppStoreAppVersionChecker, type AppStoreResponse, type AppStoreResponseResult, CantGetVersionError };
|
package/dist/index.js
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// src/index.ts
|
21
|
+
var src_exports = {};
|
22
|
+
__export(src_exports, {
|
23
|
+
AppStoreAppVersionChecker: () => AppStoreAppVersionChecker,
|
24
|
+
CantGetVersionError: () => CantGetVersionError
|
25
|
+
});
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
27
|
+
|
28
|
+
// src/errors/index.ts
|
29
|
+
var CantGetVersionError = class extends Error {
|
30
|
+
message = "Unable to get the application version, please make sure that the application does not contain anything prohibited and disable the option";
|
31
|
+
constructor() {
|
32
|
+
super();
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
// src/index.ts
|
37
|
+
var AppStoreAppVersionChecker = class {
|
38
|
+
async requestToApple(packageName) {
|
39
|
+
const response = await fetch(`https://itunes.apple.com/lookup?bundleId=${packageName}&country=ru`);
|
40
|
+
return await response.json();
|
41
|
+
}
|
42
|
+
async checkIfCanGetVersionInAppStore() {
|
43
|
+
const demoPackageName = "ru.foodapp.loyalty.devdemonew";
|
44
|
+
const response = await this.requestToApple(demoPackageName);
|
45
|
+
if (response.results.length === 0 || !response.results[0].version) {
|
46
|
+
throw new CantGetVersionError();
|
47
|
+
}
|
48
|
+
}
|
49
|
+
};
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
51
|
+
0 && (module.exports = {
|
52
|
+
AppStoreAppVersionChecker,
|
53
|
+
CantGetVersionError
|
54
|
+
});
|
55
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors/index.ts"],"sourcesContent":["import { CantGetVersionError } from './errors'\nimport { AppStoreResponse } from './types'\n\n\n\nexport * from './errors'\nexport * from './types'\n\nexport class AppStoreAppVersionChecker {\n\n public async requestToApple(packageName : string) : Promise<AppStoreResponse> {\n const response = await fetch(`https://itunes.apple.com/lookup?bundleId=${packageName}&country=ru`)\n\n return await response.json()\n }\n\n async checkIfCanGetVersionInAppStore() {\n\n // Ссылка на приложение, в котором мы всегда будем уверены, что оно в сторе и имеет версию\n const demoPackageName = 'ru.foodapp.loyalty.devdemonew'\n\n const response : AppStoreResponse = await this.requestToApple(demoPackageName)\n\n // Если не можем получить версию, кидаем ошибку, иначе, заканчиваем выполнение функции\n if (response.results.length === 0 || !response.results[0].version) {\n throw new CantGetVersionError()\n }\n }\n}\n\n\n\n\n\n","export class CantGetVersionError extends Error {\n message = 'Unable to get the application version, please make sure that the application does not contain anything prohibited and disable the option'\n\n constructor() {\n super()\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAC3C,UAAU;AAAA,EAEV,cAAc;AACV,UAAM;AAAA,EACV;AACJ;;;ADEO,IAAM,4BAAN,MAAgC;AAAA,EAEnC,MAAa,eAAe,aAAkD;AAC1E,UAAM,WAAW,MAAM,MAAM,4CAA4C,WAAW,aAAa;AAEjG,WAAO,MAAM,SAAS,KAAK;AAAA,EAC/B;AAAA,EAEA,MAAM,iCAAiC;AAGnC,UAAM,kBAAkB;AAExB,UAAM,WAA8B,MAAM,KAAK,eAAe,eAAe;AAG7E,QAAI,SAAS,QAAQ,WAAW,KAAK,CAAC,SAAS,QAAQ,CAAC,EAAE,SAAS;AAC/D,YAAM,IAAI,oBAAoB;AAAA,IAClC;AAAA,EACJ;AACJ;","names":[]}
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
// src/errors/index.ts
|
2
|
+
var CantGetVersionError = class extends Error {
|
3
|
+
message = "Unable to get the application version, please make sure that the application does not contain anything prohibited and disable the option";
|
4
|
+
constructor() {
|
5
|
+
super();
|
6
|
+
}
|
7
|
+
};
|
8
|
+
|
9
|
+
// src/index.ts
|
10
|
+
var AppStoreAppVersionChecker = class {
|
11
|
+
async requestToApple(packageName) {
|
12
|
+
const response = await fetch(`https://itunes.apple.com/lookup?bundleId=${packageName}&country=ru`);
|
13
|
+
return await response.json();
|
14
|
+
}
|
15
|
+
async checkIfCanGetVersionInAppStore() {
|
16
|
+
const demoPackageName = "ru.foodapp.loyalty.devdemonew";
|
17
|
+
const response = await this.requestToApple(demoPackageName);
|
18
|
+
if (response.results.length === 0 || !response.results[0].version) {
|
19
|
+
throw new CantGetVersionError();
|
20
|
+
}
|
21
|
+
}
|
22
|
+
};
|
23
|
+
export {
|
24
|
+
AppStoreAppVersionChecker,
|
25
|
+
CantGetVersionError
|
26
|
+
};
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/errors/index.ts","../src/index.ts"],"sourcesContent":["export class CantGetVersionError extends Error {\n message = 'Unable to get the application version, please make sure that the application does not contain anything prohibited and disable the option'\n\n constructor() {\n super()\n }\n}\n","import { CantGetVersionError } from './errors'\nimport { AppStoreResponse } from './types'\n\n\n\nexport * from './errors'\nexport * from './types'\n\nexport class AppStoreAppVersionChecker {\n\n public async requestToApple(packageName : string) : Promise<AppStoreResponse> {\n const response = await fetch(`https://itunes.apple.com/lookup?bundleId=${packageName}&country=ru`)\n\n return await response.json()\n }\n\n async checkIfCanGetVersionInAppStore() {\n\n // Ссылка на приложение, в котором мы всегда будем уверены, что оно в сторе и имеет версию\n const demoPackageName = 'ru.foodapp.loyalty.devdemonew'\n\n const response : AppStoreResponse = await this.requestToApple(demoPackageName)\n\n // Если не можем получить версию, кидаем ошибку, иначе, заканчиваем выполнение функции\n if (response.results.length === 0 || !response.results[0].version) {\n throw new CantGetVersionError()\n }\n }\n}\n\n\n\n\n\n"],"mappings":";AAAO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAC3C,UAAU;AAAA,EAEV,cAAc;AACV,UAAM;AAAA,EACV;AACJ;;;ACEO,IAAM,4BAAN,MAAgC;AAAA,EAEnC,MAAa,eAAe,aAAkD;AAC1E,UAAM,WAAW,MAAM,MAAM,4CAA4C,WAAW,aAAa;AAEjG,WAAO,MAAM,SAAS,KAAK;AAAA,EAC/B;AAAA,EAEA,MAAM,iCAAiC;AAGnC,UAAM,kBAAkB;AAExB,UAAM,WAA8B,MAAM,KAAK,eAAe,eAAe;AAG7E,QAAI,SAAS,QAAQ,WAAW,KAAK,CAAC,SAAS,QAAQ,CAAC,EAAE,SAAS;AAC/D,YAAM,IAAI,oBAAoB;AAAA,IAClC;AAAA,EACJ;AACJ;","names":[]}
|
package/package.json
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"name": "@quick-resto-frontend/app-store-app-version-checker",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "",
|
5
|
+
"main": "./dist/index.js",
|
6
|
+
"module": "./dist/index.mjs",
|
7
|
+
"types": "./dist/index.d.ts",
|
8
|
+
"files": [
|
9
|
+
"./dist"
|
10
|
+
],
|
11
|
+
"scripts": {
|
12
|
+
"build": "tsup",
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
14
|
+
},
|
15
|
+
"author": "",
|
16
|
+
"license": "ISC",
|
17
|
+
"devDependencies": {
|
18
|
+
"@types/node": "^20.11.6",
|
19
|
+
"ts-node": "^10.9.2",
|
20
|
+
"tsup": "^8.0.1",
|
21
|
+
"typescript": "^5.3.3"
|
22
|
+
}
|
23
|
+
}
|