@seedprotocol/sdk 0.7.1 → 0.7.2
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/{BasePathResolver-DRT09oVv.js → BasePathResolver-BdxCSIzn.js} +2 -2
- package/dist/{BasePathResolver-DRT09oVv.js.map → BasePathResolver-BdxCSIzn.js.map} +1 -1
- package/dist/{ClientManager-DngaZdw6.js → ClientManager-ClCwwhwo.js} +27 -22
- package/dist/ClientManager-ClCwwhwo.js.map +1 -0
- package/dist/{Item-ZUAmf943.js → Item-B9Y4VuK1.js} +75 -55
- package/dist/Item-B9Y4VuK1.js.map +1 -0
- package/dist/{ModelProperty-6llK4MTH.js → ModelProperty-BMePcicQ.js} +26 -27
- package/dist/ModelProperty-BMePcicQ.js.map +1 -0
- package/dist/{Schema-D-Ud-XYw.js → Schema-COsEXXaR.js} +30 -31
- package/dist/{Schema-D-Ud-XYw.js.map → Schema-COsEXXaR.js.map} +1 -1
- package/dist/{SchemaValidationService-IoS7JquP.js → SchemaValidationService-DabGMzSE.js} +7 -8
- package/dist/{SchemaValidationService-IoS7JquP.js.map → SchemaValidationService-DabGMzSE.js.map} +1 -1
- package/dist/{backfillMetadataPropertyIds-BlVeE7w7.js → backfillMetadataPropertyIds-Ck6fumnm.js} +4 -4
- package/dist/{backfillMetadataPropertyIds-BlVeE7w7.js.map → backfillMetadataPropertyIds-Ck6fumnm.js.map} +1 -1
- package/dist/cjs/{ModelProperty-Dv7AQfmQ.js → ModelProperty-BT6Un_MB.js} +21 -21
- package/dist/cjs/{ModelProperty-Dv7AQfmQ.js.map → ModelProperty-BT6Un_MB.js.map} +1 -1
- package/dist/cjs/{Schema-BHVp1g-M.js → Schema-BXhXdUsA.js} +23 -23
- package/dist/cjs/{Schema-BHVp1g-M.js.map → Schema-BXhXdUsA.js.map} +1 -1
- package/dist/cjs/{SchemaValidationService-BSU9knjf.js → SchemaValidationService-CC18QDfc.js} +2 -2
- package/dist/cjs/{SchemaValidationService-BSU9knjf.js.map → SchemaValidationService-CC18QDfc.js.map} +1 -1
- package/dist/cjs/{backfillMetadataPropertyIds-WIovQ_d8.js → backfillMetadataPropertyIds-DEHC9ejq.js} +3 -3
- package/dist/cjs/{backfillMetadataPropertyIds-WIovQ_d8.js.map → backfillMetadataPropertyIds-DEHC9ejq.js.map} +1 -1
- package/dist/cjs/{eas-CUYXdr2t.js → eas-C3CL0l7l.js} +3 -3
- package/dist/cjs/{eas-CUYXdr2t.js.map → eas-C3CL0l7l.js.map} +1 -1
- package/dist/cjs/{getItem-z1tHu0hu.js → getItem-CrwWYCkj.js} +2 -2
- package/dist/cjs/{getItem-z1tHu0hu.js.map → getItem-CrwWYCkj.js.map} +1 -1
- package/dist/cjs/{getPublishPayload-CEP_e-Kv.js → getPublishPayload-DRJh7WR0.js} +22 -16
- package/dist/cjs/getPublishPayload-DRJh7WR0.js.map +1 -0
- package/dist/cjs/{getPublishUploads-Ctn5k1k6.js → getPublishUploads-Bh22D3zJ.js} +4 -4
- package/dist/cjs/{getPublishUploads-Ctn5k1k6.js.map → getPublishUploads-Bh22D3zJ.js.map} +1 -1
- package/dist/cjs/{index-DfGhF1dc.js → index-BA1RIYFG.js} +3 -3
- package/dist/cjs/index-BA1RIYFG.js.map +1 -0
- package/dist/cjs/{index-Cvvt0-5B.js → index-Dls7aMjr.js} +74 -40
- package/dist/cjs/index-Dls7aMjr.js.map +1 -0
- package/dist/cjs/{property-DbEPQ1m9.js → property-ZerTWizX.js} +5 -5
- package/dist/cjs/{property-DbEPQ1m9.js.map → property-ZerTWizX.js.map} +1 -1
- package/dist/cjs/{publishDraftGraph-C38gf302.js → publishDraftGraph-CPOAcQFf.js} +4 -4
- package/dist/cjs/{publishDraftGraph-C38gf302.js.map → publishDraftGraph-CPOAcQFf.js.map} +1 -1
- package/dist/cjs/{resetAmbiguousLegacyItemData-CfMhRHwK.js → resetAmbiguousLegacyItemData-adDl4LcT.js} +2 -2
- package/dist/cjs/{resetAmbiguousLegacyItemData-CfMhRHwK.js.map → resetAmbiguousLegacyItemData-adDl4LcT.js.map} +1 -1
- package/dist/cjs/{resolveModelForSyncedSeed-CNYaLOir.js → resolveModelForSyncedSeed-DoNThPdL.js} +2 -2
- package/dist/cjs/{resolveModelForSyncedSeed-CNYaLOir.js.map → resolveModelForSyncedSeed-DoNThPdL.js.map} +1 -1
- package/dist/cjs/{syncDbWithEas-d1iOdTTI.js → syncDbWithEas-CYfPkus9.js} +7 -7
- package/dist/cjs/{syncDbWithEas-d1iOdTTI.js.map → syncDbWithEas-CYfPkus9.js.map} +1 -1
- package/dist/{configurePlatform-CZpjyuCo.js → configurePlatform-xU3Hsno3.js} +4 -4
- package/dist/{configurePlatform-CZpjyuCo.js.map → configurePlatform-xU3Hsno3.js.map} +1 -1
- package/dist/{db-Lw0KVZmc.js → db-W1g29qsM.js} +30 -26
- package/dist/{db-Lw0KVZmc.js.map → db-W1g29qsM.js.map} +1 -1
- package/dist/{eas-CQ-Smzk2.js → eas-CSwV6MvB.js} +5 -5
- package/dist/{eas-CQ-Smzk2.js.map → eas-CSwV6MvB.js.map} +1 -1
- package/dist/{getItem-CSfSok9f.js → getItem-BYQeM3DY.js} +5 -6
- package/dist/{getItem-CSfSok9f.js.map → getItem-BYQeM3DY.js.map} +1 -1
- package/dist/{getPublishPayload-76_KfB5Y.js → getPublishPayload-D5CQZd-y.js} +27 -21
- package/dist/getPublishPayload-D5CQZd-y.js.map +1 -0
- package/dist/{getPublishUploads-CqgMBD8f.js → getPublishUploads-BGpDsrBp.js} +9 -10
- package/dist/{getPublishUploads-CqgMBD8f.js.map → getPublishUploads-BGpDsrBp.js.map} +1 -1
- package/dist/{index-BpgD305l.js → index-Bev-hZF-.js} +9 -10
- package/dist/index-Bev-hZF-.js.map +1 -0
- package/dist/{index-5b3JsS55.js → index-CSOQFAOn.js} +2 -2
- package/dist/index-CSOQFAOn.js.map +1 -0
- package/dist/{index-Y-yYyRBf.js → index-DRXC5Mra.js} +38 -37
- package/dist/{index-Y-yYyRBf.js.map → index-DRXC5Mra.js.map} +1 -1
- package/dist/{index.browser-DaTzn79x.js → index.browser-DO20vYuP.js} +8 -8
- package/dist/{index.browser-DaTzn79x.js.map → index.browser-DO20vYuP.js.map} +1 -1
- package/dist/{index.node-NYKqFOoe.js → index.node-C4iyOhdo.js} +5 -5
- package/dist/{index.node-NYKqFOoe.js.map → index.node-C4iyOhdo.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +28 -29
- package/dist/main.js.map +1 -1
- package/dist/node.js +14 -15
- package/dist/node.js.map +1 -1
- package/dist/platform.browser.js +5 -5
- package/dist/platform.node.js +3 -3
- package/dist/{property-ByaiSyUK.js → property-BT1zDSkd.js} +9 -10
- package/dist/property-BT1zDSkd.js.map +1 -0
- package/dist/{publishDraftGraph-BRm6Pq3Q.js → publishDraftGraph-Bcfrdj7-.js} +8 -8
- package/dist/{publishDraftGraph-BRm6Pq3Q.js.map → publishDraftGraph-Bcfrdj7-.js.map} +1 -1
- package/dist/{resetAmbiguousLegacyItemData-B4dX6ZA1.js → resetAmbiguousLegacyItemData-Ci6PM_vC.js} +2 -2
- package/dist/{resetAmbiguousLegacyItemData-B4dX6ZA1.js.map → resetAmbiguousLegacyItemData-Ci6PM_vC.js.map} +1 -1
- package/dist/{resolveModelForSyncedSeed-B0tco3zG.js → resolveModelForSyncedSeed-CLlumTBq.js} +2 -2
- package/dist/{resolveModelForSyncedSeed-B0tco3zG.js.map → resolveModelForSyncedSeed-CLlumTBq.js.map} +1 -1
- package/dist/src/Item/Item.d.ts.map +1 -1
- package/dist/src/db/read/getPublishPayload.d.ts.map +1 -1
- package/dist/src/helpers/generateId.d.ts +4 -0
- package/dist/src/helpers/generateId.d.ts.map +1 -1
- package/dist/src/query/createLocalQueryDataSource.d.ts.map +1 -1
- package/dist/{syncDbWithEas-BPap9Sru.js → syncDbWithEas-BQsXjGhe.js} +13 -14
- package/dist/syncDbWithEas-BQsXjGhe.js.map +1 -0
- package/dist/{tabEvents-C6NXS6Jl.js → tabEvents-C9qUKx_z.js} +28 -11
- package/dist/tabEvents-C9qUKx_z.js.map +1 -0
- package/dist/{tolerantWebAccess-NBQ1NB4i.js → tolerantWebAccess-B-9bwxbw.js} +6 -6
- package/dist/{tolerantWebAccess-NBQ1NB4i.js.map → tolerantWebAccess-B-9bwxbw.js.map} +1 -1
- package/dist/{updateSeedRevokedAt-CYwgVNlM.js → updateSeedRevokedAt-D6q0h7pj.js} +3 -3
- package/dist/{updateSeedRevokedAt-CYwgVNlM.js.map → updateSeedRevokedAt-D6q0h7pj.js.map} +1 -1
- package/package.json +10 -5
- package/dist/ClientManager-DngaZdw6.js.map +0 -1
- package/dist/Item-ZUAmf943.js.map +0 -1
- package/dist/ModelProperty-6llK4MTH.js.map +0 -1
- package/dist/cjs/getLatestVersionRow-CcaabxIW.js +0 -59
- package/dist/cjs/getLatestVersionRow-CcaabxIW.js.map +0 -1
- package/dist/cjs/getPublishPayload-CEP_e-Kv.js.map +0 -1
- package/dist/cjs/index-Cvvt0-5B.js.map +0 -1
- package/dist/cjs/index-DfGhF1dc.js.map +0 -1
- package/dist/generateId-BopUwD8F.js +0 -9
- package/dist/generateId-BopUwD8F.js.map +0 -1
- package/dist/getLatestVersionRow-72Atl9vB.js +0 -46
- package/dist/getLatestVersionRow-72Atl9vB.js.map +0 -1
- package/dist/getPublishPayload-76_KfB5Y.js.map +0 -1
- package/dist/index-5b3JsS55.js.map +0 -1
- package/dist/index-BpgD305l.js.map +0 -1
- package/dist/property-ByaiSyUK.js.map +0 -1
- package/dist/syncDbWithEas-BPap9Sru.js.map +0 -1
- package/dist/tabEvents-C6NXS6Jl.js.map +0 -1
|
@@ -4331,8 +4331,16 @@ const ensureImageLocal = async (params) => {
|
|
|
4331
4331
|
return inFlight;
|
|
4332
4332
|
};
|
|
4333
4333
|
|
|
4334
|
+
const randomId = nanoid.customAlphabet(nanoidDictionary.alphanumeric, 10);
|
|
4335
|
+
/**
|
|
4336
|
+
* A 10-character local id. Never starts with "0x" (about 1 in 3,844 random ids would), so code that
|
|
4337
|
+
* tells local ids from EAS uids by that prefix can't mistake one for the other.
|
|
4338
|
+
*/
|
|
4334
4339
|
const generateId = () => {
|
|
4335
|
-
|
|
4340
|
+
let id = randomId();
|
|
4341
|
+
while (id.startsWith('0x'))
|
|
4342
|
+
id = randomId();
|
|
4343
|
+
return id;
|
|
4336
4344
|
};
|
|
4337
4345
|
|
|
4338
4346
|
var generateId$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -4453,7 +4461,7 @@ const createPropertyInstances = async (propertyFileIds) => {
|
|
|
4453
4461
|
return;
|
|
4454
4462
|
}
|
|
4455
4463
|
try {
|
|
4456
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
4464
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-BT6Un_MB.js'); });
|
|
4457
4465
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
4458
4466
|
if (!ModelProperty) {
|
|
4459
4467
|
logger$w('createPropertyInstances: ModelProperty not available from dynamic import');
|
|
@@ -4666,7 +4674,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context }, s
|
|
|
4666
4674
|
// Step 2: Fallback to Schema context (only if database doesn't have the model)
|
|
4667
4675
|
// This handles the case where model exists in schema file but not yet in database
|
|
4668
4676
|
try {
|
|
4669
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
4677
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-BXhXdUsA.js'); });
|
|
4670
4678
|
const { Schema } = schemaMod;
|
|
4671
4679
|
// Stopped meanwhile (unloaded, or evicted with its schema): don't load the schema again
|
|
4672
4680
|
if (isActorStopped(self))
|
|
@@ -4911,7 +4919,7 @@ const loadOrCreateModel = xstate.fromCallback(({ sendBack, input: { context }, s
|
|
|
4911
4919
|
}
|
|
4912
4920
|
// Mark schema as draft when a new model is created so saveNewVersion() can persist it
|
|
4913
4921
|
try {
|
|
4914
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
4922
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-BXhXdUsA.js'); });
|
|
4915
4923
|
const { Schema } = schemaMod;
|
|
4916
4924
|
if (!isActorStopped(self)) {
|
|
4917
4925
|
const schema = Schema.create(schemaName, { waitForReady: false });
|
|
@@ -4957,10 +4965,10 @@ const validateModel = xstate.fromCallback(({ sendBack, input: { context }, self
|
|
|
4957
4965
|
const _validateModel = async () => {
|
|
4958
4966
|
try {
|
|
4959
4967
|
// Use dynamic imports to break circular dependencies
|
|
4960
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
4968
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CC18QDfc.js'); });
|
|
4961
4969
|
const { SchemaValidationService } = validationServiceMod;
|
|
4962
4970
|
const validationService = new SchemaValidationService();
|
|
4963
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-
|
|
4971
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./Schema-BXhXdUsA.js'); });
|
|
4964
4972
|
const { Schema } = schemaMod;
|
|
4965
4973
|
// Validate model structure
|
|
4966
4974
|
const structureResult = validationService.validateModelStructure(context);
|
|
@@ -5077,7 +5085,7 @@ const createModelProperties = xstate.fromCallback(({ sendBack, input, self }) =>
|
|
|
5077
5085
|
return;
|
|
5078
5086
|
}
|
|
5079
5087
|
logger$u(`Creating ${Object.keys(propertyDefinitions).length} properties for model "${modelName}" (id: ${_dbId})`);
|
|
5080
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
5088
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-BT6Un_MB.js'); });
|
|
5081
5089
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
5082
5090
|
if (!ModelProperty) {
|
|
5083
5091
|
logger$u('ModelProperty not available from dynamic import');
|
|
@@ -5217,7 +5225,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5217
5225
|
const evictionEpoch = currentEvictionEpoch();
|
|
5218
5226
|
/** The schema to validate against; throws (validation then skips the schema check) once it was evicted. */
|
|
5219
5227
|
const schemaForValidation = async (schemaName) => {
|
|
5220
|
-
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-
|
|
5228
|
+
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-BXhXdUsA.js'); });
|
|
5221
5229
|
if (schemaEvictedSince(schemaName, evictionEpoch)) {
|
|
5222
5230
|
throw new Error(`Schema "${schemaName}" was evicted during validation`);
|
|
5223
5231
|
}
|
|
@@ -5233,7 +5241,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5233
5241
|
const structureMsg = `[validateEntity] Validating model structure`;
|
|
5234
5242
|
logger$t(structureMsg);
|
|
5235
5243
|
// Use existing Model validation
|
|
5236
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
5244
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CC18QDfc.js'); });
|
|
5237
5245
|
const { SchemaValidationService } = validationServiceMod;
|
|
5238
5246
|
const validationService = new SchemaValidationService();
|
|
5239
5247
|
// Validate model structure
|
|
@@ -5283,7 +5291,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5283
5291
|
}
|
|
5284
5292
|
else if (entityInput.entityType === 'modelProperty') {
|
|
5285
5293
|
// Use existing ModelProperty validation
|
|
5286
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
5294
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CC18QDfc.js'); });
|
|
5287
5295
|
const { SchemaValidationService } = validationServiceMod;
|
|
5288
5296
|
const validationService = new SchemaValidationService();
|
|
5289
5297
|
// Validate property structure
|
|
@@ -5323,7 +5331,7 @@ const validateEntity = xstate.fromPromise(async ({ input }) => {
|
|
|
5323
5331
|
}
|
|
5324
5332
|
else if (entityInput.entityType === 'schema') {
|
|
5325
5333
|
// Schema validation - use existing validation
|
|
5326
|
-
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
5334
|
+
const validationServiceMod = await Promise.resolve().then(function () { return require('./SchemaValidationService-CC18QDfc.js'); });
|
|
5327
5335
|
const { SchemaValidationService } = validationServiceMod;
|
|
5328
5336
|
const validationService = new SchemaValidationService();
|
|
5329
5337
|
const schemaResult = validationService.validateSchema(entityInput.entityData);
|
|
@@ -5412,7 +5420,7 @@ const writeToDatabase = xstate.fromCallback(({ sendBack, input }) => {
|
|
|
5412
5420
|
// initial write completes is not overwritten by the stale requestWrite payload.
|
|
5413
5421
|
let dataToWrite = input.entityData;
|
|
5414
5422
|
try {
|
|
5415
|
-
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-
|
|
5423
|
+
const mod = await Promise.resolve().then(function () { return require('./ModelProperty-BT6Un_MB.js'); });
|
|
5416
5424
|
const ModelProperty = mod?.ModelProperty ?? mod?.default;
|
|
5417
5425
|
if (ModelProperty && typeof ModelProperty.getById === 'function') {
|
|
5418
5426
|
const instance = ModelProperty.getById(input.entityId);
|
|
@@ -5806,7 +5814,7 @@ const modelMachine = xstate.setup({
|
|
|
5806
5814
|
// Create ModelProperty instances for any new property IDs
|
|
5807
5815
|
if (Array.isArray(newPropertyIds) && newPropertyIds.length > 0) {
|
|
5808
5816
|
// Import and create instances asynchronously (fire-and-forget)
|
|
5809
|
-
Promise.resolve().then(function () { return require('./ModelProperty-
|
|
5817
|
+
Promise.resolve().then(function () { return require('./ModelProperty-BT6Un_MB.js'); }).then(({ ModelProperty }) => {
|
|
5810
5818
|
if (self.getSnapshot().status === 'stopped')
|
|
5811
5819
|
return;
|
|
5812
5820
|
const createPromises = newPropertyIds.map(async (propertyFileId) => {
|
|
@@ -6536,7 +6544,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6536
6544
|
const schemaNameToTry = schemaName ?? model$1?.schemaName;
|
|
6537
6545
|
if (schemaNameToTry) {
|
|
6538
6546
|
try {
|
|
6539
|
-
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-
|
|
6547
|
+
const { Schema } = await Promise.resolve().then(function () { return require('./Schema-BXhXdUsA.js'); });
|
|
6540
6548
|
const schemaInstance = Schema.create(schemaNameToTry, { waitForReady: false });
|
|
6541
6549
|
const schemaContext = schemaInstance.getService().getSnapshot().context;
|
|
6542
6550
|
if (schemaContext.models?.[modelName]?.properties) {
|
|
@@ -6589,7 +6597,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6589
6597
|
}
|
|
6590
6598
|
}
|
|
6591
6599
|
if (Object.keys(propertySchemas).length === 0) {
|
|
6592
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
6600
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-BA1RIYFG.js'); });
|
|
6593
6601
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6594
6602
|
const KNOWN_MODEL_FALLBACKS = {
|
|
6595
6603
|
Post: {
|
|
@@ -6606,7 +6614,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6606
6614
|
}
|
|
6607
6615
|
}
|
|
6608
6616
|
// Fallbacks above may return schema-file shape ({ type, model, items }); normalize to dataType/ref/refValueType.
|
|
6609
|
-
const { normalizePropertyRecordSchema } = await Promise.resolve().then(function () { return require('./property-
|
|
6617
|
+
const { normalizePropertyRecordSchema } = await Promise.resolve().then(function () { return require('./property-ZerTWizX.js'); });
|
|
6610
6618
|
propertySchemas = Object.fromEntries(Object.entries(propertySchemas).map(([name, def]) => [name, normalizePropertyRecordSchema(def)]));
|
|
6611
6619
|
// Collapse rows that map to the same instance key (e.g. authorIdentityIds + authors -> authors).
|
|
6612
6620
|
// ItemProperty.create cache does not sync propertyValue on hit; processing order would otherwise
|
|
@@ -6639,7 +6647,7 @@ const createItemPropertyInstances = async (metadataRows, seedLocalId, seedUid, m
|
|
|
6639
6647
|
// Infer propertyRecordSchema from metadata when schema is missing (enables persistence)
|
|
6640
6648
|
let propSchema = propertySchemas[propertyName];
|
|
6641
6649
|
if (!propSchema && isRefTypeFromMeta) {
|
|
6642
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
6650
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-BA1RIYFG.js'); });
|
|
6643
6651
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
6644
6652
|
propSchema = {
|
|
6645
6653
|
dataType: refSeedType === 'html' ? ModelPropertyDataTypes.Html
|
|
@@ -6906,9 +6914,9 @@ const runPublish = xstate.fromCallback(({ sendBack, input: { context } }) => {
|
|
|
6906
6914
|
sendBack({ type: 'publishError', error: new Error(`Item not found for seedLocalId: ${seedLocalId}`) });
|
|
6907
6915
|
return;
|
|
6908
6916
|
}
|
|
6909
|
-
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-
|
|
6917
|
+
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-Bh22D3zJ.js'); });
|
|
6910
6918
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
6911
|
-
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-
|
|
6919
|
+
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-DRJh7WR0.js'); });
|
|
6912
6920
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
6913
6921
|
const uploads = await getPublishUploads(item);
|
|
6914
6922
|
let uploadedTransactions = [];
|
|
@@ -7666,6 +7674,29 @@ const getItemsData = async ({ modelName, modelFileId, schemaName, deleted, inclu
|
|
|
7666
7674
|
});
|
|
7667
7675
|
};
|
|
7668
7676
|
|
|
7677
|
+
/**
|
|
7678
|
+
* The seed's head version row: newest by (created_at DESC, local_id DESC), attested or not, skipping
|
|
7679
|
+
* revoked versions. Null when the seed has no version or every version is revoked (a fully
|
|
7680
|
+
* unpublished item). Same choice as `latestVersionLocalId` in the `getVersionData` subquery.
|
|
7681
|
+
*/
|
|
7682
|
+
async function getLatestVersionRow(seedLocalId) {
|
|
7683
|
+
const appDb = BaseDb.getAppDb();
|
|
7684
|
+
if (!appDb || !seedLocalId)
|
|
7685
|
+
return null;
|
|
7686
|
+
const rows = await appDb
|
|
7687
|
+
.select({
|
|
7688
|
+
localId: versions.localId,
|
|
7689
|
+
uid: versions.uid,
|
|
7690
|
+
createdAt: versions.createdAt,
|
|
7691
|
+
attestationCreatedAt: versions.attestationCreatedAt,
|
|
7692
|
+
})
|
|
7693
|
+
.from(versions)
|
|
7694
|
+
.where(drizzleOrm.and(drizzleOrm.eq(versions.seedLocalId, seedLocalId), versionNotRevoked()))
|
|
7695
|
+
.orderBy(drizzleOrm.desc(versions.createdAt), drizzleOrm.desc(versions.localId))
|
|
7696
|
+
.limit(1);
|
|
7697
|
+
return rows[0] ?? null;
|
|
7698
|
+
}
|
|
7699
|
+
|
|
7669
7700
|
const logger$m = debug('seedSdk:ItemProperty:service:actors:waitForDb');
|
|
7670
7701
|
const waitForDb = xstate.fromCallback(({ sendBack }) => {
|
|
7671
7702
|
// Check immediately first
|
|
@@ -7860,7 +7891,7 @@ const resolveRelatedValue = xstate.fromCallback(({ sendBack, input: { context }
|
|
|
7860
7891
|
const { isRelation, propertyValue, propertyName, seedUid, propertyRecordSchema, populatedFromDb, schemaUid, } = context;
|
|
7861
7892
|
const _resolveRelatedValue = async () => {
|
|
7862
7893
|
// Use dynamic import to break circular dependency
|
|
7863
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
7894
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-BA1RIYFG.js'); });
|
|
7864
7895
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
7865
7896
|
if (!propertyValue || !isRelation || populatedFromDb) {
|
|
7866
7897
|
return;
|
|
@@ -8354,7 +8385,7 @@ const hydrateFromDb = xstate.fromCallback(({ sendBack, input: { context } }) =>
|
|
|
8354
8385
|
// to use dynamically imported ModelPropertyDataTypes
|
|
8355
8386
|
const _hydrateFromDb = async () => {
|
|
8356
8387
|
// Use dynamic import to break circular dependency
|
|
8357
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
8388
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-BA1RIYFG.js'); });
|
|
8358
8389
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
8359
8390
|
const appDb = BaseDb.getAppDb();
|
|
8360
8391
|
const whereClauses = [];
|
|
@@ -8731,7 +8762,7 @@ const loadOrCreateProperty = xstate.fromCallback(({ sendBack, input: { context }
|
|
|
8731
8762
|
};
|
|
8732
8763
|
// Merge with schema from file/DB to get validation rules (enum, pattern, etc.) - properties table doesn't store these
|
|
8733
8764
|
try {
|
|
8734
|
-
const { getPropertySchema } = await Promise.resolve().then(function () { return require('./property-
|
|
8765
|
+
const { getPropertySchema } = await Promise.resolve().then(function () { return require('./property-ZerTWizX.js'); });
|
|
8735
8766
|
let schemaFromFile = await getPropertySchema(normalizedModelName, propertyName, {
|
|
8736
8767
|
modelFileId: modelRecord?.schemaFileId ?? modelFileId,
|
|
8737
8768
|
});
|
|
@@ -9152,9 +9183,9 @@ const analyzeInput = xstate.fromCallback(({ sendBack, input: { context, event }
|
|
|
9152
9183
|
}
|
|
9153
9184
|
const _analyzeInput = async () => {
|
|
9154
9185
|
// Use dynamic import to break circular dependency
|
|
9155
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
9186
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-BA1RIYFG.js'); });
|
|
9156
9187
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
9157
|
-
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
9188
|
+
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-CC18QDfc.js'); });
|
|
9158
9189
|
let propertyName = propertyNameRaw;
|
|
9159
9190
|
if (!propertyName) {
|
|
9160
9191
|
throw new Error('propertyName is required');
|
|
@@ -9644,7 +9675,7 @@ const createMetadata = async (metadataValues, propertyRecordSchema, options) =>
|
|
|
9644
9675
|
propertyRecordSchema?.validation &&
|
|
9645
9676
|
metadataValues.propertyValue != null &&
|
|
9646
9677
|
metadataValues.propertyValue !== '') {
|
|
9647
|
-
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-
|
|
9678
|
+
const { SchemaValidationService } = await Promise.resolve().then(function () { return require('./SchemaValidationService-CC18QDfc.js'); });
|
|
9648
9679
|
const validationService = new SchemaValidationService();
|
|
9649
9680
|
const validationResult = validationService.validatePropertyValue(metadataValues.propertyValue, normalizeDataType(propertyRecordSchema.dataType), propertyRecordSchema.validation, propertyRecordSchema.refValueType
|
|
9650
9681
|
? normalizeDataType(String(propertyRecordSchema.refValueType))
|
|
@@ -10226,7 +10257,7 @@ const saveRelation = xstate.fromCallback(({ sendBack, input: { context, event }
|
|
|
10226
10257
|
}
|
|
10227
10258
|
const _saveRelation = async () => {
|
|
10228
10259
|
// Use dynamic import to break circular dependency
|
|
10229
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
10260
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-BA1RIYFG.js'); });
|
|
10230
10261
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
10231
10262
|
if (!propertyNameRaw) {
|
|
10232
10263
|
throw new Error('propertyName is required');
|
|
@@ -11192,7 +11223,7 @@ class ItemProperty {
|
|
|
11192
11223
|
return;
|
|
11193
11224
|
}
|
|
11194
11225
|
// Use dynamic import to break circular dependency
|
|
11195
|
-
const schemaMod = await Promise.resolve().then(function () { return require('./index-
|
|
11226
|
+
const schemaMod = await Promise.resolve().then(function () { return require('./index-BA1RIYFG.js'); });
|
|
11196
11227
|
const { ModelPropertyDataTypes } = schemaMod;
|
|
11197
11228
|
const { context } = snapshot;
|
|
11198
11229
|
const { propertyRecordSchema } = context;
|
|
@@ -12591,7 +12622,6 @@ class Item {
|
|
|
12591
12622
|
const revokedAt = Math.floor(Date.now() / 1000);
|
|
12592
12623
|
// The executor stamps the revoked version rows; the latest version is now the newest one left
|
|
12593
12624
|
// (a local draft) or none, never a revoked one.
|
|
12594
|
-
const { getLatestVersionRow } = await Promise.resolve().then(function () { return require('./getLatestVersionRow-CcaabxIW.js'); });
|
|
12595
12625
|
const head = await getLatestVersionRow(this.seedLocalId);
|
|
12596
12626
|
this._service.send({
|
|
12597
12627
|
type: 'updateContext',
|
|
@@ -12637,12 +12667,12 @@ class Item {
|
|
|
12637
12667
|
};
|
|
12638
12668
|
this.getPublishUploads = async (options) => {
|
|
12639
12669
|
// Use dynamic import to break circular dependency
|
|
12640
|
-
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-
|
|
12670
|
+
const getPublishUploadsMod = await Promise.resolve().then(function () { return require('./getPublishUploads-Bh22D3zJ.js'); });
|
|
12641
12671
|
const { getPublishUploads } = getPublishUploadsMod;
|
|
12642
12672
|
return await getPublishUploads(this, [], undefined, options);
|
|
12643
12673
|
};
|
|
12644
12674
|
this.getPublishPayload = async (uploadedTransactions, options) => {
|
|
12645
|
-
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-
|
|
12675
|
+
const getPublishPayloadMod = await Promise.resolve().then(function () { return require('./getPublishPayload-DRJh7WR0.js'); });
|
|
12646
12676
|
const { getPublishPayload } = getPublishPayloadMod;
|
|
12647
12677
|
return await getPublishPayload(this, uploadedTransactions, options);
|
|
12648
12678
|
};
|
|
@@ -12659,7 +12689,6 @@ class Item {
|
|
|
12659
12689
|
});
|
|
12660
12690
|
// Publish has recorded the version it attested (updateVersionUid): reflect it here too, as
|
|
12661
12691
|
// the versions liveQuery does in the browser. After a republish this is the new version.
|
|
12662
|
-
const { getLatestVersionRow } = await Promise.resolve().then(function () { return require('./getLatestVersionRow-CcaabxIW.js'); });
|
|
12663
12692
|
const head = await getLatestVersionRow(seedLocalId);
|
|
12664
12693
|
if (head?.localId) {
|
|
12665
12694
|
this._service.send({
|
|
@@ -14449,7 +14478,7 @@ const runEasSync = xstate.fromPromise(async ({ input, }) => {
|
|
|
14449
14478
|
requestPayload: input.requestPayload,
|
|
14450
14479
|
persistedSnapshot: input.runningSnapshot,
|
|
14451
14480
|
});
|
|
14452
|
-
const { runSyncFromEas } = await Promise.resolve().then(function () { return require('./syncDbWithEas-
|
|
14481
|
+
const { runSyncFromEas } = await Promise.resolve().then(function () { return require('./syncDbWithEas-CYfPkus9.js'); });
|
|
14453
14482
|
try {
|
|
14454
14483
|
// Sync checks for rows and then inserts the rest (no unique index on uids), so syncs in
|
|
14455
14484
|
// different tabs take turns. A sync can run for minutes, so wait without a timeout.
|
|
@@ -18524,7 +18553,9 @@ async function listPublishedSeedRows(schemaName, opts) {
|
|
|
18524
18553
|
markedForDeletion: seeds._markedForDeletion,
|
|
18525
18554
|
})
|
|
18526
18555
|
.from(seeds)
|
|
18527
|
-
.where(drizzleOrm.and(drizzleOrm.inArray(seeds.type, typeCandidates), drizzleOrm.isNotNull(seeds.uid),
|
|
18556
|
+
.where(drizzleOrm.and(drizzleOrm.inArray(seeds.type, typeCandidates), drizzleOrm.isNotNull(seeds.uid),
|
|
18557
|
+
// The query layer passes `0x` + hex only, so no LIKE wildcards to escape.
|
|
18558
|
+
opts?.uidPrefix ? drizzleOrm.like(seeds.uid, `${opts.uidPrefix}%`) : undefined, drizzleOrm.or(drizzleOrm.isNull(seeds.revokedAt), drizzleOrm.eq(seeds.revokedAt, 0)), drizzleOrm.or(drizzleOrm.isNull(seeds._markedForDeletion), drizzleOrm.eq(seeds._markedForDeletion, 0))))
|
|
18528
18559
|
.orderBy(drizzleOrm.desc(seeds.attestationCreatedAt));
|
|
18529
18560
|
const out = [];
|
|
18530
18561
|
for (const row of rows) {
|
|
@@ -18603,6 +18634,10 @@ function createLocalQueryDataSource() {
|
|
|
18603
18634
|
const all = await listPublishedSeedRows(schemaName);
|
|
18604
18635
|
return all.slice(opts.skip, opts.skip + opts.limit);
|
|
18605
18636
|
},
|
|
18637
|
+
async listSeedsByUidPrefix(schemaName, uidPrefix, opts) {
|
|
18638
|
+
const matching = await listPublishedSeedRows(schemaName, { uidPrefix });
|
|
18639
|
+
return matching.slice(opts.skip, opts.skip + opts.limit);
|
|
18640
|
+
},
|
|
18606
18641
|
async listSeedsBySchemaNameForMonth(schemaName, year, month) {
|
|
18607
18642
|
const { startTs, endTs } = monthBoundsUnix(year, month);
|
|
18608
18643
|
return listPublishedSeedRows(schemaName, { startTs, endTs });
|
|
@@ -19314,7 +19349,7 @@ const saveDraftLogger = debug('seedSdk:model:saveDraftToDb');
|
|
|
19314
19349
|
// Lazy import cache for ModelProperty to avoid circular dependency
|
|
19315
19350
|
// Eagerly start loading to minimize delay on first access
|
|
19316
19351
|
let ModelPropertyClass = null;
|
|
19317
|
-
const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-
|
|
19352
|
+
const modelPropertyImportPromise = Promise.resolve().then(function () { return require('./ModelProperty-BT6Un_MB.js'); })
|
|
19318
19353
|
.then(module => {
|
|
19319
19354
|
ModelPropertyClass = module.ModelProperty;
|
|
19320
19355
|
return ModelPropertyClass;
|
|
@@ -19330,7 +19365,7 @@ function getModelProperty() {
|
|
|
19330
19365
|
return ModelPropertyClass;
|
|
19331
19366
|
}
|
|
19332
19367
|
// Lazy import for Schema to avoid circular dependency
|
|
19333
|
-
const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-
|
|
19368
|
+
const schemaImportPromise = Promise.resolve().then(function () { return require('./Schema-BXhXdUsA.js'); })
|
|
19334
19369
|
.then(module => module.Schema)
|
|
19335
19370
|
.catch(() => null);
|
|
19336
19371
|
// WeakMap to store mutable state per Model instance
|
|
@@ -21395,7 +21430,7 @@ function resolveSdkDrizzleMigrationsDir(sdkRootDir) {
|
|
|
21395
21430
|
})();
|
|
21396
21431
|
// Also resolve relative to this module so temp-cwd tests / odd roots still find
|
|
21397
21432
|
// packages/sdk/src/db/drizzle (or dist/db/drizzle after publish).
|
|
21398
|
-
const moduleDir = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cjs/index-
|
|
21433
|
+
const moduleDir = path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cjs/index-Dls7aMjr.js', document.baseURI).href))));
|
|
21399
21434
|
const candidates = [
|
|
21400
21435
|
path.join(root, 'db', 'drizzle'), // production: sdkRoot is dist/
|
|
21401
21436
|
path.join(root, 'dist', 'db', 'drizzle'), // sdk package root with built dist
|
|
@@ -21465,10 +21500,10 @@ class NodeDb {
|
|
|
21465
21500
|
logger$1('[Db.prepareDb] running migrations from %s', outDir);
|
|
21466
21501
|
await migrator.migrate(db, { migrationsFolder: outDir });
|
|
21467
21502
|
this.db = db;
|
|
21468
|
-
const { backfillMetadataPropertyIds } = await Promise.resolve().then(function () { return require('./backfillMetadataPropertyIds-
|
|
21503
|
+
const { backfillMetadataPropertyIds } = await Promise.resolve().then(function () { return require('./backfillMetadataPropertyIds-DEHC9ejq.js'); });
|
|
21469
21504
|
await backfillMetadataPropertyIds();
|
|
21470
21505
|
// One-time: clear item data whose model can't be determined (seeds.model_file_id, migration 0015)
|
|
21471
|
-
const { resetAmbiguousLegacyItemData } = await Promise.resolve().then(function () { return require('./resetAmbiguousLegacyItemData-
|
|
21506
|
+
const { resetAmbiguousLegacyItemData } = await Promise.resolve().then(function () { return require('./resetAmbiguousLegacyItemData-adDl4LcT.js'); });
|
|
21472
21507
|
await resetAmbiguousLegacyItemData();
|
|
21473
21508
|
return this.db;
|
|
21474
21509
|
}
|
|
@@ -22084,7 +22119,6 @@ exports.toSnakeCase = toSnakeCase;
|
|
|
22084
22119
|
exports.transformImportToSchemaFile = transformImportToSchemaFile;
|
|
22085
22120
|
exports.unloadEntity = unloadEntity;
|
|
22086
22121
|
exports.uploadProcesses = uploadProcesses;
|
|
22087
|
-
exports.versionNotRevoked = versionNotRevoked;
|
|
22088
22122
|
exports.versions = versions;
|
|
22089
22123
|
exports.waitForEasReadChain = waitForEasReadChain;
|
|
22090
22124
|
exports.waitForEntityIdle = waitForEntityIdle;
|
|
@@ -22092,4 +22126,4 @@ exports.withSeed = withSeed;
|
|
|
22092
22126
|
exports.writeInBatches = writeInBatches;
|
|
22093
22127
|
exports.writeProcessMachine = writeProcessMachine;
|
|
22094
22128
|
exports.writeToDatabase = writeToDatabase$1;
|
|
22095
|
-
//# sourceMappingURL=index-
|
|
22129
|
+
//# sourceMappingURL=index-Dls7aMjr.js.map
|