@absolutejs/absolute 0.20.0-beta.14 → 0.20.0-beta.16
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 +143 -4
- package/dist/build.js.map +4 -4
- package/dist/cli/index.js +150 -5
- package/dist/index.js +143 -4
- package/dist/index.js.map +4 -4
- package/dist/mobile/index.js +143 -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,34 @@ 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.persistence === "memory-only" && rule.protection === "required")
|
|
193
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.mutations[${index}] cannot require at-rest protection when it is memory-only.`);
|
|
194
|
+
if (rule.sensitivity !== undefined && rule.sensitivity !== "public" && rule.protection !== "required" && rule.persistence !== "memory-only")
|
|
195
|
+
throw new SyncLocalDataPolicyError("INVALID_POLICY", `${label}.mutations[${index}] declares ${rule.sensitivity} arguments without required protection.`);
|
|
196
|
+
}
|
|
197
|
+
return policy;
|
|
198
|
+
}, normalizeSyncLocalSchemaComponents = (schema = { version: 1 }) => {
|
|
176
199
|
const components = isSchemaBundle(schema) ? [...schema.components] : [{ ...schema, id: "@absolutejs/app" }];
|
|
177
200
|
const ids = new Set;
|
|
178
201
|
for (const component of components) {
|
|
@@ -181,6 +204,8 @@ var RUNTIME_TRANSPORT, host, isRegistry = (value) => typeof value === "object" &
|
|
|
181
204
|
if (ids.has(component.id))
|
|
182
205
|
throw new SyncLocalStoreSchemaError("INVALID_PLAN", `Sync schema component "${component.id}" is declared more than once`);
|
|
183
206
|
ids.add(component.id);
|
|
207
|
+
if (component.localData)
|
|
208
|
+
validateSyncLocalDataPolicy(component.localData, `${component.id}.localData`);
|
|
184
209
|
}
|
|
185
210
|
return components.sort((a, b) => a.id.localeCompare(b.id));
|
|
186
211
|
}, resolveSyncLocalSchemaComponents = (storedVersions, schema = { version: 1 }) => {
|
|
@@ -238,6 +263,14 @@ var init_client = __esm(() => {
|
|
|
238
263
|
});
|
|
239
264
|
return created;
|
|
240
265
|
})();
|
|
266
|
+
SyncLocalDataPolicyError = class SyncLocalDataPolicyError extends Error {
|
|
267
|
+
code;
|
|
268
|
+
constructor(code, message) {
|
|
269
|
+
super(message);
|
|
270
|
+
this.name = "SyncLocalDataPolicyError";
|
|
271
|
+
this.code = code;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
241
274
|
SyncLocalStoreSchemaError = class SyncLocalStoreSchemaError extends Error {
|
|
242
275
|
code;
|
|
243
276
|
storedVersion;
|
|
@@ -294,7 +327,7 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
294
327
|
if (!object(value))
|
|
295
328
|
throw metadataError(id, detail);
|
|
296
329
|
return value;
|
|
297
|
-
}, normalizeJsonValue2 = (value, id, field) => {
|
|
330
|
+
}, unknownField = (record, key) => record[key], normalizeJsonValue2 = (value, id, field) => {
|
|
298
331
|
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
299
332
|
return value;
|
|
300
333
|
if (typeof value === "number" && Number.isFinite(value))
|
|
@@ -345,9 +378,113 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
345
378
|
operations: operations.map((entry, operationIndex) => operation(entry, id, operationIndex)),
|
|
346
379
|
toVersion: positiveVersion2(Reflect.get(record, "toVersion"), id, `migration ${index}.toVersion`)
|
|
347
380
|
};
|
|
381
|
+
}, localDataPolicy = (value, id) => {
|
|
382
|
+
const record = requireObject(value, id, "localData must be an object.");
|
|
383
|
+
const allowed = new Set([
|
|
384
|
+
"collections",
|
|
385
|
+
"maxBytesPerNamespace",
|
|
386
|
+
"mutations"
|
|
387
|
+
]);
|
|
388
|
+
const unsupported = Object.keys(record).find((key) => !allowed.has(key));
|
|
389
|
+
if (unsupported)
|
|
390
|
+
throw metadataError(id, `localData.${unsupported} is not supported.`);
|
|
391
|
+
const collectionRules = Reflect.get(record, "collections");
|
|
392
|
+
const mutationRules = Reflect.get(record, "mutations");
|
|
393
|
+
if (collectionRules !== undefined && !Array.isArray(collectionRules))
|
|
394
|
+
throw metadataError(id, "localData.collections must be an array.");
|
|
395
|
+
if (mutationRules !== undefined && !Array.isArray(mutationRules))
|
|
396
|
+
throw metadataError(id, "localData.mutations must be an array.");
|
|
397
|
+
const collections = Array.isArray(collectionRules) ? collectionRules.map((entry, index) => {
|
|
398
|
+
const rule = requireObject(entry, id, `localData.collections[${index}] must be an object.`);
|
|
399
|
+
const allowedRuleKeys = new Set([
|
|
400
|
+
"evictionPriority",
|
|
401
|
+
"match",
|
|
402
|
+
"maxAgeMs",
|
|
403
|
+
"onProtectionUnavailable",
|
|
404
|
+
"persistence",
|
|
405
|
+
"protection",
|
|
406
|
+
"sensitivity"
|
|
407
|
+
]);
|
|
408
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
409
|
+
if (unsupportedRuleKey)
|
|
410
|
+
throw metadataError(id, `localData.collections[${index}].${unsupportedRuleKey} is not supported.`);
|
|
411
|
+
const match = nonEmpty(Reflect.get(rule, "match"), id, `localData.collections[${index}].match`);
|
|
412
|
+
const persistence = unknownField(rule, "persistence");
|
|
413
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
414
|
+
const protection = unknownField(rule, "protection");
|
|
415
|
+
const onProtectionUnavailable = unknownField(rule, "onProtectionUnavailable");
|
|
416
|
+
const evictionPriority = unknownField(rule, "evictionPriority");
|
|
417
|
+
const maxAge = unknownField(rule, "maxAgeMs");
|
|
418
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
419
|
+
throw metadataError(id, `localData.collections[${index}].persistence is invalid.`);
|
|
420
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
421
|
+
throw metadataError(id, `localData.collections[${index}].sensitivity is invalid.`);
|
|
422
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
423
|
+
throw metadataError(id, `localData.collections[${index}].protection is invalid.`);
|
|
424
|
+
if (onProtectionUnavailable !== undefined && onProtectionUnavailable !== "error" && onProtectionUnavailable !== "memory-only")
|
|
425
|
+
throw metadataError(id, `localData.collections[${index}].onProtectionUnavailable is invalid.`);
|
|
426
|
+
if (evictionPriority !== undefined && evictionPriority !== "critical" && evictionPriority !== "normal" && evictionPriority !== "disposable")
|
|
427
|
+
throw metadataError(id, `localData.collections[${index}].evictionPriority is invalid.`);
|
|
428
|
+
return {
|
|
429
|
+
match,
|
|
430
|
+
...sensitivity ? { sensitivity } : {},
|
|
431
|
+
...persistence ? { persistence } : {},
|
|
432
|
+
...protection ? { protection } : {},
|
|
433
|
+
...onProtectionUnavailable ? {
|
|
434
|
+
onProtectionUnavailable
|
|
435
|
+
} : {},
|
|
436
|
+
...evictionPriority ? { evictionPriority } : {},
|
|
437
|
+
...maxAge === undefined ? {} : {
|
|
438
|
+
maxAgeMs: positiveVersion2(maxAge, id, `localData.collections[${index}].maxAgeMs`)
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
}) : undefined;
|
|
442
|
+
const mutations = Array.isArray(mutationRules) ? mutationRules.map((entry, index) => {
|
|
443
|
+
const rule = requireObject(entry, id, `localData.mutations[${index}] must be an object.`);
|
|
444
|
+
const allowedRuleKeys = new Set([
|
|
445
|
+
"match",
|
|
446
|
+
"onProtectionUnavailable",
|
|
447
|
+
"persistence",
|
|
448
|
+
"protection",
|
|
449
|
+
"sensitivity"
|
|
450
|
+
]);
|
|
451
|
+
const unsupportedRuleKey = Object.keys(rule).find((key) => !allowedRuleKeys.has(key));
|
|
452
|
+
if (unsupportedRuleKey)
|
|
453
|
+
throw metadataError(id, `localData.mutations[${index}].${unsupportedRuleKey} is not supported.`);
|
|
454
|
+
const protection = unknownField(rule, "protection");
|
|
455
|
+
const sensitivity = unknownField(rule, "sensitivity");
|
|
456
|
+
const persistence = unknownField(rule, "persistence");
|
|
457
|
+
const onProtectionUnavailable = unknownField(rule, "onProtectionUnavailable");
|
|
458
|
+
if (protection !== undefined && protection !== "none" && protection !== "required")
|
|
459
|
+
throw metadataError(id, `localData.mutations[${index}].protection is invalid.`);
|
|
460
|
+
if (sensitivity !== undefined && sensitivity !== "public" && sensitivity !== "private" && sensitivity !== "secret")
|
|
461
|
+
throw metadataError(id, `localData.mutations[${index}].sensitivity is invalid.`);
|
|
462
|
+
if (onProtectionUnavailable !== undefined && onProtectionUnavailable !== "error" && onProtectionUnavailable !== "memory-only")
|
|
463
|
+
throw metadataError(id, `localData.mutations[${index}].onProtectionUnavailable is invalid.`);
|
|
464
|
+
if (persistence !== undefined && persistence !== "durable" && persistence !== "memory-only")
|
|
465
|
+
throw metadataError(id, `localData.mutations[${index}].persistence is invalid.`);
|
|
466
|
+
return {
|
|
467
|
+
match: nonEmpty(Reflect.get(rule, "match"), id, `localData.mutations[${index}].match`),
|
|
468
|
+
...sensitivity ? { sensitivity } : {},
|
|
469
|
+
...onProtectionUnavailable ? { onProtectionUnavailable } : {},
|
|
470
|
+
...persistence ? {
|
|
471
|
+
persistence
|
|
472
|
+
} : {},
|
|
473
|
+
...protection ? { protection } : {}
|
|
474
|
+
};
|
|
475
|
+
}) : undefined;
|
|
476
|
+
const quota = Reflect.get(record, "maxBytesPerNamespace");
|
|
477
|
+
return {
|
|
478
|
+
...collections ? { collections } : {},
|
|
479
|
+
...mutations ? { mutations } : {},
|
|
480
|
+
...quota === undefined ? {} : {
|
|
481
|
+
maxBytesPerNamespace: positiveVersion2(quota, id, "localData.maxBytesPerNamespace")
|
|
482
|
+
}
|
|
483
|
+
};
|
|
348
484
|
}, component = (id, value) => {
|
|
349
485
|
const record = requireObject(value, id, "localSchema must be an object.");
|
|
350
486
|
const allowed = new Set([
|
|
487
|
+
"localData",
|
|
351
488
|
"migrations",
|
|
352
489
|
"minimumCompatibleVersion",
|
|
353
490
|
"version"
|
|
@@ -359,11 +496,13 @@ var object = (value) => typeof value === "object" && value !== null && !Array.is
|
|
|
359
496
|
const declaredMinimum = Reflect.get(record, "minimumCompatibleVersion");
|
|
360
497
|
const minimumCompatibleVersion = declaredMinimum === undefined ? Math.max(1, version - 2) : positiveVersion2(declaredMinimum, id, "minimumCompatibleVersion");
|
|
361
498
|
const declaredMigrations = Reflect.get(record, "migrations");
|
|
499
|
+
const declaredLocalData = Reflect.get(record, "localData");
|
|
362
500
|
if (declaredMigrations !== undefined && !Array.isArray(declaredMigrations))
|
|
363
501
|
throw metadataError(id, "migrations must be an array.");
|
|
364
502
|
const migrations = Array.isArray(declaredMigrations) ? declaredMigrations : undefined;
|
|
365
503
|
return {
|
|
366
504
|
id,
|
|
505
|
+
...declaredLocalData === undefined ? {} : { localData: localDataPolicy(declaredLocalData, id) },
|
|
367
506
|
minimumCompatibleVersion,
|
|
368
507
|
...Array.isArray(migrations) ? {
|
|
369
508
|
migrations: migrations.map((entry, index) => migration(entry, id, index))
|
|
@@ -5984,5 +6123,5 @@ export {
|
|
|
5984
6123
|
ABSOLUTE_ANDROID_RELEASE_FORMAT
|
|
5985
6124
|
};
|
|
5986
6125
|
|
|
5987
|
-
//# debugId=
|
|
6126
|
+
//# debugId=8A696911288E3CC364756E2164756E21
|
|
5988
6127
|
//# sourceMappingURL=index.js.map
|