@isaijs/core 0.1.8 → 0.1.9

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
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { U as toKind, V as object } from "../validation-C3MCRBQO.js";
3
- import { I as dialectFor, h as snapshotOf, m as emptySnapshot, r as sync, t as migrate, y as MigrationError } from "../migrator-DxTpns_-.js";
4
- import { a as lookupsOf, i as filterableOf, n as isRequired, t as Resource, u as Route } from "../resource-BIMAiOre.js";
3
+ import { I as dialectFor, h as snapshotOf, m as emptySnapshot, r as sync, t as migrate, y as MigrationError } from "../migrator-vvvKa0Vk.js";
4
+ import { a as lookupsOf, i as filterableOf, n as isRequired, t as Resource, u as Route } from "../resource-DCg6LvMH.js";
5
5
  import { o as fieldOf, p as sensitivity, r as columnName, t as Model } from "../model-6pJBqqGd.js";
6
6
  import { t as kebabCase } from "../case-DpXlJCL9.js";
7
- import { i as makeMigrations, n as checkSteps, t as checkMigrations } from "../make-jMJABOWI.js";
7
+ import { i as makeMigrations, n as checkSteps, t as checkMigrations } from "../make-D6_caNkv.js";
8
8
  import { d1 } from "../adapters/database/d1/index.js";
9
9
  import { spawn } from "node:child_process";
10
10
  import { parseArgs } from "node:util";
@@ -1,5 +1,5 @@
1
1
  import { L as quantity, g as host, j as datetime, r as isPhoneRegion } from "./validation-C3MCRBQO.js";
2
- import "./migrator-DxTpns_-.js";
2
+ import "./migrator-vvvKa0Vk.js";
3
3
  import { D as now, E as not, S as any, T as count, a as defineModel, c as rowOf, d as fieldKinds, u as field, x as all, y as Relation } from "./model-6pJBqqGd.js";
4
4
  import { a as TableSet, i as platformAuthDefinitions, o as defineBuiltins, r as authTables } from "./tables-DjW96Ubl.js";
5
5
  import { n as seed } from "./seed-BObmdKdP.js";
package/dist/db/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { q as ValidationError } from "../validation-C3MCRBQO.js";
2
- import { C as database, I as dialectFor, J as DatabaseError, K as newSecretKey, L as sqlite, M as Query, U as fixedClock, W as systemClock, X as ReferenceFailed, Y as NotFound, Z as UniqueFailed, _ as TODO, b as Database, c as rollback, d as applyRules, g as UnsafeMigration, h as snapshotOf, i as acquireLock, l as setReleaseStatus, m as emptySnapshot, n as migrateFresh, p as generateMigration, q as CheckFailed, r as sync, s as releaseLock, t as migrate, u as startRelease, v as dataStep, x as Transaction, y as MigrationError } from "../migrator-DxTpns_-.js";
2
+ import { C as database, I as dialectFor, J as DatabaseError, K as newSecretKey, L as sqlite, M as Query, U as fixedClock, W as systemClock, X as ReferenceFailed, Y as NotFound, Z as UniqueFailed, _ as TODO, b as Database, c as rollback, d as applyRules, g as UnsafeMigration, h as snapshotOf, i as acquireLock, l as setReleaseStatus, m as emptySnapshot, n as migrateFresh, p as generateMigration, q as CheckFailed, r as sync, s as releaseLock, t as migrate, u as startRelease, v as dataStep, x as Transaction, y as MigrationError } from "../migrator-vvvKa0Vk.js";
3
3
  import { D as now, E as not, S as any, T as count, _ as Expr, b as Total, d as fieldKinds, f as Field, h as Condition, m as Column, p as sensitivity, t as Model, v as Now, x as all, y as Relation } from "../model-6pJBqqGd.js";
4
- import { i as slot, n as row, r as Slot, t as createDataLayer } from "../data-layer-CVCFjPyv.js";
4
+ import { i as slot, n as row, r as Slot, t as createDataLayer } from "../data-layer-BOVkYESH.js";
5
5
  import { t as Seed } from "../seed-BObmdKdP.js";
6
- import { a as cleanupMigration, i as makeMigrations, r as makeCleanup, t as checkMigrations } from "../make-jMJABOWI.js";
6
+ import { a as cleanupMigration, i as makeMigrations, r as makeCleanup, t as checkMigrations } from "../make-D6_caNkv.js";
7
7
  //#region src/db/migrations/files.ts
8
8
  /** A structure step file: adds tables and columns. Applied once, never edited. */
9
9
  function structureStep(options) {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { U as toKind, V as object, W as validate, _ as line, c as fileTypeNames, h as email, q as ValidationError } from "./validation-C3MCRBQO.js";
2
- import { A as planUpdate, B as checkTenancy, C as database, D as recordAction, F as modelOfRow, H as evaluate, N as conditionOf, O as withTableTotals, P as withIncludeRule, R as PLATFORM, S as clockOf, T as driverOf, V as NeedsDatabase, W as systemClock, Y as NotFound, Z as UniqueFailed, j as keyCondition, k as planInsert, r as sync, t as migrate, w as decodeStored, z as TENANT } from "./migrator-DxTpns_-.js";
3
- import { C as tooLarge, E as fail, S as tenantSuspended, T as Rejected, _ as json, b as routeNotFound, c as fromBody, d as route, f as HttpError, g as fileTypeRefused, h as fileTooLarge, l as readInput, m as errorResponse, o as parseListQuery, p as crossSiteRequest, r as resource, s as BODY_LIMIT, t as Resource, u as Route, v as lengthRequired, w as tooManyRequests, x as signInRequired, y as methodNotAllowed } from "./resource-BIMAiOre.js";
2
+ import { A as planUpdate, B as checkTenancy, C as database, D as recordAction, F as modelOfRow, H as evaluate, N as conditionOf, O as withTableTotals, P as withIncludeRule, R as PLATFORM, S as clockOf, T as driverOf, V as NeedsDatabase, W as systemClock, Y as NotFound, Z as UniqueFailed, j as keyCondition, k as planInsert, r as sync, t as migrate, w as decodeStored, z as TENANT } from "./migrator-vvvKa0Vk.js";
3
+ import { C as tooLarge, E as fail, S as tenantSuspended, T as Rejected, _ as json, b as routeNotFound, c as fromBody, d as route, f as HttpError, g as fileTypeRefused, h as fileTooLarge, l as readInput, m as errorResponse, o as parseListQuery, p as crossSiteRequest, r as resource, s as BODY_LIMIT, t as Resource, u as Route, v as lengthRequired, w as tooManyRequests, x as signInRequired, y as methodNotAllowed } from "./resource-DCg6LvMH.js";
4
4
  import { C as asCondition$1, I as fromBase64url, L as toBase64url, U as asActor, _ as Expr, c as rowOf, h as Condition, o as fieldOf, p as sensitivity, q as Scope, r as columnName, t as Model } from "./model-6pJBqqGd.js";
5
5
  import { r as ulid, t as kebabCase } from "./case-DpXlJCL9.js";
6
6
  import { n as notImplemented, t as NotImplementedError } from "./errors-mCNLlXg9.js";
@@ -8,7 +8,7 @@ import { t as PLATFORM_PREFIX } from "./tables-DjW96Ubl.js";
8
8
  import { t as Seed } from "./seed-BObmdKdP.js";
9
9
  import { d as afterUpdate, f as bindFor, h as ownerFieldOf, m as isFalse, p as check, u as FALSE } from "./policies-C_oiSgmY.js";
10
10
  import { i as checkRoles, n as authPerms, r as checkAuth } from "./create-auth-BCvMwlVD.js";
11
- import { _ as permissionsOf, a as hashOf, b as syncRoles, c as GoogleError, f as verifyIdToken, g as safeReturn, h as redirect, i as clearedCookie, l as consentUrl, m as cookieOf, n as authModels, o as sessions, p as cookie, t as makers, u as exchangeCode, v as roleKeys, y as seedAs } from "./makers-A0Pj6Tda.js";
11
+ import { _ as permissionsOf, a as hashOf, b as syncRoles, c as GoogleError, f as verifyIdToken, g as safeReturn, h as redirect, i as clearedCookie, l as consentUrl, m as cookieOf, n as authModels, o as sessions, p as cookie, t as makers, u as exchangeCode, v as roleKeys, y as seedAs } from "./makers-DjkBP74P.js";
12
12
  import { t as WrongSize } from "./storage-body-7dWyMszh.js";
13
13
  import { RegExpRouter } from "hono/router/reg-exp-router";
14
14
  import { SmartRouter } from "hono/router/smart-router";
@@ -1,4 +1,4 @@
1
- import { W as systemClock, f as dayOf, h as snapshotOf, p as generateMigration, y as MigrationError } from "./migrator-DxTpns_-.js";
1
+ import { W as systemClock, f as dayOf, h as snapshotOf, p as generateMigration, y as MigrationError } from "./migrator-vvvKa0Vk.js";
2
2
  //#region src/db/migrations/cleanup.ts
3
3
  /** Dropped tables, those that refer to others first, so no row is left pointing at a dropped one. */
4
4
  function dropOrder(tables) {
@@ -1,5 +1,5 @@
1
1
  import { J as Fake, Y as fakeValue } from "./validation-C3MCRBQO.js";
2
- import { D as recordAction, E as forUpkeep, S as clockOf, k as planInsert, q as CheckFailed } from "./migrator-DxTpns_-.js";
2
+ import { D as recordAction, E as forUpkeep, S as clockOf, k as planInsert, q as CheckFailed } from "./migrator-vvvKa0Vk.js";
3
3
  import { I as fromBase64url, L as toBase64url, l as IMPLICIT_FIELDS, t as Model } from "./model-6pJBqqGd.js";
4
4
  //#region src/auth/roles.ts
5
5
  const same = (a, b) => a.length === b.length && a.every((value, i) => value === b[i]);
@@ -2120,7 +2120,7 @@ function planInsert(model, input, now) {
2120
2120
  * A patch as assignments. A value is read through its kind; a function is an SQL expression over
2121
2121
  * the stored row (`(v) => v.stock.minus(2)`), which only the database can compute (and guard).
2122
2122
  */
2123
- function planUpdate(model, registry, patch, now, touch = true) {
2123
+ function planUpdate(model, registry, patch, now, upkeep = false) {
2124
2124
  const issues = [];
2125
2125
  rejectUnknown(model, patch, /* @__PURE__ */ new Set(), issues);
2126
2126
  const values = {};
@@ -2128,7 +2128,7 @@ function planUpdate(model, registry, patch, now, touch = true) {
2128
2128
  for (const [field, raw] of Object.entries(patch)) {
2129
2129
  const spec = fieldOf(model, field);
2130
2130
  if (!spec || spec.computed || spec.maintained || MANAGED$1.has(field) || raw === void 0) continue;
2131
- if (spec.fixed) {
2131
+ if (spec.fixed && !upkeep) {
2132
2132
  issues.push({
2133
2133
  path: [field],
2134
2134
  code: "fixed",
@@ -2148,10 +2148,10 @@ function planUpdate(model, registry, patch, now, touch = true) {
2148
2148
  if (issues.length > 0) throw new ValidationError(issues, { model: model.name });
2149
2149
  runChecks(model, values, now);
2150
2150
  return {
2151
- values: touch ? {
2151
+ values: upkeep ? values : {
2152
2152
  ...values,
2153
2153
  updatedAt: now
2154
- } : values,
2154
+ },
2155
2155
  expressions
2156
2156
  };
2157
2157
  }
@@ -2207,7 +2207,7 @@ function planUpsertOne(engine, target, key, options, context) {
2207
2207
  ...options.create,
2208
2208
  ...key
2209
2209
  }, context.now);
2210
- const set = options.update && planUpdate(target.spec, target.registry, options.update, context.now, !engine.upkeep);
2210
+ const set = options.update && planUpdate(target.spec, target.registry, options.update, context.now, engine.upkeep);
2211
2211
  const statements = async () => {
2212
2212
  const action = set ? { set: {
2213
2213
  ...set,
@@ -2226,7 +2226,7 @@ function planUpsertOne(engine, target, key, options, context) {
2226
2226
  }
2227
2227
  function planUpdateWhere(engine, target, patch, where, context, returning) {
2228
2228
  assertNotLog(target.spec);
2229
- const assignments = planUpdate(target.spec, target.registry, patch, context.now, !engine.upkeep);
2229
+ const assignments = planUpdate(target.spec, target.registry, patch, context.now, engine.upkeep);
2230
2230
  return async () => {
2231
2231
  const values = await engine.seal(target.spec, assignments.values);
2232
2232
  return wrap(aroundUpdate(engine, target, where, context), [engine.dialect.update(target.spec, {
@@ -1,5 +1,5 @@
1
1
  import { U as toKind, V as object, W as validate, q as ValidationError } from "./validation-C3MCRBQO.js";
2
- import { X as ReferenceFailed, Y as NotFound, Z as UniqueFailed, q as CheckFailed } from "./migrator-DxTpns_-.js";
2
+ import { X as ReferenceFailed, Y as NotFound, Z as UniqueFailed, q as CheckFailed } from "./migrator-vvvKa0Vk.js";
3
3
  import { C as asCondition, _ as Expr, g as Embed, l as IMPLICIT_FIELDS, r as columnName, s as computedFieldOf } from "./model-6pJBqqGd.js";
4
4
  import { r as actionsOf } from "./policies-C_oiSgmY.js";
5
5
  import { n as RESERVED, t as LOOKUPS } from "./syntax-CrUZFrS7.js";
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.js";
2
- import { G as utc, I as dialectFor, R as PLATFORM, U as fixedClock, a as currentRelease, b as Database, c as rollback, i as acquireLock, j as keyCondition, l as setReleaseStatus, m as emptySnapshot, n as migrateFresh, o as holdOf, p as generateMigration, r as sync, s as releaseLock, t as migrate, u as startRelease, v as dataStep, y as MigrationError, z as TENANT } from "../migrator-DxTpns_-.js";
2
+ import { G as utc, I as dialectFor, R as PLATFORM, U as fixedClock, a as currentRelease, b as Database, c as rollback, i as acquireLock, j as keyCondition, l as setReleaseStatus, m as emptySnapshot, n as migrateFresh, o as holdOf, p as generateMigration, r as sync, s as releaseLock, t as migrate, u as startRelease, v as dataStep, y as MigrationError, z as TENANT } from "../migrator-vvvKa0Vk.js";
3
3
  import { L as toBase64url, t as Model } from "../model-6pJBqqGd.js";
4
- import { t as createDataLayer } from "../data-layer-CVCFjPyv.js";
5
- import { d as forgetGoogleKeys, r as authOf, s as GOOGLE, t as makers, y as seedAs } from "../makers-A0Pj6Tda.js";
4
+ import { t as createDataLayer } from "../data-layer-BOVkYESH.js";
5
+ import { d as forgetGoogleKeys, r as authOf, s as GOOGLE, t as makers, y as seedAs } from "../makers-DjkBP74P.js";
6
6
  import { describe, expect, it } from "vitest";
7
7
  //#region src/testing/conformance/database.ts
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaijs/core",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "A batteries-included, type-safe TypeScript backend framework. Cloudflare first, no lock-in.",
5
5
  "type": "module",
6
6
  "license": "MIT",