@object-ui/providers 17.7.0 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,135 @@
1
1
  # @object-ui/providers — Changelog
2
2
 
3
+ ## 18.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 6f3299f: objectui moves to major 18, following `@objectstack/*` from 17 to 18 (objectui#12334). objectui's major is not a count of its own breaking changes: it tracks the major of the `@objectstack/spec` its packages depend on, so that the same major means compatible across the two projects. These packages already declare `@objectstack/*` on the 18 line (objectui#12030), so every package in the fixed release group crosses to 18 together. It is the one `major` that rule admits: objectui's own breaking changes ship as `minor`, described in their entries.
8
+
9
+ The 18 line is released from Changesets pre mode on the `next` tag (`.changeset/pre.json`), as `@objectstack/*` 18 is: these releases are `18.0.0-next.N` on the npm `next` dist-tag, and they do not move `latest`. The first `18.0.0` on `latest` comes when `@objectstack` 18 is generally available and this repository leaves pre mode.
10
+
11
+ What a consumer must do to take it is in the `@objectstack/*` 18 entry of this release (objectui#12030): move its own `@objectstack/*` packages to the 18 line at the same time.
12
+
13
+ ### Minor Changes
14
+
15
+ - 7282c6a: `createObjectStackUploadAdapter` no longer sends an upload's `path` as the storage scope (objectui#12055).
16
+
17
+ The adapter used to send `scope: opts.scope ?? options.path` in its presigned upload request, so an adapter built without a `scope` turned the `path` a caller passed to `upload(file, { path })` into the scope. A path is a key prefix for the S3 and Azure presign callbacks, not a scope: the ObjectStack storage service accepts only the values of the `scope` select on its `sys_file` object and refuses any other, so such an upload failed at the presign step. The adapter now sends only the `scope` it was built with, or none, and the server applies its default. `UploadResult.meta.scope` reports the same value.
18
+
19
+ The `scope` option's documentation no longer teaches free key prefixes ("avatars", "logos", "attachments/case"). It names the server's `sys_file` scope select as the vocabulary.
20
+
21
+ BREAKING (`@object-ui/providers`), for a caller that relied on `path` to choose the scope of an adapter built without one: the upload is now filed under the server's default scope. Remedy: pass one of the server's scopes as the adapter's `scope`, or none to take the server's default. (The bump is `minor` by this repo's release model: objectui's major follows the `@objectstack` family major, and its own breaking changes ship as `minor` with the breaking semantics stated here.)
22
+
23
+ **Clause-②: no (narrowing)**: no export, type member or option is added, and no type changes. The request the adapter sends narrows: a `path` no longer reaches it.
24
+ - 24804dc: `createObjectStackUploadAdapter`'s `scope` option is typed from the spec's upload-scope vocabulary (objectui#12055).
25
+
26
+ `ObjectStackUploadAdapterOptions.scope` was an open `string`, so a caller could build an adapter with a scope the ObjectStack storage service refuses with `400`. It is now `UploadScope` from `@objectstack/spec/api`, the one list the spec's upload request, the `scope` select on `sys_file` and the upload doors share. `@object-ui/providers` reaches it through the `API` namespace `@object-ui/types` already re-exports, so no dependency and no export is added. Omitting `scope` still sends none, and the server applies the default the spec's upload request declares.
27
+
28
+ BREAKING (`@object-ui/providers`), TypeScript only, for a caller that builds the adapter with a scope outside the vocabulary (for example `'avatars'` or `'attachments/case'`): it no longer compiles. The server already refused such a request at runtime. Remedy: pass one of the vocabulary's values, or omit `scope` to take the server's default. (The bump is `minor` by this repo's release model: objectui's major follows the `@objectstack` family major, and its own breaking changes ship as `minor` with the breaking semantics stated here.)
29
+
30
+ **Clause-②: no (narrowing)**: the option's accepted values narrow from any string to the spec's upload scopes. No export, option or type member is added; the declaration file gains a type-only import of `API` from `@object-ui/types`, a package `@object-ui/providers` already depends on.
31
+ - 12ff256: The props of this package's `ThemeProvider` are declared and exported as `ThemePreferenceProviderProps` instead of `ThemeProviderProps` (objectui#6349, batch 10). `@object-ui/react` publishes a different `ThemeProviderProps`: the props of its theme-system `ThemeProvider`, which registers whole `Theme` documents, takes a theme name as `defaultTheme` and the mode as `defaultMode`, and writes the active theme as CSS variables. This package's provider stores one `ThemePreference` (`auto | light | dark | system`) and takes that mode as `defaultTheme`. One exported name stood for two props types across the two packages, and react keeps it.
32
+
33
+ **Type change, breaking for some consumers.** `ThemeProviderProps` is no longer exported from `@object-ui/providers`. Replace `import type { ThemeProviderProps } from '@object-ui/providers'` with `ThemePreferenceProviderProps`; the members (`defaultTheme`, `storageKey`, `children`) are unchanged. The old import fails to compile with TS2724 ("has no exported member named 'ThemeProviderProps'"). That error's "Did you mean" names the `ThemeProvider` component, not the replacement; using the component's name as a type fails too (TS2749), so write `ThemePreferenceProviderProps`. The `ThemeProvider` component and `useTheme` keep their names.
34
+
35
+ No runtime behaviour changes.
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [18d7b48]
40
+ - Updated dependencies [172acc3]
41
+ - Updated dependencies [f0496bd]
42
+ - Updated dependencies [c4c506b]
43
+ - Updated dependencies [9db9ff3]
44
+ - Updated dependencies [b10c68e]
45
+ - Updated dependencies [bdc9049]
46
+ - Updated dependencies [2e818d0]
47
+ - Updated dependencies [8b14aec]
48
+ - Updated dependencies [2abec3a]
49
+ - Updated dependencies [9dfaca6]
50
+ - Updated dependencies [96fcf30]
51
+ - Updated dependencies [89cc738]
52
+ - Updated dependencies [c0862c1]
53
+ - Updated dependencies [c0862c1]
54
+ - Updated dependencies [c0862c1]
55
+ - Updated dependencies [4c0de52]
56
+ - Updated dependencies [a80fef7]
57
+ - Updated dependencies [f34e877]
58
+ - Updated dependencies [aaba865]
59
+ - Updated dependencies [45d5853]
60
+ - Updated dependencies [2312bd9]
61
+ - Updated dependencies [c5406c2]
62
+ - Updated dependencies [2a48bd4]
63
+ - Updated dependencies [c7b30bd]
64
+ - Updated dependencies [69bca0a]
65
+ - Updated dependencies [c0c2f79]
66
+ - Updated dependencies [0665c3b]
67
+ - Updated dependencies [d2500d8]
68
+ - Updated dependencies [b231607]
69
+ - Updated dependencies [466a219]
70
+ - Updated dependencies [6fb281d]
71
+ - Updated dependencies [c08c933]
72
+ - Updated dependencies [c4dd707]
73
+ - Updated dependencies [923504f]
74
+ - Updated dependencies [10aba37]
75
+ - Updated dependencies [5d3f437]
76
+ - Updated dependencies [7af0ab3]
77
+ - Updated dependencies [fd4872f]
78
+ - Updated dependencies [f0532d8]
79
+ - Updated dependencies [3092aca]
80
+ - Updated dependencies [82e5f53]
81
+ - Updated dependencies [d81e460]
82
+ - Updated dependencies [8106db1]
83
+ - Updated dependencies [093d55b]
84
+ - Updated dependencies [a8051d6]
85
+ - Updated dependencies [524136e]
86
+ - Updated dependencies [6f3299f]
87
+ - Updated dependencies [f2b17c6]
88
+ - Updated dependencies [52d6194]
89
+ - Updated dependencies [23bf859]
90
+ - Updated dependencies [1c72d77]
91
+ - Updated dependencies [2b4d3f1]
92
+ - Updated dependencies [d75f212]
93
+ - Updated dependencies [ff9df88]
94
+ - Updated dependencies [a2225f9]
95
+ - Updated dependencies [21f9577]
96
+ - Updated dependencies [3eb3ec1]
97
+ - Updated dependencies [619e3f7]
98
+ - Updated dependencies [f62b6ff]
99
+ - Updated dependencies [d66d7e8]
100
+ - Updated dependencies [15d8ca6]
101
+ - Updated dependencies [378896d]
102
+ - Updated dependencies [4839f5c]
103
+ - Updated dependencies [c999d4c]
104
+ - Updated dependencies [26323c4]
105
+ - Updated dependencies [c219165]
106
+ - Updated dependencies [30083da]
107
+ - Updated dependencies [8aa8e3e]
108
+ - Updated dependencies [a928aaa]
109
+ - Updated dependencies [1b94d50]
110
+ - Updated dependencies [fb85637]
111
+ - Updated dependencies [df71568]
112
+ - Updated dependencies [cbac9d7]
113
+ - Updated dependencies [daeb77f]
114
+ - Updated dependencies [eb4552e]
115
+ - Updated dependencies [55e90fd]
116
+ - Updated dependencies [9b75509]
117
+ - Updated dependencies [b13ea3c]
118
+ - Updated dependencies [d7e9e9a]
119
+ - Updated dependencies [cf62edf]
120
+ - Updated dependencies [0253416]
121
+ - Updated dependencies [5d77c09]
122
+ - Updated dependencies [3fd8625]
123
+ - Updated dependencies [1473757]
124
+ - Updated dependencies [d73d987]
125
+ - Updated dependencies [12ff256]
126
+ - Updated dependencies [26b0bd2]
127
+ - Updated dependencies [d328698]
128
+ - Updated dependencies [b4e0787]
129
+ - Updated dependencies [088e0f7]
130
+ - Updated dependencies [b403bb3]
131
+ - @object-ui/types@18.0.0
132
+
3
133
  ## 17.7.0
4
134
 
5
135
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import type { ThemePreference, ThemeProviderProps } from './types.js';
1
+ import type { ThemePreference, ThemePreferenceProviderProps } from './types.js';
2
2
  interface ThemeContextValue {
3
3
  theme: ThemePreference;
4
4
  setTheme: (theme: ThemePreference) => void;
@@ -9,7 +9,7 @@ interface ThemeContextValue {
9
9
  * Provides theme context and handles system theme detection.
10
10
  * Extracted from console for reuse in third-party applications.
11
11
  */
12
- export declare function ThemeProvider({ defaultTheme, storageKey, children, }: ThemeProviderProps): import("react").JSX.Element;
12
+ export declare function ThemeProvider({ defaultTheme, storageKey, children, }: ThemePreferenceProviderProps): import("react").JSX.Element;
13
13
  /**
14
14
  * Hook to access theme from context
15
15
  */
@@ -19,6 +19,7 @@
19
19
  * `onProgress` and an `abortSignal`.
20
20
  */
21
21
  import React, { type ReactNode } from 'react';
22
+ import type { API } from '@object-ui/types';
22
23
  export interface UploadResult {
23
24
  /** Canonical, shareable URL (e.g. https://my-bucket.s3.amazonaws.com/avatars/abc.png). */
24
25
  url: string;
@@ -30,7 +31,12 @@ export interface UploadResult {
30
31
  meta?: Record<string, unknown>;
31
32
  }
32
33
  export interface UploadOptions {
33
- /** Logical folder / key prefix (e.g. "avatars/"). */
34
+ /**
35
+ * Logical folder / key prefix (e.g. "avatars/"), handed to the presign
36
+ * callback of `createS3Adapter` and `createAzureBlobAdapter`.
37
+ * `createObjectStackUploadAdapter` never sends it: that server derives the
38
+ * object key itself, and a path is not a storage scope (objectui#12055).
39
+ */
34
40
  path?: string;
35
41
  /** Progress callback in 0–1. */
36
42
  onProgress?: (ratio: number) => void;
@@ -118,10 +124,19 @@ export interface ObjectStackUploadAdapterOptions {
118
124
  */
119
125
  basePath?: string;
120
126
  /**
121
- * Logical key prefix forwarded to the server as `scope`. Useful for
122
- * partitioning uploads (e.g. "avatars", "logos", "attachments/case").
127
+ * The storage scope the server files every upload from this adapter
128
+ * under, sent as the presigned upload request's `scope`. It is not a key
129
+ * prefix or folder. Its values are the spec's upload-scope vocabulary,
130
+ * `UploadScope` from `@objectstack/spec/api` (reached here as
131
+ * `API.UploadScope` from `@object-ui/types`): the one list the upload
132
+ * request, the `scope` select on `sys_file` and the upload doors share.
133
+ * A value outside it does not compile, and the server refuses it with
134
+ * `400`. `attachments`, for example, is the scope of files joined to
135
+ * records through `sys_attachment`. Omit it and the request carries no
136
+ * scope, so the server applies the default the spec's upload request
137
+ * declares (objectui#12055).
123
138
  */
124
- scope?: string;
139
+ scope?: API.UploadScope;
125
140
  /** Override `fetch` (tests, ServiceWorker queues). */
126
141
  fetchImpl?: typeof fetch;
127
142
  /**
@@ -146,7 +146,11 @@ export function createObjectStackUploadAdapter(opts = {}) {
146
146
  filename: name,
147
147
  mimeType,
148
148
  size: file.size,
149
- scope: opts.scope ?? options.path,
149
+ // The adapter's own scope, or none. `options.path` is never sent
150
+ // as the scope: it is a key prefix for the S3/Azure presign
151
+ // callbacks, and this server refuses any scope outside its
152
+ // vocabulary (objectui#12055).
153
+ scope: opts.scope,
150
154
  }),
151
155
  });
152
156
  if (!presignRes.ok) {
@@ -187,7 +191,7 @@ export function createObjectStackUploadAdapter(opts = {}) {
187
191
  name,
188
192
  size: file.size,
189
193
  mimeType,
190
- meta: { fileId, scope: opts.scope ?? options.path },
194
+ meta: { fileId, scope: opts.scope },
191
195
  };
192
196
  },
193
197
  };
package/dist/index.d.ts CHANGED
@@ -7,5 +7,5 @@ export { DataSourceProvider, useDataSource } from './DataSourceProvider.js';
7
7
  export { MetadataProvider, useMetadata } from './MetadataProvider.js';
8
8
  export { ThemeProvider, useTheme } from './ThemeProvider.js';
9
9
  export { UploadProvider, useUpload, createObjectUrlAdapter, createS3Adapter, createAzureBlobAdapter, createObjectStackUploadAdapter, } from './UploadProvider.js';
10
- export type { DataSourceProviderProps, MetadataProviderProps, ThemeProviderProps, ThemePreference, } from './types.js';
10
+ export type { DataSourceProviderProps, MetadataProviderProps, ThemePreferenceProviderProps, ThemePreference, } from './types.js';
11
11
  export type { UploadAdapter, UploadOptions, UploadResult, UploadProviderProps, S3AdapterOptions, AzureBlobAdapterOptions, ObjectStackUploadAdapterOptions, } from './UploadProvider.js';
package/dist/types.d.ts CHANGED
@@ -36,7 +36,20 @@ export interface MetadataProviderProps {
36
36
  * identically (#2942, pinned in `theme-mode-spec-parity`).
37
37
  */
38
38
  export type ThemePreference = ThemeMode | 'system';
39
- export interface ThemeProviderProps {
39
+ /**
40
+ * Props of this package's `ThemeProvider`, which stores one
41
+ * {@link ThemePreference} and applies it as the `light` / `dark` class.
42
+ *
43
+ * Named `ThemePreferenceProviderProps`, not `ThemeProviderProps`
44
+ * (objectui#6349, batch 10). `@object-ui/react` publishes a
45
+ * `ThemeProviderProps` with a different meaning: the props of its theme-system
46
+ * `ThemeProvider`, which registers whole `Theme` documents and turns the
47
+ * active one into CSS variables. There `defaultTheme` is a theme NAME and the
48
+ * mode is `defaultMode`; here `defaultTheme` is the mode itself. One exported
49
+ * name stood for both, so this, the narrower of the two, takes the specific
50
+ * name and react keeps the general one.
51
+ */
52
+ export interface ThemePreferenceProviderProps {
40
53
  defaultTheme?: ThemePreference;
41
54
  storageKey?: string;
42
55
  children: ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/providers",
3
- "version": "17.7.0",
3
+ "version": "18.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Reusable context providers for ObjectUI applications",
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@object-ui/types": "17.7.0"
27
+ "@object-ui/types": "18.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": "^18.0.0 || ^19.0.0",