gencow 0.1.128 → 0.1.130

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/core/index.js CHANGED
@@ -1524,6 +1524,11 @@ function buildRealtimeCtx(options) {
1524
1524
  continue;
1525
1525
  }
1526
1526
  try {
1527
+ if (!options?.buildCtxForRefresh) {
1528
+ console.warn(
1529
+ `[gencow] \u26A0\uFE0F refresh("${key}"): buildCtxForRefresh not provided. Query handler will receive an empty ctx \u2014 ctx.db will be undefined. This is a framework configuration error. \u{1F4A1} Ensure buildRealtimeCtx() receives a buildCtxForRefresh callback.`
1530
+ );
1531
+ }
1527
1532
  const refreshCtx = options?.buildCtxForRefresh?.() ?? {};
1528
1533
  const result = await queryDef.handler(refreshCtx, {});
1529
1534
  if (options?.httpCallback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gencow",
3
- "version": "0.1.128",
3
+ "version": "0.1.130",
4
4
  "description": "Gencow — AI Backend Engine",
5
5
  "type": "module",
6
6
  "bin": {
package/server/index.js CHANGED
@@ -176,6 +176,11 @@ function buildRealtimeCtx(options) {
176
176
  continue;
177
177
  }
178
178
  try {
179
+ if (!options?.buildCtxForRefresh) {
180
+ console.warn(
181
+ `[gencow] \u26A0\uFE0F refresh("${key}"): buildCtxForRefresh not provided. Query handler will receive an empty ctx \u2014 ctx.db will be undefined. This is a framework configuration error. \u{1F4A1} Ensure buildRealtimeCtx() receives a buildCtxForRefresh callback.`
182
+ );
183
+ }
179
184
  const refreshCtx = options?.buildCtxForRefresh?.() ?? {};
180
185
  const result = await queryDef.handler(refreshCtx, {});
181
186
  if (options?.httpCallback) {
@@ -64304,14 +64309,55 @@ async function main() {
64304
64309
  }
64305
64310
  };
64306
64311
  };
64312
+ const noopRealtime = {
64313
+ emit: () => {
64314
+ },
64315
+ refresh: () => {
64316
+ }
64317
+ };
64318
+ function buildRefreshCtx() {
64319
+ const refreshAuth = {
64320
+ getUserIdentity: () => null,
64321
+ requireAuth: () => {
64322
+ throw new Error("Auth not available in refresh context");
64323
+ }
64324
+ };
64325
+ return {
64326
+ db: createRlsDb(db, { userId: "" }),
64327
+ unsafeDb: db,
64328
+ auth: refreshAuth,
64329
+ storage,
64330
+ realtime: noopRealtime,
64331
+ scheduler: scheduler ?? {
64332
+ runAfter: () => {
64333
+ throw new Error("Scheduler not available in refresh context");
64334
+ },
64335
+ runAt: () => {
64336
+ throw new Error("Scheduler not available in refresh context");
64337
+ },
64338
+ cancel: () => false,
64339
+ cron: () => {
64340
+ },
64341
+ registerAction: () => {
64342
+ },
64343
+ executeAction: async () => {
64344
+ }
64345
+ },
64346
+ retry: withRetry,
64347
+ ai: buildAI()
64348
+ };
64349
+ }
64307
64350
  const partialCtx = {
64308
64351
  auth: authCtx,
64309
64352
  storage,
64310
- realtime: buildRealtimeCtx(IS_BAAS ? {
64311
- httpCallback: (event) => {
64353
+ realtime: buildRealtimeCtx({
64354
+ // BaaS 모드: Platform WS Gateway에 HTTP callback
64355
+ ...IS_BAAS ? { httpCallback: (event) => {
64312
64356
  notifyGateway(event);
64313
- }
64314
- } : void 0),
64357
+ } } : {},
64358
+ // refresh()용 ctx 생성 함수 — 로컬/BaaS 모두 필요
64359
+ buildCtxForRefresh: buildRefreshCtx
64360
+ }),
64315
64361
  scheduler: scheduler ?? {
64316
64362
  runAfter: () => {
64317
64363
  throw new Error("Scheduler not initialized \u2014 add gencow/crons.ts to enable. Note: In BaaS mode, scheduler.runAfter() is sleep-unsafe (timers are lost when app goes idle). Recommended: split into separate mutations and call sequentially from frontend.");