@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/mobile/index.js
CHANGED
|
@@ -168,11 +168,32 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
|
|
|
168
168
|
};
|
|
169
169
|
|
|
170
170
|
// node_modules/@absolutejs/sync/dist/client/index.js
|
|
171
|
-
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
171
|
+
var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" && value !== null && Array.isArray(Reflect.get(value, "installations")), registry, SyncLocalDataPolicyError, SyncLocalStoreSchemaError, positiveVersion = (value, label) => {
|
|
172
172
|
if (!Number.isSafeInteger(value) || value < 1)
|
|
173
173
|
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `${label} must be a positive safe integer`);
|
|
174
174
|
return value;
|
|
175
|
-
}, isSchemaBundle = (schema) => ("components" in schema),
|
|
175
|
+
}, isSchemaBundle = (schema) => ("components" in schema), validatePolicyMatch = (match, label) => {
|
|
176
|
+
if (match.length === 0 || match.trim() !== match || /^\*+$/.test(match) || match.includes("**"))
|
|
177
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.match must be an exact name or a non-empty glob without adjacent wildcards.`);
|
|
178
|
+
}, validateSyncLocalDataPolicy = (policy, label = "localData") => {
|
|
179
|
+
if (policy.maxBytesPerNamespace !== undefined && (!Number.isSafeInteger(policy.maxBytesPerNamespace) || policy.maxBytesPerNamespace < 1))
|
|
180
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.maxBytesPerNamespace must be a positive safe integer.`);
|
|
181
|
+
for (const [index, rule] of (policy.collections ?? []).entries()) {
|
|
182
|
+
validatePolicyMatch(rule.match, `${label}.collections[${index}]`);
|
|
183
|
+
if (rule.maxAgeMs !== undefined && (!Number.isSafeInteger(rule.maxAgeMs) || rule.maxAgeMs < 1))
|
|
184
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}].maxAgeMs must be a positive safe integer.`);
|
|
185
|
+
if (rule.persistence === "memory-only" && rule.protection === "required")
|
|
186
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}] cannot require at-rest protection when it is memory-only.`);
|
|
187
|
+
if (rule.sensitivity !== undefined && rule.sensitivity !== "public" && rule.protection !== "required" && rule.persistence !== "memory-only")
|
|
188
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.collections[${index}] declares ${rule.sensitivity} data without required protection or memory-only persistence.`);
|
|
189
|
+
}
|
|
190
|
+
for (const [index, rule] of (policy.mutations ?? []).entries()) {
|
|
191
|
+
validatePolicyMatch(rule.match, `${label}.mutations[${index}]`);
|
|
192
|
+
if (rule.sensitivity !== undefined && rule.sensitivity !== "public" && rule.protection !== "required" && rule.persistence !== "memory-only")
|
|
193
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.mutations[${index}] declares ${rule.sensitivity} arguments without required protection.`);
|
|
194
|
+
}
|
|
195
|
+
return policy;
|
|
196
|
+
}, normalizeSyncLocalSchemaComponents = (schema = { version: 1 }) => {
|
|
176
197
|
const components = isSchemaBundle(schema) ? [...schema.components] : [{ ...schema, id: "@absolutejs/app" }];
|
|
177
198
|
const ids = new Set;
|
|
178
199
|
for (const component of components) {
|
|
@@ -181,6 +202,8 @@ var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" &
|
|
|
181
202
|
if (ids.has(component.id))
|
|
182
203
|
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync schema component "${component.id}" is declared more than once`);
|
|
183
204
|
ids.add(component.id);
|
|
205
|
+
if (component.localData)
|
|
206
|
+
validateSyncLocalDataPolicy(component.localData, `${component.id}.localData`);
|
|
184
207
|
}
|
|
185
208
|
return components.sort((a, b) => a.id.localeCompare(b.id));
|
|
186
209
|
}, resolveSyncLocalSchemaComponents = (storedVersions, schema = { version: 1 }) => {
|
|
@@ -238,6 +261,14 @@ var init_client = __esm(() => {
|
|
|
238
261
|
});
|
|
239
262
|
return created;
|
|
240
263
|
})();
|
|
264
|
+
SyncLocalDataPolicyError = class SyncLocalDataPolicyError extends Error {
|
|
265
|
+
code;
|
|
266
|
+
constructor(code, message) {
|
|
267
|
+
super(message);
|
|
268
|
+
this.name = "SyncLocalDataPolicyError";
|
|
269
|
+
this.code = code;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
241
272
|
SyncLocalStoreSchemaError = class SyncLocalStoreSchemaError extends Error {
|
|
242
273
|
code;
|
|
243
274
|
storedVersion;
|
|
@@ -294,7 +325,7 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
294
325
|
if (!object(value))
|
|
295
326
|
throw metadataError(id, detail);
|
|
296
327
|
return value;
|
|
297
|
-
}, normalizeJsonValue2 = (value, id, field) => {
|
|
328
|
+
}, unknownField = (record, key) => record[key], normalizeJsonValue2 = (value, id, field) => {
|
|
298
329
|
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
299
330
|
return value;
|
|
300
331
|
if (typeof value === "number" && Number.isFinite(value))
|
|
@@ -345,9 +376,108 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
345
376
|
operations: operations.map((entry, operationIndex) => operation(entry, id, operationIndex)),
|
|
346
377
|
toVersion: positiveVersion2(Reflect.get(record, "toVersion"), id, `migration ${index}.toVersion`)
|
|
347
378
|
};
|
|
379
|
+
}, localDataPolicy = (value, id) => {
|
|
380
|
+
const record = requireObject(value, id, "localData must be an object.");
|
|
381
|
+
const allowed = new Set([
|
|
382
|
+
"collections",
|
|
383
|
+
"maxBytesPerNamespace",
|
|
384
|
+
"mutations"
|
|
385
|
+
]);
|
|
386
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
387
|
+
if (unsupported)
|
|
388
|
+
throw metadataError(id, `localData.${unsupported} is not supported.`);
|
|
389
|
+
const collectionRules = Reflect.get(record, "collections");
|
|
390
|
+
const mutationRules = Reflect.get(record, "mutations");
|
|
391
|
+
if (collectionRules !== undefined && !Array.isArray(collectionRules))
|
|
392
|
+
throw metadataError(id, "localData.collections must be an array.");
|
|
393
|
+
if (mutationRules !== undefined && !Array.isArray(mutationRules))
|
|
394
|
+
throw metadataError(id, "localData.mutations must be an array.");
|
|
395
|
+
const collections = Array.isArray(collectionRules) ? collectionRules.map((entry, index) => {
|
|
396
|
+
const rule = requireObject(entry, id, `localData.collections[${index}] must be an object.`);
|
|
397
|
+
const allowedRuleKeys = new Set([
|
|
398
|
+
"evictionPriority",
|
|
399
|
+
"match",
|
|
400
|
+
"maxAgeMs",
|
|
401
|
+
"onProtectionUnavailable",
|
|
402
|
+
"persistence",
|
|
403
|
+
"protection",
|
|
404
|
+
"sensitivity"
|
|
405
|
+
]);
|
|
406
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
407
|
+
if (unsupportedRuleKey)
|
|
408
|
+
throw metadataError(id, `localData.collections[${index}].${unsupportedRuleKey} is not supported.`);
|
|
409
|
+
const match = nonEmpty(Reflect.get(rule, "match"), id, `localData.collections[${index}].match`);
|
|
410
|
+
const persistence = unknownField(rule, "persistence");
|
|
411
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
412
|
+
const protection = unknownField(rule, "protection");
|
|
413
|
+
const onProtectionUnavailable = unknownField(rule, "onProtectionUnavailable");
|
|
414
|
+
const evictionPriority = unknownField(rule, "evictionPriority");
|
|
415
|
+
const maxAge = unknownField(rule, "maxAgeMs");
|
|
416
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
417
|
+
throw metadataError(id, `localData.collections[${index}].persistence is invalid.`);
|
|
418
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
419
|
+
throw metadataError(id, `localData.collections[${index}].sensitivity is invalid.`);
|
|
420
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
421
|
+
throw metadataError(id, `localData.collections[${index}].protection is invalid.`);
|
|
422
|
+
if (onProtectionUnavailable !== undefined && onProtectionUnavailable !== "error" && onProtectionUnavailable !== "memory-only")
|
|
423
|
+
throw metadataError(id, `localData.collections[${index}].onProtectionUnavailable is invalid.`);
|
|
424
|
+
if (evictionPriority !== undefined && evictionPriority !== "critical" && evictionPriority !== "normal" && evictionPriority !== "disposable")
|
|
425
|
+
throw metadataError(id, `localData.collections[${index}].evictionPriority is invalid.`);
|
|
426
|
+
return {
|
|
427
|
+
match,
|
|
428
|
+
...sensitivity ? { sensitivity } : {},
|
|
429
|
+
...persistence ? { persistence } : {},
|
|
430
|
+
...protection ? { protection } : {},
|
|
431
|
+
...onProtectionUnavailable ? {
|
|
432
|
+
onProtectionUnavailable
|
|
433
|
+
} : {},
|
|
434
|
+
...evictionPriority ? { evictionPriority } : {},
|
|
435
|
+
...maxAge === undefined ? {} : {
|
|
436
|
+
maxAgeMs: positiveVersion2(maxAge, id, `localData.collections[${index}].maxAgeMs`)
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
}) : undefined;
|
|
440
|
+
const mutations = Array.isArray(mutationRules) ? mutationRules.map((entry, index) => {
|
|
441
|
+
const rule = requireObject(entry, id, `localData.mutations[${index}] must be an object.`);
|
|
442
|
+
const allowedRuleKeys = new Set([
|
|
443
|
+
"match",
|
|
444
|
+
"persistence",
|
|
445
|
+
"protection",
|
|
446
|
+
"sensitivity"
|
|
447
|
+
]);
|
|
448
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
449
|
+
if (unsupportedRuleKey)
|
|
450
|
+
throw metadataError(id, `localData.mutations[${index}].${unsupportedRuleKey} is not supported.`);
|
|
451
|
+
const protection = unknownField(rule, "protection");
|
|
452
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
453
|
+
const persistence = unknownField(rule, "persistence");
|
|
454
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
455
|
+
throw metadataError(id, `localData.mutations[${index}].protection is invalid.`);
|
|
456
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
457
|
+
throw metadataError(id, `localData.mutations[${index}].sensitivity is invalid.`);
|
|
458
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
459
|
+
throw metadataError(id, `localData.mutations[${index}].persistence is invalid.`);
|
|
460
|
+
return {
|
|
461
|
+
match: nonEmpty(Reflect.get(rule, "match"), id, `localData.mutations[${index}].match`),
|
|
462
|
+
...sensitivity ? { sensitivity } : {},
|
|
463
|
+
...persistence ? {
|
|
464
|
+
persistence
|
|
465
|
+
} : {},
|
|
466
|
+
...protection ? { protection } : {}
|
|
467
|
+
};
|
|
468
|
+
}) : undefined;
|
|
469
|
+
const quota = Reflect.get(record, "maxBytesPerNamespace");
|
|
470
|
+
return {
|
|
471
|
+
...collections ? { collections } : {},
|
|
472
|
+
...mutations ? { mutations } : {},
|
|
473
|
+
...quota === undefined ? {} : {
|
|
474
|
+
maxBytesPerNamespace: positiveVersion2(quota, id, "localData.maxBytesPerNamespace")
|
|
475
|
+
}
|
|
476
|
+
};
|
|
348
477
|
}, component = (id, value) => {
|
|
349
478
|
const record = requireObject(value, id, "localSchema must be an object.");
|
|
350
479
|
const allowed = new Set([
|
|
480
|
+
"localData",
|
|
351
481
|
"migrations",
|
|
352
482
|
"minimumCompatibleVersion",
|
|
353
483
|
"version"
|
|
@@ -359,11 +489,13 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
359
489
|
const declaredMinimum = Reflect.get(record, "minimumCompatibleVersion");
|
|
360
490
|
const minimumCompatibleVersion = declaredMinimum === undefined ? Math.max(1, version - 2) : positiveVersion2(declaredMinimum, id, "minimumCompatibleVersion");
|
|
361
491
|
const declaredMigrations = Reflect.get(record, "migrations");
|
|
492
|
+
const declaredLocalData = Reflect.get(record, "localData");
|
|
362
493
|
if (declaredMigrations !== undefined && !Array.isArray(declaredMigrations))
|
|
363
494
|
throw metadataError(id, "migrations must be an array.");
|
|
364
495
|
const migrations = Array.isArray(declaredMigrations) ? declaredMigrations : undefined;
|
|
365
496
|
return {
|
|
366
497
|
id,
|
|
498
|
+
...declaredLocalData === undefined ? {} : { localData: localDataPolicy(declaredLocalData, id) },
|
|
367
499
|
minimumCompatibleVersion,
|
|
368
500
|
...Array.isArray(migrations) ? {
|
|
369
501
|
migrations: migrations.map((entry, index) => migration(entry, id, index))
|
|
@@ -5984,5 +6116,5 @@ export {
|
|
|
5984
6116
|
ABSOLUTE_ANDROID_RELEASE_FORMAT
|
|
5985
6117
|
};
|
|
5986
6118
|
|
|
5987
|
-
//# debugId=
|
|
6119
|
+
//# debugId=924628517A2DD9D064756E2164756E21
|
|
5988
6120
|
//# sourceMappingURL=index.js.map
|