@cedarjs/context 1.1.1-next.0 → 1.1.1-next.18
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/dist/cjs/context.d.ts.map +1 -1
- package/dist/cjs/context.js +23 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +23 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAAG;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAAG;AA+BjE,eAAO,IAAI,OAAO,EAAE,aAAsC,CAAA;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,YAAY,aAAa,KAAG,aA6BtD,CAAA"}
|
package/dist/cjs/context.js
CHANGED
|
@@ -28,6 +28,15 @@ function createContextProxy(target) {
|
|
|
28
28
|
get: (_target, property) => {
|
|
29
29
|
const store = (0, import_store.getAsyncStoreInstance)().getStore();
|
|
30
30
|
const ctx = store?.get("context") || {};
|
|
31
|
+
if (process.env.DEBUG_CONTEXT === "true") {
|
|
32
|
+
console.log("[Context Debug]", {
|
|
33
|
+
property,
|
|
34
|
+
hasStore: !!store,
|
|
35
|
+
hasContext: !!ctx,
|
|
36
|
+
contextKeys: Object.keys(ctx),
|
|
37
|
+
currentUser: ctx.currentUser
|
|
38
|
+
});
|
|
39
|
+
}
|
|
31
40
|
return ctx[property];
|
|
32
41
|
},
|
|
33
42
|
set: (_target, property, newVal) => {
|
|
@@ -41,8 +50,22 @@ function createContextProxy(target) {
|
|
|
41
50
|
}
|
|
42
51
|
let context = createContextProxy({});
|
|
43
52
|
const setContext = (newContext) => {
|
|
53
|
+
if (process.env.DEBUG_CONTEXT === "true") {
|
|
54
|
+
console.log("[setContext Debug]", {
|
|
55
|
+
hasNewContext: !!newContext,
|
|
56
|
+
contextKeys: Object.keys(newContext),
|
|
57
|
+
currentUser: newContext.currentUser,
|
|
58
|
+
stackTrace: new Error().stack
|
|
59
|
+
});
|
|
60
|
+
}
|
|
44
61
|
context = createContextProxy(newContext);
|
|
45
62
|
const store = (0, import_store.getAsyncStoreInstance)().getStore();
|
|
63
|
+
if (process.env.DEBUG_CONTEXT === "true") {
|
|
64
|
+
console.log("[setContext Debug - Store]", {
|
|
65
|
+
hasStore: !!store,
|
|
66
|
+
storeHasContext: !!store?.get("context")
|
|
67
|
+
});
|
|
68
|
+
}
|
|
46
69
|
store?.set("context", newContext);
|
|
47
70
|
return context;
|
|
48
71
|
};
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAAG;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAAG;AA+BjE,eAAO,IAAI,OAAO,EAAE,aAAsC,CAAA;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,YAAY,aAAa,KAAG,aA6BtD,CAAA"}
|
package/dist/context.js
CHANGED
|
@@ -4,6 +4,15 @@ function createContextProxy(target) {
|
|
|
4
4
|
get: (_target, property) => {
|
|
5
5
|
const store = getAsyncStoreInstance().getStore();
|
|
6
6
|
const ctx = store?.get("context") || {};
|
|
7
|
+
if (process.env.DEBUG_CONTEXT === "true") {
|
|
8
|
+
console.log("[Context Debug]", {
|
|
9
|
+
property,
|
|
10
|
+
hasStore: !!store,
|
|
11
|
+
hasContext: !!ctx,
|
|
12
|
+
contextKeys: Object.keys(ctx),
|
|
13
|
+
currentUser: ctx.currentUser
|
|
14
|
+
});
|
|
15
|
+
}
|
|
7
16
|
return ctx[property];
|
|
8
17
|
},
|
|
9
18
|
set: (_target, property, newVal) => {
|
|
@@ -17,8 +26,22 @@ function createContextProxy(target) {
|
|
|
17
26
|
}
|
|
18
27
|
let context = createContextProxy({});
|
|
19
28
|
const setContext = (newContext) => {
|
|
29
|
+
if (process.env.DEBUG_CONTEXT === "true") {
|
|
30
|
+
console.log("[setContext Debug]", {
|
|
31
|
+
hasNewContext: !!newContext,
|
|
32
|
+
contextKeys: Object.keys(newContext),
|
|
33
|
+
currentUser: newContext.currentUser,
|
|
34
|
+
stackTrace: new Error().stack
|
|
35
|
+
});
|
|
36
|
+
}
|
|
20
37
|
context = createContextProxy(newContext);
|
|
21
38
|
const store = getAsyncStoreInstance().getStore();
|
|
39
|
+
if (process.env.DEBUG_CONTEXT === "true") {
|
|
40
|
+
console.log("[setContext Debug - Store]", {
|
|
41
|
+
hasStore: !!store,
|
|
42
|
+
storeHasContext: !!store?.get("context")
|
|
43
|
+
});
|
|
44
|
+
}
|
|
22
45
|
store?.set("context", newContext);
|
|
23
46
|
return context;
|
|
24
47
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/context",
|
|
3
|
-
"version": "1.1.1-next.
|
|
3
|
+
"version": "1.1.1-next.18+5ffd3124d",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@arethetypeswrong/cli": "0.18.2",
|
|
61
|
-
"@cedarjs/framework-tools": "1.1.1-next.
|
|
61
|
+
"@cedarjs/framework-tools": "1.1.1-next.18",
|
|
62
62
|
"concurrently": "8.2.2",
|
|
63
63
|
"publint": "0.3.12",
|
|
64
64
|
"tsx": "4.20.5",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "5ffd3124d3d4ceb7843408264c96ecceff8542f5"
|
|
71
71
|
}
|