@decocms/apps-vtex 7.20.0 → 7.20.2
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/package.json +5 -5
- package/src/invoke.ts +24 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/apps-vtex",
|
|
3
|
-
"version": "7.20.
|
|
3
|
+
"version": "7.20.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Deco commerce app: VTEX integration",
|
|
6
6
|
"repository": {
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"lint:unused": "knip"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@decocms/blocks": "7.20.
|
|
55
|
-
"@decocms/apps-commerce": "7.20.
|
|
56
|
-
"@decocms/apps-website": "7.20.
|
|
57
|
-
"@decocms/tanstack": "7.20.
|
|
54
|
+
"@decocms/blocks": "7.20.2",
|
|
55
|
+
"@decocms/apps-commerce": "7.20.2",
|
|
56
|
+
"@decocms/apps-website": "7.20.2",
|
|
57
|
+
"@decocms/tanstack": "7.20.2"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"react": "^19.0.0",
|
package/src/invoke.ts
CHANGED
|
@@ -37,15 +37,6 @@ import {
|
|
|
37
37
|
updateCartItems,
|
|
38
38
|
updateOrderFormAttachment,
|
|
39
39
|
} from "./actions/checkout";
|
|
40
|
-
import {
|
|
41
|
-
type CreateDocumentResult,
|
|
42
|
-
createDocument,
|
|
43
|
-
getDocument,
|
|
44
|
-
patchDocument,
|
|
45
|
-
searchDocuments,
|
|
46
|
-
type UploadAttachmentOpts,
|
|
47
|
-
uploadAttachment,
|
|
48
|
-
} from "./actions/masterData";
|
|
49
40
|
import { type NotifyMeProps, notifyMe } from "./actions/misc";
|
|
50
41
|
import { type SubscribeProps, subscribe } from "./actions/newsletter";
|
|
51
42
|
import { createSession, editSession, type SessionData } from "./actions/session";
|
|
@@ -139,31 +130,30 @@ export const invoke = {
|
|
|
139
130
|
}) => Promise<SessionData>,
|
|
140
131
|
|
|
141
132
|
// -- MasterData -------------------------------------------------------
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
) as unknown as (ctx: { data: UploadAttachmentOpts }) => Promise<{ ok: true }>,
|
|
133
|
+
//
|
|
134
|
+
// Generic MasterData CRUD (createDocument / getDocument / patchDocument /
|
|
135
|
+
// searchDocuments / uploadAttachment) is deliberately NOT exposed here.
|
|
136
|
+
//
|
|
137
|
+
// Every entry in this object is emitted by @decocms/blocks-cli's
|
|
138
|
+
// generate-invoke.ts as a top-level createServerFn, which TanStack Start
|
|
139
|
+
// compiles into a public, unauthenticated /_serverFn/<hash> endpoint. A
|
|
140
|
+
// generic action that takes a client-supplied `entity` and proxies to the
|
|
141
|
+
// VTEX MasterData API with the app's admin appKey/appToken lets any caller
|
|
142
|
+
// read/enumerate/write arbitrary entities — e.g. searchDocuments({ entity:
|
|
143
|
+
// "CL", ... }) dumps the Clients (customer PII) table. Authentication alone
|
|
144
|
+
// can't make this safe: the generic (entity, filter) shape has no room for
|
|
145
|
+
// per-entity/per-record authorization.
|
|
146
|
+
//
|
|
147
|
+
// The underlying functions remain exported from ./actions/masterData for
|
|
148
|
+
// SERVER-SIDE use. A site that needs MasterData defines a narrow,
|
|
149
|
+
// entity-pinned, validated action in its own src/server/invoke.ts: pin
|
|
150
|
+
// `entity` server-side (never take it from the client), validate input, and
|
|
151
|
+
// for user-scoped data derive identity from the session cookie
|
|
152
|
+
// (parseVtexAuthJwt) rather than a client-supplied id. See `subscribe` /
|
|
153
|
+
// `notifyMe` below for the purpose-specific pattern.
|
|
154
|
+
//
|
|
155
|
+
// generate-invoke.ts also carries a PRIVILEGED_ACTIONS guard that refuses
|
|
156
|
+
// to emit these names even if re-added here, so this stays enforced.
|
|
167
157
|
|
|
168
158
|
// -- Newsletter -------------------------------------------------------
|
|
169
159
|
|