@opensaas/stack-core 0.24.0 → 0.25.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +223 -0
- package/dist/access/access-filter.d.ts +39 -0
- package/dist/access/access-filter.d.ts.map +1 -1
- package/dist/access/access-filter.js +121 -0
- package/dist/access/access-filter.js.map +1 -1
- package/dist/access/field-access.d.ts +1 -0
- package/dist/access/field-access.d.ts.map +1 -1
- package/dist/access/field-access.js +79 -4
- package/dist/access/field-access.js.map +1 -1
- package/dist/access/field-access.test.js +213 -0
- package/dist/access/field-access.test.js.map +1 -1
- package/dist/access/index.d.ts +1 -1
- package/dist/access/index.d.ts.map +1 -1
- package/dist/access/index.js +1 -1
- package/dist/access/index.js.map +1 -1
- package/dist/access/types.d.ts +39 -0
- package/dist/access/types.d.ts.map +1 -1
- package/dist/config/types.d.ts +318 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/context/index.d.ts +19 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +153 -26
- package/dist/context/index.js.map +1 -1
- package/dist/context/nested-operations.d.ts +59 -3
- package/dist/context/nested-operations.d.ts.map +1 -1
- package/dist/context/nested-operations.js +552 -129
- package/dist/context/nested-operations.js.map +1 -1
- package/dist/context/transaction-boundary.d.ts +91 -0
- package/dist/context/transaction-boundary.d.ts.map +1 -0
- package/dist/context/transaction-boundary.js +329 -0
- package/dist/context/transaction-boundary.js.map +1 -0
- package/dist/context/write-pipeline.d.ts +15 -1
- package/dist/context/write-pipeline.d.ts.map +1 -1
- package/dist/context/write-pipeline.js +173 -10
- package/dist/context/write-pipeline.js.map +1 -1
- package/dist/fields/calendar-day.test.d.ts +2 -0
- package/dist/fields/calendar-day.test.d.ts.map +1 -0
- package/dist/fields/calendar-day.test.js +120 -0
- package/dist/fields/calendar-day.test.js.map +1 -0
- package/dist/fields/index.d.ts +18 -2
- package/dist/fields/index.d.ts.map +1 -1
- package/dist/fields/index.js +93 -17
- package/dist/fields/index.js.map +1 -1
- package/dist/hooks/index.d.ts +116 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +154 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/validation/schema.test.js +222 -1
- package/dist/validation/schema.test.js.map +1 -1
- package/package.json +1 -1
- package/src/access/access-filter.ts +156 -0
- package/src/access/field-access.test.ts +255 -0
- package/src/access/field-access.ts +91 -5
- package/src/access/index.ts +1 -1
- package/src/access/types.ts +45 -0
- package/src/config/types.ts +364 -0
- package/src/context/index.ts +207 -37
- package/src/context/nested-operations.ts +969 -143
- package/src/context/transaction-boundary.ts +440 -0
- package/src/context/write-pipeline.ts +234 -13
- package/src/fields/calendar-day.test.ts +140 -0
- package/src/fields/index.ts +96 -16
- package/src/hooks/index.ts +265 -0
- package/src/validation/schema.test.ts +266 -1
- package/tests/access.test.ts +24 -16
- package/tests/context.test.ts +481 -0
- package/tests/field-types.test.ts +17 -3
- package/tests/nested-access-and-hooks.test.ts +1130 -54
- package/tests/nested-operation-registry.test.ts +28 -3
- package/tests/nested-write-hooks.test.ts +864 -0
- package/tests/transaction-boundary-hooks.test.ts +465 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -118,14 +118,18 @@ describe('Nested Operation Handler Registry', () => {
|
|
|
118
118
|
expect(passedData.author).toEqual({ disconnect: true })
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
-
it('passes
|
|
121
|
+
it('passes deleteMany, set and updateMany through unchanged', async () => {
|
|
122
|
+
// NOTE (#569 / ADR-0010): nested `delete` is no longer a pass-through kind —
|
|
123
|
+
// it now runs the full delete hook pipeline (access + before/afterOperation),
|
|
124
|
+
// so it is tested separately below. `deleteMany`/`set`/`updateMany` remain
|
|
125
|
+
// pass-through (out of scope for #569) and the payload is handed to Prisma
|
|
126
|
+
// unchanged.
|
|
122
127
|
const context = getContext(await buildConfig(), mockPrisma, { userId: '1' })
|
|
123
128
|
|
|
124
129
|
await context.db.post.update({
|
|
125
130
|
where: { id: '1' },
|
|
126
131
|
data: {
|
|
127
132
|
tags: {
|
|
128
|
-
delete: { id: 'a' },
|
|
129
133
|
deleteMany: { label: { contains: 'x' } },
|
|
130
134
|
set: [{ id: 'b' }],
|
|
131
135
|
updateMany: { where: { id: 'c' }, data: { label: 'renamed' } },
|
|
@@ -135,12 +139,33 @@ describe('Nested Operation Handler Registry', () => {
|
|
|
135
139
|
|
|
136
140
|
const passedTags = mockPrisma.post.update.mock.calls[0][0].data.tags
|
|
137
141
|
expect(passedTags).toEqual({
|
|
138
|
-
delete: { id: 'a' },
|
|
139
142
|
deleteMany: { label: { contains: 'x' } },
|
|
140
143
|
set: [{ id: 'b' }],
|
|
141
144
|
updateMany: { where: { id: 'c' }, data: { label: 'renamed' } },
|
|
142
145
|
})
|
|
143
146
|
})
|
|
147
|
+
|
|
148
|
+
it('runs the delete hook pipeline for nested delete then hands the payload to Prisma', async () => {
|
|
149
|
+
// Nested `delete` now resolves the target row (access + hooks), then the
|
|
150
|
+
// identifying payload is still handed to Prisma's nested write unchanged.
|
|
151
|
+
mockPrisma.tag.findUnique.mockResolvedValue({ id: 'a', label: 'doomed' })
|
|
152
|
+
const context = getContext(await buildConfig(), mockPrisma, { userId: '1' })
|
|
153
|
+
|
|
154
|
+
await context.db.post.update({
|
|
155
|
+
where: { id: '1' },
|
|
156
|
+
data: {
|
|
157
|
+
tags: {
|
|
158
|
+
delete: { id: 'a' },
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
// The target row was resolved for access/hooks.
|
|
164
|
+
expect(mockPrisma.tag.findUnique).toHaveBeenCalledWith({ where: { id: 'a' } })
|
|
165
|
+
// The delete payload reaches Prisma unchanged.
|
|
166
|
+
const passedTags = mockPrisma.post.update.mock.calls[0][0].data.tags
|
|
167
|
+
expect(passedTags).toEqual({ delete: { id: 'a' } })
|
|
168
|
+
})
|
|
144
169
|
})
|
|
145
170
|
|
|
146
171
|
describe('multiple kinds on a single field', () => {
|