@seedprotocol/sdk 0.1.42 → 0.1.43

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.
@@ -1,4 +1,4 @@
1
- export { f as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, e as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SEEDS, b as GET_SEED_IDS, c as GET_STORAGE_TRANSACTION_ID, d as GET_VERSIONS, I as Item, g as itemMachineAll, i as itemMachineSingle } from './index-CQMUGXEO.js';
1
+ export { f as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, e as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SEEDS, b as GET_SEED_IDS, c as GET_STORAGE_TRANSACTION_ID, d as GET_VERSIONS, I as Item, g as itemMachineAll, i as itemMachineSingle } from './index-CdvwVcYz.js';
2
2
  import './constants-KW2RTtZB.js';
3
3
  import 'path';
4
4
  import 'reflect-metadata';
@@ -27,4 +27,4 @@ import '@xstate/react';
27
27
  import '@statelyai/inspect';
28
28
  import '@zenfs/dom';
29
29
  import 'drizzle-orm/sqlite-proxy';
30
- //# sourceMappingURL=index-CRxO3Kq1.js.map
30
+ //# sourceMappingURL=index-CLdGyn50.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CLdGyn50.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,7 +3,7 @@ import path, { basename } from 'path';
3
3
  import 'reflect-metadata';
4
4
  import { Type } from '@sinclair/typebox';
5
5
  import { fromCallback, setup, assign, createActor, waitFor, emit, raise } from 'xstate';
6
- import { sql, relations, and, eq, max, or, count, isNotNull, isNull, like } from 'drizzle-orm';
6
+ import { sql, relations, and, eq, max, or, isNotNull, isNull, count, desc, like } from 'drizzle-orm';
7
7
  import { fs, configureSingle } from '@zenfs/core';
8
8
  import 'dayjs';
9
9
  import { customAlphabet } from 'nanoid';
@@ -984,7 +984,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
984
984
  renderValue: refResolvedDisplayValue,
985
985
  });
986
986
  if (propertyNameFromDb === 'storageTransactionId') {
987
- const { Item } = yield import('./index-CRxO3Kq1.js');
987
+ const { Item } = yield import('./index-CLdGyn50.js');
988
988
  const item = yield Item.find({
989
989
  seedLocalId,
990
990
  modelName: itemModelName,
@@ -3099,6 +3099,16 @@ const itemMachineSingle = setup({
3099
3099
 
3100
3100
  const getItemsData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelName, deleted, }) {
3101
3101
  const appDb = getAppDb();
3102
+ const conditions = [];
3103
+ if (modelName) {
3104
+ conditions.push(eq(seeds.type, modelName.toLowerCase()));
3105
+ }
3106
+ if (deleted) {
3107
+ conditions.push(or(isNotNull(seeds._markedForDeletion), eq(seeds._markedForDeletion, 1)));
3108
+ }
3109
+ if (!deleted) {
3110
+ conditions.push(or(isNull(seeds._markedForDeletion), eq(seeds._markedForDeletion, 0)));
3111
+ }
3102
3112
  let query = appDb
3103
3113
  .select({
3104
3114
  seedLocalId: seeds.localId,
@@ -3109,20 +3119,14 @@ const getItemsData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelN
3109
3119
  versionsCount: count(versions.localId),
3110
3120
  lastVersionPublishedAt: max(versions.attestationCreatedAt),
3111
3121
  lastLocalUpdateAt: max(versions.createdAt),
3122
+ createdAt: seeds.createdAt,
3112
3123
  })
3113
3124
  .from(seeds)
3114
3125
  .leftJoin(versions, eq(seeds.localId, versions.seedLocalId))
3115
- .$dynamic();
3116
- if (modelName) {
3117
- query = query.where(eq(seeds.type, modelName.toLowerCase()));
3118
- }
3119
- if (deleted) {
3120
- query = query.where(or(isNotNull(seeds._markedForDeletion), eq(seeds._markedForDeletion, 1)));
3121
- }
3122
- if (!deleted) {
3123
- query = query.where(or(isNull(seeds._markedForDeletion), eq(seeds._markedForDeletion, 0)));
3124
- }
3125
- const itemsData = (yield query.groupBy(seeds.localId));
3126
+ .where(and(...conditions))
3127
+ .orderBy(desc(seeds.createdAt))
3128
+ .groupBy(seeds.localId);
3129
+ const itemsData = (yield query);
3126
3130
  return itemsData;
3127
3131
  });
3128
3132
 
@@ -4371,7 +4375,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
4371
4375
  if (!models$1) {
4372
4376
  return;
4373
4377
  }
4374
- const { models: SeedModels } = yield import('./seed.schema.config-C1msLpdD.js');
4378
+ const { models: SeedModels } = yield import('./seed.schema.config-keaMgDSQ.js');
4375
4379
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
4376
4380
  let hasModelsInDb = false;
4377
4381
  const schemaDefsByModelName = new Map();
@@ -5847,11 +5851,11 @@ const globalMachine = setup({
5847
5851
  (_a) => __awaiter(void 0, [_a], void 0, function* ({ context }) {
5848
5852
  let SeedClass;
5849
5853
  if (context.environment === 'node') {
5850
- const { SeedNode } = yield import('./seed-CZTfFPC0.js');
5854
+ const { SeedNode } = yield import('./seed-BHTgf9tV.js');
5851
5855
  SeedClass = SeedNode;
5852
5856
  }
5853
5857
  else {
5854
- const { SeedBrowser } = yield import('./seed-X5AZrDlF.js');
5858
+ const { SeedBrowser } = yield import('./seed-BY0EJg54.js');
5855
5859
  SeedClass = SeedBrowser;
5856
5860
  }
5857
5861
  return SeedClass;
@@ -6698,7 +6702,7 @@ const client = {
6698
6702
  console.error('fs listeners not ready during init');
6699
6703
  }
6700
6704
  globalService.send({ type: 'init', endpoints, models, addresses });
6701
- import('./seed.schema.config-C1msLpdD.js').then(({ models }) => {
6705
+ import('./seed.schema.config-keaMgDSQ.js').then(({ models }) => {
6702
6706
  for (const [key, value] of Object.entries(models)) {
6703
6707
  setModel(key, value);
6704
6708
  }
@@ -6755,4 +6759,4 @@ if (isNode()) {
6755
6759
  }
6756
6760
 
6757
6761
  export { CHILD_SNAPSHOT as C, GET_SCHEMAS as G, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, GET_SEEDS as a, GET_SEED_IDS as b, GET_STORAGE_TRANSACTION_ID as c, GET_VERSIONS as d, GET_PROPERTIES as e, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as f, itemMachineAll as g, internalMachine as h, itemMachineSingle as i, isNode as j, isBrowser as k, isReactNative as l, ImageSrc as m, ItemProperty as n, useItem as o, useItemProperties as p, useCreateItem as q, useItemProperty as r, useDeleteItem as s, useGlobalServiceStatus as t, useItems as u, useServices as v, withSeed as w, getGlobalService as x, client as y, getCorrectId as z };
6758
- //# sourceMappingURL=index-CQMUGXEO.js.map
6762
+ //# sourceMappingURL=index-CdvwVcYz.js.map