@seedprotocol/sdk 0.2.6 → 0.2.7

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
- import { B as BaseItem } from './index-s_H8DdLb.js';
1
+ import { B as BaseItem } from './index-CvJyeO8i.js';
2
2
  import 'immer';
3
3
  import 'reflect-metadata';
4
4
  import 'tslib';
@@ -37,4 +37,4 @@ class Item extends BaseItem {
37
37
  BaseItem.setPlatformClass(Item);
38
38
 
39
39
  export { Item };
40
- //# sourceMappingURL=Item-5bbmH1H4.js.map
40
+ //# sourceMappingURL=Item-C0yRQjy9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Item-5bbmH1H4.js","sources":["../../src/node/Item/Item.ts"],"sourcesContent":["import { IItem } from '@/interfaces';\nimport { BaseItem } from '@/Item/BaseItem';\nimport { ModelSchema, ModelValues } from '@/types';\n\nexport class Item<T extends ModelValues<ModelSchema>> extends BaseItem<T> implements IItem<T> {\n constructor(initialValues: any) {\n super(initialValues);\n }\n\n}\n\nBaseItem.setPlatformClass(Item)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIM,MAAO,IAAyC,SAAQ,QAAW,CAAA;AACvE,IAAA,WAAA,CAAY,aAAkB,EAAA;QAC5B,KAAK,CAAC,aAAa,CAAC;;AAGvB;AAED,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;;;;"}
1
+ {"version":3,"file":"Item-C0yRQjy9.js","sources":["../../src/node/Item/Item.ts"],"sourcesContent":["import { IItem } from '@/interfaces';\nimport { BaseItem } from '@/Item/BaseItem';\nimport { ModelSchema, ModelValues } from '@/types';\n\nexport class Item<T extends ModelValues<ModelSchema>> extends BaseItem<T> implements IItem<T> {\n constructor(initialValues: any) {\n super(initialValues);\n }\n\n}\n\nBaseItem.setPlatformClass(Item)"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIM,MAAO,IAAyC,SAAQ,QAAW,CAAA;AACvE,IAAA,WAAA,CAAY,aAAkB,EAAA;QAC5B,KAAK,CAAC,aAAa,CAAC;;AAGvB;AAED,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- export { I as Item } from './index-s_H8DdLb.js';
1
+ export { I as Item } from './index-CvJyeO8i.js';
2
2
  import 'immer';
3
3
  import 'reflect-metadata';
4
4
  import 'tslib';
@@ -28,4 +28,4 @@ import '@zenfs/dom';
28
28
  import 'arweave';
29
29
  import 'use-immer';
30
30
  import '@xstate/react';
31
- //# sourceMappingURL=index-CoqbOXfg.js.map
31
+ //# sourceMappingURL=index-BOWZmkrB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BOWZmkrB.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -9,7 +9,7 @@ import 'dayjs';
9
9
  import { customAlphabet } from 'nanoid';
10
10
  import * as nanoIdDictionary from 'nanoid-dictionary';
11
11
  import debug from 'debug';
12
- import { a as BaseQueryClient, B as BaseEasClient, I as INTERNAL_DATA_TYPES, G as GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY, d as GLOBAL_INITIALIZING_SEND_CONFIG, e as GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES, f as GLOBAL_ADDING_MODELS_TO_DB_SUCCESS, D as DB_CHECK_STATUS_UPDATE_PATHS, g as DB_CHECK_STATUS_EXISTS, h as BROWSER_FS_TOP_DIR, i as DB_CREATING_SUCCESS, j as DB_VALIDATING_SUCCESS, k as DB_VALIDATING_WAIT, l as DB_MIGRATING_SUCCESS, M as MachineIds, m as DB_WAITING_FOR_FILES_RECEIVED, n as DB_MIGRATING_WAIT, o as DbState, p as INTERNAL_VALIDATING_INPUT_SUCCESS, b as BaseArweaveClient, q as ARWEAVE_HOST, r as INTERNAL_CONFIGURING_FS_SUCCESS, s as INTERNAL_SAVING_CONFIG_SUCCESS, t as INTERNAL_LOADING_APP_DB_SUCCESS, u as DB_ON_SNAPSHOT, v as DB_NAME_APP, w as InternalState, P as PublishMachineStates, x as GlobalState, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, y as defaultAttestationData, z as internalPropertyNames } from './constants-CtWTDW5q.js';
12
+ import { a as BaseQueryClient, B as BaseEasClient, I as INTERNAL_DATA_TYPES, G as GLOBAL_INITIALIZING_INTERNAL_SERVICE_READY, d as GLOBAL_INITIALIZING_SEND_CONFIG, e as GLOBAL_INITIALIZING_CREATE_ALL_ITEMS_SERVICES, f as GLOBAL_ADDING_MODELS_TO_DB_SUCCESS, D as DB_CHECK_STATUS_UPDATE_PATHS, g as DB_CHECK_STATUS_EXISTS, h as BROWSER_FS_TOP_DIR, i as DB_CREATING_SUCCESS, j as DB_VALIDATING_SUCCESS, k as DB_VALIDATING_WAIT, l as DB_MIGRATING_SUCCESS, M as MachineIds, m as DB_WAITING_FOR_FILES_RECEIVED, n as DB_MIGRATING_WAIT, o as DbState, p as INTERNAL_VALIDATING_INPUT_SUCCESS, q as ARWEAVE_HOST, b as BaseArweaveClient, r as INTERNAL_CONFIGURING_FS_SUCCESS, s as INTERNAL_SAVING_CONFIG_SUCCESS, t as INTERNAL_LOADING_APP_DB_SUCCESS, u as DB_ON_SNAPSHOT, v as DB_NAME_APP, w as InternalState, P as PublishMachineStates, x as GlobalState, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, y as defaultAttestationData, z as internalPropertyNames } from './constants-CtWTDW5q.js';
13
13
  import { sqliteTable, text, int, blob, check, unique } from 'drizzle-orm/sqlite-core';
14
14
  import { sql, relations, and, eq, max, or, isNotNull, not, inArray, like, isNull, getTableColumns, count, gt } from 'drizzle-orm';
15
15
  import path from 'path';
@@ -1271,7 +1271,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1271
1271
  if (propertyRecordSchema &&
1272
1272
  propertyRecordSchema.storageType &&
1273
1273
  propertyRecordSchema.storageType === 'ItemStorage') {
1274
- const { Item } = yield import('./index-CoqbOXfg.js');
1274
+ const { Item } = yield import('./index-BOWZmkrB.js');
1275
1275
  const item = yield Item.find({
1276
1276
  seedLocalId,
1277
1277
  modelName,
@@ -2222,7 +2222,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2222
2222
  if (!models$1) {
2223
2223
  return;
2224
2224
  }
2225
- const { models: SeedModels } = yield import('./seed.schema.config-CTpDY6LU.js');
2225
+ const { models: SeedModels } = yield import('./seed.schema.config-DLCIfUGL.js');
2226
2226
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2227
2227
  let hasModelsInDb = false;
2228
2228
  const schemaDefsByModelName = new Map();
@@ -3234,9 +3234,6 @@ const saveAppState = (key, value) => __awaiter(void 0, void 0, void 0, function*
3234
3234
  });
3235
3235
  });
3236
3236
 
3237
- const easClient$5 = BaseEasClient.getEasClient();
3238
- const queryClient$5 = BaseQueryClient.getQueryClient();
3239
- const arweaveClient = BaseArweaveClient.getArweaveClient();
3240
3237
  const logger$e = debug('app:files:download');
3241
3238
  const downloadAllFilesRequestHandler = (_a) => __awaiter(void 0, [_a], void 0, function* ({ endpoints, eventId, }) {
3242
3239
  yield syncDbFiles(endpoints);
@@ -3259,10 +3256,12 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
3259
3256
  if (!addresses || addresses.length === 0) {
3260
3257
  return;
3261
3258
  }
3262
- const { filesMetadata } = yield queryClient$5.fetchQuery({
3259
+ const queryClient = BaseQueryClient.getQueryClient();
3260
+ const easClient = BaseEasClient.getEasClient();
3261
+ const { filesMetadata } = yield queryClient.fetchQuery({
3263
3262
  queryKey: ['getFilesMetadata', ...addresses],
3264
3263
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
3265
- return easClient$5.request(GET_FILES_METADATA, {
3264
+ return easClient.request(GET_FILES_METADATA, {
3266
3265
  where: {
3267
3266
  attester: {
3268
3267
  in: addresses,
@@ -3329,7 +3328,8 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
3329
3328
  if (transactionId === 'ZXnDkNk_PHRl5Yqu90kEJn_R3LS3Tl9P8eLtlJTqB-M') {
3330
3329
  console.log('transactionId', transactionId);
3331
3330
  }
3332
- const { tags: tagsResult } = yield queryClient$5.fetchQuery({
3331
+ const arweaveClient = BaseArweaveClient.getArweaveClient();
3332
+ const { tags: tagsResult } = yield queryClient.fetchQuery({
3333
3333
  queryKey: ['getTransactionTags', transactionId],
3334
3334
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
3335
3335
  return arweaveClient.request(GET_TRANSACTION_TAGS, {
@@ -3352,7 +3352,7 @@ const downloadAllFilesBinaryRequestHandler = () => __awaiter(void 0, void 0, voi
3352
3352
  }
3353
3353
  }
3354
3354
  }
3355
- const data = yield queryClient$5.fetchQuery({
3355
+ const data = yield queryClient.fetchQuery({
3356
3356
  queryKey: ['fetchTransaction', transactionId],
3357
3357
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
3358
3358
  const response = yield fetch(`https://${ARWEAVE_HOST}/raw/${transactionId}`);
@@ -3864,8 +3864,6 @@ const internalMachine = setup({
3864
3864
  // })
3865
3865
  // internalService.start()
3866
3866
 
3867
- const easClient$4 = BaseEasClient.getEasClient();
3868
- const queryClient$4 = BaseQueryClient.getQueryClient();
3869
3867
  const initialize = fromCallback(({ sendBack, input: { context } }) => {
3870
3868
  const { modelName, modelAddedToDb, ModelClass, times } = context;
3871
3869
  const newTimes = {
@@ -3908,10 +3906,12 @@ const initialize = fromCallback(({ sendBack, input: { context } }) => {
3908
3906
  // }
3909
3907
  modelNameLowercase = modelName.toLowerCase();
3910
3908
  modelNamePlural = pluralize(modelNameLowercase);
3911
- const modelSchemas = yield queryClient$4.fetchQuery({
3909
+ const queryClient = BaseQueryClient.getQueryClient();
3910
+ const easClient = BaseEasClient.getEasClient();
3911
+ const modelSchemas = yield queryClient.fetchQuery({
3912
3912
  queryKey: [`getSchemas${modelName}`],
3913
3913
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
3914
- return easClient$4.request(GET_SCHEMAS, {
3914
+ return easClient.request(GET_SCHEMAS, {
3915
3915
  where: {
3916
3916
  schema: {
3917
3917
  equals: `bytes32 ${toSnakeCase(modelName)}`,
@@ -3981,9 +3981,9 @@ const initialize = fromCallback(({ sendBack, input: { context } }) => {
3981
3981
  });
3982
3982
  }
3983
3983
  }
3984
- const foundPropertySchemas = yield queryClient$4.fetchQuery({
3984
+ const foundPropertySchemas = yield queryClient.fetchQuery({
3985
3985
  queryKey: [`getPropertySchemas${modelName}`],
3986
- queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient$4.request(GET_SCHEMAS, queryVariables); }),
3986
+ queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient.request(GET_SCHEMAS, queryVariables); }),
3987
3987
  });
3988
3988
  const tempExclusions = ['html', 'json'];
3989
3989
  for (const foundProperty of foundPropertiesDb) {
@@ -4058,8 +4058,6 @@ const fetchDbData = fromCallback(({ sendBack, input: { context } }) => {
4058
4058
  return () => { };
4059
4059
  });
4060
4060
 
4061
- const easClient$3 = BaseEasClient.getEasClient();
4062
- const queryClient$3 = BaseQueryClient.getQueryClient();
4063
4061
  const logger$9 = debug('app:allItemsActors:fetchSeeds');
4064
4062
  const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
4065
4063
  const { queryVariables, modelName } = context;
@@ -4069,11 +4067,13 @@ const fetchSeeds = fromCallback(({ sendBack, input: { context } }) => {
4069
4067
  let itemSeeds;
4070
4068
  const _fetchSeeds = () => __awaiter(void 0, void 0, void 0, function* () {
4071
4069
  const queryKey = [`getSeeds${modelName}`];
4072
- const cachedResults = queryClient$3.getQueryData(queryKey);
4070
+ const queryClient = BaseQueryClient.getQueryClient();
4071
+ const easClient = BaseEasClient.getEasClient();
4072
+ const cachedResults = queryClient.getQueryData(queryKey);
4073
4073
  logger$9(`[allItemsActors] [fetchSeeds] cachedResults ${Date.now()}`, cachedResults);
4074
- const results = yield queryClient$3.fetchQuery({
4074
+ const results = yield queryClient.fetchQuery({
4075
4075
  queryKey,
4076
- queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient$3.request(GET_SEEDS, queryVariables); }),
4076
+ queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient.request(GET_SEEDS, queryVariables); }),
4077
4077
  });
4078
4078
  itemSeeds = results.itemSeeds;
4079
4079
  });
@@ -4113,8 +4113,6 @@ const fetchVersions = fromCallback(({ sendBack, input: { context } }) => {
4113
4113
  return () => { };
4114
4114
  });
4115
4115
 
4116
- const easClient$2 = BaseEasClient.getEasClient();
4117
- const queryClient$2 = BaseQueryClient.getQueryClient();
4118
4116
  const fetchRelatedItems = fromCallback(({ sendBack, input: { context } }) => {
4119
4117
  const { ModelClass, modelName } = context;
4120
4118
  const appDb = BaseDb.getAppDb();
@@ -4154,10 +4152,12 @@ const fetchRelatedItems = fromCallback(({ sendBack, input: { context } }) => {
4154
4152
  }
4155
4153
  }
4156
4154
  const queryKey = [`getRelatedSeedIds${modelName}`];
4157
- const { itemSeedIds: relatedSeedIdAttestations } = yield queryClient$2.fetchQuery({
4155
+ const queryClient = BaseQueryClient.getQueryClient();
4156
+ const easClient = BaseEasClient.getEasClient();
4157
+ const { itemSeedIds: relatedSeedIdAttestations } = yield queryClient.fetchQuery({
4158
4158
  queryKey,
4159
4159
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
4160
- return easClient$2.request(GET_SEED_IDS, {
4160
+ return easClient.request(GET_SEED_IDS, {
4161
4161
  where: {
4162
4162
  schema: {
4163
4163
  is: {
@@ -4174,10 +4174,10 @@ const fetchRelatedItems = fromCallback(({ sendBack, input: { context } }) => {
4174
4174
  }),
4175
4175
  });
4176
4176
  const relatedSeedIds = relatedSeedIdAttestations.map((seed) => seed.id);
4177
- const { itemVersions: relatedVersions } = yield queryClient$2.fetchQuery({
4177
+ const { itemVersions: relatedVersions } = yield queryClient.fetchQuery({
4178
4178
  queryKey: [`getRelatedVersions${modelName}`],
4179
4179
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
4180
- return easClient$2.request(GET_VERSIONS, {
4180
+ return easClient.request(GET_VERSIONS, {
4181
4181
  where: {
4182
4182
  refUID: {
4183
4183
  in: relatedSeedIds,
@@ -4206,10 +4206,10 @@ const fetchRelatedItems = fromCallback(({ sendBack, input: { context } }) => {
4206
4206
  }
4207
4207
  // Extract the ids of the most recent versions
4208
4208
  const mostRecentVersionIds = Array.from(mostRecentVersionsBySeedUid.values()).map((version) => version.id);
4209
- const { allProperties } = yield queryClient$2.fetchQuery({
4209
+ const { allProperties } = yield queryClient.fetchQuery({
4210
4210
  queryKey: [`getAllProperties${modelName}`],
4211
4211
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
4212
- return easClient$2.request(GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, {
4212
+ return easClient.request(GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, {
4213
4213
  where: {
4214
4214
  refUID: {
4215
4215
  in: mostRecentVersionIds,
@@ -5074,8 +5074,6 @@ const hydrateNewItem = fromCallback(({ sendBack, input: { context } }) => {
5074
5074
  });
5075
5075
  });
5076
5076
 
5077
- const easClient$1 = BaseEasClient.getEasClient();
5078
- const queryClient$1 = BaseQueryClient.getQueryClient();
5079
5077
  const fetchDataFromEas = fromCallback(({ sendBack, input: { context } }) => {
5080
5078
  const { ModelClass, modelTableName, versionUid } = context;
5081
5079
  const propertiesMetadata = new Map();
@@ -5093,11 +5091,13 @@ const fetchDataFromEas = fromCallback(({ sendBack, input: { context } }) => {
5093
5091
  return;
5094
5092
  }
5095
5093
  const _fetchDataFromEas = () => __awaiter(void 0, void 0, void 0, function* () {
5094
+ const queryClient = BaseQueryClient.getQueryClient();
5095
+ const easClient = BaseEasClient.getEasClient();
5096
5096
  // Fetch Properties by versionUid
5097
- const { itemProperties } = yield queryClient$1.fetchQuery({
5097
+ const { itemProperties } = yield queryClient.fetchQuery({
5098
5098
  queryKey: ['getProperties', versionUid],
5099
5099
  queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
5100
- return easClient$1.request(GET_PROPERTIES, {
5100
+ return easClient.request(GET_PROPERTIES, {
5101
5101
  where: {
5102
5102
  refUID: {
5103
5103
  in: [versionUid],
@@ -7989,7 +7989,7 @@ const initItem = () => __awaiter(void 0, void 0, void 0, function* () {
7989
7989
  (yield Promise.resolve().then(function () { return Item$1; })).Item;
7990
7990
  }
7991
7991
  else {
7992
- (yield import('./Item-5bbmH1H4.js')).Item;
7992
+ (yield import('./Item-C0yRQjy9.js')).Item;
7993
7993
  }
7994
7994
  });
7995
7995
 
@@ -8030,7 +8030,7 @@ const client = {
8030
8030
  addresses,
8031
8031
  arweaveDomain,
8032
8032
  });
8033
- const { models: internalModels } = yield import('./seed.schema.config-CTpDY6LU.js');
8033
+ const { models: internalModels } = yield import('./seed.schema.config-DLCIfUGL.js');
8034
8034
  for (const [key, value] of Object.entries(internalModels)) {
8035
8035
  setModel(key, value);
8036
8036
  }
@@ -8081,4 +8081,4 @@ const client = {
8081
8081
  enableMapSet();
8082
8082
 
8083
8083
  export { BaseItem as B, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, ImageSrc as a, ItemProperty as b, useItem as c, useItemProperties as d, useCreateItem as e, useItemProperty as f, useDeleteItem as g, useGlobalServiceStatus as h, useServices as i, getGlobalService as j, getCorrectId as k, BaseFileManager as l, eventEmitter as m, client as n, useItems as u, withSeed as w };
8084
- //# sourceMappingURL=index-s_H8DdLb.js.map
8084
+ //# sourceMappingURL=index-CvJyeO8i.js.map