Skip to content

Commit 15c5452

Browse files
committed
refactor(ui)!: fold the providers upload context into fields and data-objectstack, retire the package
UploadProvider and useUpload move into @object-ui/fields, next to the file, image and avatar widgets that read them. createObjectStackUploadAdapter and its options move into @object-ui/data-objectstack, beside the other fetch logic against an ObjectStack server. The UploadAdapter, UploadOptions and UploadResult contract both sides share goes into @object-ui/types, as DataSource does, because the two packages do not depend on each other. createS3Adapter and createAzureBlobAdapter had no consumer in the workspace or in hotcrm and retire with the package. createObjectUrlAdapter stays as the module-private fallback useUpload answers with when no provider is mounted. Every importer, alias line, mock and the fixed release group are re-pointed; the lockfile is regenerated. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fa9c0aa commit 15c5452

60 files changed

Lines changed: 304 additions & 2131 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/fields': patch
3+
'@object-ui/data-objectstack': patch
4+
---
5+
6+
refactor(fields, data-objectstack)!: `UploadProvider` moves into `@object-ui/fields`, the ObjectStack upload adapter into `@object-ui/data-objectstack`, and `@object-ui/providers` is retired
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/providers#*) the retired operand is a published ui package whose entry held a React upload context, its hook, four upload adapter factories and their TypeScript option and result types; no packages/spec schema, registered node type, ADR-0087 conversion surface or stored shape names any of them, so there is nothing for `objectstack migrate meta` to rewrite, and a consumer meets the move at its own import, where the compiler names the missing module -->
12+
13+
**BREAKING.** `@object-ui/providers` is retired: `18.3.0` is its last published version, and it gets no further release. Its one remaining job was the upload context the file, image and avatar widgets of `@object-ui/fields` upload through, so that context now lives in `@object-ui/fields` itself, and the adapter that talks to an ObjectStack server's storage service lives in `@object-ui/data-objectstack`, beside the other fetch logic against that server. The upload contract the two share is `@object-ui/types`'.
14+
15+
What leaves, and what to do:
16+
17+
- FROM `@object-ui/providers` TO `@object-ui/fields` and `@object-ui/data-objectstack`: import `UploadProvider`, `useUpload` and the `UploadProviderProps`, `UploadAdapter`, `UploadOptions` and `UploadResult` types from `@object-ui/fields` (the three contract types also from `@object-ui/types`), and `createObjectStackUploadAdapter` with `ObjectStackUploadAdapterOptions` from `@object-ui/data-objectstack`, then drop the `@object-ui/providers` dependency. `createS3Adapter`, `createAzureBlobAdapter`, `S3AdapterOptions` and `AzureBlobAdapterOptions` had no consumer and leave with no replacement: a host that uploads to its own bucket writes an object with a `name` and an `upload(file, options)` method against the `UploadAdapter` type of `@object-ui/types` and hands it to `UploadProvider`. `createObjectUrlAdapter` is no longer exported: it stays the local `blob:` adapter `useUpload` falls back to when no `UploadProvider` is mounted.
18+
19+
What does not change: `UploadProvider`, `useUpload` and `createObjectStackUploadAdapter` keep their signatures and behaviour, the presigned upload request is the same, and the widgets read the same context.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/types': patch
3+
---
4+
5+
feat(types): `@object-ui/types` publishes the upload adapter contract, `UploadAdapter`, `UploadOptions` and `UploadResult`
6+
7+
Clause-②: yes (widening)
8+
Metadata-protocol: none
9+
10+
The three interfaces the file, image and avatar widgets upload through, unchanged in shape from the `@object-ui/providers` package they leave. They live here, as `DataSource` does, because `@object-ui/fields` (whose `UploadProvider` reads an adapter) and `@object-ui/data-objectstack` (whose `createObjectStackUploadAdapter` builds one) do not depend on each other. A host that writes its own adapter types it from here. Nothing existing changes.

‎.changeset/config.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114
"@object-ui/plugin-timeline",
115115
"@object-ui/plugin-tree",
116116
"@object-ui/plugin-view",
117-
"@object-ui/providers",
118117
"@object-ui/react",
119118
"@object-ui/react-runtime",
120119
"@object-ui/types"

‎CONTRIBUTING.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ Atoms and fields stay light; heavy widgets live in lazy-loaded plugins.
467467
| Package | Description |
468468
| :--- | :--- |
469469
| [`@object-ui/app-shell`](ui/packages/app-shell) | The Console's shell, views and Studio; a private workspace package, last published to npm as 18.2.0 |
470-
| [`@object-ui/providers`](ui/packages/providers) | The upload adapter context the file and image fields upload through |
471470
| [`@object-ui/auth`](ui/packages/auth) | `AuthProvider`, `useAuth`, `AuthGuard`, sign-in forms |
472471
| [`@object-ui/permissions`](ui/packages/permissions) | Object / field / row-level permission guards and hooks |
473472
| [`@object-ui/i18n`](ui/packages/i18n) | Language packs, RTL layout, date and currency formatting |

‎pnpm-lock.yaml‎

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ui/apps/console/package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
"@object-ui/plugin-timeline": "workspace:*",
8585
"@object-ui/plugin-tree": "workspace:*",
8686
"@object-ui/plugin-view": "workspace:*",
87-
"@object-ui/providers": "workspace:*",
8887
"@object-ui/react": "workspace:*",
8988
"@object-ui/test-support": "workspace:*",
9089
"@object-ui/types": "workspace:*",

‎ui/apps/console/src/App.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import { lazy, Suspense, useCallback, useEffect, useMemo } from 'react';
1616
import { BrowserRouter, Routes, Route, Navigate, Outlet, matchPath, useLocation, useNavigate } from 'react-router-dom';
1717
import { useNativeHostRouting } from '@object-ui/mobile';
1818
import { AuthProvider, useAuth, createAuthenticatedFetch } from '@object-ui/auth';
19-
import { UploadProvider, createObjectStackUploadAdapter } from '@object-ui/providers';
19+
import { UploadProvider } from '@object-ui/fields';
20+
import { createObjectStackUploadAdapter } from '@object-ui/data-objectstack';
2021
import { DevMasterDetail } from './dev/DevMasterDetail';
2122
import { DevLists } from './dev/DevLists';
2223
import { DevModal } from './dev/DevModal';

‎ui/apps/console/src/__tests__/App.uploadAltitude-10131.test.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ const { adapterOptions, uploadSpy, passthrough, stub, MINTED_FILE_ID } = vi.hois
8181
return { adapterOptions, uploadSpy, passthrough, stub, MINTED_FILE_ID };
8282
});
8383

84-
// The console's OWN adapter factory, replaced by a spy that mints a `sys_file`
85-
// id. `UploadProvider` / `useUpload` stay real — the context lookup is the
86-
// thing under test.
87-
vi.mock('@object-ui/providers', async (importOriginal) => ({
84+
// The console's OWN adapter factory (`@object-ui/data-objectstack`), replaced by
85+
// a spy that mints a `sys_file` id. `UploadProvider` / `useUpload`
86+
// (`@object-ui/fields`) stay real — the context lookup is the thing under test.
87+
vi.mock('@object-ui/data-objectstack', async (importOriginal) => ({
8888
...(await importOriginal<Record<string, unknown>>()),
8989
createObjectStackUploadAdapter: (opts: Record<string, unknown>) => {
9090
adapterOptions.push(opts);

‎ui/apps/console/src/components/FormPage.avatarUpload-10785.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
3030
import { render, screen, waitFor, cleanup } from '@testing-library/react';
3131
import userEvent from '@testing-library/user-event';
3232
import { MemoryRouter, Route, Routes } from 'react-router-dom';
33-
import { UploadProvider } from '@object-ui/providers';
33+
import { UploadProvider } from '@object-ui/fields';
3434
import { createI18n } from '@object-ui/i18n';
3535
import { FormPage } from './FormPage';
3636

‎ui/apps/console/src/components/FormPage.chromeI18n-11071.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { render, screen, waitFor, cleanup } from '@testing-library/react';
3131
import userEvent from '@testing-library/user-event';
3232
import { MemoryRouter, Route, Routes } from 'react-router-dom';
3333
import { createI18n } from '@object-ui/i18n';
34-
import { UploadProvider } from '@object-ui/providers';
34+
import { UploadProvider } from '@object-ui/fields';
3535
import { FormPage } from './FormPage';
3636

3737
const { toastError } = vi.hoisted(() => ({ toastError: vi.fn() }));

0 commit comments

Comments
 (0)