@oxyhq/core 19.1.2 → 20.1.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.
- package/LICENSE +202 -0
- package/NOTICE +16 -0
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/HttpService.js +23 -18
- package/dist/cjs/i18n/accountCategoryLabels.js +44 -0
- package/dist/cjs/i18n/accountRoleLabels.js +27 -0
- package/dist/cjs/i18n/reputationCategoryLabels.js +20 -0
- package/dist/cjs/i18n/trustTierLabels.js +19 -0
- package/dist/cjs/index.js +19 -9
- package/dist/cjs/mixins/OxyServices.chains.js +73 -0
- package/dist/cjs/mixins/OxyServices.followGraph.js +17 -0
- package/dist/cjs/mixins/OxyServices.store.js +266 -0
- package/dist/cjs/mixins/OxyServices.utility.js +159 -104
- package/dist/cjs/mixins/index.js +7 -0
- package/dist/cjs/server/rateLimit.js +15 -6
- package/dist/cjs/session/accountProjection.js +31 -6
- package/dist/cjs/utils/errorUtils.js +65 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/HttpService.js +24 -19
- package/dist/esm/i18n/accountCategoryLabels.js +37 -0
- package/dist/esm/i18n/accountRoleLabels.js +20 -0
- package/dist/esm/i18n/reputationCategoryLabels.js +13 -0
- package/dist/esm/i18n/trustTierLabels.js +12 -0
- package/dist/esm/index.js +11 -8
- package/dist/esm/mixins/OxyServices.chains.js +70 -0
- package/dist/esm/mixins/OxyServices.followGraph.js +17 -0
- package/dist/esm/mixins/OxyServices.store.js +263 -0
- package/dist/esm/mixins/OxyServices.utility.js +159 -104
- package/dist/esm/mixins/index.js +7 -0
- package/dist/esm/server/rateLimit.js +15 -6
- package/dist/esm/session/accountProjection.js +30 -6
- package/dist/esm/utils/errorUtils.js +63 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/i18n/accountCategoryLabels.d.ts +34 -0
- package/dist/types/i18n/accountRoleLabels.d.ts +10 -0
- package/dist/types/i18n/reputationCategoryLabels.d.ts +10 -0
- package/dist/types/i18n/trustTierLabels.d.ts +9 -0
- package/dist/types/index.d.ts +14 -2
- package/dist/types/mixins/OxyServices.chains.d.ts +156 -0
- package/dist/types/mixins/OxyServices.followGraph.d.ts +13 -0
- package/dist/types/mixins/OxyServices.store.d.ts +334 -0
- package/dist/types/mixins/OxyServices.utility.d.ts +31 -8
- package/dist/types/mixins/index.d.ts +3 -1
- package/dist/types/session/accountProjection.d.ts +20 -4
- package/dist/types/utils/errorUtils.d.ts +67 -0
- package/package.json +7 -6
- package/src/HttpService.ts +29 -22
- package/src/__tests__/parseHttpErrorBody.test.ts +116 -0
- package/src/__tests__/serverValueImportsDeclared.test.ts +7 -0
- package/src/i18n/__tests__/accountCategoryLabels.test.ts +62 -0
- package/src/i18n/__tests__/accountRoleLabels.test.ts +54 -0
- package/src/i18n/__tests__/reputationCategoryLabels.test.ts +56 -0
- package/src/i18n/__tests__/trustTierLabels.test.ts +47 -0
- package/src/i18n/accountCategoryLabels.ts +44 -0
- package/src/i18n/accountRoleLabels.ts +26 -0
- package/src/i18n/reputationCategoryLabels.ts +20 -0
- package/src/i18n/trustTierLabels.ts +18 -0
- package/src/index.ts +43 -6
- package/src/mixins/OxyServices.chains.ts +134 -0
- package/src/mixins/OxyServices.followGraph.ts +24 -0
- package/src/mixins/OxyServices.store.ts +585 -0
- package/src/mixins/OxyServices.utility.ts +161 -108
- package/src/mixins/__tests__/chains.test.ts +113 -0
- package/src/mixins/__tests__/followGraph.test.ts +19 -0
- package/src/mixins/__tests__/store.test.ts +304 -0
- package/src/mixins/__tests__/userTokenAuth.test.ts +746 -0
- package/src/mixins/index.ts +9 -0
- package/src/server/__tests__/rateLimit.test.ts +47 -0
- package/src/server/rateLimit.ts +18 -8
- package/src/session/__tests__/accountProjection.test.ts +98 -0
- package/src/session/accountProjection.ts +37 -6
- package/src/utils/errorUtils.ts +116 -5
package/dist/cjs/HttpService.js
CHANGED
|
@@ -450,32 +450,37 @@ class HttpService {
|
|
|
450
450
|
// Failed to parse error body — not a CSRF error
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
//
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
453
|
+
// Read the error body (may be absent, non-JSON, empty or malformed).
|
|
454
|
+
// Anything unreadable leaves `errorBody` undefined and degrades to the
|
|
455
|
+
// status-based message — an error path that throws its own error is
|
|
456
|
+
// worse than the error it was reporting.
|
|
457
|
+
let errorBody;
|
|
458
|
+
const errorContentType = response.headers.get('content-type');
|
|
459
|
+
if (errorContentType?.includes('application/json')) {
|
|
457
460
|
try {
|
|
458
|
-
|
|
459
|
-
// Accept either structured error field from API responses.
|
|
460
|
-
if (errorData?.message) {
|
|
461
|
-
errorMessage = errorData.message;
|
|
462
|
-
}
|
|
463
|
-
else if (errorData?.error_description) {
|
|
464
|
-
// RFC 6749 §5.2 / RFC 6750 §3 — OAuth endpoints surface human text here.
|
|
465
|
-
errorMessage = errorData.error_description;
|
|
466
|
-
}
|
|
467
|
-
else if (errorData?.error) {
|
|
468
|
-
errorMessage = errorData.error;
|
|
469
|
-
}
|
|
461
|
+
errorBody = await response.json();
|
|
470
462
|
}
|
|
471
463
|
catch (parseError) {
|
|
472
464
|
// Malformed JSON or empty response - use status text
|
|
473
465
|
this.logger.warn('Failed to parse error response JSON:', parseError);
|
|
474
466
|
}
|
|
475
467
|
}
|
|
476
|
-
|
|
468
|
+
// `parseHttpErrorBody` handles every envelope in use, including the
|
|
469
|
+
// nested `{ error: { code, message } }` shape — assigning that nested
|
|
470
|
+
// OBJECT as the message is what produced `"[object Object]"`.
|
|
471
|
+
const parsed = (0, errorUtils_1.parseHttpErrorBody)(errorBody);
|
|
472
|
+
const error = new Error(parsed.message ?? `HTTP ${response.status}: ${response.statusText}`);
|
|
477
473
|
error.status = response.status;
|
|
478
|
-
error.response = { status: response.status, statusText: response.statusText };
|
|
474
|
+
error.response = { status: response.status, statusText: response.statusText, data: errorBody };
|
|
475
|
+
// Only set `code`/`details` when the server actually sent them.
|
|
476
|
+
// Assigning `undefined` would still create the property, which changes
|
|
477
|
+
// how `handleHttpError` classifies the error downstream.
|
|
478
|
+
if (parsed.code !== undefined) {
|
|
479
|
+
error.code = parsed.code;
|
|
480
|
+
}
|
|
481
|
+
if (parsed.details !== undefined) {
|
|
482
|
+
error.details = parsed.details;
|
|
483
|
+
}
|
|
479
484
|
throw error;
|
|
480
485
|
}
|
|
481
486
|
// Handle different response types (optimized - read response once)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EN_ACCOUNT_CATEGORY_LABELS = void 0;
|
|
7
|
+
exports.accountCategoryLabel = accountCategoryLabel;
|
|
8
|
+
const en_US_json_1 = __importDefault(require("./locales/en-US.json"));
|
|
9
|
+
const index_1 = require("./index");
|
|
10
|
+
/**
|
|
11
|
+
* Every account category's English name, keyed by its stable id.
|
|
12
|
+
*
|
|
13
|
+
* **The annotation is the point.** The vocabulary lives in `@oxyhq/contracts`
|
|
14
|
+
* and the names live in `locales/en-US.json`, so they are two lists that must
|
|
15
|
+
* agree and nothing but a type can make them. Declaring the JSON node as a
|
|
16
|
+
* TOTAL `Record<AccountCategoryId, string>` turns "somebody added a category at
|
|
17
|
+
* Oxy and nobody wrote its English" into a `TS2741` naming the missing id, at
|
|
18
|
+
* build time, instead of a picker row that paints `accounts.accountCategory.<id>`
|
|
19
|
+
* at a user trying to choose one.
|
|
20
|
+
*
|
|
21
|
+
* That failure is not hypothetical. The screen previously wrote `t(key) || id`,
|
|
22
|
+
* whose author believed an unnamed id would degrade to its raw slug. It cannot:
|
|
23
|
+
* {@link translate} echoes the KEY when it resolves nothing, and a non-empty
|
|
24
|
+
* string is never falsy, so the `|| id` arm was unreachable and the output was
|
|
25
|
+
* the dotted key. A runtime fallback that cannot run is worse than none,
|
|
26
|
+
* because it reads as protection.
|
|
27
|
+
*
|
|
28
|
+
* Totality is over `ACCOUNT_CATEGORY_IDS`, which RETAINS withdrawn ids, so an
|
|
29
|
+
* account still carrying a retired category keeps rendering its name while no
|
|
30
|
+
* picker offers it again. Retired and unknown are different cases: only an id
|
|
31
|
+
* outside the union is unnameable, which is why this is keyed by
|
|
32
|
+
* `AccountCategoryId` and not by `string`.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Module-scoped, NOT re-exported from the package index: the annotation is the
|
|
36
|
+
* whole job, and it does that job without being public API. It carries no
|
|
37
|
+
* `Object.freeze` and no `Readonly<>` for the same reason — those existed only
|
|
38
|
+
* to make an exported reference safe from a consumer's stray write, and there
|
|
39
|
+
* is no such consumer. Exported from the MODULE so its own test can name it.
|
|
40
|
+
*/
|
|
41
|
+
exports.EN_ACCOUNT_CATEGORY_LABELS = en_US_json_1.default.accounts.accountCategory;
|
|
42
|
+
function accountCategoryLabel(locale, id) {
|
|
43
|
+
return (0, index_1.translate)(locale, `accounts.accountCategory.${id}`);
|
|
44
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EN_ACCOUNT_ROLE_LABELS = void 0;
|
|
7
|
+
exports.accountRoleLabel = accountRoleLabel;
|
|
8
|
+
const en_US_json_1 = __importDefault(require("./locales/en-US.json"));
|
|
9
|
+
const index_1 = require("./index");
|
|
10
|
+
/**
|
|
11
|
+
* Every account member role's English name, keyed by its stable id.
|
|
12
|
+
*
|
|
13
|
+
* Totality is over the closed `AccountRole` union so a new role without an
|
|
14
|
+
* English label is a build error, not a members row that paints
|
|
15
|
+
* `accounts.roles.<role>.label`.
|
|
16
|
+
*/
|
|
17
|
+
exports.EN_ACCOUNT_ROLE_LABELS = {
|
|
18
|
+
owner: en_US_json_1.default.accounts.roles.owner.label,
|
|
19
|
+
admin: en_US_json_1.default.accounts.roles.admin.label,
|
|
20
|
+
editor: en_US_json_1.default.accounts.roles.editor.label,
|
|
21
|
+
developer: en_US_json_1.default.accounts.roles.developer.label,
|
|
22
|
+
billing: en_US_json_1.default.accounts.roles.billing.label,
|
|
23
|
+
viewer: en_US_json_1.default.accounts.roles.viewer.label,
|
|
24
|
+
};
|
|
25
|
+
function accountRoleLabel(locale, role) {
|
|
26
|
+
return (0, index_1.translate)(locale, `accounts.roles.${role}.label`);
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EN_REPUTATION_CATEGORY_LABELS = void 0;
|
|
7
|
+
exports.reputationCategoryLabel = reputationCategoryLabel;
|
|
8
|
+
const en_US_json_1 = __importDefault(require("./locales/en-US.json"));
|
|
9
|
+
const index_1 = require("./index");
|
|
10
|
+
/**
|
|
11
|
+
* Every reputation rule category's English name, keyed by its stable id.
|
|
12
|
+
*
|
|
13
|
+
* Totality is over `REPUTATION_CATEGORIES` from `@oxyhq/contracts` so a new
|
|
14
|
+
* category added server-side without an English label is a build error, not a
|
|
15
|
+
* Trust Rules section title that paints `trust.rules.categories.<id>`.
|
|
16
|
+
*/
|
|
17
|
+
exports.EN_REPUTATION_CATEGORY_LABELS = en_US_json_1.default.trust.rules.categories;
|
|
18
|
+
function reputationCategoryLabel(locale, id) {
|
|
19
|
+
return (0, index_1.translate)(locale, `trust.rules.categories.${id}`);
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EN_TRUST_TIER_LABELS = void 0;
|
|
7
|
+
exports.trustTierLabel = trustTierLabel;
|
|
8
|
+
const en_US_json_1 = __importDefault(require("./locales/en-US.json"));
|
|
9
|
+
const index_1 = require("./index");
|
|
10
|
+
/**
|
|
11
|
+
* Every trust tier's English name, keyed by its stable id.
|
|
12
|
+
*
|
|
13
|
+
* Totality is over `TRUST_TIERS` from `@oxyhq/contracts` so a new tier without
|
|
14
|
+
* an English label is a build error, not a chip that paints `trust.tiers.<id>`.
|
|
15
|
+
*/
|
|
16
|
+
exports.EN_TRUST_TIER_LABELS = en_US_json_1.default.trust.tiers;
|
|
17
|
+
function trustTierLabel(locale, tier) {
|
|
18
|
+
return (0, index_1.translate)(locale, `trust.tiers.${tier}`);
|
|
19
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.AEAD_KEY_LENGTH = exports.decryptAead = exports.encryptAead = exports.hkdfSha256 = exports.RecoveryPhraseService = exports.SignatureService = exports.updateIdentityMarker = exports.readIdentityMarker = exports.IdentityUnavailableError = exports.IdentityPersistError = exports.IdentityAlreadyExistsError = exports.KeyManager = exports.sessionsArraysEqual = exports.normalizeAndSortSessions = exports.mergeSessions = exports.authenticatedApiCall = exports.withAuthErrorHandling = exports.isAuthenticationError = exports.ensureValidToken = exports.AuthenticationFailedError = exports.SessionSyncRequiredError = exports.verifyPublicCardAttestation = exports.parseAttestPayload = exports.parseIdPayload = exports.buildUserDid = exports.kindAcceptsAccountCategories = exports.isSelectableAccountCategoryId = exports.SELECTABLE_ACCOUNT_CATEGORY_IDS = exports.MAX_ACCOUNT_CATEGORIES = exports.ACCOUNT_CATEGORY_IDS = exports.normalizeProfileLinks = exports.getNormalizedUserHandle = exports.getCanonicalUserHandle = exports.normalizeUserIdentityOrNull = exports.normalizeUserIdentity = exports.getNormalizedUserId = exports.OxyAppDataIdentifierError = exports.commonsDeliveryPlatform = exports.pushTargetsFromDelivery = exports.selectCommonsDelivery = exports.parseCommonsApprovalExpiresAt = exports.getCommonsApprovalBlockingReason = exports.ServiceCredentialMismatchError = exports.oxyClient = exports.OXY_CLOUD_URL = exports.ServiceAssetMetadataError = exports.OxyAuthenticationTimeoutError = exports.OxyAuthenticationError = exports.AssetUrlResolutionError = exports.OxyServices = void 0;
|
|
22
22
|
exports.calculateBackoffInterval = exports.createCircuitBreakerState = exports.DEFAULT_CIRCUIT_BREAKER_CONFIG = exports.isRetryableError = exports.isNetworkError = exports.isServerError = exports.isRateLimitError = exports.isNotFoundError = exports.isForbiddenError = exports.isUnauthorizedError = exports.isAlreadyRegisteredError = exports.getErrorMessage = exports.getErrorStatus = exports.HttpStatus = exports.getSystemColorScheme = exports.systemPrefersDarkMode = exports.getOppositeTheme = exports.normalizeColorScheme = exports.normalizeTheme = exports.getContrastTextColor = exports.isLightColor = exports.withOpacity = exports.rgbToHex = exports.hexToRgb = exports.lightenColor = exports.darkenColor = exports.isWebBrowser = exports.isAndroid = exports.isIOS = exports.isNative = exports.isWeb = exports.setPlatformOS = exports.getPlatformOS = exports.getPrimaryLanguage = exports.getUserLanguages = exports.isRTLLocale = exports.getNativeLanguageName = exports.getLanguageName = exports.getLanguageMetadata = exports.isSupportedLocale = exports.normalizeLocale = exports.getBaseLanguage = exports.FALLBACK_LOCALE = exports.SUPPORTED_LANGUAGES = exports.TopicSource = exports.TopicType = exports.SECURITY_EVENT_SEVERITY_MAP = exports.DeviceManager = exports.deriveSharedSecret = exports.AEAD_NONCE_LENGTH = void 0;
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.packageInfo = exports.runSessionColdBoot = exports.TOKEN_REFRESH_LEAD_MS = exports.startTokenRefreshScheduler = exports.installAuthRefreshHandler = exports.createAuthRefreshHandler = exports.refreshDeviceSecretArm = exports.refreshPersistedSession = exports.AccountNotOnDeviceError = exports.establishIdentitySession = exports.resolveIdentityPin = exports.IDENTITY_PIN_STORAGE_KEY = exports.identityPinMatches = exports.createMemoryIdentityPinStore = exports.createNativeIdentityPinStore = void 0;
|
|
23
|
+
exports.normalizeInlineText = exports.validateAndSanitizeUserInput = exports.isValidObjectId = exports.sanitizeHTML = exports.sanitizeString = exports.isValidFileType = exports.isValidFileSize = exports.isValidDate = exports.isValidURL = exports.isValidUUID = exports.isValidObject = exports.isValidArray = exports.isRequiredBoolean = exports.isRequiredNumber = exports.isRequiredString = exports.DISPLAY_NAME_UNFLANKED_SEPARATOR_SOURCE = exports.DISPLAY_NAME_ORPHANED_MARK_SOURCE = exports.DISPLAY_NAME_DISALLOWED_SOURCE = exports.DISPLAY_NAME_ALLOWED_SCRIPTS = exports.isValidDisplayName = exports.isValidPassword = exports.isValidUsername = exports.isValidEmail = exports.DISPLAY_NAME_INVALID_MESSAGE = exports.MAX_DISPLAY_NAME_LENGTH = exports.PASSWORD_REGEX = exports.USERNAME_REGEX = exports.EMAIL_REGEX = exports.retryAsync = exports.validateRequiredFields = exports.parseHttpErrorBody = exports.isHttpRequestError = exports.handleHttpError = exports.createApiError = exports.ErrorCodes = exports.safeJsonParse = exports.buildPaginationParams = exports.buildUrl = exports.buildSearchParams = exports.buildQueryParams = exports.trustTierLabel = exports.reputationCategoryLabel = exports.accountRoleLabel = exports.accountCategoryLabel = exports.translate = exports.withRetry = exports.delay = exports.shouldAllowRequest = exports.recordSuccess = exports.recordFailure = void 0;
|
|
24
|
+
exports.switchableAccountIds = exports.projectSwitchableAccounts = exports.canSwitchIntoAccount = exports.isSwitchTargetAccount = exports.accountIdsOf = exports.activeUserOf = exports.activeSessionIdOf = exports.deviceStateToClientSessions = exports.createSessionClient = exports.createSessionClientHost = exports.SessionClient = exports.isAllowedDeviceJoinOrigin = exports.isOfficialWebOrigin = exports.isLoopbackOrigin = exports.consumeOAuthReturnPath = exports.persistOAuthReturnPath = exports.clearOAuthHandshake = exports.readOAuthHandshake = exports.persistOAuthHandshake = exports.canonicalizeOAuthRedirectUri = exports.normalizeOAuthRedirectUri = exports.OXY_OAUTH_RETURN_PATH_STORAGE_KEY = exports.OXY_OAUTH_REDIRECT_URI_STORAGE_KEY = exports.OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY = exports.OXY_OAUTH_STATE_STORAGE_KEY = exports.OXY_AUTHORIZE_URL = exports.DEFAULT_OAUTH_SCOPE = exports.generatePkcePair = exports.generateOAuthState = exports.computeCodeChallenge = exports.buildOAuthAuthorizeUrl = exports.runColdBoot = exports.isOxyRpOrigin = exports.CENTRAL_IDP_APEX = exports.registrableApex = exports.getAccountColor = exports.formatPublicKeyHandle = exports.getAccountFallbackHandle = exports.getAccountDisplayName = exports.createQuickAccount = exports.buildAccountsArray = exports.updateAvatarVisibility = exports.isDev = exports.consoleSink = exports.resetLoggerConfig = exports.getLoggerConfig = exports.configureLogger = exports.createLogger = exports.logger = exports.normalizeMultilineText = void 0;
|
|
25
|
+
exports.packageInfo = exports.runSessionColdBoot = exports.TOKEN_REFRESH_LEAD_MS = exports.startTokenRefreshScheduler = exports.installAuthRefreshHandler = exports.createAuthRefreshHandler = exports.refreshDeviceSecretArm = exports.refreshPersistedSession = exports.AccountNotOnDeviceError = exports.establishIdentitySession = exports.resolveIdentityPin = exports.IDENTITY_PIN_STORAGE_KEY = exports.identityPinMatches = exports.createMemoryIdentityPinStore = exports.createNativeIdentityPinStore = exports.createWebIdentityPinStore = exports.AUTH_STATE_STORAGE_KEY = exports.createMemoryAuthStateStore = exports.createNativeAuthStateStore = exports.createWebAuthStateStore = exports.createAccountDialogController = exports.AccountDialogController = void 0;
|
|
26
26
|
// Ensure crypto polyfills are loaded before anything else
|
|
27
27
|
require("./crypto/polyfill");
|
|
28
28
|
// ---------------------------------------------------------------------------
|
|
@@ -223,6 +223,14 @@ Object.defineProperty(exports, "withRetry", { enumerable: true, get: function ()
|
|
|
223
223
|
// ---------------------------------------------------------------------------
|
|
224
224
|
var i18n_1 = require("./i18n");
|
|
225
225
|
Object.defineProperty(exports, "translate", { enumerable: true, get: function () { return i18n_1.translate; } });
|
|
226
|
+
var accountCategoryLabels_1 = require("./i18n/accountCategoryLabels");
|
|
227
|
+
Object.defineProperty(exports, "accountCategoryLabel", { enumerable: true, get: function () { return accountCategoryLabels_1.accountCategoryLabel; } });
|
|
228
|
+
var accountRoleLabels_1 = require("./i18n/accountRoleLabels");
|
|
229
|
+
Object.defineProperty(exports, "accountRoleLabel", { enumerable: true, get: function () { return accountRoleLabels_1.accountRoleLabel; } });
|
|
230
|
+
var reputationCategoryLabels_1 = require("./i18n/reputationCategoryLabels");
|
|
231
|
+
Object.defineProperty(exports, "reputationCategoryLabel", { enumerable: true, get: function () { return reputationCategoryLabels_1.reputationCategoryLabel; } });
|
|
232
|
+
var trustTierLabels_1 = require("./i18n/trustTierLabels");
|
|
233
|
+
Object.defineProperty(exports, "trustTierLabel", { enumerable: true, get: function () { return trustTierLabels_1.trustTierLabel; } });
|
|
226
234
|
// ---------------------------------------------------------------------------
|
|
227
235
|
// API request / URL helpers
|
|
228
236
|
// ---------------------------------------------------------------------------
|
|
@@ -236,6 +244,8 @@ var errorUtils_2 = require("./utils/errorUtils");
|
|
|
236
244
|
Object.defineProperty(exports, "ErrorCodes", { enumerable: true, get: function () { return errorUtils_2.ErrorCodes; } });
|
|
237
245
|
Object.defineProperty(exports, "createApiError", { enumerable: true, get: function () { return errorUtils_2.createApiError; } });
|
|
238
246
|
Object.defineProperty(exports, "handleHttpError", { enumerable: true, get: function () { return errorUtils_2.handleHttpError; } });
|
|
247
|
+
Object.defineProperty(exports, "isHttpRequestError", { enumerable: true, get: function () { return errorUtils_2.isHttpRequestError; } });
|
|
248
|
+
Object.defineProperty(exports, "parseHttpErrorBody", { enumerable: true, get: function () { return errorUtils_2.parseHttpErrorBody; } });
|
|
239
249
|
Object.defineProperty(exports, "validateRequiredFields", { enumerable: true, get: function () { return errorUtils_2.validateRequiredFields; } });
|
|
240
250
|
var asyncUtils_1 = require("./utils/asyncUtils");
|
|
241
251
|
Object.defineProperty(exports, "retryAsync", { enumerable: true, get: function () { return asyncUtils_1.retryAsync; } });
|
|
@@ -370,14 +380,14 @@ Object.defineProperty(exports, "accountIdsOf", { enumerable: true, get: function
|
|
|
370
380
|
// chooser: device sign-ins ∪ account graph, deduped by accountId). Pure +
|
|
371
381
|
// I/O-free — the caller hydrates profiles via `getUsersByIds`. Shared by
|
|
372
382
|
// `@oxyhq/services` and auth.oxy.so so the list can't diverge.
|
|
373
|
-
// `isSwitchTargetAccount` is the
|
|
374
|
-
//
|
|
375
|
-
//
|
|
376
|
-
//
|
|
377
|
-
//
|
|
378
|
-
// too, so gating a switcher on it alone empties the list.
|
|
383
|
+
// `isSwitchTargetAccount` is the structural half ("is this kind switchable at
|
|
384
|
+
// all?"); `canSwitchIntoAccount` adds the caller's `account:act_as` permission.
|
|
385
|
+
// Both are exported so surfaces that render `AccountNode`s rather than the
|
|
386
|
+
// projection — the Console workspace switcher, managed-accounts rows — ask the
|
|
387
|
+
// SAME questions instead of testing a kind literal.
|
|
379
388
|
var accountProjection_1 = require("./session/accountProjection");
|
|
380
389
|
Object.defineProperty(exports, "isSwitchTargetAccount", { enumerable: true, get: function () { return accountProjection_1.isSwitchTargetAccount; } });
|
|
390
|
+
Object.defineProperty(exports, "canSwitchIntoAccount", { enumerable: true, get: function () { return accountProjection_1.canSwitchIntoAccount; } });
|
|
381
391
|
Object.defineProperty(exports, "projectSwitchableAccounts", { enumerable: true, get: function () { return accountProjection_1.projectSwitchableAccounts; } });
|
|
382
392
|
Object.defineProperty(exports, "switchableAccountIds", { enumerable: true, get: function () { return accountProjection_1.switchableAccountIds; } });
|
|
383
393
|
// Headless controller for the unified account dialog. Framework-agnostic
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Chains — the shared record log every Oxy app reads and writes.
|
|
4
|
+
*
|
|
5
|
+
* A person has ONE chain. An app appends its own records to it and projects its
|
|
6
|
+
* feeds from what it reads back, instead of keeping a private copy of the same
|
|
7
|
+
* person's activity. This mixin is the client half of `/chains` in oxy-api, and
|
|
8
|
+
* it exists so that adopting the chain costs an app no HTTP of its own — the
|
|
9
|
+
* whole point of the shared substrate is that the second app writes less code
|
|
10
|
+
* than the first, not the same amount in a different file.
|
|
11
|
+
*
|
|
12
|
+
* ## Both calls are SERVICE-authenticated
|
|
13
|
+
*
|
|
14
|
+
* They go through `makeServiceRequest`, so they only work on a backend that has
|
|
15
|
+
* called `configureServiceAuth()`. That is not an accident of implementation: an
|
|
16
|
+
* append writes to someone else's chain and a read spans many subjects, so
|
|
17
|
+
* neither belongs in a browser holding a user session. A frontend that needs
|
|
18
|
+
* this asks its own backend.
|
|
19
|
+
*
|
|
20
|
+
* The authority is checked server-side and cannot be talked out of from here:
|
|
21
|
+
* `chains:write` plus the application's own `chainNamespaces` for an append,
|
|
22
|
+
* `chains:read` plus the public-collection policy for a read. A call that
|
|
23
|
+
* violates either gets a 403 or an empty page — this client adds no
|
|
24
|
+
* pre-validation that could drift from the server's answer.
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.OxyServicesChainsMixin = OxyServicesChainsMixin;
|
|
28
|
+
function OxyServicesChainsMixin(Base) {
|
|
29
|
+
return class extends Base {
|
|
30
|
+
constructor(...args) {
|
|
31
|
+
super(...args);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Append a record to `oxyUserId`'s chain under `collection`/`rkey`.
|
|
35
|
+
*
|
|
36
|
+
* Oxy issues and signs it; the calling app never holds a chain signing key.
|
|
37
|
+
* `rkey` is the app's own id for the thing — reusing it later supersedes the
|
|
38
|
+
* earlier record for that key, which is how an edit works.
|
|
39
|
+
*
|
|
40
|
+
* Requires the `chains:write` scope AND `collection` falling under one of
|
|
41
|
+
* this application's granted `chainNamespaces`. Both are enforced by the
|
|
42
|
+
* server; a violation throws with a 403.
|
|
43
|
+
*/
|
|
44
|
+
async appendChainRecord(params) {
|
|
45
|
+
return this.makeServiceRequest('POST', '/chains/records', params);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Records published by any of `oxyUserIds` under any of `collections`,
|
|
49
|
+
* oldest first — the read a cross-app feed is projected from.
|
|
50
|
+
*
|
|
51
|
+
* Only collections Oxy declares PUBLIC come back, whatever is asked for; a
|
|
52
|
+
* private one yields nothing rather than an error.
|
|
53
|
+
*
|
|
54
|
+
* **Re-poll from slightly BEFORE your last cursor and dedupe by
|
|
55
|
+
* `recordId`.** The chain's pagination axis is a transaction-start
|
|
56
|
+
* timestamp, so a record can commit behind a cursor that already passed it.
|
|
57
|
+
* Re-delivering one costs bytes; skipping one costs a record that never
|
|
58
|
+
* appears. Projections are expected to be idempotent for exactly this
|
|
59
|
+
* reason.
|
|
60
|
+
*/
|
|
61
|
+
async readChainRecords(params) {
|
|
62
|
+
const query = new URLSearchParams({
|
|
63
|
+
authors: params.oxyUserIds.join(','),
|
|
64
|
+
collections: params.collections.join(','),
|
|
65
|
+
});
|
|
66
|
+
if (params.since)
|
|
67
|
+
query.set('since', params.since);
|
|
68
|
+
if (params.limit !== undefined)
|
|
69
|
+
query.set('limit', String(params.limit));
|
|
70
|
+
return this.makeServiceRequest('GET', `/chains/records?${query.toString()}`);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
@@ -159,6 +159,23 @@ function OxyServicesFollowGraphMixin(Base) {
|
|
|
159
159
|
throw this.handleError(error);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Release a namespace the calling application holds, when nothing is
|
|
164
|
+
registered inside it yet.
|
|
165
|
+
*
|
|
166
|
+
* Idempotent when the namespace is already unowned (`released: false`).
|
|
167
|
+
* Exists because claims are first-come and registration runs on boot — a
|
|
168
|
+
* development build with the wrong client id can bind a name permanently
|
|
169
|
+
* unless the holder can give it back.
|
|
170
|
+
*/
|
|
171
|
+
async releaseFollowNamespace(namespace) {
|
|
172
|
+
try {
|
|
173
|
+
return await this.makeRequest('DELETE', `/v2/follow-targets/namespaces/${encodeURIComponent(namespace)}`, undefined, { cache: false });
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
throw this.handleError(error);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
162
179
|
/**
|
|
163
180
|
* Declare what following a kind of thing MEANS: the verb clients render,
|
|
164
181
|
* whether reverse lookups are public, whether it federates.
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OxyServicesStoreMixin = OxyServicesStoreMixin;
|
|
4
|
+
const mixinHelpers_1 = require("./mixinHelpers");
|
|
5
|
+
/** Read one page out of that envelope. */
|
|
6
|
+
function pageOf(res) {
|
|
7
|
+
return {
|
|
8
|
+
items: res.data ?? [],
|
|
9
|
+
total: res.pagination?.total ?? 0,
|
|
10
|
+
hasMore: res.pagination?.hasMore ?? false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Build a query string from the options that were actually supplied.
|
|
15
|
+
*
|
|
16
|
+
* Generic over the options object rather than taking a `Record`: an interface
|
|
17
|
+
* has no implicit index signature in TypeScript, so `StoreReviewsOptions` would
|
|
18
|
+
* not be assignable to one and every call site would need a cast.
|
|
19
|
+
*/
|
|
20
|
+
function queryOf(params) {
|
|
21
|
+
const search = new URLSearchParams();
|
|
22
|
+
for (const [key, value] of Object.entries(params)) {
|
|
23
|
+
if (value !== undefined)
|
|
24
|
+
search.set(key, String(value));
|
|
25
|
+
}
|
|
26
|
+
const rendered = search.toString();
|
|
27
|
+
return rendered ? `?${rendered}` : '';
|
|
28
|
+
}
|
|
29
|
+
function OxyServicesStoreMixin(Base) {
|
|
30
|
+
return class extends Base {
|
|
31
|
+
constructor(...args) {
|
|
32
|
+
super(...args);
|
|
33
|
+
}
|
|
34
|
+
// =========================================================================
|
|
35
|
+
// The storefront — /store. No authentication: everything served is public.
|
|
36
|
+
// =========================================================================
|
|
37
|
+
/** The shelves, in the order the store curates them. */
|
|
38
|
+
async listStoreCategories() {
|
|
39
|
+
try {
|
|
40
|
+
const res = await this.makeRequest('GET', '/store/categories', undefined, { cache: true, cacheTTL: mixinHelpers_1.CACHE_TIMES.MEDIUM });
|
|
41
|
+
return res.data ?? [];
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
throw this.handleError(error);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Published listings, newest first, optionally one shelf.
|
|
49
|
+
*
|
|
50
|
+
* An unknown category slug is an EMPTY shelf, not every app on the store —
|
|
51
|
+
* so a typo shows nothing rather than showing everything.
|
|
52
|
+
*
|
|
53
|
+
* @param options - `category` is a category slug; `limit` defaults to 24.
|
|
54
|
+
*/
|
|
55
|
+
async listStoreApps(options = {}) {
|
|
56
|
+
try {
|
|
57
|
+
const res = await this.makeRequest('GET', `/store/apps${queryOf(options)}`, undefined, { cache: true, cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT });
|
|
58
|
+
return pageOf(res);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw this.handleError(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* One store page.
|
|
66
|
+
*
|
|
67
|
+
* A draft answers 404 exactly as an unknown slug does: whether an
|
|
68
|
+
* unpublished page exists under a name is not something a visitor learns.
|
|
69
|
+
*
|
|
70
|
+
* @param slug - The listing's public slug, not an application id.
|
|
71
|
+
*/
|
|
72
|
+
async getStoreApp(slug) {
|
|
73
|
+
try {
|
|
74
|
+
const res = await this.makeRequest('GET', `/store/apps/${encodeURIComponent(slug)}`, undefined, { cache: true, cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT });
|
|
75
|
+
return res.data;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
throw this.handleError(error);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Visible reviews for a published app, each with the publisher's reply. */
|
|
82
|
+
async listStoreReviews(slug, options = {}) {
|
|
83
|
+
try {
|
|
84
|
+
const res = await this.makeRequest('GET', `/store/apps/${encodeURIComponent(slug)}/reviews${queryOf(options)}`, undefined, { cache: true, cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT });
|
|
85
|
+
return pageOf(res);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
throw this.handleError(error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// =========================================================================
|
|
92
|
+
// Reviewing — any signed-in Oxy account
|
|
93
|
+
// =========================================================================
|
|
94
|
+
/** The caller's own review of an app, or `null` if they have not written one. */
|
|
95
|
+
async getMyStoreReview(slug) {
|
|
96
|
+
try {
|
|
97
|
+
const res = await this.makeRequest('GET', `/store/apps/${encodeURIComponent(slug)}/review`, undefined, { cache: false });
|
|
98
|
+
return res.data ?? null;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw this.handleError(error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Write the caller's review, or replace what they said before.
|
|
106
|
+
*
|
|
107
|
+
* A person has one review per app, so this sets it rather than adding one.
|
|
108
|
+
* Rewriting does not clear a moderator's decision: a hidden review stays
|
|
109
|
+
* hidden when its author edits it.
|
|
110
|
+
*/
|
|
111
|
+
async writeStoreReview(slug, input) {
|
|
112
|
+
try {
|
|
113
|
+
const res = await this.makeRequest('PUT', `/store/apps/${encodeURIComponent(slug)}/review`, input, { cache: false });
|
|
114
|
+
return res.data;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
throw this.handleError(error);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** Withdraw the caller's own review. A real delete — the words were theirs. */
|
|
121
|
+
async deleteMyStoreReview(slug) {
|
|
122
|
+
try {
|
|
123
|
+
await this.makeRequest('DELETE', `/store/apps/${encodeURIComponent(slug)}/review`, undefined, { cache: false });
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
throw this.handleError(error);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Answer a review on the publisher's behalf.
|
|
131
|
+
*
|
|
132
|
+
* Requires `app:update` over the application's owning account — the same
|
|
133
|
+
* permission that guards every other write to that application. Addressed
|
|
134
|
+
* by review id because the reply belongs to the review, and a listing can be
|
|
135
|
+
* renamed or withdrawn out from under it.
|
|
136
|
+
*/
|
|
137
|
+
async replyToStoreReview(reviewId, body) {
|
|
138
|
+
try {
|
|
139
|
+
const res = await this.makeRequest('PUT', `/store/reviews/${encodeURIComponent(reviewId)}/reply`, { body }, { cache: false });
|
|
140
|
+
return res.data;
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw this.handleError(error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** Withdraw the publisher's answer. Same permission that wrote it. */
|
|
147
|
+
async deleteStoreReviewReply(reviewId) {
|
|
148
|
+
try {
|
|
149
|
+
await this.makeRequest('DELETE', `/store/reviews/${encodeURIComponent(reviewId)}/reply`, undefined, { cache: false });
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
throw this.handleError(error);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// =========================================================================
|
|
156
|
+
// The publisher's listing — /applications/:appId/listing
|
|
157
|
+
// =========================================================================
|
|
158
|
+
/** The application's store page in whatever state, or `null` if it has none. */
|
|
159
|
+
async getAppListing(applicationId) {
|
|
160
|
+
try {
|
|
161
|
+
return await this.makeRequest('GET', `/applications/${encodeURIComponent(applicationId)}/listing`, undefined, { cache: false });
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
throw this.handleError(error);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Create the page or replace its content. Never its status.
|
|
169
|
+
*
|
|
170
|
+
* Editing does not move a page: correcting a typo on a live listing leaves
|
|
171
|
+
* it live, and fixing a rejected one does not re-submit it.
|
|
172
|
+
*/
|
|
173
|
+
async writeAppListing(applicationId, input) {
|
|
174
|
+
try {
|
|
175
|
+
return await this.makeRequest('PUT', `/applications/${encodeURIComponent(applicationId)}/listing`, input, { cache: false });
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
throw this.handleError(error);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/** Hand the page to the store for review. From a draft, or a rejected page once fixed. */
|
|
182
|
+
async submitAppListing(applicationId) {
|
|
183
|
+
try {
|
|
184
|
+
return await this.makeRequest('POST', `/applications/${encodeURIComponent(applicationId)}/listing/submit`, undefined, { cache: false });
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
throw this.handleError(error);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Take the page down, or withdraw it from the queue.
|
|
192
|
+
*
|
|
193
|
+
* Back to a draft, never deleted: the slug, the words and the screenshots
|
|
194
|
+
* are the publisher's work, and the reviews were never the listing's to take
|
|
195
|
+
* with them.
|
|
196
|
+
*/
|
|
197
|
+
async unpublishAppListing(applicationId) {
|
|
198
|
+
try {
|
|
199
|
+
return await this.makeRequest('POST', `/applications/${encodeURIComponent(applicationId)}/listing/unpublish`, undefined, { cache: false });
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
throw this.handleError(error);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// =========================================================================
|
|
206
|
+
// Screenshots
|
|
207
|
+
// =========================================================================
|
|
208
|
+
/** Every picture on the listing, in the author's order. */
|
|
209
|
+
async listAppListingScreenshots(applicationId) {
|
|
210
|
+
try {
|
|
211
|
+
return await this.makeRequest('GET', `/applications/${encodeURIComponent(applicationId)}/listing/screenshots`, undefined, { cache: false });
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
throw this.handleError(error);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Attach an already-uploaded image, appended to the end.
|
|
219
|
+
*
|
|
220
|
+
* Upload through the assets surface first; the store keeps a reference
|
|
221
|
+
* rather than a second copy of the asset pipeline. The file must be live, an
|
|
222
|
+
* image, and one the caller is entitled to.
|
|
223
|
+
*/
|
|
224
|
+
async addAppListingScreenshot(applicationId, input) {
|
|
225
|
+
try {
|
|
226
|
+
return await this.makeRequest('POST', `/applications/${encodeURIComponent(applicationId)}/listing/screenshots`, input, { cache: false });
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
throw this.handleError(error);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
/** Edit a picture's caption or the frame it was taken in. Order is {@link reorderAppListingScreenshots}. */
|
|
233
|
+
async updateAppListingScreenshot(applicationId, screenshotId, input) {
|
|
234
|
+
try {
|
|
235
|
+
return await this.makeRequest('PATCH', `/applications/${encodeURIComponent(applicationId)}/listing/screenshots/${encodeURIComponent(screenshotId)}`, input, { cache: false });
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
throw this.handleError(error);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/** Remove a picture. The uploaded file stays — it may be in use elsewhere. */
|
|
242
|
+
async deleteAppListingScreenshot(applicationId, screenshotId) {
|
|
243
|
+
try {
|
|
244
|
+
await this.makeRequest('DELETE', `/applications/${encodeURIComponent(applicationId)}/listing/screenshots/${encodeURIComponent(screenshotId)}`, undefined, { cache: false });
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
throw this.handleError(error);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Set the order of every picture at once.
|
|
252
|
+
*
|
|
253
|
+
* Send EVERY id on the listing, exactly once, in the order they should
|
|
254
|
+
* appear. A partial list is rejected rather than applied: it would leave the
|
|
255
|
+
* pictures it omits at their old positions, interleaved with the new ones.
|
|
256
|
+
*/
|
|
257
|
+
async reorderAppListingScreenshots(applicationId, screenshotIds) {
|
|
258
|
+
try {
|
|
259
|
+
return await this.makeRequest('PUT', `/applications/${encodeURIComponent(applicationId)}/listing/screenshots/order`, { screenshotIds }, { cache: false });
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
throw this.handleError(error);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|