@base44-preview/cli 0.1.29-pr.655.1f8f35a → 0.1.29-pr.656.58d97d4

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/cli/index.js CHANGED
@@ -261311,7 +261311,7 @@ function shardOf(group, response, verdict, options) {
261311
261311
  gzipBytes: verdict.gzipBytes,
261312
261312
  ...response.activation ? { activation: response.activation } : {},
261313
261313
  wrapper: {
261314
- secrets: response.activation ? `blob_${response.activation}` : "binding",
261314
+ secrets: response.activation ? `blob-${response.activation}` : "binding",
261315
261315
  postResponseTelemetry: options.postResponseTelemetry ?? false,
261316
261316
  staticEgress: STATIC_EGRESS_ARTIFACT_MARKER
261317
261317
  }
@@ -264197,8 +264197,10 @@ In order to complete registration use this verification code: ${otpCode}
264197
264197
  // src/cli/dev/dev-server/routes/entities/entities-router.ts
264198
264198
  var import_express4 = __toESM(require_express(), 1);
264199
264199
 
264200
- // src/cli/dev/dev-server/db/rls.ts
264200
+ // src/cli/dev/dev-server/db/fls-write.ts
264201
264201
  import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
264202
+
264203
+ // src/cli/dev/dev-server/db/rls.ts
264202
264204
  function getRLSFieldValue(key, source) {
264203
264205
  const DATA_FIELD_PREFIX = "data.";
264204
264206
  return source[key.startsWith(DATA_FIELD_PREFIX) ? key.slice(DATA_FIELD_PREFIX.length) : key];
@@ -264316,18 +264318,38 @@ function applyFLS(record, schema, user, operation) {
264316
264318
  return result;
264317
264319
  }
264318
264320
 
264321
+ // src/cli/dev/dev-server/db/fls-write.ts
264319
264322
  class FLSWriteError extends Error {
264320
264323
  constructor(operation, deniedFields) {
264321
264324
  const verb = operation === "create" ? "set" : "modify";
264322
264325
  super(`You're not allowed to ${verb} the following fields: ${deniedFields.join(", ")}`);
264323
264326
  }
264324
264327
  }
264328
+ var isPlainObject4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
264329
+ var flattenToDataPaths = (record, prefix = "data") => Object.entries(record).flatMap(([key, value]) => isPlainObject4(value) ? flattenToDataPaths(value, `${prefix}.${key}`) : [[`${prefix}.${key}`, value]]);
264330
+ var collectFieldRules = (properties, prefix = "data") => Object.entries(properties).flatMap(([key, property]) => {
264331
+ const path = `${prefix}.${key}`;
264332
+ const own = property.rls ? [[path, property.rls]] : [];
264333
+ return [...own, ...collectFieldRules(property.properties ?? {}, path)];
264334
+ });
264335
+ var findClosestRule = (rules, path) => {
264336
+ const segments = path.split(".");
264337
+ for (let length = segments.length;length > 1; length--) {
264338
+ const rule = rules.get(segments.slice(0, length).join("."));
264339
+ if (rule)
264340
+ return rule;
264341
+ }
264342
+ return;
264343
+ };
264344
+ var isUnchanged = (before, after) => isDeepStrictEqual5(before ?? null, after ?? null);
264325
264345
  function assertFLSWrite(changes, context, schema, user, operation) {
264326
- const denied = Object.entries(changes).filter(([key, value]) => {
264327
- const rls = schema.properties[key]?.rls;
264346
+ const rules = new Map(collectFieldRules(schema.properties));
264347
+ const before = new Map(flattenToDataPaths(context));
264348
+ const denied = flattenToDataPaths(changes).filter(([path, value]) => {
264349
+ const rls = findClosestRule(rules, path);
264328
264350
  const rule = rls?.[operation] ?? rls?.write;
264329
- return rule !== undefined && !isDeepStrictEqual5(context[key], value) && !checkRLS(rule, context, user);
264330
- }).map(([key]) => `data.${key}`);
264351
+ return rule !== undefined && !isUnchanged(before.get(path), value) && !checkRLS(rule, context, user);
264352
+ }).map(([path]) => path);
264331
264353
  if (denied.length > 0) {
264332
264354
  throw new FLSWriteError(operation, denied);
264333
264355
  }
@@ -267647,7 +267669,7 @@ function isBuiltin4(candidate, className) {
267647
267669
  function isEvent(candidate) {
267648
267670
  return !isUndefined(Event) && isInstanceOf(candidate, Event);
267649
267671
  }
267650
- function isPlainObject4(candidate) {
267672
+ function isPlainObject5(candidate) {
267651
267673
  return isBuiltin4(candidate, "Object");
267652
267674
  }
267653
267675
  function isInstanceOf(candidate, base) {
@@ -270783,7 +270805,7 @@ class PostHogBackendClient extends PostHogCoreStateless {
270783
270805
  const personProperties = {};
270784
270806
  const groupProperties = {};
270785
270807
  for (const [key, value] of Object.entries(eventProperties))
270786
- if (isPlainObject4(value) && groups && key in groups) {
270808
+ if (isPlainObject5(value) && groups && key in groups) {
270787
270809
  const groupProps = {};
270788
270810
  for (const [groupKey, groupValue] of Object.entries(value))
270789
270811
  groupProps[String(groupKey)] = String(groupValue);
@@ -271260,4 +271282,4 @@ export {
271260
271282
  runCLI
271261
271283
  };
271262
271284
 
271263
- //# debugId=E5E7C98F673394D264756E2164756E21
271285
+ //# debugId=397A39E710CEFAB564756E2164756E21