mirror of
https://github.com/rxliuli/apps.apple.com.git
synced 2025-11-10 01:10:34 +00:00
init commit
This commit is contained in:
17
node_modules/@jet/engine/lib/dependencies/index.js
generated
vendored
Normal file
17
node_modules/@jet/engine/lib/dependencies/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./jet-bag"), exports);
|
||||
__exportStar(require("./jet-host"), exports);
|
||||
__exportStar(require("./jet-network-fetch"), exports);
|
||||
__exportStar(require("./localized-strings-bundle"), exports);
|
||||
__exportStar(require("./localized-strings-json-object"), exports);
|
||||
40
node_modules/@jet/engine/lib/dependencies/jet-bag.js
generated
vendored
Normal file
40
node_modules/@jet/engine/lib/dependencies/jet-bag.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JetBag = void 0;
|
||||
class JetBag {
|
||||
constructor(backing) {
|
||||
this.backing = backing;
|
||||
}
|
||||
registerBagKeys() {
|
||||
// do nothing.
|
||||
}
|
||||
string(key) {
|
||||
const value = this.backing[key];
|
||||
return typeof value === "string" || value === null ? value : undefined;
|
||||
}
|
||||
double(key) {
|
||||
const value = this.backing[key];
|
||||
return typeof value === "number" || value === null ? value : undefined;
|
||||
}
|
||||
integer(key) {
|
||||
const value = this.backing[key];
|
||||
return typeof value === "number" || value === null ? value : undefined;
|
||||
}
|
||||
boolean(key) {
|
||||
const value = this.backing[key];
|
||||
return typeof value === "boolean" || value === null ? value : undefined;
|
||||
}
|
||||
array(key) {
|
||||
const value = this.backing[key];
|
||||
return Array.isArray(value) || value === null ? value : undefined;
|
||||
}
|
||||
dictionary(key) {
|
||||
const value = this.backing[key];
|
||||
return typeof value === "object" ? value : undefined;
|
||||
}
|
||||
url(key) {
|
||||
const value = this.backing[key];
|
||||
return typeof value === "string" ? value : undefined;
|
||||
}
|
||||
}
|
||||
exports.JetBag = JetBag;
|
||||
19
node_modules/@jet/engine/lib/dependencies/jet-host.js
generated
vendored
Normal file
19
node_modules/@jet/engine/lib/dependencies/jet-host.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JetHost = void 0;
|
||||
class JetHost {
|
||||
constructor(options) {
|
||||
this.osBuild = "unknown";
|
||||
this.deviceModel = "unknown";
|
||||
this.deviceModelFamily = "unknown";
|
||||
this.devicePhysicalModel = "unknown";
|
||||
this.deviceLocalizedModel = "unknown";
|
||||
this.clientIdentifier = "unknown";
|
||||
this.clientVersion = "unknown";
|
||||
this.platform = options.platform;
|
||||
}
|
||||
isOSAtLeast() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.JetHost = JetHost;
|
||||
39
node_modules/@jet/engine/lib/dependencies/jet-network-fetch.js
generated
vendored
Normal file
39
node_modules/@jet/engine/lib/dependencies/jet-network-fetch.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.JetNetworkFetch = void 0;
|
||||
const optional_1 = require("@jet/environment/types/optional");
|
||||
class JetNetworkFetch {
|
||||
async fetch(request) {
|
||||
var _a, _b, _c;
|
||||
if (optional_1.isNothing(process === null || process === void 0 ? void 0 : process.env.MEDIA_API_TOKEN)) {
|
||||
return await Promise.reject(new Error("process.env.MEDIA_API_TOKEN must be specified"));
|
||||
}
|
||||
const headers = {
|
||||
...((_a = request.headers) !== null && _a !== void 0 ? _a : {}),
|
||||
authorization: `Bearer ${process === null || process === void 0 ? void 0 : process.env.MEDIA_API_TOKEN}`,
|
||||
};
|
||||
const response = await fetch(request.url, {
|
||||
body: request.body,
|
||||
method: (_b = request.method) !== null && _b !== void 0 ? _b : undefined,
|
||||
cache: (_c = request.cache) !== null && _c !== void 0 ? _c : undefined,
|
||||
headers: headers,
|
||||
});
|
||||
return {
|
||||
ok: response.ok,
|
||||
headers: Array.from(response.headers.keys()).reduce((previous, key) => {
|
||||
const value = response.headers.get(key);
|
||||
if (optional_1.isSome(value)) {
|
||||
previous[key] = value;
|
||||
}
|
||||
return previous;
|
||||
}, {}),
|
||||
redirected: response.redirected,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
url: response.url,
|
||||
body: await response.text(),
|
||||
metrics: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.JetNetworkFetch = JetNetworkFetch;
|
||||
68
node_modules/@jet/engine/lib/dependencies/localized-strings-bundle.js
generated
vendored
Normal file
68
node_modules/@jet/engine/lib/dependencies/localized-strings-bundle.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LocalizedStringsBundle = void 0;
|
||||
const environment_1 = require("@jet/environment");
|
||||
const localized_strings_json_object_1 = require("./localized-strings-json-object");
|
||||
/**
|
||||
* A localized string data source which loads strings from the application bundle.
|
||||
*
|
||||
* The bundle used by this data source can be a web app webpack bundle
|
||||
* or a native app bundle bridged over to JS code.
|
||||
*/
|
||||
class LocalizedStringsBundle {
|
||||
// MARK: - Initialization
|
||||
/**
|
||||
* Create localized strings bundle with all required attributes.
|
||||
*
|
||||
* @param bundle - The app bundle object.
|
||||
*/
|
||||
constructor(bundle) {
|
||||
this.bundle = bundle;
|
||||
}
|
||||
// MARK: - LocalizedStringsDataSource
|
||||
async fetchStrings(language) {
|
||||
var _a;
|
||||
// Load the strings from bundle and cache them.
|
||||
const localizations = this.bundle.localizationsProperty;
|
||||
if (environment_1.isNothing(localizations)) {
|
||||
throw new Error("Localized strings bundle index file is missing 'localizations' property");
|
||||
}
|
||||
let strings;
|
||||
const format = (_a = localizations.format) !== null && _a !== void 0 ? _a : "json/inline" /* jsonInline */;
|
||||
if (format === "json/inline" /* jsonInline */) {
|
||||
const inlineLocalizations = localizations;
|
||||
strings = inlineLocalizations[language];
|
||||
}
|
||||
else {
|
||||
const externalLocalizations = localizations;
|
||||
switch (externalLocalizations.format) {
|
||||
case "json/multi-file" /* jsonMultiFile */:
|
||||
{
|
||||
// The path points to directory where JSON files are located.
|
||||
// We don't even have to list a directory, just construct a final path.
|
||||
// The path is also not an OS path but a bundle (e.g. JetPack) path.
|
||||
// Bundle APIs always use "/" in the path, same as the paths used in the
|
||||
// index.json (manifest) files.
|
||||
const jsonPath = `${externalLocalizations.path}/${language}.json`;
|
||||
strings = (await this.bundle.loadResource(jsonPath));
|
||||
}
|
||||
break;
|
||||
case "json/single-file" /* jsonSingleFile */:
|
||||
// The bundle contains single JSON file with all strings dictionary in it.
|
||||
strings = (await this.bundle.loadResource(externalLocalizations.path))[language];
|
||||
break;
|
||||
case "loctable" /* loctable */:
|
||||
throw new Error("Loctable format not supported in JS implementation");
|
||||
case "js" /* js */:
|
||||
throw new Error("Not yet implemented");
|
||||
default:
|
||||
throw new Error(`Unknown localization format: ${JSON.stringify(format)}`);
|
||||
}
|
||||
}
|
||||
if (environment_1.isNothing(strings)) {
|
||||
throw new Error(`Missing strings for ${language}`);
|
||||
}
|
||||
return new localized_strings_json_object_1.LocalizedStringsJSONObject(strings);
|
||||
}
|
||||
}
|
||||
exports.LocalizedStringsBundle = LocalizedStringsBundle;
|
||||
21
node_modules/@jet/engine/lib/dependencies/localized-strings-json-object.js
generated
vendored
Normal file
21
node_modules/@jet/engine/lib/dependencies/localized-strings-json-object.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.LocalizedStringsJSONObject = void 0;
|
||||
/**
|
||||
* A type providing access to underlying localized strings JSON object.
|
||||
*/
|
||||
class LocalizedStringsJSONObject {
|
||||
/**
|
||||
* Create localized strings JSON object.
|
||||
*
|
||||
* @param strings - A dictionary containing localized strings.
|
||||
*/
|
||||
constructor(strings) {
|
||||
this.strings = strings;
|
||||
}
|
||||
// MARK: - Localized Strings
|
||||
string(key) {
|
||||
return this.strings[key];
|
||||
}
|
||||
}
|
||||
exports.LocalizedStringsJSONObject = LocalizedStringsJSONObject;
|
||||
Reference in New Issue
Block a user