@object-ui/data-objectstack 17.5.0 → 17.7.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +2311 -0
  2. package/README.md +557 -11
  3. package/dist/index.cjs +1663 -463
  4. package/dist/index.d.cts +1780 -518
  5. package/dist/index.d.ts +1780 -518
  6. package/dist/index.js +1648 -457
  7. package/package.json +9 -9
  8. package/dist/tsconfig.tsbuildinfo +0 -1
  9. package/src/aggregate-capability.test.ts +0 -177
  10. package/src/apiAccessDenied.test.ts +0 -233
  11. package/src/appAccessProbe.test.ts +0 -147
  12. package/src/bulkDelete.test.ts +0 -75
  13. package/src/bulkUpdate.test.ts +0 -93
  14. package/src/cache/MetadataCache.test.ts +0 -477
  15. package/src/cache/MetadataCache.ts +0 -289
  16. package/src/cloud-surface-retired-4152.pin.test.ts +0 -171
  17. package/src/connection.test.ts +0 -188
  18. package/src/contracts.ts +0 -115
  19. package/src/deleteView.homes.test.ts +0 -389
  20. package/src/deleteViewContract.types.test.ts +0 -246
  21. package/src/errors.test.ts +0 -426
  22. package/src/errors.ts +0 -293
  23. package/src/exportDownload.test.ts +0 -141
  24. package/src/filter-entry-translation.test.ts +0 -360
  25. package/src/filter-operator-ast-parity.test.ts +0 -135
  26. package/src/getObjectSchema.test.ts +0 -145
  27. package/src/httpFailureLogging.test.ts +0 -109
  28. package/src/importJob.test.ts +0 -71
  29. package/src/index.ts +0 -4442
  30. package/src/integration.ts +0 -200
  31. package/src/listViewOverrides.test.ts +0 -241
  32. package/src/listViews.test.ts +0 -175
  33. package/src/metadata-client.get-envelope.test.ts +0 -171
  34. package/src/metadata-client.saveAdvisories.test.ts +0 -226
  35. package/src/metadata-client.test.ts +0 -303
  36. package/src/metadata-client.ts +0 -1046
  37. package/src/occ.test.ts +0 -101
  38. package/src/onMutation.test.ts +0 -589
  39. package/src/onSaveAdvisory.test.ts +0 -311
  40. package/src/onWriteWarning.test.ts +0 -273
  41. package/src/orderby-serialization.test.ts +0 -115
  42. package/src/queryDataset.test.ts +0 -543
  43. package/src/searchAll.test.ts +0 -120
  44. package/src/security.ts +0 -243
  45. package/src/spec-symbol-batch6.test.ts +0 -326
  46. package/src/studio.ts +0 -152
  47. package/src/updateView.draft.test.ts +0 -242
  48. package/src/userState.test.ts +0 -315
  49. package/src/userState.ts +0 -238
  50. package/src/v3-compat.test.ts +0 -229
  51. package/src/validation-error.test.ts +0 -94
  52. package/src/viewCacheInvalidation.pin.test.ts +0 -260
  53. package/src/viewInvalidationSeam.pin.test.ts +0 -162
package/src/occ.test.ts DELETED
@@ -1,101 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { describe, it, expect } from 'vitest';
10
- import {
11
- ConcurrentUpdateError,
12
- isConcurrentUpdateError,
13
- normaliseClientError,
14
- } from './index';
15
-
16
- describe('Optimistic Concurrency Control errors', () => {
17
- describe('ConcurrentUpdateError', () => {
18
- it('carries currentVersion + currentRecord and a stable shape', () => {
19
- const e = new ConcurrentUpdateError({
20
- currentVersion: '2026-05-22T07:14:00.000Z',
21
- currentRecord: { id: 'rec_1', name: 'Acme', updated_at: '2026-05-22T07:14:00.000Z' },
22
- message: 'stale write',
23
- });
24
- expect(e).toBeInstanceOf(Error);
25
- expect(e.name).toBe('ConcurrentUpdateError');
26
- expect(e.code).toBe('CONCURRENT_UPDATE');
27
- expect(e.httpStatus).toBe(409);
28
- expect(e.currentVersion).toBe('2026-05-22T07:14:00.000Z');
29
- expect((e.currentRecord as any).name).toBe('Acme');
30
- expect(e.message).toBe('stale write');
31
- });
32
-
33
- it('defaults to a generic message when none is supplied', () => {
34
- const e = new ConcurrentUpdateError({ currentVersion: null, currentRecord: null });
35
- expect(e.message).toMatch(/modified/i);
36
- });
37
- });
38
-
39
- describe('isConcurrentUpdateError', () => {
40
- it('returns true for our typed instances', () => {
41
- const e = new ConcurrentUpdateError({ currentVersion: null, currentRecord: null });
42
- expect(isConcurrentUpdateError(e)).toBe(true);
43
- });
44
-
45
- it('returns true for plain objects with the canonical code', () => {
46
- expect(isConcurrentUpdateError({ code: 'CONCURRENT_UPDATE' })).toBe(true);
47
- });
48
-
49
- it('returns false for unrelated errors', () => {
50
- expect(isConcurrentUpdateError(new Error('boom'))).toBe(false);
51
- expect(isConcurrentUpdateError({ code: 'NOT_FOUND' })).toBe(false);
52
- expect(isConcurrentUpdateError(null)).toBe(false);
53
- expect(isConcurrentUpdateError(undefined)).toBe(false);
54
- expect(isConcurrentUpdateError('CONCURRENT_UPDATE')).toBe(false);
55
- });
56
- });
57
-
58
- describe('normaliseClientError', () => {
59
- it('returns the original error when it is not a 409 CONCURRENT_UPDATE', () => {
60
- const generic = Object.assign(new Error('not found'), {
61
- code: 'NOT_FOUND',
62
- httpStatus: 404,
63
- });
64
- expect(normaliseClientError(generic)).toBe(generic);
65
- });
66
-
67
- it('returns the original error for non-object inputs', () => {
68
- expect(normaliseClientError(null)).toBe(null);
69
- expect(normaliseClientError(undefined)).toBe(undefined);
70
- expect(normaliseClientError('boom')).toBe('boom');
71
- });
72
-
73
- it('wraps an upstream 409 CONCURRENT_UPDATE into a typed ConcurrentUpdateError', () => {
74
- const upstream = Object.assign(new Error('Record was modified by another user'), {
75
- code: 'CONCURRENT_UPDATE',
76
- httpStatus: 409,
77
- details: {
78
- currentVersion: '2026-05-22T07:14:00.000Z',
79
- currentRecord: { id: 'rec_1', name: 'Acme' },
80
- },
81
- });
82
- const normalised = normaliseClientError(upstream);
83
- expect(isConcurrentUpdateError(normalised)).toBe(true);
84
- const typed = normalised as ConcurrentUpdateError;
85
- expect(typed.currentVersion).toBe('2026-05-22T07:14:00.000Z');
86
- expect((typed.currentRecord as any).name).toBe('Acme');
87
- expect(typed.message).toBe('Record was modified by another user');
88
- });
89
-
90
- it('tolerates a missing details payload', () => {
91
- const upstream = Object.assign(new Error('stale'), {
92
- code: 'CONCURRENT_UPDATE',
93
- httpStatus: 409,
94
- });
95
- const normalised = normaliseClientError(upstream) as ConcurrentUpdateError;
96
- expect(isConcurrentUpdateError(normalised)).toBe(true);
97
- expect(normalised.currentVersion).toBeNull();
98
- expect(normalised.currentRecord).toBeNull();
99
- });
100
- });
101
- });