@camstack/addon-waste-collections 0.1.34 → 0.1.36
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/CHANGELOG.md +12 -0
- package/dist/waste-collections.addon.js +199 -8
- package/dist/waste-collections.addon.mjs +199 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.36] - 2026-11-06
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Rebuilt against updated dependencies.
|
|
15
|
+
|
|
16
|
+
## [0.1.35] - 2026-11-06
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- A boot after the credentials moved to the keychain no longer crash-loops the integrations runner
|
|
21
|
+
|
|
10
22
|
## [0.1.34] - 2026-11-06
|
|
11
23
|
|
|
12
24
|
### Changed
|
|
@@ -5988,7 +5988,7 @@ var ZodIssueCode = {
|
|
|
5988
5988
|
var ZodFirstPartyTypeKind;
|
|
5989
5989
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5990
5990
|
//#endregion
|
|
5991
|
-
//#region ../types/dist/sleep-
|
|
5991
|
+
//#region ../types/dist/sleep-D7ZKm4nb.mjs
|
|
5992
5992
|
/**
|
|
5993
5993
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5994
5994
|
* window to float samples (D455).
|
|
@@ -6706,11 +6706,61 @@ function integrationRowsApiOver(api) {
|
|
|
6706
6706
|
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
6707
6707
|
};
|
|
6708
6708
|
}
|
|
6709
|
+
/**
|
|
6710
|
+
* The named failures of `ctx.records` (D881).
|
|
6711
|
+
*
|
|
6712
|
+
* A records call crosses a worker thread, a UDS channel and a tRPC router, and
|
|
6713
|
+
* an error class does not survive any of them - only its message does. So
|
|
6714
|
+
* every message STARTS with a stable code, `records/<code>: <detail>`, and
|
|
6715
|
+
* {@link recordsErrorFromMessage} rebuilds the typed class on the caller's side.
|
|
6716
|
+
* A failed read is never `[]` or `undefined`: it throws one of these.
|
|
6717
|
+
*/
|
|
6718
|
+
/** Every code a records failure carries. */
|
|
6719
|
+
var RECORDS_ERROR_CODES = [
|
|
6720
|
+
"rev-conflict",
|
|
6721
|
+
"too-large",
|
|
6722
|
+
"unindexed-filter",
|
|
6723
|
+
"filter-required",
|
|
6724
|
+
"unknown-kind",
|
|
6725
|
+
"not-found",
|
|
6726
|
+
"unique-violation",
|
|
6727
|
+
"plaintext-secret",
|
|
6728
|
+
"foreign-marker",
|
|
6729
|
+
"secret-unavailable",
|
|
6730
|
+
"invalid-record",
|
|
6731
|
+
"declaration-refused",
|
|
6732
|
+
"no-caller",
|
|
6733
|
+
"batch-too-large",
|
|
6734
|
+
"transact-refused"
|
|
6735
|
+
];
|
|
6709
6736
|
var PREFIX = "records/";
|
|
6737
|
+
/**
|
|
6738
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
6739
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
6740
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
6741
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
6742
|
+
*/
|
|
6743
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
6744
|
+
function carriesBrand(value) {
|
|
6745
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
6746
|
+
}
|
|
6710
6747
|
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6711
6748
|
var RecordsError = class extends Error {
|
|
6749
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
6750
|
+
static code = void 0;
|
|
6751
|
+
/**
|
|
6752
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
6753
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
6754
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
6755
|
+
*/
|
|
6756
|
+
static [Symbol.hasInstance](value) {
|
|
6757
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
6758
|
+
if (!carriesBrand(value)) return false;
|
|
6759
|
+
return this.code === void 0 || value.code === this.code;
|
|
6760
|
+
}
|
|
6712
6761
|
code;
|
|
6713
6762
|
detail;
|
|
6763
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
6714
6764
|
constructor(code, detail) {
|
|
6715
6765
|
super(`${PREFIX}${code}: ${detail}`);
|
|
6716
6766
|
this.name = "RecordsError";
|
|
@@ -6718,26 +6768,167 @@ var RecordsError = class extends Error {
|
|
|
6718
6768
|
this.detail = detail;
|
|
6719
6769
|
}
|
|
6720
6770
|
};
|
|
6771
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6772
|
+
var RevConflictError = class RevConflictError extends RecordsError {
|
|
6773
|
+
static code = "rev-conflict";
|
|
6774
|
+
constructor(detail) {
|
|
6775
|
+
super(RevConflictError.code, detail);
|
|
6776
|
+
this.name = "RevConflictError";
|
|
6777
|
+
}
|
|
6778
|
+
};
|
|
6779
|
+
/** `data` exceeds the kind's `maxDataBytes`. Bytes are never record fields (D613). */
|
|
6780
|
+
var RecordTooLargeError = class RecordTooLargeError extends RecordsError {
|
|
6781
|
+
static code = "too-large";
|
|
6782
|
+
constructor(detail) {
|
|
6783
|
+
super(RecordTooLargeError.code, detail);
|
|
6784
|
+
this.name = "RecordTooLargeError";
|
|
6785
|
+
}
|
|
6786
|
+
};
|
|
6787
|
+
/** A filter, order or aggregate names a field no declared index serves. */
|
|
6788
|
+
var UnindexedFilterError = class UnindexedFilterError extends RecordsError {
|
|
6789
|
+
static code = "unindexed-filter";
|
|
6790
|
+
constructor(detail) {
|
|
6791
|
+
super(UnindexedFilterError.code, detail);
|
|
6792
|
+
this.name = "UnindexedFilterError";
|
|
6793
|
+
}
|
|
6794
|
+
};
|
|
6795
|
+
/** A bulk delete with no predicate at all. */
|
|
6796
|
+
var FilterRequiredError = class FilterRequiredError extends RecordsError {
|
|
6797
|
+
static code = "filter-required";
|
|
6798
|
+
constructor(detail) {
|
|
6799
|
+
super(FilterRequiredError.code, detail);
|
|
6800
|
+
this.name = "FilterRequiredError";
|
|
6801
|
+
}
|
|
6802
|
+
};
|
|
6803
|
+
/** The caller declared no such kind (another addon's kind is indistinguishable from none). */
|
|
6804
|
+
var UnknownRecordKindError = class UnknownRecordKindError extends RecordsError {
|
|
6805
|
+
static code = "unknown-kind";
|
|
6806
|
+
constructor(detail) {
|
|
6807
|
+
super(UnknownRecordKindError.code, detail);
|
|
6808
|
+
this.name = "UnknownRecordKindError";
|
|
6809
|
+
}
|
|
6810
|
+
};
|
|
6811
|
+
var RecordNotFoundError = class RecordNotFoundError extends RecordsError {
|
|
6812
|
+
static code = "not-found";
|
|
6813
|
+
constructor(detail) {
|
|
6814
|
+
super(RecordNotFoundError.code, detail);
|
|
6815
|
+
this.name = "RecordNotFoundError";
|
|
6816
|
+
}
|
|
6817
|
+
};
|
|
6818
|
+
/** A unique index refused the write. */
|
|
6819
|
+
var RecordUniqueViolationError = class RecordUniqueViolationError extends RecordsError {
|
|
6820
|
+
static code = "unique-violation";
|
|
6821
|
+
constructor(detail) {
|
|
6822
|
+
super(RecordUniqueViolationError.code, detail);
|
|
6823
|
+
this.name = "RecordUniqueViolationError";
|
|
6824
|
+
}
|
|
6825
|
+
};
|
|
6826
|
+
/** A secret field held a plain string where only a keychain marker may be stored. */
|
|
6827
|
+
var PlaintextSecretError = class PlaintextSecretError extends RecordsError {
|
|
6828
|
+
static code = "plaintext-secret";
|
|
6829
|
+
constructor(detail) {
|
|
6830
|
+
super(PlaintextSecretError.code, detail);
|
|
6831
|
+
this.name = "PlaintextSecretError";
|
|
6832
|
+
}
|
|
6833
|
+
};
|
|
6834
|
+
/** A marker whose ref is not the row's own (the D878 rule). */
|
|
6835
|
+
var ForeignSecretMarkerError = class ForeignSecretMarkerError extends RecordsError {
|
|
6836
|
+
static code = "foreign-marker";
|
|
6837
|
+
constructor(detail) {
|
|
6838
|
+
super(ForeignSecretMarkerError.code, detail);
|
|
6839
|
+
this.name = "ForeignSecretMarkerError";
|
|
6840
|
+
}
|
|
6841
|
+
};
|
|
6721
6842
|
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6722
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6843
|
+
var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
|
|
6844
|
+
static code = "secret-unavailable";
|
|
6723
6845
|
constructor(detail) {
|
|
6724
|
-
super(
|
|
6846
|
+
super(RecordSecretUnavailableError.code, detail);
|
|
6725
6847
|
this.name = "RecordSecretUnavailableError";
|
|
6726
6848
|
}
|
|
6727
6849
|
};
|
|
6728
|
-
var InvalidRecordError = class extends RecordsError {
|
|
6850
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
6851
|
+
static code = "invalid-record";
|
|
6729
6852
|
constructor(detail) {
|
|
6730
|
-
super(
|
|
6853
|
+
super(InvalidRecordError.code, detail);
|
|
6731
6854
|
this.name = "InvalidRecordError";
|
|
6732
6855
|
}
|
|
6733
6856
|
};
|
|
6734
6857
|
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6735
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
6858
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
6859
|
+
static code = "declaration-refused";
|
|
6736
6860
|
constructor(detail) {
|
|
6737
|
-
super(
|
|
6861
|
+
super(DeclarationRefusedError.code, detail);
|
|
6738
6862
|
this.name = "DeclarationRefusedError";
|
|
6739
6863
|
}
|
|
6740
6864
|
};
|
|
6865
|
+
var NoCallerError = class NoCallerError extends RecordsError {
|
|
6866
|
+
static code = "no-caller";
|
|
6867
|
+
constructor(detail) {
|
|
6868
|
+
super(NoCallerError.code, detail);
|
|
6869
|
+
this.name = "NoCallerError";
|
|
6870
|
+
}
|
|
6871
|
+
};
|
|
6872
|
+
var BatchTooLargeError = class BatchTooLargeError extends RecordsError {
|
|
6873
|
+
static code = "batch-too-large";
|
|
6874
|
+
constructor(detail) {
|
|
6875
|
+
super(BatchTooLargeError.code, detail);
|
|
6876
|
+
this.name = "BatchTooLargeError";
|
|
6877
|
+
}
|
|
6878
|
+
};
|
|
6879
|
+
/**
|
|
6880
|
+
* A `transact` the engine refuses before touching a row: an op on a kind the
|
|
6881
|
+
* caller did not declare in ONE file and ONE `transactFamily`. The detail names
|
|
6882
|
+
* which rule (`cross-file`, `cross-family`, `no-family`); it is never a silent split.
|
|
6883
|
+
*/
|
|
6884
|
+
var TransactRefusedError = class TransactRefusedError extends RecordsError {
|
|
6885
|
+
static code = "transact-refused";
|
|
6886
|
+
constructor(detail) {
|
|
6887
|
+
super(TransactRefusedError.code, detail);
|
|
6888
|
+
this.name = "TransactRefusedError";
|
|
6889
|
+
}
|
|
6890
|
+
};
|
|
6891
|
+
var FACTORIES = {
|
|
6892
|
+
"rev-conflict": (d) => new RevConflictError(d),
|
|
6893
|
+
"too-large": (d) => new RecordTooLargeError(d),
|
|
6894
|
+
"unindexed-filter": (d) => new UnindexedFilterError(d),
|
|
6895
|
+
"filter-required": (d) => new FilterRequiredError(d),
|
|
6896
|
+
"unknown-kind": (d) => new UnknownRecordKindError(d),
|
|
6897
|
+
"not-found": (d) => new RecordNotFoundError(d),
|
|
6898
|
+
"unique-violation": (d) => new RecordUniqueViolationError(d),
|
|
6899
|
+
"plaintext-secret": (d) => new PlaintextSecretError(d),
|
|
6900
|
+
"foreign-marker": (d) => new ForeignSecretMarkerError(d),
|
|
6901
|
+
"secret-unavailable": (d) => new RecordSecretUnavailableError(d),
|
|
6902
|
+
"invalid-record": (d) => new InvalidRecordError(d),
|
|
6903
|
+
"declaration-refused": (d) => new DeclarationRefusedError(d),
|
|
6904
|
+
"no-caller": (d) => new NoCallerError(d),
|
|
6905
|
+
"batch-too-large": (d) => new BatchTooLargeError(d),
|
|
6906
|
+
"transact-refused": (d) => new TransactRefusedError(d)
|
|
6907
|
+
};
|
|
6908
|
+
function isCode(value) {
|
|
6909
|
+
return RECORDS_ERROR_CODES.some((code) => code === value);
|
|
6910
|
+
}
|
|
6911
|
+
/**
|
|
6912
|
+
* Rebuild the typed error from a message that crossed a wire; `null` when the
|
|
6913
|
+
* message is not a records failure.
|
|
6914
|
+
*/
|
|
6915
|
+
function recordsErrorFromMessage(message) {
|
|
6916
|
+
if (!message.startsWith(PREFIX)) return null;
|
|
6917
|
+
const colon = message.indexOf(": ");
|
|
6918
|
+
if (colon < 0) return null;
|
|
6919
|
+
const code = message.slice(8, colon);
|
|
6920
|
+
if (!isCode(code)) return null;
|
|
6921
|
+
return FACTORIES[code](message.slice(colon + 2));
|
|
6922
|
+
}
|
|
6923
|
+
/** The records failure inside any thrown value (a wrapped tRPC error included), or the value. */
|
|
6924
|
+
function asRecordsError(err) {
|
|
6925
|
+
if (err instanceof RecordsError) return err;
|
|
6926
|
+
if (err instanceof Error) {
|
|
6927
|
+
const typed = recordsErrorFromMessage(err.message);
|
|
6928
|
+
if (typed !== null) return typed;
|
|
6929
|
+
}
|
|
6930
|
+
return err;
|
|
6931
|
+
}
|
|
6741
6932
|
function linkTargetOf(meta) {
|
|
6742
6933
|
if (typeof meta !== "object" || meta === null) return void 0;
|
|
6743
6934
|
const link = Reflect.get(meta, "link");
|
|
@@ -91694,7 +91885,7 @@ async function sealPlaintextCredentials(records, secrets, log) {
|
|
|
91694
91885
|
try {
|
|
91695
91886
|
await records.declare({ "waste-source": plainWasteSourceKind });
|
|
91696
91887
|
} catch (err) {
|
|
91697
|
-
if (err instanceof
|
|
91888
|
+
if (asRecordsError(err) instanceof DeclarationRefusedError) {
|
|
91698
91889
|
log.info("waste-collections: the secret kind is already declared; no plain-text credential can remain");
|
|
91699
91890
|
return { state: "already-secret" };
|
|
91700
91891
|
}
|
|
@@ -5984,7 +5984,7 @@ var ZodIssueCode = {
|
|
|
5984
5984
|
var ZodFirstPartyTypeKind;
|
|
5985
5985
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5986
5986
|
//#endregion
|
|
5987
|
-
//#region ../types/dist/sleep-
|
|
5987
|
+
//#region ../types/dist/sleep-D7ZKm4nb.mjs
|
|
5988
5988
|
/**
|
|
5989
5989
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5990
5990
|
* window to float samples (D455).
|
|
@@ -6702,11 +6702,61 @@ function integrationRowsApiOver(api) {
|
|
|
6702
6702
|
clearLegacyIntegrationRows: (input) => api.legacyRows.clear(input)
|
|
6703
6703
|
};
|
|
6704
6704
|
}
|
|
6705
|
+
/**
|
|
6706
|
+
* The named failures of `ctx.records` (D881).
|
|
6707
|
+
*
|
|
6708
|
+
* A records call crosses a worker thread, a UDS channel and a tRPC router, and
|
|
6709
|
+
* an error class does not survive any of them - only its message does. So
|
|
6710
|
+
* every message STARTS with a stable code, `records/<code>: <detail>`, and
|
|
6711
|
+
* {@link recordsErrorFromMessage} rebuilds the typed class on the caller's side.
|
|
6712
|
+
* A failed read is never `[]` or `undefined`: it throws one of these.
|
|
6713
|
+
*/
|
|
6714
|
+
/** Every code a records failure carries. */
|
|
6715
|
+
var RECORDS_ERROR_CODES = [
|
|
6716
|
+
"rev-conflict",
|
|
6717
|
+
"too-large",
|
|
6718
|
+
"unindexed-filter",
|
|
6719
|
+
"filter-required",
|
|
6720
|
+
"unknown-kind",
|
|
6721
|
+
"not-found",
|
|
6722
|
+
"unique-violation",
|
|
6723
|
+
"plaintext-secret",
|
|
6724
|
+
"foreign-marker",
|
|
6725
|
+
"secret-unavailable",
|
|
6726
|
+
"invalid-record",
|
|
6727
|
+
"declaration-refused",
|
|
6728
|
+
"no-caller",
|
|
6729
|
+
"batch-too-large",
|
|
6730
|
+
"transact-refused"
|
|
6731
|
+
];
|
|
6705
6732
|
var PREFIX = "records/";
|
|
6733
|
+
/**
|
|
6734
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
6735
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
6736
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
6737
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
6738
|
+
*/
|
|
6739
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
6740
|
+
function carriesBrand(value) {
|
|
6741
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
6742
|
+
}
|
|
6706
6743
|
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6707
6744
|
var RecordsError = class extends Error {
|
|
6745
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
6746
|
+
static code = void 0;
|
|
6747
|
+
/**
|
|
6748
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
6749
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
6750
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
6751
|
+
*/
|
|
6752
|
+
static [Symbol.hasInstance](value) {
|
|
6753
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
6754
|
+
if (!carriesBrand(value)) return false;
|
|
6755
|
+
return this.code === void 0 || value.code === this.code;
|
|
6756
|
+
}
|
|
6708
6757
|
code;
|
|
6709
6758
|
detail;
|
|
6759
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
6710
6760
|
constructor(code, detail) {
|
|
6711
6761
|
super(`${PREFIX}${code}: ${detail}`);
|
|
6712
6762
|
this.name = "RecordsError";
|
|
@@ -6714,26 +6764,167 @@ var RecordsError = class extends Error {
|
|
|
6714
6764
|
this.detail = detail;
|
|
6715
6765
|
}
|
|
6716
6766
|
};
|
|
6767
|
+
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6768
|
+
var RevConflictError = class RevConflictError extends RecordsError {
|
|
6769
|
+
static code = "rev-conflict";
|
|
6770
|
+
constructor(detail) {
|
|
6771
|
+
super(RevConflictError.code, detail);
|
|
6772
|
+
this.name = "RevConflictError";
|
|
6773
|
+
}
|
|
6774
|
+
};
|
|
6775
|
+
/** `data` exceeds the kind's `maxDataBytes`. Bytes are never record fields (D613). */
|
|
6776
|
+
var RecordTooLargeError = class RecordTooLargeError extends RecordsError {
|
|
6777
|
+
static code = "too-large";
|
|
6778
|
+
constructor(detail) {
|
|
6779
|
+
super(RecordTooLargeError.code, detail);
|
|
6780
|
+
this.name = "RecordTooLargeError";
|
|
6781
|
+
}
|
|
6782
|
+
};
|
|
6783
|
+
/** A filter, order or aggregate names a field no declared index serves. */
|
|
6784
|
+
var UnindexedFilterError = class UnindexedFilterError extends RecordsError {
|
|
6785
|
+
static code = "unindexed-filter";
|
|
6786
|
+
constructor(detail) {
|
|
6787
|
+
super(UnindexedFilterError.code, detail);
|
|
6788
|
+
this.name = "UnindexedFilterError";
|
|
6789
|
+
}
|
|
6790
|
+
};
|
|
6791
|
+
/** A bulk delete with no predicate at all. */
|
|
6792
|
+
var FilterRequiredError = class FilterRequiredError extends RecordsError {
|
|
6793
|
+
static code = "filter-required";
|
|
6794
|
+
constructor(detail) {
|
|
6795
|
+
super(FilterRequiredError.code, detail);
|
|
6796
|
+
this.name = "FilterRequiredError";
|
|
6797
|
+
}
|
|
6798
|
+
};
|
|
6799
|
+
/** The caller declared no such kind (another addon's kind is indistinguishable from none). */
|
|
6800
|
+
var UnknownRecordKindError = class UnknownRecordKindError extends RecordsError {
|
|
6801
|
+
static code = "unknown-kind";
|
|
6802
|
+
constructor(detail) {
|
|
6803
|
+
super(UnknownRecordKindError.code, detail);
|
|
6804
|
+
this.name = "UnknownRecordKindError";
|
|
6805
|
+
}
|
|
6806
|
+
};
|
|
6807
|
+
var RecordNotFoundError = class RecordNotFoundError extends RecordsError {
|
|
6808
|
+
static code = "not-found";
|
|
6809
|
+
constructor(detail) {
|
|
6810
|
+
super(RecordNotFoundError.code, detail);
|
|
6811
|
+
this.name = "RecordNotFoundError";
|
|
6812
|
+
}
|
|
6813
|
+
};
|
|
6814
|
+
/** A unique index refused the write. */
|
|
6815
|
+
var RecordUniqueViolationError = class RecordUniqueViolationError extends RecordsError {
|
|
6816
|
+
static code = "unique-violation";
|
|
6817
|
+
constructor(detail) {
|
|
6818
|
+
super(RecordUniqueViolationError.code, detail);
|
|
6819
|
+
this.name = "RecordUniqueViolationError";
|
|
6820
|
+
}
|
|
6821
|
+
};
|
|
6822
|
+
/** A secret field held a plain string where only a keychain marker may be stored. */
|
|
6823
|
+
var PlaintextSecretError = class PlaintextSecretError extends RecordsError {
|
|
6824
|
+
static code = "plaintext-secret";
|
|
6825
|
+
constructor(detail) {
|
|
6826
|
+
super(PlaintextSecretError.code, detail);
|
|
6827
|
+
this.name = "PlaintextSecretError";
|
|
6828
|
+
}
|
|
6829
|
+
};
|
|
6830
|
+
/** A marker whose ref is not the row's own (the D878 rule). */
|
|
6831
|
+
var ForeignSecretMarkerError = class ForeignSecretMarkerError extends RecordsError {
|
|
6832
|
+
static code = "foreign-marker";
|
|
6833
|
+
constructor(detail) {
|
|
6834
|
+
super(ForeignSecretMarkerError.code, detail);
|
|
6835
|
+
this.name = "ForeignSecretMarkerError";
|
|
6836
|
+
}
|
|
6837
|
+
};
|
|
6717
6838
|
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6718
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6839
|
+
var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
|
|
6840
|
+
static code = "secret-unavailable";
|
|
6719
6841
|
constructor(detail) {
|
|
6720
|
-
super(
|
|
6842
|
+
super(RecordSecretUnavailableError.code, detail);
|
|
6721
6843
|
this.name = "RecordSecretUnavailableError";
|
|
6722
6844
|
}
|
|
6723
6845
|
};
|
|
6724
|
-
var InvalidRecordError = class extends RecordsError {
|
|
6846
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
6847
|
+
static code = "invalid-record";
|
|
6725
6848
|
constructor(detail) {
|
|
6726
|
-
super(
|
|
6849
|
+
super(InvalidRecordError.code, detail);
|
|
6727
6850
|
this.name = "InvalidRecordError";
|
|
6728
6851
|
}
|
|
6729
6852
|
};
|
|
6730
6853
|
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6731
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
6854
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
6855
|
+
static code = "declaration-refused";
|
|
6732
6856
|
constructor(detail) {
|
|
6733
|
-
super(
|
|
6857
|
+
super(DeclarationRefusedError.code, detail);
|
|
6734
6858
|
this.name = "DeclarationRefusedError";
|
|
6735
6859
|
}
|
|
6736
6860
|
};
|
|
6861
|
+
var NoCallerError = class NoCallerError extends RecordsError {
|
|
6862
|
+
static code = "no-caller";
|
|
6863
|
+
constructor(detail) {
|
|
6864
|
+
super(NoCallerError.code, detail);
|
|
6865
|
+
this.name = "NoCallerError";
|
|
6866
|
+
}
|
|
6867
|
+
};
|
|
6868
|
+
var BatchTooLargeError = class BatchTooLargeError extends RecordsError {
|
|
6869
|
+
static code = "batch-too-large";
|
|
6870
|
+
constructor(detail) {
|
|
6871
|
+
super(BatchTooLargeError.code, detail);
|
|
6872
|
+
this.name = "BatchTooLargeError";
|
|
6873
|
+
}
|
|
6874
|
+
};
|
|
6875
|
+
/**
|
|
6876
|
+
* A `transact` the engine refuses before touching a row: an op on a kind the
|
|
6877
|
+
* caller did not declare in ONE file and ONE `transactFamily`. The detail names
|
|
6878
|
+
* which rule (`cross-file`, `cross-family`, `no-family`); it is never a silent split.
|
|
6879
|
+
*/
|
|
6880
|
+
var TransactRefusedError = class TransactRefusedError extends RecordsError {
|
|
6881
|
+
static code = "transact-refused";
|
|
6882
|
+
constructor(detail) {
|
|
6883
|
+
super(TransactRefusedError.code, detail);
|
|
6884
|
+
this.name = "TransactRefusedError";
|
|
6885
|
+
}
|
|
6886
|
+
};
|
|
6887
|
+
var FACTORIES = {
|
|
6888
|
+
"rev-conflict": (d) => new RevConflictError(d),
|
|
6889
|
+
"too-large": (d) => new RecordTooLargeError(d),
|
|
6890
|
+
"unindexed-filter": (d) => new UnindexedFilterError(d),
|
|
6891
|
+
"filter-required": (d) => new FilterRequiredError(d),
|
|
6892
|
+
"unknown-kind": (d) => new UnknownRecordKindError(d),
|
|
6893
|
+
"not-found": (d) => new RecordNotFoundError(d),
|
|
6894
|
+
"unique-violation": (d) => new RecordUniqueViolationError(d),
|
|
6895
|
+
"plaintext-secret": (d) => new PlaintextSecretError(d),
|
|
6896
|
+
"foreign-marker": (d) => new ForeignSecretMarkerError(d),
|
|
6897
|
+
"secret-unavailable": (d) => new RecordSecretUnavailableError(d),
|
|
6898
|
+
"invalid-record": (d) => new InvalidRecordError(d),
|
|
6899
|
+
"declaration-refused": (d) => new DeclarationRefusedError(d),
|
|
6900
|
+
"no-caller": (d) => new NoCallerError(d),
|
|
6901
|
+
"batch-too-large": (d) => new BatchTooLargeError(d),
|
|
6902
|
+
"transact-refused": (d) => new TransactRefusedError(d)
|
|
6903
|
+
};
|
|
6904
|
+
function isCode(value) {
|
|
6905
|
+
return RECORDS_ERROR_CODES.some((code) => code === value);
|
|
6906
|
+
}
|
|
6907
|
+
/**
|
|
6908
|
+
* Rebuild the typed error from a message that crossed a wire; `null` when the
|
|
6909
|
+
* message is not a records failure.
|
|
6910
|
+
*/
|
|
6911
|
+
function recordsErrorFromMessage(message) {
|
|
6912
|
+
if (!message.startsWith(PREFIX)) return null;
|
|
6913
|
+
const colon = message.indexOf(": ");
|
|
6914
|
+
if (colon < 0) return null;
|
|
6915
|
+
const code = message.slice(8, colon);
|
|
6916
|
+
if (!isCode(code)) return null;
|
|
6917
|
+
return FACTORIES[code](message.slice(colon + 2));
|
|
6918
|
+
}
|
|
6919
|
+
/** The records failure inside any thrown value (a wrapped tRPC error included), or the value. */
|
|
6920
|
+
function asRecordsError(err) {
|
|
6921
|
+
if (err instanceof RecordsError) return err;
|
|
6922
|
+
if (err instanceof Error) {
|
|
6923
|
+
const typed = recordsErrorFromMessage(err.message);
|
|
6924
|
+
if (typed !== null) return typed;
|
|
6925
|
+
}
|
|
6926
|
+
return err;
|
|
6927
|
+
}
|
|
6737
6928
|
function linkTargetOf(meta) {
|
|
6738
6929
|
if (typeof meta !== "object" || meta === null) return void 0;
|
|
6739
6930
|
const link = Reflect.get(meta, "link");
|
|
@@ -91690,7 +91881,7 @@ async function sealPlaintextCredentials(records, secrets, log) {
|
|
|
91690
91881
|
try {
|
|
91691
91882
|
await records.declare({ "waste-source": plainWasteSourceKind });
|
|
91692
91883
|
} catch (err) {
|
|
91693
|
-
if (err instanceof
|
|
91884
|
+
if (asRecordsError(err) instanceof DeclarationRefusedError) {
|
|
91694
91885
|
log.info("waste-collections: the secret kind is already declared; no plain-text credential can remain");
|
|
91695
91886
|
return { state: "already-secret" };
|
|
91696
91887
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-waste-collections",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"description": "Waste collection schedules via the vendored HACS waste_collection_schedule Python core — full source catalog as calendar-source.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
],
|
|
60
60
|
"requires": {
|
|
61
|
-
"server": ">=1.2.
|
|
61
|
+
"server": ">=1.2.788"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"files": [
|