From b074b649613e014fb0872d098d974354d198ccf9 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 14:27:54 +0000 Subject: [PATCH 1/4] feat(cloud-connection): the install answer says where its sample rows went, and a read names the language they load in The install answer's `seeded` gains `objects`: the run split by object, which objects the package defines, and why each skipped row was not written (a row already there, one removed after an earlier load, or an update that found no row). `GET /api/v1/marketplace/install-local/seed-locale` answers the language an install now would load locale-scoped sample data in, from the install's own resolver. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L9qibzuc2GU96KTJbcqdg8 --- .../cloud-connection-auth-gate.pin.test.ts | 12 +- .../src/cloud-connection-route-ledger.ts | 12 + ...-local-api-key-account-posture.pin.test.ts | 5 +- .../src/marketplace-install-local-plugin.ts | 76 +++++- .../marketplace-install-seed-report.test.ts | 217 ++++++++++++++++++ .../src/marketplace-install-seed-report.ts | 172 ++++++++++++++ 6 files changed, 484 insertions(+), 10 deletions(-) create mode 100644 packages/cloud-connection/src/marketplace-install-seed-report.test.ts create mode 100644 packages/cloud-connection/src/marketplace-install-seed-report.ts diff --git a/packages/cloud-connection/src/cloud-connection-auth-gate.pin.test.ts b/packages/cloud-connection/src/cloud-connection-auth-gate.pin.test.ts index 4f7ac3689ed..861ed61a2ff 100644 --- a/packages/cloud-connection/src/cloud-connection-auth-gate.pin.test.ts +++ b/packages/cloud-connection/src/cloud-connection-auth-gate.pin.test.ts @@ -13,7 +13,7 @@ * nine doors refuse on it; `/status` reads it only to decide what it * serves (#24148) and refuses no one. * - `MarketplaceInstallLocalPlugin` reads it in ONE place - * (`resolveInstallPrincipal`), and all six doors answer a held session + * (`resolveInstallPrincipal`), and all seven doors answer a held session * through the same refusal (`refuseHeldSession`). * * Each consults `evaluateAuthGate` (`@objectstack/core`) once, with no request @@ -392,7 +392,7 @@ async function mountInstallLocal(storageDir: string) { }; } -/** The six doors, addressed with what each needs to act. */ +/** The seven doors, addressed with what each needs to act. */ const IL_DOORS = [ { route: `POST ${IL}`, body: { manifest: APP } }, { route: `GET ${IL}`, body: {} }, @@ -400,6 +400,7 @@ const IL_DOORS = [ { route: `POST ${IL}/:manifestId/reseed-sample-data`, body: {} }, { route: `POST ${IL}/:manifestId/purge-sample-data`, body: {} }, { route: `GET ${IL}/:manifestId/sample-data`, body: {} }, + { route: `GET ${IL}/seed-locale`, body: {} }, ] as const; /** Install the app as the un-held operator, so the follow-on doors have a target. */ @@ -411,7 +412,7 @@ async function seedInstall(storageDir: string) { } describe('ADR-0069 at MarketplaceInstallLocalPlugin', () => { - it('census: six routes, none allow-listed, all six covered below', async () => { + it('census: seven routes, none allow-listed, all seven covered below', async () => { const { rawApp } = await mountInstallLocal(dir); const keys = [...rawApp.routes.keys()].sort(); expect(keys).toEqual(IL_DOORS.map((d) => d.route).sort()); @@ -419,7 +420,7 @@ describe('ADR-0069 at MarketplaceInstallLocalPlugin', () => { }); for (const { user, gate } of HELD) { - it(`HELD (${gate.code}): all six doors answer 403 with the gate's code, before any effect and before the ledger is touched`, async () => { + it(`HELD (${gate.code}): all seven doors answer 403 with the gate's code, before any effect and before the ledger is touched`, async () => { await seedInstall(dir); const ledgerBefore = existsSync(join(dir, LEDGER_FILE)); const { rawApp, effects } = await mountInstallLocal(dir); @@ -442,6 +443,9 @@ describe('ADR-0069 at MarketplaceInstallLocalPlugin', () => { const counted = await rawApp.routes.get(`GET ${IL}/:manifestId/sample-data`)!(makeC(`http://localhost${IL}`, 'u_member', {}, APP.id)); expect(counted.status, JSON.stringify(counted.payload)).toBe(200); expect(counted.payload.success).toBe(true); + const language = await rawApp.routes.get(`GET ${IL}/seed-locale`)!(makeC(`http://localhost${IL}`, 'u_member')); + expect(language.status, JSON.stringify(language.payload)).toBe(200); + expect(language.payload.success).toBe(true); for (const route of [`POST ${IL}/:manifestId/reseed-sample-data`, `POST ${IL}/:manifestId/purge-sample-data`, `DELETE ${IL}/:manifestId`]) { const res = await rawApp.routes.get(route)!(makeC(`http://localhost${IL}`, 'u_member', {}, APP.id)); expect(res.status, `${route}: ${JSON.stringify(res.payload)}`).toBe(200); diff --git a/packages/cloud-connection/src/cloud-connection-route-ledger.ts b/packages/cloud-connection/src/cloud-connection-route-ledger.ts index 929706ba078..3a581875c2a 100644 --- a/packages/cloud-connection/src/cloud-connection-route-ledger.ts +++ b/packages/cloud-connection/src/cloud-connection-route-ledger.ts @@ -274,6 +274,18 @@ export const CLOUD_CONNECTION_ROUTE_LEDGER: readonly CloudConnectionRouteLedgerE + 'takes no query parameter. Behind `manage_metadata`, the purge\'s gate, since it exists to tell an operator ' + 'what a purge would remove; no `@objectstack/client` method builds this URL, for the reason purge has none.', }, + { + route: 'GET /api/v1/marketplace/install-local/seed-locale', + family: 'marketplace-install-local', + mountedIn: 'marketplace-install-local-plugin.ts', + disposition: 'server-only', + note: + 'the read-only language an install would load locale-scoped sample data in, and which rung chose it ' + + '(the runtime\'s `resolveSeedLocaleForLoad`, the install\'s own resolver), so the Console\'s install confirm ' + + 'names it before the install. Its one query parameter is the package\'s declared default locale. Behind ' + + '`manage_metadata`, the install\'s gate, and writes nothing; no `@objectstack/client` method builds it, for the ' + + 'reason the install has none.', + }, // ── marketplace browse passthrough ───────────────────────────────── { diff --git a/packages/cloud-connection/src/marketplace-install-local-api-key-account-posture.pin.test.ts b/packages/cloud-connection/src/marketplace-install-local-api-key-account-posture.pin.test.ts index 8bcb5d2ada9..df953fbb2e1 100644 --- a/packages/cloud-connection/src/marketplace-install-local-api-key-account-posture.pin.test.ts +++ b/packages/cloud-connection/src/marketplace-install-local-api-key-account-posture.pin.test.ts @@ -222,7 +222,7 @@ function withKey( }; } -/** The six doors, addressed with what each needs to act. */ +/** The seven doors, addressed with what each needs to act. */ const IL_DOORS = [ { route: `POST ${IL}`, body: { manifest: APP } }, { route: `GET ${IL}`, body: {} }, @@ -230,6 +230,7 @@ const IL_DOORS = [ { route: `POST ${IL}/:manifestId/reseed-sample-data`, body: {} }, { route: `POST ${IL}/:manifestId/purge-sample-data`, body: {} }, { route: `GET ${IL}/:manifestId/sample-data`, body: {} }, + { route: `GET ${IL}/seed-locale`, body: {} }, ] as const; let dir: string; @@ -243,7 +244,7 @@ afterEach(() => { }); describe('install-local doors — a key answers as its owner\'s session does (#23455, ruling C′)', () => { - it('REFUSES a key whose owner holds MFA_REQUIRED on all six doors, with the session\'s 403 code and message, before any effect', async () => { + it('REFUSES a key whose owner holds MFA_REQUIRED on all seven doors, with the session\'s 403 code and message, before any effect', async () => { const postures: Record = {}; const m = await mountInstallLocal(dir, postures); // Installed by the same key while its owner is not held, so the diff --git a/packages/cloud-connection/src/marketplace-install-local-plugin.ts b/packages/cloud-connection/src/marketplace-install-local-plugin.ts index 832836f07e5..8a3fefb74dc 100644 --- a/packages/cloud-connection/src/marketplace-install-local-plugin.ts +++ b/packages/cloud-connection/src/marketplace-install-local-plugin.ts @@ -428,6 +428,14 @@ import { } from '@objectstack/metadata-protocol'; import { resolveThrownHttpError, type ThrownHttpError } from '@objectstack/types'; import { unknownQueryParamRefusalMessage } from '@objectstack/rest'; +import { + describeSeedTally, + packageObjectNames, + resolveSeedLocaleForPreview, + SEED_LOCALE_QUERY_PARAMS, + tallySeedObjects, + type SeedObjectTally, +} from './marketplace-install-seed-report.js'; import { composedClusterDriver, declaresMultiReplicaOnRedis, MULTI_REPLICA_PACKAGE_CHANGE_REFUSED } from '@objectstack/service-cluster'; /** What the auth service's in-process session read answers, as `AuthSessionApi` declares it. */ @@ -2132,9 +2140,12 @@ export class MarketplaceInstallLocalPlugin implements Plugin { const reseedHandler = async (c: any) => this.handleReseed(c, ctx); const purgeHandler = async (c: any) => this.handlePurge(c, ctx); const sampleDataCountHandler = async (c: any) => this.handleSampleDataCount(c, ctx); + const seedLocaleHandler = async (c: any) => this.handleSeedLocale(c, ctx); if (typeof rawApp.post === 'function') rawApp.post(ROUTE_BASE, postHandler); if (typeof rawApp.get === 'function') rawApp.get(ROUTE_BASE, getHandler); + // [#39681] Before `/:manifestId` routes, so `seed-locale` is never read as a manifest id. + if (typeof rawApp.get === 'function') rawApp.get(`${ROUTE_BASE}/seed-locale`, seedLocaleHandler); if (typeof rawApp.get === 'function') rawApp.get(`${ROUTE_BASE}/:manifestId/sample-data`, sampleDataCountHandler); if (typeof rawApp.delete === 'function') rawApp.delete(`${ROUTE_BASE}/:manifestId`, deleteHandler); if (typeof rawApp.post === 'function') { @@ -7157,6 +7168,49 @@ export class MarketplaceInstallLocalPlugin implements Plugin { * `count: 0` for a copy made without the sample data, the purge's * `503` for a receipt that was not read. */ + /** + * [#39681] `GET …/install-local/seed-locale?appDefaultLocale=` — the + * language an install run now would load locale-scoped sample data in, + * and which rung chose it, so the install confirm names it before the + * install. The same resolver and the same inputs as the install's own + * seed (`runInlineSeed`): the caller's active organization, the caller, + * and the package's declared default, which the confirm reads off the + * body it is about to install. Behind the install's gate; it writes + * nothing. A settings or user read that throws is a `500`, never a guess. + */ + private handleSeedLocale = async (c: any, ctx: PluginContext): Promise => { + const admission = await this.requireInstallCapability(c, ctx, 'Reading the sample-data language'); + if (!admission.ok) return admission.response; + const query = typeof c.req?.query === 'function' ? c.req.query() : undefined; + const queryRefusal = unknownQueryParamRefusalMessage(query, SEED_LOCALE_QUERY_PARAMS); + if (queryRefusal) { + return c.json({ success: false, error: { code: 'VALIDATION_ERROR', message: queryRefusal } }, 400); + } + const appDefault = typeof query?.appDefaultLocale === 'string' ? query.appDefaultLocale : undefined; + // The organization the install's rows would land in: the active one + // under a wall, none otherwise (the settings service's own reach). + let organizationId: string | undefined; + if (organizationWallActive(ctx)) organizationId = (await this.resolveActiveOrgId(c, ctx)) ?? undefined; + try { + const data = await resolveSeedLocaleForPreview(ctx, { + organizationId, + userId: admission.userId, + appDefaultLocale: appDefault, + }); + return c.json({ success: true, data }, 200); + } catch (err: any) { + ctx.logger?.warn?.(`[MarketplaceInstallLocal] the sample-data language could not be read: ${err?.message ?? err}`); + return c.json({ + success: false, + error: { + code: 'INTERNAL_ERROR', + message: `The sample-data language could not be read: ${err?.message ?? err}. The organization's language ` + + 'setting or your own language may exist and was not read, so no language is named.', + }, + }, 500); + } + }; + private handleSampleDataCount = async (c: any, ctx: PluginContext): Promise => { const admission = await this.requireInstallCapability(c, ctx, 'Counting sample data'); if (!admission.ok) return admission.response; @@ -7920,7 +7974,7 @@ export class MarketplaceInstallLocalPlugin implements Plugin { ctx: PluginContext, manifest: any, opts: { seedNow: boolean; c?: any; door?: Exclude; userId?: string }, - ): Promise<{ translationsLoaded: number; seeded: { mode: 'inline' | 'replayer' | 'skipped' | 'refused'; inserted?: number; updated?: number; skipped?: number; errors?: number; reason?: string; errorSample?: string; errorList?: any[]; droppedRefs?: number } }> => { + ): Promise<{ translationsLoaded: number; seeded: { mode: 'inline' | 'replayer' | 'skipped' | 'refused'; inserted?: number; updated?: number; skipped?: number; errors?: number; reason?: string; errorSample?: string; errorList?: any[]; droppedRefs?: number; objects?: SeedObjectTally[] } }> => { const appId = String(manifest?.id ?? 'unknown'); let translationsLoaded = 0; let seedSummary: any = { mode: 'skipped', reason: 'no-datasets' }; @@ -8079,8 +8133,19 @@ export class MarketplaceInstallLocalPlugin implements Plugin { // The whole run, failures included: the console's install // result lists `errorList` (each record or link that did // not load) beside the `errors` and `droppedRefs` counts. - seedSummary = { mode: 'inline', ...s }; - ctx.logger?.info?.(`[MarketplaceInstallLocal] inline seed for ${appId}${organizationId ? ` (org=${organizationId})` : ''}: inserted=${s.inserted} updated=${s.updated} skipped=${s.skipped} errors=${s.errors}`); + // [#39681] `objects` says which rows are the package's + // records and which were written to other objects (a + // platform object's timeline pointers), and why each + // skipped row was not written, so the install result + // can agree with the sample-data count and name them. + // The rows already landed, so an unreadable object list + // leaves the tally as the loader gave it, never the run. + let own: Set | undefined; + try { own = packageObjectNames(resolveStackCollection(manifest, 'objects')); } catch { /* tally as loaded */ } + const objects = own ? s.objects.map((t) => ({ ...t, inPackage: own.has(t.object) })) : s.objects; + seedSummary = { mode: 'inline', ...s, objects }; + const tally = describeSeedTally(objects); + ctx.logger?.info?.(`[MarketplaceInstallLocal] inline seed for ${appId}${organizationId ? ` (org=${organizationId})` : ''}: inserted=${s.inserted} updated=${s.updated} skipped=${s.skipped} errors=${s.errors}${tally ? ` — ${tally}` : ''}`); } } } catch (err: any) { @@ -8202,7 +8267,7 @@ export class MarketplaceInstallLocalPlugin implements Plugin { organizationId?: string, localeFrom: { userId?: string; app?: unknown } = {}, owner: SeedOwnerOfLoad = { userId: null, door: 'seed', none: 'no person named' }, - ): Promise<{ inserted: number; updated: number; skipped: number; errors: number; errorList: any[]; droppedRefs: number; errorSample?: string }> => { + ): Promise<{ inserted: number; updated: number; skipped: number; errors: number; errorList: any[]; droppedRefs: number; errorSample?: string; objects: SeedObjectTally[] }> => { const ql: any = ctx.getService('objectql'); let metadata: any; try { metadata = ctx.getService('metadata'); } catch { /* none */ } @@ -8268,6 +8333,9 @@ export class MarketplaceInstallLocalPlugin implements Plugin { // report WHY nothing landed (e.g. a locked DB, a missing table, // a failed validation) instead of a bare "0 rows". errorSample: result.errors[0]?.message, + // [#39681] The run by object, and why each skipped row was not + // written. Which objects are the package's is the caller's to say. + objects: tallySeedObjects(result?.results), }; }; diff --git a/packages/cloud-connection/src/marketplace-install-seed-report.test.ts b/packages/cloud-connection/src/marketplace-install-seed-report.test.ts new file mode 100644 index 00000000000..c0d4783199b --- /dev/null +++ b/packages/cloud-connection/src/marketplace-install-seed-report.test.ts @@ -0,0 +1,217 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * [#39681] The install answer says where its sample rows went, per object, + * and the confirm can ask which language the samples will load in. + * + * Measured on HotCRM 7.1.0 into an empty database: the answer said + * `inserted: 486, skipped: 1` while the sample-data count said 482. The 4 + * extra rows were `sys_activity` timeline pointers, a platform object the + * package does not define, and the skipped row was explained as "already + * there, or deleted after an earlier load", which an empty database rules out. + */ + +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import { SeedLoaderRequestSchema } from '@objectstack/spec/data'; +import { mkdtempSync, rmSync } from 'node:fs'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; + +let seedResult: any; +const localeQuestions: any[] = []; +let localeAnswer: { locale: string; source: string } | undefined | Error; + +vi.mock('@objectstack/runtime', () => ({ + SeedLoaderService: class { + async loadStored(raw: any) { return this.load(SeedLoaderRequestSchema.parse(raw)); } + async load(_request: unknown) { return seedResult; } + async buildDependencyGraph(objects: string[]) { return { objects }; } + }, + resolveSeedLocaleForLoad: async (_host: unknown, question: any) => { + localeQuestions.push(question); + if (localeAnswer instanceof Error) throw localeAnswer; + return localeAnswer; + }, + appDefaultSeedLocale: () => undefined, + describeSeedLocale: () => 'none', +})); +vi.mock('@objectstack/spec/data', async (importOriginal) => ({ + ...(await importOriginal()), + SeedLoaderRequestSchema: { parse: (x: any) => x }, +})); + +import { MarketplaceInstallLocalPlugin } from './marketplace-install-local-plugin.js'; +import { installerAuthService, withInstallerGrants } from './install-local-principal.fixtures.js'; +import { tallySeedObjects, describeSeedTally, SEED_LOCALE_QUERY_PARAMS } from './marketplace-install-seed-report.js'; + +type Handler = (c: any) => Promise; +const ROUTE = '/api/v1/marketplace/install-local'; + +const APP = { + id: 'com.example.crm', + name: 'CRM', + version: '1.0.0', + objects: [ + { name: 'crm_order', label: 'Order', fields: { name: { type: 'text', label: 'Name' } } }, + { name: 'crm_lead', label: 'Lead', fields: { name: { type: 'text', label: 'Name' } } }, + ], + data: [ + { object: 'crm_lead', records: [{ name: 'L1' }, { name: 'L2' }] }, + { object: 'crm_order', records: [{ name: 'O1' }] }, + { object: 'crm_order', mode: 'update', externalId: 'name', records: [{ name: 'O1' }] }, + { object: 'sys_activity', records: [{ summary: 'a' }, { summary: 'b' }] }, + ], +}; + +/** The loader's per-dataset results, as `SeedLoaderService` reports them. */ +const RESULTS = [ + { object: 'crm_lead', mode: 'ignore', inserted: 2, updated: 0, skipped: 0, errored: 0, landedIds: ['l1', 'l2'] }, + { object: 'crm_order', mode: 'ignore', inserted: 1, updated: 0, skipped: 0, errored: 0, landedIds: ['o1'] }, + { object: 'crm_order', mode: 'update', inserted: 0, updated: 0, skipped: 1, errored: 0, landedIds: [] }, + { object: 'sys_activity', mode: 'ignore', inserted: 2, updated: 0, skipped: 0, errored: 0, landedIds: ['a1', 'a2'] }, +]; + +function makeC(reqBody: any, query?: Record) { + const json = vi.fn((payload: any, status?: number) => ({ payload, status: status ?? 200 })); + return { + req: { + url: `http://localhost:3000${ROUTE}`, + raw: new Request(`http://localhost:3000${ROUTE}`), + json: async () => reqBody, + param: () => undefined, + header: () => undefined, + query: () => query, + }, + json, + }; +} + +async function boot(dir: string) { + const routes = new Map(); + const rawApp = { + get: (p: string, h: Handler) => routes.set(`GET ${p}`, h), + post: (p: string, h: Handler) => routes.set(`POST ${p}`, h), + delete: (p: string, h: Handler) => routes.set(`DELETE ${p}`, h), + }; + const hooks = new Map(); + const services: Record = { + manifest: { register: vi.fn() }, + auth: installerAuthService(), + objectql: withInstallerGrants({ syncSchemas: async () => undefined }), + metadata: {}, + }; + const logger = { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() }; + const ctx = { + hook: (e: string, h: any) => hooks.set(e, h), + getService: (name: string) => { + if (name === 'http-server') return { getRawApp: () => rawApp }; + const svc = services[name]; + if (svc === undefined) throw new Error(`no ${name}`); + return svc; + }, + registerService: (name: string, svc: unknown) => { services[name] = svc; }, + logger, + }; + const plugin = new MarketplaceInstallLocalPlugin({ controlPlaneUrl: 'off', storageDir: dir }); + await plugin.start(ctx as any); + await hooks.get('kernel:ready')?.(); + return { + logger, + install: (manifest: unknown) => routes.get(`POST ${ROUTE}`)!(makeC({ manifest })), + seedLocale: (query?: Record) => routes.get(`GET ${ROUTE}/seed-locale`)!(makeC({}, query)), + }; +} + +let dir: string; +beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'mil-seed-report-')); + localeQuestions.length = 0; + localeAnswer = undefined; + seedResult = { + summary: { totalInserted: 5, totalUpdated: 0, totalSkipped: 1 }, + results: RESULTS, + errors: [], + }; +}); +afterEach(() => { rmSync(dir, { recursive: true, force: true }); vi.restoreAllMocks(); }); + +describe('tallySeedObjects', () => { + it('splits the run by object and tells the three skip reasons apart', () => { + const tallies = tallySeedObjects([ + ...RESULTS, + // A replay: one row matched and left as it is, one kept out by the landed-key record. + { object: 'crm_lead', mode: 'ignore', inserted: 0, updated: 0, skipped: 2, errored: 0, landedIds: ['l1'] }, + ], new Set(['crm_order', 'crm_lead'])); + expect(tallies).toEqual([ + { object: 'crm_lead', inPackage: true, inserted: 2, updated: 0, existing: 1, withdrawn: 1, noRowToUpdate: 0, errors: 0 }, + { object: 'crm_order', inPackage: true, inserted: 1, updated: 0, existing: 0, withdrawn: 0, noRowToUpdate: 1, errors: 0 }, + { object: 'sys_activity', inPackage: false, inserted: 2, updated: 0, existing: 0, withdrawn: 0, noRowToUpdate: 0, errors: 0 }, + ]); + expect(describeSeedTally(tallies)).toBe( + 'outside the package: sys_activity=2; skipped (already there): crm_lead=1; ' + + 'skipped (removed after an earlier load): crm_lead=1; skipped (no row to update): crm_order=1', + ); + }); + + it('answers nothing for a loader result with no per-dataset results', () => { + expect(tallySeedObjects(undefined)).toEqual([]); + }); +}); + +describe('the install answer says where the sample rows went', () => { + it('names the rows written outside the package and why the skipped row was not written', async () => { + const rt = await boot(dir); + const res = await rt.install(APP); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + const seeded = res.payload.data.seeded; + // The loader's totals stay as they were. + expect(seeded).toMatchObject({ mode: 'inline', inserted: 5, updated: 0, skipped: 1 }); + expect(seeded.objects).toEqual([ + expect.objectContaining({ object: 'crm_lead', inPackage: true, inserted: 2 }), + expect.objectContaining({ object: 'crm_order', inPackage: true, inserted: 1, noRowToUpdate: 1, existing: 0, withdrawn: 0 }), + expect.objectContaining({ object: 'sys_activity', inPackage: false, inserted: 2 }), + ]); + const line = rt.logger.info.mock.calls.map((c) => String(c[0])).find((m) => m.includes('inline seed for com.example.crm')); + expect(line).toContain('outside the package: sys_activity=2'); + expect(line).toContain('skipped (no row to update): crm_order=1'); + }); +}); + +describe('GET …/install-local/seed-locale', () => { + it('answers the install\'s own resolver for the caller, with the package default the confirm passes', async () => { + localeAnswer = { locale: 'en', source: 'app-default' }; + const rt = await boot(dir); + const res = await rt.seedLocale({ appDefaultLocale: 'en' }); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + expect(res.payload).toEqual({ success: true, data: { locale: 'en', source: 'app-default' } }); + expect(localeQuestions).toHaveLength(1); + expect(localeQuestions[0]).toMatchObject({ appDefaultLocale: 'en' }); + expect(typeof localeQuestions[0].userId).toBe('string'); + // No `seeds`: the confirm asks before any dataset is loaded, so every rung is read. + expect(localeQuestions[0].seeds).toBeUndefined(); + }); + + it('answers null when no rung answers: every dataset loads', async () => { + const rt = await boot(dir); + const res = await rt.seedLocale(); + expect(res.payload).toEqual({ success: true, data: { locale: null, source: null } }); + }); + + it('refuses an unknown query parameter with a located 400', async () => { + expect(SEED_LOCALE_QUERY_PARAMS).toEqual(['appDefaultLocale']); + const rt = await boot(dir); + const res = await rt.seedLocale({ locale: 'zh-CN' }); + expect(res.status).toBe(400); + expect(res.payload.error.code).toBe('VALIDATION_ERROR'); + expect(localeQuestions).toHaveLength(0); + }); + + it('a read that throws is a 500 naming no language, never a guess', async () => { + localeAnswer = new Error('settings down'); + const rt = await boot(dir); + const res = await rt.seedLocale({ appDefaultLocale: 'en' }); + expect(res.status).toBe(500); + expect(res.payload.success).toBe(false); + expect(res.payload.error.message).toContain('settings down'); + }); +}); diff --git a/packages/cloud-connection/src/marketplace-install-seed-report.ts b/packages/cloud-connection/src/marketplace-install-seed-report.ts new file mode 100644 index 00000000000..247d5dd5d56 --- /dev/null +++ b/packages/cloud-connection/src/marketplace-install-seed-report.ts @@ -0,0 +1,172 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * Two readings the install confirm and the install result need from the + * install-local door (objectstack#39681), kept out of the door's own file. + * + * ## Where the sample rows went, per object + * + * The loader's totals (`inserted`, `updated`, `skipped`) add up every dataset + * the package ships, including datasets on objects the package does not + * define: a platform object such as `sys_activity`, whose rows a package seeds + * as timeline pointers. Those rows are not the package's records. The + * sample-data count and the purge do not read them as such, so an install note + * built from the totals claimed more "sample records" than the clear then + * offered to remove. A `skipped` row was explained as "already there, or + * deleted after an earlier load" even on an empty database, where neither can + * be true. + * + * {@link tallySeedObjects} splits the run by object, from the loader's own + * per-dataset results, and says which objects are the package's and why each + * skipped row was not written: + * + * - `existing`: its key matched a row that was already there, left as it is + * (an `ignore` dataset, or a replay that changed nothing). The loader + * records the row it matched in `landedIds`, so these are the skipped rows + * that landed somewhere. + * - `withdrawn`: the landed-key record keeps it out. It landed here on an + * earlier load and a person removed it. + * - `noRowToUpdate`: an `update` dataset's key found no row. Such a dataset + * only ever writes onto a row that exists, so nothing was written. + * + * The last two land on no row, and are told apart by the dataset's `mode`. + * + * ## The language the samples will load in, asked before the install + * + * {@link resolveSeedLocaleForPreview} asks `resolveSeedLocaleForLoad`, the + * function the install's own seed asks, for the caller and the caller's active + * organization. The confirm can then name the language before the install + * runs. The rungs are the runtime's, never repeated here. + */ + +/** One object's share of a seed run. */ +export interface SeedObjectTally { + object: string; + /** The installing package defines this object. `false`: a platform object, or another package's. */ + inPackage: boolean; + inserted: number; + updated: number; + /** Skipped rows whose key matched a row already there, left as it is. */ + existing: number; + /** Skipped rows the landed-key record keeps out: a person removed them after an earlier load. */ + withdrawn: number; + /** Skipped rows of an `update` dataset whose key found no row. */ + noRowToUpdate: number; + errors: number; +} + +interface LoaderDatasetResult { + object?: unknown; + mode?: unknown; + inserted?: unknown; + updated?: unknown; + skipped?: unknown; + errored?: unknown; + landedIds?: unknown; +} + +const count = (value: unknown): number => (typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0); + +/** + * The object names a package body defines: every `objects` entry's `name`, + * through the collection reader the door uses (`resolveStackCollection`). + */ +export function packageObjectNames(objects: readonly unknown[]): Set { + const names = new Set(); + for (const o of objects) { + const name = (o as { name?: unknown } | null)?.name; + if (typeof name === 'string' && name.length > 0) names.add(name); + } + return names; +} + +/** + * The run split by object, in the order the loader wrote them. `results` is + * the loader's `results` (one entry per dataset). `packageObjects` absent: + * every object reads as the package's. + */ +export function tallySeedObjects(results: unknown, packageObjects?: ReadonlySet): SeedObjectTally[] { + const byObject = new Map(); + for (const raw of Array.isArray(results) ? results : []) { + const r = (raw ?? {}) as LoaderDatasetResult; + if (typeof r.object !== 'string' || r.object.length === 0) continue; + const inserted = count(r.inserted); + const updated = count(r.updated); + const skipped = count(r.skipped); + const landed = Array.isArray(r.landedIds) ? r.landedIds.length : 0; + // A skipped row that matched a row is recorded as landed on it; the + // inserted and updated rows are the rest of `landedIds`. + const existing = Math.min(skipped, Math.max(0, landed - inserted - updated)); + const unmatched = skipped - existing; + let tally = byObject.get(r.object); + if (!tally) { + tally = { + object: r.object, + inPackage: packageObjects ? packageObjects.has(r.object) : true, + inserted: 0, + updated: 0, + existing: 0, + withdrawn: 0, + noRowToUpdate: 0, + errors: 0, + }; + byObject.set(r.object, tally); + } + tally.inserted += inserted; + tally.updated += updated; + tally.existing += existing; + if (r.mode === 'update') tally.noRowToUpdate += unmatched; + else tally.withdrawn += unmatched; + tally.errors += count(r.errored); + } + return [...byObject.values()]; +} + +/** One line for the door's log: the objects outside the package, and the skipped rows by reason. */ +export function describeSeedTally(tallies: readonly SeedObjectTally[]): string { + const outside = tallies.filter((t) => !t.inPackage && t.inserted + t.updated > 0); + const parts: string[] = []; + if (outside.length > 0) { + parts.push(`outside the package: ${outside.map((t) => `${t.object}=${t.inserted + t.updated}`).join(', ')}`); + } + for (const [reason, pick] of [ + ['already there', (t: SeedObjectTally) => t.existing], + ['removed after an earlier load', (t: SeedObjectTally) => t.withdrawn], + ['no row to update', (t: SeedObjectTally) => t.noRowToUpdate], + ] as const) { + const hit = tallies.filter((t) => pick(t) > 0); + if (hit.length > 0) parts.push(`skipped (${reason}): ${hit.map((t) => `${t.object}=${pick(t)}`).join(', ')}`); + } + return parts.join('; '); +} + +/** The closed query-parameter set of `GET …/install-local/seed-locale` (AGENTS.md, route rule 5). */ +export const SEED_LOCALE_QUERY_PARAMS: readonly string[] = Object.freeze(['appDefaultLocale']); + +/** What `GET …/install-local/seed-locale` answers: the locale an install now would load, and which rung chose it. */ +export interface SeedLocalePreview { + /** `null`: no rung answers, so every dataset loads (the loader's unrestricted spelling). */ + locale: string | null; + source: 'organization-setting' | 'user' | 'app-default' | null; +} + +/** + * The seed locale an install run now, by this caller, in this organization, + * would pick: `resolveSeedLocaleForLoad` with the same three inputs the + * install's seed hands it. `appDefaultLocale` is the package's declared + * `i18n.defaultLocale`, which the confirm reads off the body it is about to + * install. A settings or user read that throws reaches the caller, as it does + * for the install. + */ +export async function resolveSeedLocaleForPreview( + host: unknown, + question: { organizationId?: string; userId?: string; appDefaultLocale?: string }, +): Promise { + const { resolveSeedLocaleForLoad } = await import('@objectstack/runtime'); + const resolved = await resolveSeedLocaleForLoad(host, { + organizationId: question.organizationId, + userId: question.userId, + appDefaultLocale: question.appDefaultLocale, + }); + return resolved ? { locale: resolved.locale, source: resolved.source } : { locale: null, source: null }; +} From da1c3931f80315f4207a9e3479e372cbc1f14253 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 14:34:16 +0000 Subject: [PATCH 2/4] feat(app-shell, i18n): the install confirm names the sample-data language, the install note agrees with the clear, and a reinstall offers no accepted grant Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L9qibzuc2GU96KTJbcqdg8 --- .../install-sample-language-and-counts.md | 14 ++ .../marketplace/MarketplacePackagePage.tsx | 73 +++++- ...ePackagePage.installConfirm-39681.test.tsx | 226 ++++++++++++++++++ .../__tests__/sampleDataCounts-39681.test.ts | 61 +++++ .../marketplace/installConfirmReadings.ts | 102 ++++++++ .../src/console/marketplace/installPreview.ts | 22 ++ .../src/console/marketplace/marketplaceApi.ts | 65 +++++ .../console/marketplace/sampleDataNotice.ts | 83 +++++-- .../i18n/src/namespaces/marketplace/ar.ts | 21 ++ .../i18n/src/namespaces/marketplace/de.ts | 13 + .../i18n/src/namespaces/marketplace/en.ts | 13 + .../i18n/src/namespaces/marketplace/es.ts | 15 ++ .../i18n/src/namespaces/marketplace/fr.ts | 15 ++ .../i18n/src/namespaces/marketplace/ja.ts | 13 + .../i18n/src/namespaces/marketplace/ko.ts | 13 + .../i18n/src/namespaces/marketplace/pt-BR.ts | 15 ++ .../i18n/src/namespaces/marketplace/ru.ts | 17 ++ .../src/namespaces/marketplace/zh-Hans.ts | 13 + .../src/namespaces/marketplace/zh-Hant.ts | 13 + 19 files changed, 786 insertions(+), 21 deletions(-) create mode 100644 .changeset/install-sample-language-and-counts.md create mode 100644 ui/packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.installConfirm-39681.test.tsx create mode 100644 ui/packages/app-shell/src/console/marketplace/__tests__/sampleDataCounts-39681.test.ts create mode 100644 ui/packages/app-shell/src/console/marketplace/installConfirmReadings.ts diff --git a/.changeset/install-sample-language-and-counts.md b/.changeset/install-sample-language-and-counts.md new file mode 100644 index 00000000000..b8ad0ef61be --- /dev/null +++ b/.changeset/install-sample-language-and-counts.md @@ -0,0 +1,14 @@ +--- +"@objectstack/cloud-connection": patch +"@object-ui/app-shell": patch +"@object-ui/i18n": patch +--- + +Clause-②: no +Metadata-protocol: none + +The local marketplace install confirm now names the language an app's sample records will load in, when the app ships them per language. It asks the runtime first: `GET /api/v1/marketplace/install-local/seed-locale?appDefaultLocale=` answers `{ locale, source }` from the install's own choice (the organization's language setting, then the installing user's language, then the app's declared default). When that language is not the one the administrator reads the console in, the confirm says so and links to Language & Region, where the organization's language is set. The order of that choice is unchanged. + +The install answer's `seeded` gains `objects`: the run split by object, whether the package defines each object, and why each skipped row was not written (`existing`, `withdrawn`, `noRowToUpdate`). The install note now counts only the package's own records as sample records, so it agrees with the clear and the sample-data count. Rows written to an object the package does not define (a platform object's timeline pointers) and updates that found no record are named instead of counted. "Already here, or deleted after an earlier load" is said only for rows where that is true. `inserted`, `updated` and `skipped` keep their meaning, and a runtime without `objects` is read as before. + +A reinstall confirm opens with a reinstall's line, and no longer suggests an Everyone grant the administrator already accepted. diff --git a/ui/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx b/ui/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx index 8d084afce6b..56d061cea9d 100644 --- a/ui/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx +++ b/ui/packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx @@ -101,6 +101,7 @@ import { useDependencyMissingText } from './dependencyMissing.js'; import { useProtocolCheckSkippedText } from './protocolCheckSkipped.js'; import { ProtocolCheckSkippedNote } from './ProtocolCheckSkippedNote.js'; import { extensionsBeyondPackage, installPreviewOf, type InstallPreview } from './installPreview.js'; +import { languageName, seedLanguageDiffers, useInstallConfirmReadings } from './installConfirmReadings.js'; import { forgetSampleData, noteServedSampleCount, @@ -177,6 +178,11 @@ function majorOf(version: string): number { return Number(version.trim().split('.')[0]); } +/** `sys_activity (4), crm_order (1)` — the objects an install note names, each with its count. */ +function objectCountList(items: readonly { object: string; count: number }[]): string { + return items.map((o) => `${o.object} (${o.count})`).join(', '); +} + /** The side panel's entry for a version, the target of the dialog's release-notes link. */ function versionEntryId(version: string): string { return `marketplace-version-${version}`; @@ -1132,6 +1138,14 @@ function MarketplacePackagePageBody() { const localInstall = (marketplaceEnabled ? localInstalls.find((i) => !!data && i.manifestId === data.package.manifest_id) : localInstalls.find((i) => i.packageId === packageId)) ?? null; + // objectstack#39681 — what the open confirm asks the runtime: the language + // the sample records load in, and (on a reinstall) the suggested grants + // already accepted, which are not offered again. + const confirmReadings = useInstallConfirmReadings( + confirmLocalOpen, + previewRead && previewRead.packageId === packageId ? previewRead.preview : null, + localInstall?.manifestId ?? null, + ); // ADR-0090 D5 — an installed package's suggested audience bindings, on every // visit and not only in an install's own result: a package installed earlier, @@ -1383,7 +1397,8 @@ function MarketplacePackagePageBody() { record or link that did not load, listed under a disclosure. */} {localResult.sampleData ? (
- {localResult.sampleData.outcome.written > 0 || localResult.sampleData.outcome.kept > 0 || localResult.sampleData.reinstall ? ( + {localResult.sampleData.outcome.written > 0 || localResult.sampleData.outcome.kept > 0 || localResult.sampleData.reinstall + || localResult.sampleData.outcome.outside.length > 0 || localResult.sampleData.outcome.noRowToUpdate.length > 0 ? (

{localResult.sampleData.outcome.written > 0 ? <>{t('marketplace.detail.sampleDataLoaded', { count: localResult.sampleData.outcome.written })}{' '} @@ -1391,6 +1406,21 @@ function MarketplacePackagePageBody() { {localResult.sampleData.outcome.kept > 0 ? <>{t('marketplace.detail.sampleDataKept', { count: localResult.sampleData.outcome.kept })}{' '} : null} + {/* objectstack#39681 — rows written beside the sample records, to + objects the package does not define, and updates that found + no record: named, so the counts agree with the clear's. */} + {localResult.sampleData.outcome.outside.length > 0 + ? {t('marketplace.detail.sampleDataOutside', { + count: localResult.sampleData.outcome.outside.reduce((n, o) => n + o.count, 0), + objects: objectCountList(localResult.sampleData.outcome.outside), + })}{' '} + : null} + {localResult.sampleData.outcome.noRowToUpdate.length > 0 + ? {t('marketplace.detail.sampleDataNoRowToUpdate', { + count: localResult.sampleData.outcome.noRowToUpdate.reduce((n, o) => n + o.count, 0), + objects: objectCountList(localResult.sampleData.outcome.noRowToUpdate), + })}{' '} + : null} {localResult.sampleData.reinstall ? t('marketplace.detail.sampleDataReinstall') : null}

) : null} @@ -2033,7 +2063,7 @@ function MarketplacePackagePageBody() { {!localPreviewRead ? t('marketplace.install.preview.reading') : localPreviewRead.preview - ? t('marketplace.install.preview.intro') + ? t(localInstall ? 'marketplace.install.preview.reinstallIntro' : 'marketplace.install.preview.intro') : t('marketplace.install.preview.unreadable')} @@ -2052,13 +2082,48 @@ function MarketplacePackagePageBody() { ? t('marketplace.install.preview.atMost', { count: localPreviewRead.preview.sampleRecords }) : localPreviewRead.preview.sampleRecords} + {localPreviewRead.preview.sampleRecordsByLanguage && ( + <> +
{t('marketplace.install.preview.sampleLanguage')}
+
+ {confirmReadings.seedLocale === 'reading' + ? t('marketplace.install.preview.sampleLanguageReading') + : confirmReadings.seedLocale === null + ? t('marketplace.install.preview.byLanguage') + : confirmReadings.seedLocale.locale === null + ? t('marketplace.install.preview.sampleLanguageAll') + : languageName(confirmReadings.seedLocale.locale, displayLocale)} +
+ + )} + {/* objectstack#39681 — the samples load in another language than + the one the installer reads: said before the click, with the + page where the organization's language is set. */} + {localPreviewRead.preview.sampleRecordsByLanguage + && confirmReadings.seedLocale !== null && confirmReadings.seedLocale !== 'reading' + && seedLanguageDiffers(confirmReadings.seedLocale.locale, language) && ( +

+ {t('marketplace.install.preview.languageMismatch', { + seed: languageName(confirmReadings.seedLocale.locale!, displayLocale), + console: languageName(language, displayLocale), + })}{' '} + { e.preventDefault(); setConfirmLocalOpen(false); navigate('/apps/setup/system/settings/localization'); }} + data-testid="install-preview-language-settings" + > + {t('marketplace.install.preview.languageSettings')} + +

+ )} {localPreviewRead.preview.sampleRecords > 0 && (

{t('marketplace.install.preview.sampleNote')}

)} - {localPreviewRead.preview.suggestedGrants.length > 0 && ( + {localPreviewRead.preview.suggestedGrants.some((set) => !confirmReadings.acceptedGrants.has(set)) && (
    - {localPreviewRead.preview.suggestedGrants.map((set) => ( + {localPreviewRead.preview.suggestedGrants.filter((set) => !confirmReadings.acceptedGrants.has(set)).map((set) => (
  • {t('marketplace.install.preview.suggestsEveryone', { set })}
  • ))}
diff --git a/ui/packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.installConfirm-39681.test.tsx b/ui/packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.installConfirm-39681.test.tsx new file mode 100644 index 00000000000..a1ff642010b --- /dev/null +++ b/ui/packages/app-shell/src/console/marketplace/__tests__/MarketplacePackagePage.installConfirm-39681.test.tsx @@ -0,0 +1,226 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#39681 — the local install confirm, measured on a 简体中文 console + * over an organization with no language: it named no language for the sample + * records (HotCRM then loaded its English story), and a reinstall offered + * again the Everyone grant the administrator had already accepted, under a + * first install's opening line. + * + * Same harness as `MarketplacePackagePage.installPreview-30325.test.tsx`: one + * stubbed `fetch` answers by path, and `t` echoes the key. + */ + +import '@testing-library/jest-dom/vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; +import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; + +vi.mock('react-router-dom', () => ({ + useNavigate: () => vi.fn(), + useParams: () => ({ packageId: 'pkg_crm' }), +})); + +vi.mock('@object-ui/auth', async (importOriginal) => ({ + ...(await importOriginal>()), + useWorkspaceAdminStatus: () => ({ isAdmin: true, isResolved: true }), +})); + +vi.mock('@object-ui/i18n', async (importOriginal) => ({ + ...(await importOriginal>()), + useObjectTranslation: () => ({ + t: (key: string, o?: Record) => { + const facts = ['name', 'count', 'set'].filter((k) => o?.[k] !== undefined).map((k) => `${k}=${String(o?.[k])}`); + return facts.length > 0 ? `«${key}|${facts.join('|')}»` : `«${key}»`; + }, + language: 'en', + }), +})); + +vi.mock('../../../assistant/assistantBus', () => ({ emitMetadataRefresh: () => {} })); +vi.mock('../../../providers/MetadataProvider', () => ({ useMetadata: () => ({ refresh: async () => {} }) })); +vi.mock('../../../components/SuggestedBindingsPanel', () => ({ + SuggestedBindingsPanel: () =>
, +})); +vi.mock('../ConnectorCredentialsStep', () => ({ + ConnectorCredentialsStep: () =>
, +})); + +import { initRuntimeConfig, resetRuntimeConfigForTesting } from '../../../runtime-config'; +import { MarketplacePackagePage } from '../MarketplacePackagePage'; + +const PKG = 'app.acme.crm'; +const INSTALL_PATH = '/api/v1/marketplace/install-local'; +const MANIFEST_PATH = '/api/v1/marketplace/packages/pkg_crm/versions/latest/manifest'; +const CATALOG_PACKAGE = { + package: { id: 'pkg_crm', manifest_id: PKG, display_name: 'Acme CRM', latest_version: { id: 'ver_6', version: '6.0.0' } }, + versions: [{ id: 'ver_6', version: '6.0.0' }], +}; +const records = (n: number) => Array.from({ length: n }, (_, i) => ({ name: `r${i}` })); + +/** A flattened marketplace bundle, the shape a published app's version serves. */ +const BUNDLE = { + manifest: { id: PKG, version: '6.0.0', type: 'app', name: 'Acme CRM' }, + objects: [{ name: 'crm_account' }, { name: 'crm_contact' }, { name: 'crm_lead' }], + permissions: [{ name: 'crm_user', isDefault: true }, { name: 'crm_admin' }], + data: [ + { object: 'crm_account', externalId: 'name', records: records(5) }, + { object: 'crm_contact', externalId: 'email', records: records(4) }, + ], +}; + +const MANAGED = { manifestId: PKG, version: '6.0.0', versionId: 'ver_6', installedAt: '2026-11-05T00:00:00Z', upgradedFrom: null, hotLoaded: true }; + +const answer = (status: number, body: unknown) => ({ + ok: status >= 200 && status < 300, + status, + statusText: '', + headers: new Headers({ 'content-type': 'application/json' }), + json: async () => body, + text: async () => JSON.stringify(body), +}); + +let calls: string[] = []; +let seedLocale: { locale: string | null; source: string | null } | null = null; +let seedLocaleQueries: Array = []; +let accepted: unknown[] = []; + +async function boot(manifest: { status: number; body?: unknown }, catalog: unknown = CATALOG_PACKAGE, installed: unknown[] = []) { + calls = []; + resetRuntimeConfigForTesting(); + vi.stubGlobal('fetch', vi.fn(async (input: unknown, init?: { method?: string }) => { + const path = new URL(String(input), 'http://console.test').pathname; + const method = (init?.method ?? 'GET').toUpperCase(); + calls.push(`${method} ${path}`); + if (path === '/api/v1/runtime/config') { + return answer(200, { + cloudUrl: '', singleEnvironment: true, + features: { installLocal: true, marketplace: true, aiStudio: true, autoPublishAiBuilds: true }, + branding: { productName: 'ObjectOS', productShortName: 'ObjectOS' }, + }); + } + if (path === INSTALL_PATH && method === 'GET') return answer(200, { success: true, data: { items: installed, total: installed.length } }); + if (path === INSTALL_PATH && method === 'POST') return answer(200, { success: true, data: MANAGED }); + if (path === MANIFEST_PATH) { + // `status: 0`: the manifest read never answers, so the page stays "reading". + if (manifest.status === 0) return new Promise(() => {}); + return manifest.status === 200 + ? answer(200, { success: true, data: { manifest: manifest.body, version: '6.0.0', version_id: 'ver_6' } }) + : answer(manifest.status, { success: false, error: { code: 'NOT_FOUND', message: 'no manifest' } }); + } + if (path === '/api/v1/marketplace/packages/pkg_crm') return answer(200, { success: true, data: catalog }); + if (path === `${INSTALL_PATH}/seed-locale`) { + seedLocaleQueries.push(new URL(String(input), 'http://console.test').searchParams.get('appDefaultLocale')); + return seedLocale ? answer(200, { success: true, data: seedLocale }) : answer(404, { success: false }); + } + if (path === '/api/v1/security/suggested-bindings') return answer(200, { success: true, data: { suggestions: accepted } }); + return answer(404, { success: false, error: { code: 'NOT_FOUND', message: `no route ${method} ${path}` } }); + })); + await initRuntimeConfig(); +} + +const posts = () => calls.filter((c) => c === `POST ${INSTALL_PATH}`); + +/** Render, settle the manifest read, and click the page's Install. */ +async function openConfirm() { + render(); + const button = await screen.findByRole('button', { name: '«marketplace.action.install»' }); + await waitFor(() => expect(calls).toContain(`GET ${MANIFEST_PATH}`)); + await act(async () => {}); + fireEvent.click(button); + return screen.findByTestId('install-preview-dialog'); +} + +afterEach(() => { + cleanup(); + vi.unstubAllGlobals(); + resetRuntimeConfigForTesting(); +}); + + +const LOCALE_BUNDLE = { + ...BUNDLE, + i18n: { defaultLocale: 'en' }, + data: [ + { object: 'crm_account', locale: ['en'], records: records(6) }, + { object: 'crm_account', locale: ['zh-CN'], records: records(6) }, + ], +}; + +const installedAt = (version: string) => ({ + packageId: PKG, versionId: `ver_${version}`, manifestId: PKG, version, + installedAt: '2026-11-05T00:00:00Z', withSampleData: true, +}); + +afterEach(() => { seedLocale = null; seedLocaleQueries = []; accepted = []; }); + +describe('the confirm names the language the sample records load in (objectstack#39681)', () => { + it('asks the runtime with the package default and names the answer; a language other than the console\'s is said, with the setting', async () => { + seedLocale = { locale: 'zh-CN', source: 'organization-setting' }; + await boot({ status: 200, body: LOCALE_BUNDLE }); + const dialog = await openConfirm(); + + await waitFor(() => expect(within(dialog).getByTestId('install-preview-sample-language')).not.toHaveTextContent('sampleLanguageReading')); + expect(seedLocaleQueries).toEqual(['en']); + expect(within(dialog).getByTestId('install-preview-sample-language').textContent).toMatch(/Chinese|zh/); + expect(within(dialog).getByTestId('install-preview-language-mismatch')).toHaveTextContent('«marketplace.install.preview.languageMismatch»'); + expect(within(dialog).getByTestId('install-preview-language-settings')).toHaveAttribute('href', '/apps/setup/system/settings/localization'); + }); + + it('CONTROL: the console\'s own language: named, and no notice', async () => { + seedLocale = { locale: 'en', source: 'app-default' }; + await boot({ status: 200, body: LOCALE_BUNDLE }); + const dialog = await openConfirm(); + + await waitFor(() => expect(within(dialog).getByTestId('install-preview-sample-language')).toHaveTextContent('English')); + expect(within(dialog).queryByTestId('install-preview-language-mismatch')).not.toBeInTheDocument(); + }); + + it('a runtime that cannot answer: no language is named, and no notice', async () => { + await boot({ status: 200, body: LOCALE_BUNDLE }); + const dialog = await openConfirm(); + + await waitFor(() => expect(within(dialog).getByTestId('install-preview-sample-language')).toHaveTextContent('«marketplace.install.preview.byLanguage»')); + expect(within(dialog).queryByTestId('install-preview-language-mismatch')).not.toBeInTheDocument(); + }); + + it('CONTROL: datasets not scoped by locale: no language row, and the runtime is not asked', async () => { + await boot({ status: 200, body: BUNDLE }); + const dialog = await openConfirm(); + + expect(within(dialog).queryByTestId('install-preview-sample-language')).not.toBeInTheDocument(); + expect(calls.some((c) => c.endsWith('/seed-locale'))).toBe(false); + }); +}); + +describe('a reinstall confirm describes a reinstall and offers no grant already accepted (objectstack#39681)', () => { + async function openReinstall() { + render(); + await waitFor(() => expect(calls).toContain(`GET ${MANIFEST_PATH}`)); + await act(async () => {}); + fireEvent.click(await screen.findByRole('button', { name: '«marketplace.action.reinstall»' })); + return screen.findByTestId('install-preview-dialog'); + } + + it('an accepted Everyone grant is not suggested again, and the opening line is the reinstall\'s', async () => { + accepted = [{ id: 's1', package_id: PKG, permission_set_name: 'crm_user', anchor: 'everyone', status: 'confirmed' }]; + await boot({ status: 200, body: BUNDLE }, CATALOG_PACKAGE, [installedAt('5.0.0')]); + const dialog = await openReinstall(); + + expect(within(dialog).getByText('«marketplace.install.preview.reinstallIntro»')).toBeInTheDocument(); + await waitFor(() => expect(within(dialog).queryByTestId('install-preview-suggestions')).not.toBeInTheDocument()); + }); + + it('CONTROL: a grant not yet accepted is still suggested on a reinstall', async () => { + await boot({ status: 200, body: BUNDLE }, CATALOG_PACKAGE, [installedAt('5.0.0')]); + const dialog = await openReinstall(); + + expect(within(dialog).getByTestId('install-preview-suggestions')).toHaveTextContent('«marketplace.install.preview.suggestsEveryone|set=crm_user»'); + }); + + it('CONTROL: a first install opens with the install\'s line', async () => { + await boot({ status: 200, body: BUNDLE }); + const dialog = await openConfirm(); + + expect(within(dialog).getByText('«marketplace.install.preview.intro»')).toBeInTheDocument(); + }); +}); diff --git a/ui/packages/app-shell/src/console/marketplace/__tests__/sampleDataCounts-39681.test.ts b/ui/packages/app-shell/src/console/marketplace/__tests__/sampleDataCounts-39681.test.ts new file mode 100644 index 00000000000..2f62307ef68 --- /dev/null +++ b/ui/packages/app-shell/src/console/marketplace/__tests__/sampleDataCounts-39681.test.ts @@ -0,0 +1,61 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#39681 — the install note, the clear and the sample-data count + * agree. Measured on HotCRM 7.1.0 into an empty database: the answer said + * `inserted: 486, skipped: 1`, the note claimed 486 sample records and + * explained the skipped one as "already here, or deleted after an earlier + * load", while the clear and the count said 482. The 4 were `sys_activity` + * timeline pointers, a platform object the package does not define. + */ + +import { describe, expect, it } from 'vitest'; +import { sampleDataOutcome, sampleRecordsLoaded } from '../sampleDataNotice'; +import type { LocalInstallSeeded } from '../marketplaceApi'; + +const tally = (object: string, inPackage: boolean, o: Partial<{ inserted: number; updated: number; existing: number; withdrawn: number; noRowToUpdate: number }> = {}) => ({ + object, inPackage, inserted: 0, updated: 0, existing: 0, withdrawn: 0, noRowToUpdate: 0, errors: 0, ...o, +}); + +const HOTCRM: LocalInstallSeeded = { + mode: 'inline', inserted: 486, updated: 0, skipped: 1, errors: 0, + objects: [ + tally('crm_account', true, { inserted: 300 }), + tally('crm_sales_order', true, { inserted: 182, noRowToUpdate: 1 }), + tally('sys_activity', false, { inserted: 4 }), + ], +}; + +describe('with the per-object report', () => { + it('the sample records are the package\'s own objects\' rows, the number the clear counts', () => { + expect(sampleRecordsLoaded({ seeded: HOTCRM })).toBe(482); + }); + + it('the note writes the package\'s rows, names the other writes and the update that found no record, and keeps nothing', () => { + expect(sampleDataOutcome({ seeded: HOTCRM })).toEqual({ + written: 482, + kept: 0, + outside: [{ object: 'sys_activity', count: 4 }], + noRowToUpdate: [{ object: 'crm_sales_order', count: 1 }], + problems: 0, + details: [], + }); + }); + + it('a reinstall over live sample data: the rows already there are kept, and still counted as in place', () => { + const seeded: LocalInstallSeeded = { + mode: 'inline', inserted: 0, updated: 0, skipped: 5, + objects: [tally('crm_account', true, { existing: 3, withdrawn: 2 })], + }; + expect(sampleRecordsLoaded({ seeded })).toBe(3); + expect(sampleDataOutcome({ seeded })).toMatchObject({ written: 0, kept: 5, outside: [], noRowToUpdate: [] }); + }); +}); + +describe('CONTROL: an older runtime sends no per-object report', () => { + it('reads the run\'s totals as before', () => { + const seeded: LocalInstallSeeded = { mode: 'inline', inserted: 486, updated: 0, skipped: 1 }; + expect(sampleRecordsLoaded({ seeded })).toBe(487); + expect(sampleDataOutcome({ seeded })).toEqual({ written: 486, kept: 1, outside: [], noRowToUpdate: [], problems: 0, details: [] }); + }); +}); diff --git a/ui/packages/app-shell/src/console/marketplace/installConfirmReadings.ts b/ui/packages/app-shell/src/console/marketplace/installConfirmReadings.ts new file mode 100644 index 00000000000..0a7a03d3696 --- /dev/null +++ b/ui/packages/app-shell/src/console/marketplace/installConfirmReadings.ts @@ -0,0 +1,102 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * Two readings the local install confirm makes while it is open + * (objectstack#39681), beside what the package body says it adds + * (`installPreview.ts`): + * + * - **The language the sample records load in.** A package whose datasets are + * scoped by locale loads the ones for the language the install picks: the + * organization's language setting, then the installing user's language, then + * the app's declared default. The confirm asks the runtime which one an + * install now would pick (`GET …/install-local/seed-locale`, the install's + * own resolver), so it can name it, and say so when it is not the language + * the installer is reading the console in. + * - **The grants already accepted.** A reinstall of a package whose suggested + * Everyone grant was accepted would otherwise suggest it again. The + * suggestions list says which were accepted (`status: 'confirmed'`); those + * are not offered again. A list that could not be read leaves the offer as + * the package body states it. + */ + +import { useEffect, useState } from 'react'; +import { getSeedLocalePreview, type SeedLocalePreview } from './marketplaceApi.js'; +import { listSuggestedBindings } from '../../services/suggestedBindingsApi.js'; +import type { InstallPreview } from './installPreview.js'; + +/** `reading` while the runtime is asked; `null` when it could not answer. */ +export type SeedLocaleReading = SeedLocalePreview | 'reading' | null; + +export interface InstallConfirmReadings { + seedLocale: SeedLocaleReading; + /** Suggested sets whose Everyone grant was already accepted for this package. */ + acceptedGrants: ReadonlySet; +} + +const NONE: ReadonlySet = new Set(); + +/** + * The readings for an open confirm. `preview` is the package body's preview + * (`null` or `undefined` when unread); `installedAs` is the manifest id of the + * install this one goes over, `null` for a first install. + */ +export function useInstallConfirmReadings( + open: boolean, + preview: InstallPreview | null | undefined, + installedAs: string | null, +): InstallConfirmReadings { + const [seedLocale, setSeedLocale] = useState(null); + const [acceptedGrants, setAcceptedGrants] = useState>(NONE); + const asksLanguage = open && !!preview?.sampleRecordsByLanguage; + const appDefaultLocale = preview?.appDefaultLocale; + const asksGrants = open && !!installedAs && (preview?.suggestedGrants.length ?? 0) > 0; + + useEffect(() => { + if (!asksLanguage) { setSeedLocale(null); return; } + let cancelled = false; + setSeedLocale('reading'); + void getSeedLocalePreview(appDefaultLocale).then((answer) => { if (!cancelled) setSeedLocale(answer); }); + return () => { cancelled = true; }; + }, [asksLanguage, appDefaultLocale]); + + useEffect(() => { + if (!asksGrants || !installedAs) { setAcceptedGrants(NONE); return; } + let cancelled = false; + listSuggestedBindings({ packageId: installedAs, status: 'confirmed' }) + .then((rows) => { + if (cancelled) return; + setAcceptedGrants(new Set(rows + .filter((r) => r.anchor === 'everyone' && r.status === 'confirmed') + .map((r) => r.permission_set_name))); + }) + .catch(() => { if (!cancelled) setAcceptedGrants(NONE); }); + return () => { cancelled = true; }; + }, [asksGrants, installedAs]); + + return { seedLocale, acceptedGrants }; +} + +/** The language part of a locale tag, lower-cased: `zh-CN` → `zh`. */ +function languageOf(tag: string): string { + return tag.trim().split(/[-_]/)[0]!.toLowerCase(); +} + +/** + * Whether the samples load in a language other than the one the installer is + * reading: compared by language, so `zh-CN` samples for a `zh-Hans` console + * are no mismatch. `false` when either is unknown. + */ +export function seedLanguageDiffers(seedLocale: string | null | undefined, consoleLanguage: string | null | undefined): boolean { + if (!seedLocale || !consoleLanguage) return false; + return languageOf(seedLocale) !== languageOf(consoleLanguage); +} + +/** A locale's name in the reader's language (`en` → 「英语」 for a zh reader), or the tag itself. */ +export function languageName(tag: string, displayLocale: string): string { + try { + const names = new Intl.DisplayNames([displayLocale], { type: 'language' }); + return names.of(tag) ?? tag; + } catch { + return tag; + } +} diff --git a/ui/packages/app-shell/src/console/marketplace/installPreview.ts b/ui/packages/app-shell/src/console/marketplace/installPreview.ts index 49455247533..e1b0095c61a 100644 --- a/ui/packages/app-shell/src/console/marketplace/installPreview.ts +++ b/ui/packages/app-shell/src/console/marketplace/installPreview.ts @@ -69,6 +69,13 @@ export interface InstallPreview { objectExtensions: MarketplaceObjectExtension[]; /** The names of the objects the package's bodies define, in the order declared. */ definedObjects: string[]; + /** + * The package's declared `i18n.defaultLocale` (objectstack#39681): the last + * rung of the install's seed-locale choice, which the confirm hands the + * runtime to ask which language the samples load in. `undefined` when the + * package declares none. + */ + appDefaultLocale?: string; } const ALL_ENVS = ['prod', 'dev', 'test']; @@ -224,5 +231,20 @@ export function installPreviewOf(served: unknown): InstallPreview | null { objects, permissionSets, sampleRecords, sampleRecordsAtMost, sampleRecordsByLanguage, suggestedGrants, objectExtensions: objectExtensionsIn(bodies, definedObjects), definedObjects, + appDefaultLocale: declaredDefaultLocale(served), }; } + +/** + * The body's `i18n.defaultLocale`, read as the install door reads it + * (`appDefaultSeedLocale` in `@objectstack/runtime`): the top level first, + * then a nested `manifest`. A legacy `i18n` ARRAY declares no default. + */ +function declaredDefaultLocale(served: Record): string | undefined { + for (const i18n of [served.i18n, isRecord(served.manifest) ? served.manifest.i18n : undefined]) { + if (isRecord(i18n) && typeof i18n.defaultLocale === 'string' && i18n.defaultLocale.trim() !== '') { + return i18n.defaultLocale.trim(); + } + } + return undefined; +} diff --git a/ui/packages/app-shell/src/console/marketplace/marketplaceApi.ts b/ui/packages/app-shell/src/console/marketplace/marketplaceApi.ts index 9b419b7ade2..b05749a4666 100644 --- a/ui/packages/app-shell/src/console/marketplace/marketplaceApi.ts +++ b/ui/packages/app-shell/src/console/marketplace/marketplaceApi.ts @@ -1058,6 +1058,71 @@ export interface LocalInstallSeeded { reason?: string; errorSample?: string; errorList?: LocalInstallSeedProblem[]; + /** + * objectstack#39681 — the run by object ({@link LocalInstallSeededObject}). + * Absent from a runtime that predates it; the counts above still add up the + * whole run. + */ + objects?: LocalInstallSeededObject[]; +} + +/** + * One object's share of an `inline` seed run (objectstack#39681): whether the + * package defines the object (`inPackage: false` is a platform object, such as + * the timeline's `sys_activity`, whose rows are not the package's records and + * are not what the sample-data count and the clear count), what it wrote, and + * why each skipped row was not written: already there and left as it is + * (`existing`), removed by a person after an earlier load (`withdrawn`), or an + * update whose record was not found (`noRowToUpdate`). + */ +export interface LocalInstallSeededObject { + object: string; + inPackage: boolean; + inserted: number; + updated: number; + existing: number; + withdrawn: number; + noRowToUpdate: number; + errors: number; +} + +/** + * objectstack#39681 — the language an install now would load locale-scoped + * sample data in, and which rung chose it: the organization's language + * setting, the installing user's language, or the app's declared default. + * `null`: no rung answers, so every dataset loads. + */ +export interface SeedLocalePreview { + locale: string | null; + source: 'organization-setting' | 'user' | 'app-default' | null; +} + +/** + * `GET /api/v1/marketplace/install-local/seed-locale` — asked by the install + * confirm before the install, with the package's declared default locale + * (`appDefaultLocale`), so it can name the language. The runtime answers from + * the install's own resolver. `null` when the answer could not be read (an + * older runtime, a refusal, a failed read): the confirm then names no language. + */ +export async function getSeedLocalePreview(appDefaultLocale: string | undefined): Promise { + try { + const qs = appDefaultLocale ? `?appDefaultLocale=${encodeURIComponent(appDefaultLocale)}` : ''; + const res = await serverFetch(`${API_BASE}/install-local/seed-locale${qs}`, { + credentials: 'include', + headers: { 'Accept': 'application/json' }, + }); + if (!res.ok) return null; + const payload: any = await res.json().catch(() => ({})); + const data: any = payload?.data; + if (!data || typeof data !== 'object') return null; + const source = data.source; + return { + locale: typeof data.locale === 'string' && data.locale.length > 0 ? data.locale : null, + source: source === 'organization-setting' || source === 'user' || source === 'app-default' ? source : null, + }; + } catch { + return null; + } } /** One problem of a seed run: the loader's reference-resolution error, as the install answer carries it. */ diff --git a/ui/packages/app-shell/src/console/marketplace/sampleDataNotice.ts b/ui/packages/app-shell/src/console/marketplace/sampleDataNotice.ts index b4f1ad33289..13c199cec02 100644 --- a/ui/packages/app-shell/src/console/marketplace/sampleDataNotice.ts +++ b/ui/packages/app-shell/src/console/marketplace/sampleDataNotice.ts @@ -26,34 +26,65 @@ * read began (an install, a reseed or a clear) is fresher and is kept. */ -import type { LocalInstallSeeded } from './marketplaceApi.js'; +import type { LocalInstallSeeded, LocalInstallSeededObject } from './marketplaceApi.js'; /** * How many sample records an install left in place, at most, from its - * answer's `seeded`: `inserted + updated + skipped` of an `inline` run (its - * `skipped` are records whose row was already there, or was deleted after an - * earlier load and is kept out). It is what the clear and the banner count, - * not what the run wrote ({@link sampleDataOutcome}). `null` when the install ran no - * seed now (`skipped`, `refused`, `replayer`), sent no report, or its run left - * no record in place, so the note says nothing about sample data. + * answer's `seeded`. With the answer's per-object report (`objects`, + * objectstack#39681): the package's own objects' `inserted + updated + + * existing`, the rows the sample-data count and the clear count too. Rows + * written to an object the package does not define (a platform object's + * timeline pointers) are not its sample records, and a skipped row that + * landed on no row is not in place. Without that report (an older runtime): + * `inserted + updated + skipped` of the run, an upper bound. It is what the + * clear and the banner count, not what the run wrote ({@link sampleDataOutcome}). + * `null` when the install ran no seed now (`skipped`, `refused`, `replayer`), + * sent no report, or its run left no record in place, so the note says + * nothing about sample data. */ export function sampleRecordsLoaded(answer: { seeded?: LocalInstallSeeded }): number | null { const seeded = answer.seeded; if (!seeded || seeded.mode !== 'inline') return null; - const count = (seeded.inserted ?? 0) + (seeded.updated ?? 0) + (seeded.skipped ?? 0); + const objects = packageObjectsOf(seeded); + const count = objects + ? objects.reduce((n, o) => n + num(o.inserted) + num(o.updated) + num(o.existing), 0) + : num(seeded.inserted) + num(seeded.updated) + num(seeded.skipped); return count > 0 ? count : null; } +/** A non-negative count, `0` for anything else. */ +const num = (value: unknown): number => (typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0); + +/** The answer's per-object report, when it sent one. */ +const objectsOf = (seeded: LocalInstallSeeded): LocalInstallSeededObject[] | null => + Array.isArray(seeded.objects) ? seeded.objects.filter((o) => o && typeof o.object === 'string') : null; + +/** The report's objects the package defines, when it sent one. */ +const packageObjectsOf = (seeded: LocalInstallSeeded): LocalInstallSeededObject[] | null => + objectsOf(seeded)?.filter((o) => o.inPackage !== false) ?? null; + +/** One object named with a count, as the install note lists them. */ +export interface SampleDataObjectCount { + object: string; + count: number; +} + /** - * What an install's sample-data run did, as its answer says it: the records - * it wrote (`inserted + updated`), the records it did not write because their - * row was already there or was deleted after an earlier load (`skipped`), and - * its problems: `problems` counts them (`errors`), and `details` names each - * one the answer lists (`errorList`, or `errorSample` when it lists none). + * What an install's sample-data run did, as its answer says it: the sample + * records it wrote (`written`), the ones it did not write because their row + * was already there or a person deleted it after an earlier load (`kept`), + * the rows it wrote to objects the package does not define (`outside`, by + * object), the updates that found no record to change (`noRowToUpdate`, by + * object), and its problems: `problems` counts them (`errors`), and `details` + * names each one the answer lists (`errorList`, or `errorSample` when it lists + * none). Without the per-object report (an older runtime) every written row + * is a sample record and every skipped one is `kept`. */ export interface SampleDataOutcome { written: number; kept: number; + outside: SampleDataObjectCount[]; + noRowToUpdate: SampleDataObjectCount[]; problems: number; details: string[]; } @@ -66,8 +97,26 @@ export interface SampleDataOutcome { export function sampleDataOutcome(answer: { seeded?: LocalInstallSeeded }): SampleDataOutcome | null { const seeded = answer.seeded; if (!seeded || seeded.mode !== 'inline') return null; - const written = (seeded.inserted ?? 0) + (seeded.updated ?? 0); - const kept = seeded.skipped ?? 0; + const objects = objectsOf(seeded); + let written: number; + let kept: number; + let outside: SampleDataObjectCount[] = []; + let noRowToUpdate: SampleDataObjectCount[] = []; + if (objects) { + const own = objects.filter((o) => o.inPackage !== false); + written = own.reduce((n, o) => n + num(o.inserted) + num(o.updated), 0); + kept = own.reduce((n, o) => n + num(o.existing) + num(o.withdrawn), 0); + outside = objects + .filter((o) => o.inPackage === false) + .map((o) => ({ object: o.object, count: num(o.inserted) + num(o.updated) })) + .filter((o) => o.count > 0); + noRowToUpdate = objects + .map((o) => ({ object: o.object, count: num(o.noRowToUpdate) })) + .filter((o) => o.count > 0); + } else { + written = num(seeded.inserted) + num(seeded.updated); + kept = num(seeded.skipped); + } const listed = Array.isArray(seeded.errorList) ? seeded.errorList .map((e) => (e && typeof e.message === 'string' ? e.message.trim() : '')) @@ -76,8 +125,8 @@ export function sampleDataOutcome(answer: { seeded?: LocalInstallSeeded }): Samp const sample = typeof seeded.errorSample === 'string' ? seeded.errorSample.trim() : ''; const details = listed.length > 0 ? listed : sample.length > 0 ? [sample] : []; const problems = Math.max(seeded.errors ?? 0, details.length); - if (written === 0 && kept === 0 && problems === 0) return null; - return { written, kept, problems, details }; + if (written === 0 && kept === 0 && problems === 0 && outside.length === 0 && noRowToUpdate.length === 0) return null; + return { written, kept, outside, noRowToUpdate, problems, details }; } /** One installed package's sample data, as this session learned it. */ diff --git a/ui/packages/i18n/src/namespaces/marketplace/ar.ts b/ui/packages/i18n/src/namespaces/marketplace/ar.ts index 52758a2a011..5fd957a1d63 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/ar.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/ar.ts @@ -122,6 +122,20 @@ const ar = { sampleDataKept_few: 'لم تُكتب سجلات تجريبية عددها {{count}}: كانت موجودة بالفعل، أو حُذفت بعد تحميل سابق.', sampleDataKept_many: 'لم تُكتب سجلات تجريبية عددها {{count}}: كانت موجودة بالفعل، أو حُذفت بعد تحميل سابق.', sampleDataKept_other: 'لم تُكتب سجلات تجريبية عددها {{count}}: كانت موجودة بالفعل، أو حُذفت بعد تحميل سابق.', + sampleDataOutside: 'كُتبت بجانبها {{count}} سجلات أخرى في كائنات لا يعرّفها هذا التطبيق: {{objects}}. هذه ليست سجلات تجريبية للتطبيق، ومسح البيانات التجريبية يُبقيها.', + sampleDataOutside_zero: 'كُتبت بجانبها {{count}} سجلات أخرى في كائنات لا يعرّفها هذا التطبيق: {{objects}}. هذه ليست سجلات تجريبية للتطبيق، ومسح البيانات التجريبية يُبقيها.', + sampleDataOutside_one: 'كُتبت بجانبها {{count}} سجلات أخرى في كائنات لا يعرّفها هذا التطبيق: {{objects}}. هذه ليست سجلات تجريبية للتطبيق، ومسح البيانات التجريبية يُبقيها.', + sampleDataOutside_two: 'كُتبت بجانبها {{count}} سجلات أخرى في كائنات لا يعرّفها هذا التطبيق: {{objects}}. هذه ليست سجلات تجريبية للتطبيق، ومسح البيانات التجريبية يُبقيها.', + sampleDataOutside_few: 'كُتبت بجانبها {{count}} سجلات أخرى في كائنات لا يعرّفها هذا التطبيق: {{objects}}. هذه ليست سجلات تجريبية للتطبيق، ومسح البيانات التجريبية يُبقيها.', + sampleDataOutside_many: 'كُتبت بجانبها {{count}} سجلات أخرى في كائنات لا يعرّفها هذا التطبيق: {{objects}}. هذه ليست سجلات تجريبية للتطبيق، ومسح البيانات التجريبية يُبقيها.', + sampleDataOutside_other: 'كُتبت بجانبها {{count}} سجلات أخرى في كائنات لا يعرّفها هذا التطبيق: {{objects}}. هذه ليست سجلات تجريبية للتطبيق، ومسح البيانات التجريبية يُبقيها.', + sampleDataNoRowToUpdate: 'لم تجد {{count}} تغييرات تجريبية سجلًا لتغييره، لذا لم يُكتب لها شيء: {{objects}}.', + sampleDataNoRowToUpdate_zero: 'لم تجد {{count}} تغييرات تجريبية سجلًا لتغييره، لذا لم يُكتب لها شيء: {{objects}}.', + sampleDataNoRowToUpdate_one: 'لم تجد {{count}} تغييرات تجريبية سجلًا لتغييره، لذا لم يُكتب لها شيء: {{objects}}.', + sampleDataNoRowToUpdate_two: 'لم تجد {{count}} تغييرات تجريبية سجلًا لتغييره، لذا لم يُكتب لها شيء: {{objects}}.', + sampleDataNoRowToUpdate_few: 'لم تجد {{count}} تغييرات تجريبية سجلًا لتغييره، لذا لم يُكتب لها شيء: {{objects}}.', + sampleDataNoRowToUpdate_many: 'لم تجد {{count}} تغييرات تجريبية سجلًا لتغييره، لذا لم يُكتب لها شيء: {{objects}}.', + sampleDataNoRowToUpdate_other: 'لم تجد {{count}} تغييرات تجريبية سجلًا لتغييره، لذا لم يُكتب لها شيء: {{objects}}.', sampleDataReinstall: 'لا يعيد التثبيت مرة أخرى السجلات التجريبية المحذوفة أو التي مسحتها. يعيدها «إعادة تحميل البيانات التجريبية».', sampleDataProblems: 'لم يُحمَّل من السجلات التجريبية أو الروابط بينها ما عدده {{count}}.', sampleDataProblems_zero: 'لم يُحمَّل من السجلات التجريبية أو الروابط بينها ما عدده {{count}}.', @@ -260,6 +274,13 @@ const ar = { byLanguage: "يعتمد على لغة التثبيت", sampleNote: "تُحمَّل السجلات التجريبية مع التطبيق. يمكنك حذفها من هذه الصفحة بعد التثبيت.", suggestsEveryone: "بعد التثبيت سيقترح منح «{{set}}» لجميع المستخدمين المسجّلين (موضع Everyone). لن يُمنح أي شيء حتى توافق.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: 'تعيد إعادة التثبيت تسجيل هذه الحزمة بما يلي:', + sampleLanguage: 'لغة البيانات التجريبية', + sampleLanguageReading: 'جارٍ القراءة…', + sampleLanguageAll: 'كل اللغات التي يتضمنها التطبيق', + languageMismatch: 'ستُحمَّل البيانات التجريبية باللغة {{seed}} وليس {{console}}، اللغة التي تقرأ بها. لتحميلها بلغتك، عيّن لغة المؤسسة أولًا ثم ثبّت.', + languageSettings: 'فتح اللغة والمنطقة', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/de.ts b/ui/packages/i18n/src/namespaces/marketplace/de.ts index 15cd2015e6d..18aa519c66f 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/de.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/de.ts @@ -106,6 +106,12 @@ const de = { sampleDataKept: '{{count}} Beispieldatensatz/-sätze wurden nicht geschrieben: Sie waren schon vorhanden oder wurden nach einem früheren Laden gelöscht.', sampleDataKept_one: '{{count}} Beispieldatensatz wurde nicht geschrieben: Er war schon vorhanden oder wurde nach einem früheren Laden gelöscht.', sampleDataKept_other: '{{count}} Beispieldatensätze wurden nicht geschrieben: Sie waren schon vorhanden oder wurden nach einem früheren Laden gelöscht.', + sampleDataOutside: 'Daneben wurden {{count}} weitere Datensätze in Objekte geschrieben, die diese App nicht definiert: {{objects}}. Sie sind keine Beispieldatensätze der App, und das Löschen der Beispieldaten lässt sie bestehen.', + sampleDataOutside_one: 'Daneben wurden {{count}} weitere Datensätze in Objekte geschrieben, die diese App nicht definiert: {{objects}}. Sie sind keine Beispieldatensätze der App, und das Löschen der Beispieldaten lässt sie bestehen.', + sampleDataOutside_other: 'Daneben wurden {{count}} weitere Datensätze in Objekte geschrieben, die diese App nicht definiert: {{objects}}. Sie sind keine Beispieldatensätze der App, und das Löschen der Beispieldaten lässt sie bestehen.', + sampleDataNoRowToUpdate: '{{count}} Beispieländerungen fanden keinen zu ändernden Datensatz, daher wurde für sie nichts geschrieben: {{objects}}.', + sampleDataNoRowToUpdate_one: '{{count}} Beispieländerungen fanden keinen zu ändernden Datensatz, daher wurde für sie nichts geschrieben: {{objects}}.', + sampleDataNoRowToUpdate_other: '{{count}} Beispieländerungen fanden keinen zu ändernden Datensatz, daher wurde für sie nichts geschrieben: {{objects}}.', sampleDataReinstall: 'Eine erneute Installation stellt gelöschte oder entfernte Beispieldatensätze nicht wieder her. „Beispieldaten neu laden“ tut das.', sampleDataProblems: '{{count}} Beispieldatensatz/-sätze oder Verknüpfung(en) zwischen Datensätzen wurden nicht geladen.', sampleDataProblems_one: '{{count}} Beispieldatensatz oder eine Verknüpfung zwischen Datensätzen wurde nicht geladen.', @@ -232,6 +238,13 @@ const de = { byLanguage: "hängt von der Sprache der Installation ab", sampleNote: "Beispieldatensätze werden mit der App geladen. Sie können sie nach der Installation auf dieser Seite entfernen.", suggestsEveryone: "Danach wird empfohlen, den Berechtigungssatz {{set}} allen angemeldeten Benutzern (Position Everyone) zu gewähren. Gewährt wird nichts, bevor Sie zustimmen.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: 'Bei der Neuinstallation wird dieses Paket erneut registriert, mit Folgendem:', + sampleLanguage: 'Sprache der Beispieldaten', + sampleLanguageReading: 'Wird gelesen…', + sampleLanguageAll: 'alle Sprachen, die die App mitbringt', + languageMismatch: 'Die Beispieldaten werden auf {{seed}} geladen, nicht auf {{console}}, der Sprache, in der Sie lesen. Um sie in Ihrer Sprache zu laden, legen Sie zuerst die Sprache der Organisation fest und installieren Sie dann.', + languageSettings: 'Sprache und Region öffnen', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/en.ts b/ui/packages/i18n/src/namespaces/marketplace/en.ts index dc184ebf182..3f80a9ad8e2 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/en.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/en.ts @@ -71,6 +71,12 @@ const en = { sampleDataKept: '{{count}} sample record(s) were not written: they were already here, or were deleted after an earlier load.', sampleDataKept_one: '{{count}} sample record was not written: it was already here, or was deleted after an earlier load.', sampleDataKept_other: '{{count}} sample records were not written: they were already here, or were deleted after an earlier load.', + sampleDataOutside: '{{count}} other record(s) were written beside them, to objects this app does not define: {{objects}}. They are not sample records of the app, and clearing the sample data leaves them.', + sampleDataOutside_one: '{{count}} other record(s) were written beside them, to objects this app does not define: {{objects}}. They are not sample records of the app, and clearing the sample data leaves them.', + sampleDataOutside_other: '{{count}} other record(s) were written beside them, to objects this app does not define: {{objects}}. They are not sample records of the app, and clearing the sample data leaves them.', + sampleDataNoRowToUpdate: '{{count}} sample change(s) found no record to change, so nothing was written for them: {{objects}}.', + sampleDataNoRowToUpdate_one: '{{count}} sample change(s) found no record to change, so nothing was written for them: {{objects}}.', + sampleDataNoRowToUpdate_other: '{{count}} sample change(s) found no record to change, so nothing was written for them: {{objects}}.', sampleDataReinstall: 'Installing again does not bring back sample records that were deleted or cleared. Re-seed sample data does.', sampleDataProblems: '{{count}} sample record(s) or link(s) between records did not load.', sampleDataProblems_one: '{{count}} sample record or link between records did not load.', @@ -204,6 +210,13 @@ const en = { byLanguage: "depends on the language the install uses", sampleNote: "Sample records load with the app. You can clear them from this page after install.", suggestsEveryone: "Afterwards it suggests granting \"{{set}}\" to all signed-in users (the Everyone position). Nothing is granted until you accept.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: 'Reinstalling registers this package again, with the following:', + sampleLanguage: 'Sample data language', + sampleLanguageReading: 'Reading…', + sampleLanguageAll: 'every language the app ships', + languageMismatch: 'The sample data will load in {{seed}}, not {{console}}, the language you are reading. To load it in your language, set the organization\'s language first, then install.', + languageSettings: 'Open Language & Region', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/es.ts b/ui/packages/i18n/src/namespaces/marketplace/es.ts index 874429c02f9..14c20be779e 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/es.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/es.ts @@ -110,6 +110,14 @@ const es = { sampleDataKept_one: '{{count}} registro de ejemplo no se escribió: ya estaba aquí o se eliminó después de una carga anterior.', sampleDataKept_many: '{{count}} de registros de ejemplo no se escribieron: ya estaban aquí o se eliminaron después de una carga anterior.', sampleDataKept_other: '{{count}} registros de ejemplo no se escribieron: ya estaban aquí o se eliminaron después de una carga anterior.', + sampleDataOutside: 'Además se escribieron {{count}} registros más en objetos que esta aplicación no define: {{objects}}. No son registros de ejemplo de la aplicación y borrar los datos de ejemplo los conserva.', + sampleDataOutside_one: 'Además se escribieron {{count}} registros más en objetos que esta aplicación no define: {{objects}}. No son registros de ejemplo de la aplicación y borrar los datos de ejemplo los conserva.', + sampleDataOutside_many: 'Además se escribieron {{count}} registros más en objetos que esta aplicación no define: {{objects}}. No son registros de ejemplo de la aplicación y borrar los datos de ejemplo los conserva.', + sampleDataOutside_other: 'Además se escribieron {{count}} registros más en objetos que esta aplicación no define: {{objects}}. No son registros de ejemplo de la aplicación y borrar los datos de ejemplo los conserva.', + sampleDataNoRowToUpdate: '{{count}} cambios de ejemplo no encontraron ningún registro que modificar, así que no se escribió nada para ellos: {{objects}}.', + sampleDataNoRowToUpdate_one: '{{count}} cambios de ejemplo no encontraron ningún registro que modificar, así que no se escribió nada para ellos: {{objects}}.', + sampleDataNoRowToUpdate_many: '{{count}} cambios de ejemplo no encontraron ningún registro que modificar, así que no se escribió nada para ellos: {{objects}}.', + sampleDataNoRowToUpdate_other: '{{count}} cambios de ejemplo no encontraron ningún registro que modificar, así que no se escribió nada para ellos: {{objects}}.', sampleDataReinstall: 'Instalar de nuevo no recupera los registros de ejemplo eliminados o borrados. «Volver a cargar datos de ejemplo» sí lo hace.', sampleDataProblems: '{{count}} registro(s) de ejemplo o vínculo(s) entre registros no se cargaron.', sampleDataProblems_one: '{{count}} registro de ejemplo o vínculo entre registros no se cargó.', @@ -239,6 +247,13 @@ const es = { byLanguage: "depende del idioma de la instalación", sampleNote: "Los registros de ejemplo se cargan con la aplicación. Puedes borrarlos desde esta página después de instalar.", suggestsEveryone: "Después sugerirá conceder «{{set}}» a todos los usuarios con sesión iniciada (la posición Everyone). No se concede nada hasta que lo aceptes.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: 'La reinstalación vuelve a registrar este paquete, con lo siguiente:', + sampleLanguage: 'Idioma de los datos de ejemplo', + sampleLanguageReading: 'Leyendo…', + sampleLanguageAll: 'todos los idiomas que incluye la aplicación', + languageMismatch: 'Los datos de ejemplo se cargarán en {{seed}}, no en {{console}}, el idioma en que lee. Para cargarlos en su idioma, configure primero el idioma de la organización y luego instale.', + languageSettings: 'Abrir Idioma y región', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/fr.ts b/ui/packages/i18n/src/namespaces/marketplace/fr.ts index 25580e43b58..4e74d39fdd2 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/fr.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/fr.ts @@ -110,6 +110,14 @@ const fr = { sampleDataKept_one: '{{count}} enregistrement d\'exemple n\'a pas été écrit : il était déjà là ou a été supprimé après un chargement précédent.', sampleDataKept_many: '{{count}} d\'enregistrements d\'exemple n\'ont pas été écrits : ils étaient déjà là ou ont été supprimés après un chargement précédent.', sampleDataKept_other: '{{count}} enregistrements d\'exemple n\'ont pas été écrits : ils étaient déjà là ou ont été supprimés après un chargement précédent.', + sampleDataOutside: '{{count}} autres enregistrements ont été écrits à côté, dans des objets que cette application ne définit pas : {{objects}}. Ce ne sont pas des enregistrements d\'exemple de l\'application, et effacer les données d\'exemple les conserve.', + sampleDataOutside_one: '{{count}} autres enregistrements ont été écrits à côté, dans des objets que cette application ne définit pas : {{objects}}. Ce ne sont pas des enregistrements d\'exemple de l\'application, et effacer les données d\'exemple les conserve.', + sampleDataOutside_many: '{{count}} autres enregistrements ont été écrits à côté, dans des objets que cette application ne définit pas : {{objects}}. Ce ne sont pas des enregistrements d\'exemple de l\'application, et effacer les données d\'exemple les conserve.', + sampleDataOutside_other: '{{count}} autres enregistrements ont été écrits à côté, dans des objets que cette application ne définit pas : {{objects}}. Ce ne sont pas des enregistrements d\'exemple de l\'application, et effacer les données d\'exemple les conserve.', + sampleDataNoRowToUpdate: '{{count}} modifications d\'exemple n\'ont trouvé aucun enregistrement à modifier, donc rien n\'a été écrit pour elles : {{objects}}.', + sampleDataNoRowToUpdate_one: '{{count}} modifications d\'exemple n\'ont trouvé aucun enregistrement à modifier, donc rien n\'a été écrit pour elles : {{objects}}.', + sampleDataNoRowToUpdate_many: '{{count}} modifications d\'exemple n\'ont trouvé aucun enregistrement à modifier, donc rien n\'a été écrit pour elles : {{objects}}.', + sampleDataNoRowToUpdate_other: '{{count}} modifications d\'exemple n\'ont trouvé aucun enregistrement à modifier, donc rien n\'a été écrit pour elles : {{objects}}.', sampleDataReinstall: 'Réinstaller ne rétablit pas les enregistrements d\'exemple supprimés ou effacés. « Recharger les données d\'exemple » le fait.', sampleDataProblems: '{{count}} enregistrement(s) d\'exemple ou lien(s) entre enregistrements n\'ont pas été chargés.', sampleDataProblems_one: '{{count}} enregistrement d\'exemple ou lien entre enregistrements n\'a pas été chargé.', @@ -239,6 +247,13 @@ const fr = { byLanguage: "dépend de la langue de l'installation", sampleNote: "Les enregistrements d'exemple sont chargés avec l'application. Vous pouvez les supprimer depuis cette page après l'installation.", suggestsEveryone: "Ensuite, il suggérera d'accorder « {{set}} » à tous les utilisateurs connectés (position Everyone). Rien n'est accordé tant que vous n'acceptez pas.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: 'La réinstallation enregistre de nouveau ce paquet, avec ce qui suit :', + sampleLanguage: 'Langue des données d\'exemple', + sampleLanguageReading: 'Lecture…', + sampleLanguageAll: 'toutes les langues fournies par l\'application', + languageMismatch: 'Les données d\'exemple seront chargées en {{seed}}, et non en {{console}}, la langue dans laquelle vous lisez. Pour les charger dans votre langue, définissez d\'abord la langue de l\'organisation, puis installez.', + languageSettings: 'Ouvrir Langue et région', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/ja.ts b/ui/packages/i18n/src/namespaces/marketplace/ja.ts index 1cacd3b7787..33668ecc655 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/ja.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/ja.ts @@ -106,6 +106,12 @@ const ja = { sampleDataKept: '{{count}} 件のサンプルレコードは書き込まれませんでした。すでに存在していたか、以前の読み込みの後に削除されています。', sampleDataKept_one: '{{count}} 件のサンプルレコードは書き込まれませんでした。すでに存在していたか、以前の読み込みの後に削除されています。', sampleDataKept_other: '{{count}} 件のサンプルレコードは書き込まれませんでした。すでに存在していたか、以前の読み込みの後に削除されています。', + sampleDataOutside: 'このほか、このアプリが定義していないオブジェクトに {{count}} 件のレコードが書き込まれました:{{objects}}。これらはアプリのサンプルレコードではなく、サンプルデータを消去しても残ります。', + sampleDataOutside_one: 'このほか、このアプリが定義していないオブジェクトに {{count}} 件のレコードが書き込まれました:{{objects}}。これらはアプリのサンプルレコードではなく、サンプルデータを消去しても残ります。', + sampleDataOutside_other: 'このほか、このアプリが定義していないオブジェクトに {{count}} 件のレコードが書き込まれました:{{objects}}。これらはアプリのサンプルレコードではなく、サンプルデータを消去しても残ります。', + sampleDataNoRowToUpdate: '{{count}} 件のサンプル変更は変更対象のレコードが見つからなかったため、書き込まれませんでした:{{objects}}。', + sampleDataNoRowToUpdate_one: '{{count}} 件のサンプル変更は変更対象のレコードが見つからなかったため、書き込まれませんでした:{{objects}}。', + sampleDataNoRowToUpdate_other: '{{count}} 件のサンプル変更は変更対象のレコードが見つからなかったため、書き込まれませんでした:{{objects}}。', sampleDataReinstall: 'もう一度インストールしても、削除またはクリアしたサンプルレコードは戻りません。戻すには「サンプルデータを再投入」を使います。', sampleDataProblems: '{{count}} 件のサンプルレコードまたはレコード間のリンクが読み込まれませんでした。', sampleDataProblems_one: '{{count}} 件のサンプルレコードまたはレコード間のリンクが読み込まれませんでした。', @@ -232,6 +238,13 @@ const ja = { byLanguage: "インストール時の言語によって異なります", sampleNote: "サンプルレコードはアプリと一緒に読み込まれます。インストール後、このページから削除できます。", suggestsEveryone: "インストール後、サインイン済みの全ユーザー(Everyone ポジション)に「{{set}}」を付与することが提案されます。承認するまで何も付与されません。", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: '再インストールすると、このパッケージが次の内容で再登録されます:', + sampleLanguage: 'サンプルデータの言語', + sampleLanguageReading: '読み込み中…', + sampleLanguageAll: 'アプリに含まれるすべての言語', + languageMismatch: 'サンプルデータは、表示中の{{console}}ではなく{{seed}}で読み込まれます。ご利用の言語で読み込むには、先に組織の言語を設定してからインストールしてください。', + languageSettings: '「言語と地域」を開く', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/ko.ts b/ui/packages/i18n/src/namespaces/marketplace/ko.ts index cb11c417306..5a02fdc12e2 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/ko.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/ko.ts @@ -106,6 +106,12 @@ const ko = { sampleDataKept: '샘플 레코드 {{count}}개는 쓰지 않았습니다. 이미 있었거나 이전에 불러온 뒤 삭제되었습니다.', sampleDataKept_one: '샘플 레코드 {{count}}개는 쓰지 않았습니다. 이미 있었거나 이전에 불러온 뒤 삭제되었습니다.', sampleDataKept_other: '샘플 레코드 {{count}}개는 쓰지 않았습니다. 이미 있었거나 이전에 불러온 뒤 삭제되었습니다.', + sampleDataOutside: '이 밖에 이 앱이 정의하지 않은 개체에 {{count}}개의 다른 레코드가 기록되었습니다: {{objects}}. 이는 앱의 샘플 레코드가 아니며, 샘플 데이터를 지워도 남습니다.', + sampleDataOutside_one: '이 밖에 이 앱이 정의하지 않은 개체에 {{count}}개의 다른 레코드가 기록되었습니다: {{objects}}. 이는 앱의 샘플 레코드가 아니며, 샘플 데이터를 지워도 남습니다.', + sampleDataOutside_other: '이 밖에 이 앱이 정의하지 않은 개체에 {{count}}개의 다른 레코드가 기록되었습니다: {{objects}}. 이는 앱의 샘플 레코드가 아니며, 샘플 데이터를 지워도 남습니다.', + sampleDataNoRowToUpdate: '{{count}}개의 샘플 변경은 변경할 레코드를 찾지 못해 기록되지 않았습니다: {{objects}}.', + sampleDataNoRowToUpdate_one: '{{count}}개의 샘플 변경은 변경할 레코드를 찾지 못해 기록되지 않았습니다: {{objects}}.', + sampleDataNoRowToUpdate_other: '{{count}}개의 샘플 변경은 변경할 레코드를 찾지 못해 기록되지 않았습니다: {{objects}}.', sampleDataReinstall: '다시 설치해도 삭제하거나 지운 샘플 레코드는 돌아오지 않습니다. 되돌리려면 "샘플 데이터 다시 적재"를 사용하세요.', sampleDataProblems: '샘플 레코드 또는 레코드 간 연결 {{count}}개를 불러오지 못했습니다.', sampleDataProblems_one: '샘플 레코드 또는 레코드 간 연결 {{count}}개를 불러오지 못했습니다.', @@ -232,6 +238,13 @@ const ko = { byLanguage: "설치에 쓰이는 언어에 따라 다름", sampleNote: "샘플 레코드는 앱과 함께 로드됩니다. 설치 후 이 페이지에서 지울 수 있습니다.", suggestsEveryone: "설치 후 로그인한 모든 사용자(Everyone 위치)에게 \"{{set}}\"을(를) 부여할 것을 제안합니다. 수락하기 전에는 아무것도 부여되지 않습니다.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: '다시 설치하면 이 패키지가 다음 내용으로 다시 등록됩니다:', + sampleLanguage: '샘플 데이터 언어', + sampleLanguageReading: '읽는 중…', + sampleLanguageAll: '앱에 포함된 모든 언어', + languageMismatch: '샘플 데이터는 현재 사용 중인 {{console}}가 아니라 {{seed}}로 로드됩니다. 사용 중인 언어로 로드하려면 먼저 조직 언어를 설정한 뒤 설치하세요.', + languageSettings: '언어 및 지역 열기', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/pt-BR.ts b/ui/packages/i18n/src/namespaces/marketplace/pt-BR.ts index 0520e156073..2fb9b81481b 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/pt-BR.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/pt-BR.ts @@ -110,6 +110,14 @@ const pt = { sampleDataKept_one: '{{count}} registro de exemplo não foi gravado: já estava aqui ou foi excluído depois de uma carga anterior.', sampleDataKept_many: '{{count}} de registros de exemplo não foram gravados: já estavam aqui ou foram excluídos depois de uma carga anterior.', sampleDataKept_other: '{{count}} registros de exemplo não foram gravados: já estavam aqui ou foram excluídos depois de uma carga anterior.', + sampleDataOutside: 'Além disso, {{count}} outros registros foram gravados em objetos que este aplicativo não define: {{objects}}. Eles não são registros de exemplo do aplicativo, e limpar os dados de exemplo os mantém.', + sampleDataOutside_one: 'Além disso, {{count}} outros registros foram gravados em objetos que este aplicativo não define: {{objects}}. Eles não são registros de exemplo do aplicativo, e limpar os dados de exemplo os mantém.', + sampleDataOutside_many: 'Além disso, {{count}} outros registros foram gravados em objetos que este aplicativo não define: {{objects}}. Eles não são registros de exemplo do aplicativo, e limpar os dados de exemplo os mantém.', + sampleDataOutside_other: 'Além disso, {{count}} outros registros foram gravados em objetos que este aplicativo não define: {{objects}}. Eles não são registros de exemplo do aplicativo, e limpar os dados de exemplo os mantém.', + sampleDataNoRowToUpdate: '{{count}} alterações de exemplo não encontraram registro para alterar, então nada foi gravado para elas: {{objects}}.', + sampleDataNoRowToUpdate_one: '{{count}} alterações de exemplo não encontraram registro para alterar, então nada foi gravado para elas: {{objects}}.', + sampleDataNoRowToUpdate_many: '{{count}} alterações de exemplo não encontraram registro para alterar, então nada foi gravado para elas: {{objects}}.', + sampleDataNoRowToUpdate_other: '{{count}} alterações de exemplo não encontraram registro para alterar, então nada foi gravado para elas: {{objects}}.', sampleDataReinstall: 'Instalar de novo não traz de volta registros de exemplo excluídos ou removidos. "Recarregar dados de exemplo" traz.', sampleDataProblems: '{{count}} registro(s) de exemplo ou vínculo(s) entre registros não foram carregados.', sampleDataProblems_one: '{{count}} registro de exemplo ou vínculo entre registros não foi carregado.', @@ -239,6 +247,13 @@ const pt = { byLanguage: "depende do idioma da instalação", sampleNote: "Os registros de exemplo são carregados com o app. Você pode removê-los nesta página após a instalação.", suggestsEveryone: "Depois, ele sugere conceder \"{{set}}\" a todos os usuários autenticados (a posição Everyone). Nada é concedido até que você aceite.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: 'A reinstalação registra este pacote novamente, com o seguinte:', + sampleLanguage: 'Idioma dos dados de exemplo', + sampleLanguageReading: 'Lendo…', + sampleLanguageAll: 'todos os idiomas que o aplicativo inclui', + languageMismatch: 'Os dados de exemplo serão carregados em {{seed}}, não em {{console}}, o idioma em que você está lendo. Para carregá-los no seu idioma, defina primeiro o idioma da organização e depois instale.', + languageSettings: 'Abrir Idioma e região', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/ru.ts b/ui/packages/i18n/src/namespaces/marketplace/ru.ts index e27787b333b..2ab4136ef7f 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/ru.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/ru.ts @@ -114,6 +114,16 @@ const ru = { sampleDataKept_few: 'Не записано демонстрационных записей: {{count}}. Они уже были здесь или были удалены после прошлой загрузки.', sampleDataKept_many: 'Не записано демонстрационных записей: {{count}}. Они уже были здесь или были удалены после прошлой загрузки.', sampleDataKept_other: 'Не записано демонстрационных записей: {{count}}. Они уже были здесь или были удалены после прошлой загрузки.', + sampleDataOutside: 'Кроме того, записано других записей: {{count}} — в объекты, которые это приложение не определяет: {{objects}}. Это не демонстрационные записи приложения, и очистка демонстрационных данных их не удаляет.', + sampleDataOutside_one: 'Кроме того, записано других записей: {{count}} — в объекты, которые это приложение не определяет: {{objects}}. Это не демонстрационные записи приложения, и очистка демонстрационных данных их не удаляет.', + sampleDataOutside_few: 'Кроме того, записано других записей: {{count}} — в объекты, которые это приложение не определяет: {{objects}}. Это не демонстрационные записи приложения, и очистка демонстрационных данных их не удаляет.', + sampleDataOutside_many: 'Кроме того, записано других записей: {{count}} — в объекты, которые это приложение не определяет: {{objects}}. Это не демонстрационные записи приложения, и очистка демонстрационных данных их не удаляет.', + sampleDataOutside_other: 'Кроме того, записано других записей: {{count}} — в объекты, которые это приложение не определяет: {{objects}}. Это не демонстрационные записи приложения, и очистка демонстрационных данных их не удаляет.', + sampleDataNoRowToUpdate: 'Демонстрационных изменений, не нашедших запись для изменения: {{count}}, поэтому для них ничего не записано: {{objects}}.', + sampleDataNoRowToUpdate_one: 'Демонстрационных изменений, не нашедших запись для изменения: {{count}}, поэтому для них ничего не записано: {{objects}}.', + sampleDataNoRowToUpdate_few: 'Демонстрационных изменений, не нашедших запись для изменения: {{count}}, поэтому для них ничего не записано: {{objects}}.', + sampleDataNoRowToUpdate_many: 'Демонстрационных изменений, не нашедших запись для изменения: {{count}}, поэтому для них ничего не записано: {{objects}}.', + sampleDataNoRowToUpdate_other: 'Демонстрационных изменений, не нашедших запись для изменения: {{count}}, поэтому для них ничего не записано: {{objects}}.', sampleDataReinstall: 'Повторная установка не возвращает удалённые или очищенные демонстрационные записи. Это делает «Перезагрузить демоданные».', sampleDataProblems: 'Не загружено демонстрационных записей или связей между записями: {{count}}.', sampleDataProblems_one: 'Не загружено демонстрационных записей или связей между записями: {{count}}.', @@ -246,6 +256,13 @@ const ru = { byLanguage: "зависит от языка установки", sampleNote: "Демонстрационные записи загружаются вместе с приложением. После установки их можно удалить на этой странице.", suggestsEveryone: "После установки будет предложено предоставить «{{set}}» всем вошедшим пользователям (позиция Everyone). Ничего не предоставляется, пока вы не примете предложение.", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: 'Повторная установка снова регистрирует этот пакет со следующим содержимым:', + sampleLanguage: 'Язык демонстрационных данных', + sampleLanguageReading: 'Чтение…', + sampleLanguageAll: 'все языки, которые поставляются с приложением', + languageMismatch: 'Демонстрационные данные будут загружены на языке «{{seed}}», а не «{{console}}», на котором вы читаете. Чтобы загрузить их на вашем языке, сначала задайте язык организации, затем установите.', + languageSettings: 'Открыть «Язык и регион»', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/zh-Hans.ts b/ui/packages/i18n/src/namespaces/marketplace/zh-Hans.ts index e5b1d4f2b06..84cd5ab9ec3 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/zh-Hans.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/zh-Hans.ts @@ -73,6 +73,12 @@ const zh = { sampleDataKept: '{{count}} 条示例记录没有写入:它们已经存在,或在之前载入后已被删除。', sampleDataKept_one: '{{count}} 条示例记录没有写入:它们已经存在,或在之前载入后已被删除。', sampleDataKept_other: '{{count}} 条示例记录没有写入:它们已经存在,或在之前载入后已被删除。', + sampleDataOutside: '另外写入了 {{count}} 条其他记录,属于本应用未定义的对象:{{objects}}。它们不是本应用的示例记录,清除示例数据时不会删除。', + sampleDataOutside_one: '另外写入了 {{count}} 条其他记录,属于本应用未定义的对象:{{objects}}。它们不是本应用的示例记录,清除示例数据时不会删除。', + sampleDataOutside_other: '另外写入了 {{count}} 条其他记录,属于本应用未定义的对象:{{objects}}。它们不是本应用的示例记录,清除示例数据时不会删除。', + sampleDataNoRowToUpdate: '{{count}} 条示例更改没有找到要修改的记录,因此没有写入:{{objects}}。', + sampleDataNoRowToUpdate_one: '{{count}} 条示例更改没有找到要修改的记录,因此没有写入:{{objects}}。', + sampleDataNoRowToUpdate_other: '{{count}} 条示例更改没有找到要修改的记录,因此没有写入:{{objects}}。', sampleDataReinstall: '再次安装不会恢复已删除或已清除的示例记录;要恢复它们,请使用“重新加载示例数据”。', sampleDataProblems: '有 {{count}} 条示例记录或记录之间的关联没有载入。', sampleDataProblems_one: '有 {{count}} 条示例记录或记录之间的关联没有载入。', @@ -199,6 +205,13 @@ const zh = { byLanguage: "取决于安装时使用的语言", sampleNote: "示例记录随应用一起加载,安装后可在本页清除。", suggestsEveryone: "安装后会建议将「{{set}}」授予所有已登录用户(Everyone 岗位)。在你接受之前不会授予任何权限。", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: '重新安装会再次注册此软件包,包含以下内容:', + sampleLanguage: '示例数据语言', + sampleLanguageReading: '正在读取…', + sampleLanguageAll: '应用自带的所有语言', + languageMismatch: '示例数据将以{{seed}}载入,而不是你当前使用的{{console}}。如需按你的语言载入,请先设置组织语言,再安装。', + languageSettings: '打开「语言与区域」', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy diff --git a/ui/packages/i18n/src/namespaces/marketplace/zh-Hant.ts b/ui/packages/i18n/src/namespaces/marketplace/zh-Hant.ts index 27f5ff501e5..648767ae687 100644 --- a/ui/packages/i18n/src/namespaces/marketplace/zh-Hant.ts +++ b/ui/packages/i18n/src/namespaces/marketplace/zh-Hant.ts @@ -68,6 +68,12 @@ const zhHant = { sampleDataKept: '{{count}} 條示例記錄沒有寫入:它們已經存在,或在之前載入後已被刪除。', sampleDataKept_one: '{{count}} 條示例記錄沒有寫入:它們已經存在,或在之前載入後已被刪除。', sampleDataKept_other: '{{count}} 條示例記錄沒有寫入:它們已經存在,或在之前載入後已被刪除。', + sampleDataOutside: '另外寫入了 {{count}} 條其他記錄,屬於本應用未定義的物件:{{objects}}。它們不是本應用的示例記錄,清除示例資料時不會刪除。', + sampleDataOutside_one: '另外寫入了 {{count}} 條其他記錄,屬於本應用未定義的物件:{{objects}}。它們不是本應用的示例記錄,清除示例資料時不會刪除。', + sampleDataOutside_other: '另外寫入了 {{count}} 條其他記錄,屬於本應用未定義的物件:{{objects}}。它們不是本應用的示例記錄,清除示例資料時不會刪除。', + sampleDataNoRowToUpdate: '{{count}} 條示例更改沒有找到要修改的記錄,因此沒有寫入:{{objects}}。', + sampleDataNoRowToUpdate_one: '{{count}} 條示例更改沒有找到要修改的記錄,因此沒有寫入:{{objects}}。', + sampleDataNoRowToUpdate_other: '{{count}} 條示例更改沒有找到要修改的記錄,因此沒有寫入:{{objects}}。', sampleDataReinstall: '再次安裝不會恢復已刪除或已清除的示例記錄;要恢復它們,請使用“重新載入示例資料”。', sampleDataProblems: '有 {{count}} 條示例記錄或記錄之間的關聯沒有載入。', sampleDataProblems_one: '有 {{count}} 條示例記錄或記錄之間的關聯沒有載入。', @@ -194,6 +200,13 @@ const zhHant = { byLanguage: "取決於安裝時使用的語言", sampleNote: "示例記錄隨應用一起載入,安裝後可在本頁清除。", suggestsEveryone: "安裝後會建議將「{{set}}」授予所有已登入使用者(Everyone 崗位)。在你接受之前不會授予任何權限。", + // objectstack#39681 — the reinstall's opening line, and the language the sample records load in. + reinstallIntro: '重新安裝會再次註冊此軟體包,包含以下內容:', + sampleLanguage: '示例資料語言', + sampleLanguageReading: '正在讀取…', + sampleLanguageAll: '應用自帶的所有語言', + languageMismatch: '示例資料將以{{seed}}載入,而不是你當前使用的{{console}}。如需按你的語言載入,請先設定組織語言,再安裝。', + languageSettings: '開啟「語言與區域」', }, }, // objectui#12146 — the install dialog opened as an UPDATE of the copy From 6d6e9310dc5225d3d2898f42f90905fef72e0a00 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 15:09:12 +0000 Subject: [PATCH 3/4] fix(cloud-connection): a seed run with no per-object report reports none, never a failed seed Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L9qibzuc2GU96KTJbcqdg8 --- .../cloud-connection/src/marketplace-install-local-plugin.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cloud-connection/src/marketplace-install-local-plugin.ts b/packages/cloud-connection/src/marketplace-install-local-plugin.ts index 8a3fefb74dc..e565fff9093 100644 --- a/packages/cloud-connection/src/marketplace-install-local-plugin.ts +++ b/packages/cloud-connection/src/marketplace-install-local-plugin.ts @@ -8142,7 +8142,9 @@ export class MarketplaceInstallLocalPlugin implements Plugin { // leaves the tally as the loader gave it, never the run. let own: Set | undefined; try { own = packageObjectNames(resolveStackCollection(manifest, 'objects')); } catch { /* tally as loaded */ } - const objects = own ? s.objects.map((t) => ({ ...t, inPackage: own.has(t.object) })) : s.objects; + // A run with no per-object report (a stand-in seed) reports none. + const tallied = Array.isArray(s.objects) ? s.objects : []; + const objects = own ? tallied.map((t) => ({ ...t, inPackage: own.has(t.object) })) : tallied; seedSummary = { mode: 'inline', ...s, objects }; const tally = describeSeedTally(objects); ctx.logger?.info?.(`[MarketplaceInstallLocal] inline seed for ${appId}${organizationId ? ` (org=${organizationId})` : ''}: inserted=${s.inserted} updated=${s.updated} skipped=${s.skipped} errors=${s.errors}${tally ? ` — ${tally}` : ''}`); From 7c119ca4af25f2fe238c3ac6f1df4aefa797a101 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 15:10:55 +0000 Subject: [PATCH 4/4] =?UTF-8?q?chore(changeset):=20declare=20the=20install?= =?UTF-8?q?-local=20widening=20as=20Clause-=E2=91=A1=20yes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01L9qibzuc2GU96KTJbcqdg8 --- .changeset/install-sample-language-and-counts.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.changeset/install-sample-language-and-counts.md b/.changeset/install-sample-language-and-counts.md index b8ad0ef61be..094b63887f4 100644 --- a/.changeset/install-sample-language-and-counts.md +++ b/.changeset/install-sample-language-and-counts.md @@ -4,9 +4,11 @@ "@object-ui/i18n": patch --- -Clause-②: no +Clause-②: yes (widening) Metadata-protocol: none +The widening: a new read-only route, `GET /api/v1/marketplace/install-local/seed-locale`, served to `manage_metadata` holders, and a new `objects` member on the install answer's `seeded`; nothing that was served before changes. + The local marketplace install confirm now names the language an app's sample records will load in, when the app ships them per language. It asks the runtime first: `GET /api/v1/marketplace/install-local/seed-locale?appDefaultLocale=` answers `{ locale, source }` from the install's own choice (the organization's language setting, then the installing user's language, then the app's declared default). When that language is not the one the administrator reads the console in, the confirm says so and links to Language & Region, where the organization's language is set. The order of that choice is unchanged. The install answer's `seeded` gains `objects`: the run split by object, whether the package defines each object, and why each skipped row was not written (`existing`, `withdrawn`, `noRowToUpdate`). The install note now counts only the package's own records as sample records, so it agrees with the clear and the sample-data count. Rows written to an object the package does not define (a platform object's timeline pointers) and updates that found no record are named instead of counted. "Already here, or deleted after an earlier load" is said only for rows where that is true. `inserted`, `updated` and `skipped` keep their meaning, and a runtime without `objects` is read as before.