@absolutejs/absolute 0.20.0-beta.14 → 0.20.0-beta.15
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/README.md +7 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +136 -4
- package/dist/build.js.map +4 -4
- package/dist/cli/index.js +143 -5
- package/dist/index.js +136 -4
- package/dist/index.js.map +4 -4
- package/dist/mobile/index.js +136 -4
- package/dist/mobile/index.js.map +4 -4
- package/dist/mobile/shellSync.js +6 -1
- package/package.json +11 -11
package/dist/cli/index.js
CHANGED
|
@@ -6304,11 +6304,32 @@ var init_materializedBundle = __esm(() => {
|
|
|
6304
6304
|
});
|
|
6305
6305
|
|
|
6306
6306
|
// node_modules/@absolutejs/sync/dist/client/index.js
|
|
6307
|
-
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
6307
|
+
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalDataPolicyError, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
6308
6308
|
if (!Number.isSafeInteger(value) || value < 1)
|
|
6309
6309
|
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `${label} must be a positive safe integer`);
|
|
6310
6310
|
return value;
|
|
6311
|
-
}, isSchemaBundle = (schema) => ("components" in schema),
|
|
6311
|
+
}, isSchemaBundle = (schema) => ("components" in schema), validatePolicyMatch = (match, label) => {
|
|
6312
|
+
if (match.length === 0 || match.trim() !== match || /^\*+$/.test(match) || match.includes("**"))
|
|
6313
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.match must be an exact name or a non-empty glob without adjacent wildcards.`);
|
|
6314
|
+
}, validateSyncLocalDataPolicy = (policy, label = "localData") => {
|
|
6315
|
+
if (policy.maxBytesPerNamespace !== undefined && (!Number.isSafeInteger(policy.maxBytesPerNamespace) || policy.maxBytesPerNamespace < 1))
|
|
6316
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.maxBytesPerNamespace must be a positive safe integer.`);
|
|
6317
|
+
for (const [index, rule] of (policy.collections ?? []).entries()) {
|
|
6318
|
+
validatePolicyMatch(rule.match, `${label}.collections[${index}]`);
|
|
6319
|
+
if (rule.maxAgeMs !== undefined && (!Number.isSafeInteger(rule.maxAgeMs) || rule.maxAgeMs < 1))
|
|
6320
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}].maxAgeMs must be a positive safe integer.`);
|
|
6321
|
+
if (rule.persistence === "memory-only" && rule.protection === "required")
|
|
6322
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}] cannot require at-rest protection when it is memory-only.`);
|
|
6323
|
+
if (rule.sensitivity !== undefined && rule.sensitivity !== "public" && rule.protection !== "required" && rule.persistence !== "memory-only")
|
|
6324
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}] declares ${rule.sensitivity} data without required protection or memory-only persistence.`);
|
|
6325
|
+
}
|
|
6326
|
+
for (const [index, rule] of (policy.mutations ?? []).entries()) {
|
|
6327
|
+
validatePolicyMatch(rule.match, `${label}.mutations[${index}]`);
|
|
6328
|
+
if (rule.sensitivity !== undefined && rule.sensitivity !== "public" && rule.protection !== "required" && rule.persistence !== "memory-only")
|
|
6329
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.mutations[${index}] declares ${rule.sensitivity} arguments without required protection.`);
|
|
6330
|
+
}
|
|
6331
|
+
return policy;
|
|
6332
|
+
}, normalizeSyncLocalSchemaComponents = (schema = { version: 1 }) => {
|
|
6312
6333
|
const components = isSchemaBundle(schema) ? [...schema.components] : [{ ...schema, id: "@absolutejs/app" }];
|
|
6313
6334
|
const ids = new Set;
|
|
6314
6335
|
for (const component of components) {
|
|
@@ -6317,6 +6338,8 @@ var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" &
|
|
|
6317
6338
|
if (ids.has(component.id))
|
|
6318
6339
|
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync schema component "${component.id}" is declared more than once`);
|
|
6319
6340
|
ids.add(component.id);
|
|
6341
|
+
if (component.localData)
|
|
6342
|
+
validateSyncLocalDataPolicy(component.localData, `${component.id}.localData`);
|
|
6320
6343
|
}
|
|
6321
6344
|
return components.sort((a, b) => a.id.localeCompare(b.id));
|
|
6322
6345
|
}, resolveSyncLocalSchemaComponents = (storedVersions, schema = { version: 1 }) => {
|
|
@@ -6374,6 +6397,14 @@ var init_client2 = __esm(() => {
|
|
|
6374
6397
|
});
|
|
6375
6398
|
return created;
|
|
6376
6399
|
})();
|
|
6400
|
+
SyncLocalDataPolicyError = class SyncLocalDataPolicyError extends Error {
|
|
6401
|
+
code;
|
|
6402
|
+
constructor(code, message) {
|
|
6403
|
+
super(message);
|
|
6404
|
+
this.name = "SyncLocalDataPolicyError";
|
|
6405
|
+
this.code = code;
|
|
6406
|
+
}
|
|
6407
|
+
};
|
|
6377
6408
|
SyncLocalStoreSchemaError = class SyncLocalStoreSchemaError extends Error {
|
|
6378
6409
|
code;
|
|
6379
6410
|
storedVersion;
|
|
@@ -6430,7 +6461,7 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
6430
6461
|
if (!object(value))
|
|
6431
6462
|
throw metadataError(id, detail);
|
|
6432
6463
|
return value;
|
|
6433
|
-
}, normalizeJsonValue = (value, id, field) => {
|
|
6464
|
+
}, unknownField = (record, key) => record[key], normalizeJsonValue = (value, id, field) => {
|
|
6434
6465
|
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
6435
6466
|
return value;
|
|
6436
6467
|
if (typeof value === "number" && Number.isFinite(value))
|
|
@@ -6481,9 +6512,108 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
6481
6512
|
operations: operations.map((entry, operationIndex) => operation(entry, id, operationIndex)),
|
|
6482
6513
|
toVersion: positiveVersion2(Reflect.get(record, "toVersion"), id, `migration ${index}.toVersion`)
|
|
6483
6514
|
};
|
|
6515
|
+
}, localDataPolicy = (value, id) => {
|
|
6516
|
+
const record = requireObject(value, id, "localData must be an object.");
|
|
6517
|
+
const allowed = new Set([
|
|
6518
|
+
"collections",
|
|
6519
|
+
"maxBytesPerNamespace",
|
|
6520
|
+
"mutations"
|
|
6521
|
+
]);
|
|
6522
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
6523
|
+
if (unsupported)
|
|
6524
|
+
throw metadataError(id, `localData.${unsupported} is not supported.`);
|
|
6525
|
+
const collectionRules = Reflect.get(record, "collections");
|
|
6526
|
+
const mutationRules = Reflect.get(record, "mutations");
|
|
6527
|
+
if (collectionRules !== undefined && !Array.isArray(collectionRules))
|
|
6528
|
+
throw metadataError(id, "localData.collections must be an array.");
|
|
6529
|
+
if (mutationRules !== undefined && !Array.isArray(mutationRules))
|
|
6530
|
+
throw metadataError(id, "localData.mutations must be an array.");
|
|
6531
|
+
const collections = Array.isArray(collectionRules) ? collectionRules.map((entry, index) => {
|
|
6532
|
+
const rule = requireObject(entry, id, `localData.collections[${index}] must be an object.`);
|
|
6533
|
+
const allowedRuleKeys = new Set([
|
|
6534
|
+
"evictionPriority",
|
|
6535
|
+
"match",
|
|
6536
|
+
"maxAgeMs",
|
|
6537
|
+
"onProtectionUnavailable",
|
|
6538
|
+
"persistence",
|
|
6539
|
+
"protection",
|
|
6540
|
+
"sensitivity"
|
|
6541
|
+
]);
|
|
6542
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
6543
|
+
if (unsupportedRuleKey)
|
|
6544
|
+
throw metadataError(id, `localData.collections[${index}].${unsupportedRuleKey} is not supported.`);
|
|
6545
|
+
const match = nonEmpty(Reflect.get(rule, "match"), id, `localData.collections[${index}].match`);
|
|
6546
|
+
const persistence = unknownField(rule, "persistence");
|
|
6547
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
6548
|
+
const protection = unknownField(rule, "protection");
|
|
6549
|
+
const onProtectionUnavailable = unknownField(rule, "onProtectionUnavailable");
|
|
6550
|
+
const evictionPriority = unknownField(rule, "evictionPriority");
|
|
6551
|
+
const maxAge = unknownField(rule, "maxAgeMs");
|
|
6552
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
6553
|
+
throw metadataError(id, `localData.collections[${index}].persistence is invalid.`);
|
|
6554
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
6555
|
+
throw metadataError(id, `localData.collections[${index}].sensitivity is invalid.`);
|
|
6556
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
6557
|
+
throw metadataError(id, `localData.collections[${index}].protection is invalid.`);
|
|
6558
|
+
if (onProtectionUnavailable !== undefined && onProtectionUnavailable !== "error" && onProtectionUnavailable !== "memory-only")
|
|
6559
|
+
throw metadataError(id, `localData.collections[${index}].onProtectionUnavailable is invalid.`);
|
|
6560
|
+
if (evictionPriority !== undefined && evictionPriority !== "critical" && evictionPriority !== "normal" && evictionPriority !== "disposable")
|
|
6561
|
+
throw metadataError(id, `localData.collections[${index}].evictionPriority is invalid.`);
|
|
6562
|
+
return {
|
|
6563
|
+
match,
|
|
6564
|
+
...sensitivity ? { sensitivity } : {},
|
|
6565
|
+
...persistence ? { persistence } : {},
|
|
6566
|
+
...protection ? { protection } : {},
|
|
6567
|
+
...onProtectionUnavailable ? {
|
|
6568
|
+
onProtectionUnavailable
|
|
6569
|
+
} : {},
|
|
6570
|
+
...evictionPriority ? { evictionPriority } : {},
|
|
6571
|
+
...maxAge === undefined ? {} : {
|
|
6572
|
+
maxAgeMs: positiveVersion2(maxAge, id, `localData.collections[${index}].maxAgeMs`)
|
|
6573
|
+
}
|
|
6574
|
+
};
|
|
6575
|
+
}) : undefined;
|
|
6576
|
+
const mutations = Array.isArray(mutationRules) ? mutationRules.map((entry, index) => {
|
|
6577
|
+
const rule = requireObject(entry, id, `localData.mutations[${index}] must be an object.`);
|
|
6578
|
+
const allowedRuleKeys = new Set([
|
|
6579
|
+
"match",
|
|
6580
|
+
"persistence",
|
|
6581
|
+
"protection",
|
|
6582
|
+
"sensitivity"
|
|
6583
|
+
]);
|
|
6584
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
6585
|
+
if (unsupportedRuleKey)
|
|
6586
|
+
throw metadataError(id, `localData.mutations[${index}].${unsupportedRuleKey} is not supported.`);
|
|
6587
|
+
const protection = unknownField(rule, "protection");
|
|
6588
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
6589
|
+
const persistence = unknownField(rule, "persistence");
|
|
6590
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
6591
|
+
throw metadataError(id, `localData.mutations[${index}].protection is invalid.`);
|
|
6592
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
6593
|
+
throw metadataError(id, `localData.mutations[${index}].sensitivity is invalid.`);
|
|
6594
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
6595
|
+
throw metadataError(id, `localData.mutations[${index}].persistence is invalid.`);
|
|
6596
|
+
return {
|
|
6597
|
+
match: nonEmpty(Reflect.get(rule, "match"), id, `localData.mutations[${index}].match`),
|
|
6598
|
+
...sensitivity ? { sensitivity } : {},
|
|
6599
|
+
...persistence ? {
|
|
6600
|
+
persistence
|
|
6601
|
+
} : {},
|
|
6602
|
+
...protection ? { protection } : {}
|
|
6603
|
+
};
|
|
6604
|
+
}) : undefined;
|
|
6605
|
+
const quota = Reflect.get(record, "maxBytesPerNamespace");
|
|
6606
|
+
return {
|
|
6607
|
+
...collections ? { collections } : {},
|
|
6608
|
+
...mutations ? { mutations } : {},
|
|
6609
|
+
...quota === undefined ? {} : {
|
|
6610
|
+
maxBytesPerNamespace: positiveVersion2(quota, id, "localData.maxBytesPerNamespace")
|
|
6611
|
+
}
|
|
6612
|
+
};
|
|
6484
6613
|
}, component = (id, value) => {
|
|
6485
6614
|
const record = requireObject(value, id, "localSchema must be an object.");
|
|
6486
6615
|
const allowed = new Set([
|
|
6616
|
+
"localData",
|
|
6487
6617
|
"migrations",
|
|
6488
6618
|
"minimumCompatibleVersion",
|
|
6489
6619
|
"version"
|
|
@@ -6495,11 +6625,13 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
6495
6625
|
const declaredMinimum = Reflect.get(record, "minimumCompatibleVersion");
|
|
6496
6626
|
const minimumCompatibleVersion = declaredMinimum === undefined ? Math.max(1, version2 - 2) : positiveVersion2(declaredMinimum, id, "minimumCompatibleVersion");
|
|
6497
6627
|
const declaredMigrations = Reflect.get(record, "migrations");
|
|
6628
|
+
const declaredLocalData = Reflect.get(record, "localData");
|
|
6498
6629
|
if (declaredMigrations !== undefined && !Array.isArray(declaredMigrations))
|
|
6499
6630
|
throw metadataError(id, "migrations must be an array.");
|
|
6500
6631
|
const migrations = Array.isArray(declaredMigrations) ? declaredMigrations : undefined;
|
|
6501
6632
|
return {
|
|
6502
6633
|
id,
|
|
6634
|
+
...declaredLocalData === undefined ? {} : { localData: localDataPolicy(declaredLocalData, id) },
|
|
6503
6635
|
minimumCompatibleVersion,
|
|
6504
6636
|
...Array.isArray(migrations) ? {
|
|
6505
6637
|
migrations: migrations.map((entry, index) => migration(entry, id, index))
|
|
@@ -16835,7 +16967,13 @@ var HMR_ASSET_PATTERN, RELEASE_ASSET_EXTENSIONS, pathExists5 = async (path) => {
|
|
|
16835
16967
|
try {
|
|
16836
16968
|
const schema = discoverAbsoluteSyncSchema(projectRoot);
|
|
16837
16969
|
const versions = schema.components.map((component2) => `${component2.id}@${component2.version}`).join(", ");
|
|
16838
|
-
|
|
16970
|
+
const collectionRules = schema.components.flatMap((component2) => component2.localData?.collections ?? []);
|
|
16971
|
+
const mutationRules = schema.components.flatMap((component2) => component2.localData?.mutations ?? []);
|
|
16972
|
+
const protectedCount = [...collectionRules, ...mutationRules].filter((rule) => rule.protection === "required").length;
|
|
16973
|
+
const memoryOnlyCount = collectionRules.filter((rule) => rule.persistence === "memory-only" || rule.onProtectionUnavailable === "memory-only").length;
|
|
16974
|
+
const quotas = schema.components.map((component2) => component2.localData?.maxBytesPerNamespace).filter((value) => value !== undefined);
|
|
16975
|
+
const policy = `${collectionRules.length} collection rule(s), ${mutationRules.length} mutation rule(s), ${protectedCount} encryption-required, ${memoryOnlyCount} memory-only fallback(s)${quotas.length > 0 ? `, ${Math.min(...quotas)}-byte effective quota` : ", no logical quota"}`;
|
|
16976
|
+
return pass("sync.storage-schema", `Generated offline schema is compatible: ${versions}; ${policy}.`, manifestPath);
|
|
16839
16977
|
} catch (error) {
|
|
16840
16978
|
return fail5("sync.storage-schema", error instanceof Error ? error.message : "Generated offline schema metadata is invalid.", manifestPath, "Fix absolutejs.sync.localSchema metadata in the named app or package before releasing.");
|
|
16841
16979
|
}
|
|
@@ -18367,7 +18505,7 @@ var init_mobile = __esm(() => {
|
|
|
18367
18505
|
"@absolutejs/devices-capacitor@0.1.3"
|
|
18368
18506
|
];
|
|
18369
18507
|
CAPACITOR_SYNC_PACKAGE_SPECS = [
|
|
18370
|
-
"@absolutejs/sync-capacitor@0.
|
|
18508
|
+
"@absolutejs/sync-capacitor@0.7.0",
|
|
18371
18509
|
"@capacitor-community/sqlite@8.1.1"
|
|
18372
18510
|
];
|
|
18373
18511
|
});
|
package/dist/index.js
CHANGED
|
@@ -13199,11 +13199,32 @@ var isTestSourcePath = (file2) => {
|
|
|
13199
13199
|
};
|
|
13200
13200
|
|
|
13201
13201
|
// node_modules/@absolutejs/sync/dist/client/index.js
|
|
13202
|
-
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
13202
|
+
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalDataPolicyError, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
13203
13203
|
if (!Number.isSafeInteger(value) || value < 1)
|
|
13204
13204
|
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `${label} must be a positive safe integer`);
|
|
13205
13205
|
return value;
|
|
13206
|
-
}, isSchemaBundle = (schema) => ("components" in schema),
|
|
13206
|
+
}, isSchemaBundle = (schema) => ("components" in schema), validatePolicyMatch = (match, label) => {
|
|
13207
|
+
if (match.length === 0 || match.trim() !== match || /^\*+$/.test(match) || match.includes("**"))
|
|
13208
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.match must be an exact name or a non-empty glob without adjacent wildcards.`);
|
|
13209
|
+
}, validateSyncLocalDataPolicy = (policy, label = "localData") => {
|
|
13210
|
+
if (policy.maxBytesPerNamespace !== undefined && (!Number.isSafeInteger(policy.maxBytesPerNamespace) || policy.maxBytesPerNamespace < 1))
|
|
13211
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.maxBytesPerNamespace must be a positive safe integer.`);
|
|
13212
|
+
for (const [index, rule] of (policy.collections ?? []).entries()) {
|
|
13213
|
+
validatePolicyMatch(rule.match, `${label}.collections[${index}]`);
|
|
13214
|
+
if (rule.maxAgeMs !== undefined && (!Number.isSafeInteger(rule.maxAgeMs) || rule.maxAgeMs < 1))
|
|
13215
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}].maxAgeMs must be a positive safe integer.`);
|
|
13216
|
+
if (rule.persistence === "memory-only" && rule.protection === "required")
|
|
13217
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}] cannot require at-rest protection when it is memory-only.`);
|
|
13218
|
+
if (rule.sensitivity !== undefined && rule.sensitivity !== "public" && rule.protection !== "required" && rule.persistence !== "memory-only")
|
|
13219
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}] declares ${rule.sensitivity} data without required protection or memory-only persistence.`);
|
|
13220
|
+
}
|
|
13221
|
+
for (const [index, rule] of (policy.mutations ?? []).entries()) {
|
|
13222
|
+
validatePolicyMatch(rule.match, `${label}.mutations[${index}]`);
|
|
13223
|
+
if (rule.sensitivity !== undefined && rule.sensitivity !== "public" && rule.protection !== "required" && rule.persistence !== "memory-only")
|
|
13224
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.mutations[${index}] declares ${rule.sensitivity} arguments without required protection.`);
|
|
13225
|
+
}
|
|
13226
|
+
return policy;
|
|
13227
|
+
}, normalizeSyncLocalSchemaComponents = (schema = { version: 1 }) => {
|
|
13207
13228
|
const components = isSchemaBundle(schema) ? [...schema.components] : [{ ...schema, id: "@absolutejs/app" }];
|
|
13208
13229
|
const ids = new Set;
|
|
13209
13230
|
for (const component of components) {
|
|
@@ -13212,6 +13233,8 @@ var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" &
|
|
|
13212
13233
|
if (ids.has(component.id))
|
|
13213
13234
|
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync schema component "${component.id}" is declared more than once`);
|
|
13214
13235
|
ids.add(component.id);
|
|
13236
|
+
if (component.localData)
|
|
13237
|
+
validateSyncLocalDataPolicy(component.localData, `${component.id}.localData`);
|
|
13215
13238
|
}
|
|
13216
13239
|
return components.sort((a, b2) => a.id.localeCompare(b2.id));
|
|
13217
13240
|
}, resolveSyncLocalSchemaComponents = (storedVersions, schema = { version: 1 }) => {
|
|
@@ -13269,6 +13292,14 @@ var init_client = __esm(() => {
|
|
|
13269
13292
|
});
|
|
13270
13293
|
return created;
|
|
13271
13294
|
})();
|
|
13295
|
+
SyncLocalDataPolicyError = class SyncLocalDataPolicyError extends Error {
|
|
13296
|
+
code;
|
|
13297
|
+
constructor(code, message) {
|
|
13298
|
+
super(message);
|
|
13299
|
+
this.name = "SyncLocalDataPolicyError";
|
|
13300
|
+
this.code = code;
|
|
13301
|
+
}
|
|
13302
|
+
};
|
|
13272
13303
|
SyncLocalStoreSchemaError = class SyncLocalStoreSchemaError extends Error {
|
|
13273
13304
|
code;
|
|
13274
13305
|
storedVersion;
|
|
@@ -13325,7 +13356,7 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
13325
13356
|
if (!object(value))
|
|
13326
13357
|
throw metadataError(id, detail);
|
|
13327
13358
|
return value;
|
|
13328
|
-
}, normalizeJsonValue2 = (value, id, field) => {
|
|
13359
|
+
}, unknownField = (record, key) => record[key], normalizeJsonValue2 = (value, id, field) => {
|
|
13329
13360
|
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
13330
13361
|
return value;
|
|
13331
13362
|
if (typeof value === "number" && Number.isFinite(value))
|
|
@@ -13376,9 +13407,108 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
13376
13407
|
operations: operations.map((entry, operationIndex) => operation(entry, id, operationIndex)),
|
|
13377
13408
|
toVersion: positiveVersion2(Reflect.get(record, "toVersion"), id, `migration ${index}.toVersion`)
|
|
13378
13409
|
};
|
|
13410
|
+
}, localDataPolicy = (value, id) => {
|
|
13411
|
+
const record = requireObject(value, id, "localData must be an object.");
|
|
13412
|
+
const allowed = new Set([
|
|
13413
|
+
"collections",
|
|
13414
|
+
"maxBytesPerNamespace",
|
|
13415
|
+
"mutations"
|
|
13416
|
+
]);
|
|
13417
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
13418
|
+
if (unsupported)
|
|
13419
|
+
throw metadataError(id, `localData.${unsupported} is not supported.`);
|
|
13420
|
+
const collectionRules = Reflect.get(record, "collections");
|
|
13421
|
+
const mutationRules = Reflect.get(record, "mutations");
|
|
13422
|
+
if (collectionRules !== undefined && !Array.isArray(collectionRules))
|
|
13423
|
+
throw metadataError(id, "localData.collections must be an array.");
|
|
13424
|
+
if (mutationRules !== undefined && !Array.isArray(mutationRules))
|
|
13425
|
+
throw metadataError(id, "localData.mutations must be an array.");
|
|
13426
|
+
const collections = Array.isArray(collectionRules) ? collectionRules.map((entry, index) => {
|
|
13427
|
+
const rule = requireObject(entry, id, `localData.collections[${index}] must be an object.`);
|
|
13428
|
+
const allowedRuleKeys = new Set([
|
|
13429
|
+
"evictionPriority",
|
|
13430
|
+
"match",
|
|
13431
|
+
"maxAgeMs",
|
|
13432
|
+
"onProtectionUnavailable",
|
|
13433
|
+
"persistence",
|
|
13434
|
+
"protection",
|
|
13435
|
+
"sensitivity"
|
|
13436
|
+
]);
|
|
13437
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
13438
|
+
if (unsupportedRuleKey)
|
|
13439
|
+
throw metadataError(id, `localData.collections[${index}].${unsupportedRuleKey} is not supported.`);
|
|
13440
|
+
const match = nonEmpty(Reflect.get(rule, "match"), id, `localData.collections[${index}].match`);
|
|
13441
|
+
const persistence = unknownField(rule, "persistence");
|
|
13442
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
13443
|
+
const protection = unknownField(rule, "protection");
|
|
13444
|
+
const onProtectionUnavailable = unknownField(rule, "onProtectionUnavailable");
|
|
13445
|
+
const evictionPriority = unknownField(rule, "evictionPriority");
|
|
13446
|
+
const maxAge = unknownField(rule, "maxAgeMs");
|
|
13447
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
13448
|
+
throw metadataError(id, `localData.collections[${index}].persistence is invalid.`);
|
|
13449
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
13450
|
+
throw metadataError(id, `localData.collections[${index}].sensitivity is invalid.`);
|
|
13451
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
13452
|
+
throw metadataError(id, `localData.collections[${index}].protection is invalid.`);
|
|
13453
|
+
if (onProtectionUnavailable !== undefined && onProtectionUnavailable !== "error" && onProtectionUnavailable !== "memory-only")
|
|
13454
|
+
throw metadataError(id, `localData.collections[${index}].onProtectionUnavailable is invalid.`);
|
|
13455
|
+
if (evictionPriority !== undefined && evictionPriority !== "critical" && evictionPriority !== "normal" && evictionPriority !== "disposable")
|
|
13456
|
+
throw metadataError(id, `localData.collections[${index}].evictionPriority is invalid.`);
|
|
13457
|
+
return {
|
|
13458
|
+
match,
|
|
13459
|
+
...sensitivity ? { sensitivity } : {},
|
|
13460
|
+
...persistence ? { persistence } : {},
|
|
13461
|
+
...protection ? { protection } : {},
|
|
13462
|
+
...onProtectionUnavailable ? {
|
|
13463
|
+
onProtectionUnavailable
|
|
13464
|
+
} : {},
|
|
13465
|
+
...evictionPriority ? { evictionPriority } : {},
|
|
13466
|
+
...maxAge === undefined ? {} : {
|
|
13467
|
+
maxAgeMs: positiveVersion2(maxAge, id, `localData.collections[${index}].maxAgeMs`)
|
|
13468
|
+
}
|
|
13469
|
+
};
|
|
13470
|
+
}) : undefined;
|
|
13471
|
+
const mutations = Array.isArray(mutationRules) ? mutationRules.map((entry, index) => {
|
|
13472
|
+
const rule = requireObject(entry, id, `localData.mutations[${index}] must be an object.`);
|
|
13473
|
+
const allowedRuleKeys = new Set([
|
|
13474
|
+
"match",
|
|
13475
|
+
"persistence",
|
|
13476
|
+
"protection",
|
|
13477
|
+
"sensitivity"
|
|
13478
|
+
]);
|
|
13479
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
13480
|
+
if (unsupportedRuleKey)
|
|
13481
|
+
throw metadataError(id, `localData.mutations[${index}].${unsupportedRuleKey} is not supported.`);
|
|
13482
|
+
const protection = unknownField(rule, "protection");
|
|
13483
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
13484
|
+
const persistence = unknownField(rule, "persistence");
|
|
13485
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
13486
|
+
throw metadataError(id, `localData.mutations[${index}].protection is invalid.`);
|
|
13487
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
13488
|
+
throw metadataError(id, `localData.mutations[${index}].sensitivity is invalid.`);
|
|
13489
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
13490
|
+
throw metadataError(id, `localData.mutations[${index}].persistence is invalid.`);
|
|
13491
|
+
return {
|
|
13492
|
+
match: nonEmpty(Reflect.get(rule, "match"), id, `localData.mutations[${index}].match`),
|
|
13493
|
+
...sensitivity ? { sensitivity } : {},
|
|
13494
|
+
...persistence ? {
|
|
13495
|
+
persistence
|
|
13496
|
+
} : {},
|
|
13497
|
+
...protection ? { protection } : {}
|
|
13498
|
+
};
|
|
13499
|
+
}) : undefined;
|
|
13500
|
+
const quota = Reflect.get(record, "maxBytesPerNamespace");
|
|
13501
|
+
return {
|
|
13502
|
+
...collections ? { collections } : {},
|
|
13503
|
+
...mutations ? { mutations } : {},
|
|
13504
|
+
...quota === undefined ? {} : {
|
|
13505
|
+
maxBytesPerNamespace: positiveVersion2(quota, id, "localData.maxBytesPerNamespace")
|
|
13506
|
+
}
|
|
13507
|
+
};
|
|
13379
13508
|
}, component = (id, value) => {
|
|
13380
13509
|
const record = requireObject(value, id, "localSchema must be an object.");
|
|
13381
13510
|
const allowed = new Set([
|
|
13511
|
+
"localData",
|
|
13382
13512
|
"migrations",
|
|
13383
13513
|
"minimumCompatibleVersion",
|
|
13384
13514
|
"version"
|
|
@@ -13390,11 +13520,13 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
13390
13520
|
const declaredMinimum = Reflect.get(record, "minimumCompatibleVersion");
|
|
13391
13521
|
const minimumCompatibleVersion = declaredMinimum === undefined ? Math.max(1, version - 2) : positiveVersion2(declaredMinimum, id, "minimumCompatibleVersion");
|
|
13392
13522
|
const declaredMigrations = Reflect.get(record, "migrations");
|
|
13523
|
+
const declaredLocalData = Reflect.get(record, "localData");
|
|
13393
13524
|
if (declaredMigrations !== undefined && !Array.isArray(declaredMigrations))
|
|
13394
13525
|
throw metadataError(id, "migrations must be an array.");
|
|
13395
13526
|
const migrations = Array.isArray(declaredMigrations) ? declaredMigrations : undefined;
|
|
13396
13527
|
return {
|
|
13397
13528
|
id,
|
|
13529
|
+
...declaredLocalData === undefined ? {} : { localData: localDataPolicy(declaredLocalData, id) },
|
|
13398
13530
|
minimumCompatibleVersion,
|
|
13399
13531
|
...Array.isArray(migrations) ? {
|
|
13400
13532
|
migrations: migrations.map((entry, index) => migration(entry, id, index))
|
|
@@ -40248,5 +40380,5 @@ export {
|
|
|
40248
40380
|
ANGULAR_INIT_TIMEOUT_MS
|
|
40249
40381
|
};
|
|
40250
40382
|
|
|
40251
|
-
//# debugId=
|
|
40383
|
+
//# debugId=6C5F45490109F7A064756E2164756E21
|
|
40252
40384
|
//# sourceMappingURL=index.js.map
|