@objectstack/service-settings 6.7.0 → 6.8.0
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/LICENSE +93 -202
- package/dist/index.cjs +144 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +144 -25
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,202 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute
|
|
108
|
-
must include a readable copy of the attribution notices
|
|
109
|
-
contained within such NOTICE file, excluding those notices
|
|
110
|
-
that do not pertain to any part of the Derivative Works,
|
|
111
|
-
in at least one of the following places: within a NOTICE
|
|
112
|
-
text file distributed as part of the Derivative Works; within
|
|
113
|
-
the Source form or documentation, if provided along with
|
|
114
|
-
the Derivative Works; or, within a display generated by the
|
|
115
|
-
Derivative Works, if and wherever such third-party notices
|
|
116
|
-
normally appear. The contents of the NOTICE file are for
|
|
117
|
-
informational purposes only and do not modify the License.
|
|
118
|
-
You may add Your own attribution notices within Derivative
|
|
119
|
-
Works that You distribute, alongside or as an addendum to
|
|
120
|
-
the NOTICE text from the Work, provided that such additional
|
|
121
|
-
attribution notices cannot be construed as modifying the
|
|
122
|
-
License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright 2026 ObjectStack
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
|
1
|
+
License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
|
|
2
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
3
|
+
|
|
4
|
+
Parameters
|
|
5
|
+
|
|
6
|
+
Licensor: ObjectStack AI LLC
|
|
7
|
+
Licensed Work: ObjectStack Runtime: the BSL-licensed packages
|
|
8
|
+
of the ObjectStack monorepo as listed in LICENSING.md.
|
|
9
|
+
Copyright (c) 2026 ObjectStack AI LLC.
|
|
10
|
+
Additional Use Grant: You may make production use of the Licensed Work, provided
|
|
11
|
+
Your use does not include offering the Licensed Work to third
|
|
12
|
+
parties on a hosted or embedded basis in order to compete with
|
|
13
|
+
ObjectStack AI LLC's paid version(s) of the Licensed Work. For purposes
|
|
14
|
+
of this license:
|
|
15
|
+
|
|
16
|
+
A "competitive offering" is a Product that is offered to third
|
|
17
|
+
parties on a paid basis, including through paid support
|
|
18
|
+
arrangements, that significantly overlaps with the capabilities
|
|
19
|
+
of ObjectStack AI LLC's paid version(s) of the Licensed Work. If Your
|
|
20
|
+
Product is not a competitive offering when You first make it
|
|
21
|
+
generally available, it will not become a competitive offering
|
|
22
|
+
later due to ObjectStack AI LLC releasing a new version of the Licensed
|
|
23
|
+
Work with additional capabilities. In addition, Products that
|
|
24
|
+
are not provided on a paid basis are not competitive.
|
|
25
|
+
|
|
26
|
+
"Product" means software that is offered to end users to manage
|
|
27
|
+
in their own environments or offered as a service on a hosted
|
|
28
|
+
basis.
|
|
29
|
+
|
|
30
|
+
"Embedded" means including the source code or executable code
|
|
31
|
+
from the Licensed Work in a competitive offering. "Embedded"
|
|
32
|
+
also means packaging the competitive offering in such a way
|
|
33
|
+
that the Licensed Work must be accessed or downloaded for the
|
|
34
|
+
competitive offering to operate.
|
|
35
|
+
|
|
36
|
+
Hosting or using the Licensed Work(s) for internal purposes
|
|
37
|
+
within an organization is not considered a competitive
|
|
38
|
+
offering. ObjectStack AI LLC considers your organization to include all
|
|
39
|
+
of your affiliates under common control.
|
|
40
|
+
|
|
41
|
+
For binding interpretive guidance on using ObjectStack AI LLC products
|
|
42
|
+
under the Business Source License, please visit our FAQ.
|
|
43
|
+
(see LICENSING.md in this repository)
|
|
44
|
+
Change Date: Four years from the date the Licensed Work is published.
|
|
45
|
+
Change License: Apache License, Version 2.0
|
|
46
|
+
|
|
47
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
48
|
+
please contact licensing@objectstack.dev.
|
|
49
|
+
|
|
50
|
+
Notice
|
|
51
|
+
|
|
52
|
+
Business Source License 1.1
|
|
53
|
+
|
|
54
|
+
Terms
|
|
55
|
+
|
|
56
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
57
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
58
|
+
Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
59
|
+
|
|
60
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
61
|
+
available distribution of a specific version of the Licensed Work under this
|
|
62
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
63
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
64
|
+
above terminate.
|
|
65
|
+
|
|
66
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
67
|
+
currently in effect as described in this License, you must purchase a
|
|
68
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
69
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
70
|
+
|
|
71
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
72
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
73
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
74
|
+
for each version of the Licensed Work released by Licensor.
|
|
75
|
+
|
|
76
|
+
You must conspicuously display this License on each original or modified copy
|
|
77
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
78
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
79
|
+
License apply to your use of that work.
|
|
80
|
+
|
|
81
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
82
|
+
terminate your rights under this License for the current and all other
|
|
83
|
+
versions of the Licensed Work.
|
|
84
|
+
|
|
85
|
+
This License does not grant you any right in any trademark or logo of
|
|
86
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
87
|
+
Licensor as expressly required by this License).
|
|
88
|
+
|
|
89
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
90
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
91
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
92
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
93
|
+
TITLE.
|
package/dist/index.cjs
CHANGED
|
@@ -144,6 +144,15 @@ var SettingsService = class {
|
|
|
144
144
|
if (extras?.secretStore) this.secretStore = extras.secretStore;
|
|
145
145
|
if (extras?.auditWriter) this.auditWriter = extras.auditWriter;
|
|
146
146
|
if (extras?.cryptoProvider) this.cryptoProvider = extras.cryptoProvider;
|
|
147
|
+
for (const ns of this.registry.keys()) {
|
|
148
|
+
this.emitChange({
|
|
149
|
+
namespace: ns,
|
|
150
|
+
key: "*",
|
|
151
|
+
scope: "global",
|
|
152
|
+
action: "set",
|
|
153
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
154
|
+
});
|
|
155
|
+
}
|
|
147
156
|
}
|
|
148
157
|
/**
|
|
149
158
|
* Cascade priority ranks for lock comparisons (lower = higher
|
|
@@ -563,24 +572,31 @@ var SettingsService = class {
|
|
|
563
572
|
if (row.encrypted) {
|
|
564
573
|
if (!row.value_enc) return null;
|
|
565
574
|
let plain;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
575
|
+
try {
|
|
576
|
+
if (this.cryptoProvider && this.secretStore && typeof row.value_enc === "string" && row.value_enc.startsWith("sec_")) {
|
|
577
|
+
const secret = await this.secretStore.get(row.value_enc);
|
|
578
|
+
if (!secret) return null;
|
|
579
|
+
plain = await this.cryptoProvider.decrypt(
|
|
580
|
+
{
|
|
581
|
+
id: secret.id,
|
|
582
|
+
kmsKeyId: secret.kms_key_id,
|
|
583
|
+
alg: secret.alg,
|
|
584
|
+
version: secret.version,
|
|
585
|
+
ciphertext: secret.ciphertext
|
|
586
|
+
},
|
|
587
|
+
{ namespace: row.namespace, key: row.key }
|
|
588
|
+
);
|
|
589
|
+
} else {
|
|
590
|
+
plain = await this.crypto.decrypt(row.value_enc, {
|
|
591
|
+
namespace: row.namespace,
|
|
592
|
+
key: row.key
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
} catch (err) {
|
|
596
|
+
console.warn(
|
|
597
|
+
`[SettingsService] failed to decrypt ${row.namespace}.${row.key}: ${err?.message ?? err}. Returning null so the namespace remains readable; re-save the field to repair.`
|
|
578
598
|
);
|
|
579
|
-
|
|
580
|
-
plain = await this.crypto.decrypt(row.value_enc, {
|
|
581
|
-
namespace: row.namespace,
|
|
582
|
-
key: row.key
|
|
583
|
-
});
|
|
599
|
+
return null;
|
|
584
600
|
}
|
|
585
601
|
try {
|
|
586
602
|
return JSON.parse(plain);
|
|
@@ -616,6 +632,47 @@ function coerceEnvValue(raw, hint) {
|
|
|
616
632
|
|
|
617
633
|
// src/in-memory-crypto-provider.ts
|
|
618
634
|
var import_node_crypto = require("crypto");
|
|
635
|
+
var import_node_fs = require("fs");
|
|
636
|
+
var import_node_os = require("os");
|
|
637
|
+
var import_node_path = require("path");
|
|
638
|
+
var DEV_KEY_ENV = "OBJECTSTACK_DEV_CRYPTO_KEY";
|
|
639
|
+
var devKeyFallbackPath = () => {
|
|
640
|
+
const proc = globalThis?.process;
|
|
641
|
+
const home = proc?.env?.OBJECTSTACK_HOME || (proc?.env?.HOME ? (0, import_node_path.join)(proc.env.HOME, ".objectstack") : void 0) || (0, import_node_path.join)((0, import_node_os.homedir)(), ".objectstack");
|
|
642
|
+
return (0, import_node_path.join)(home, "dev-crypto-key");
|
|
643
|
+
};
|
|
644
|
+
var loadOrCreateDevKey = () => {
|
|
645
|
+
try {
|
|
646
|
+
const path = devKeyFallbackPath();
|
|
647
|
+
if ((0, import_node_fs.existsSync)(path)) {
|
|
648
|
+
const raw = (0, import_node_fs.readFileSync)(path, "utf8").trim();
|
|
649
|
+
const parsed = parseDevKey(raw);
|
|
650
|
+
if (parsed) return { key: parsed, path, generated: false };
|
|
651
|
+
}
|
|
652
|
+
const key = (0, import_node_crypto.randomBytes)(32);
|
|
653
|
+
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(path), { recursive: true });
|
|
654
|
+
(0, import_node_fs.writeFileSync)(path, key.toString("base64"), { mode: 384 });
|
|
655
|
+
return { key, path, generated: true };
|
|
656
|
+
} catch {
|
|
657
|
+
return void 0;
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
var parseDevKey = (raw) => {
|
|
661
|
+
if (!raw) return void 0;
|
|
662
|
+
const trimmed = raw.trim();
|
|
663
|
+
if (!trimmed) return void 0;
|
|
664
|
+
if (/^[0-9a-fA-F]{64}$/.test(trimmed)) return Buffer.from(trimmed, "hex");
|
|
665
|
+
try {
|
|
666
|
+
const normalised = trimmed.replace(/-/g, "+").replace(/_/g, "/");
|
|
667
|
+
const buf = Buffer.from(normalised, "base64");
|
|
668
|
+
if (buf.length === 32) return buf;
|
|
669
|
+
} catch {
|
|
670
|
+
}
|
|
671
|
+
console.warn(
|
|
672
|
+
`[InMemoryCryptoProvider] ${DEV_KEY_ENV} is set but is not 32 bytes (hex or base64). Ignoring and generating an ephemeral key.`
|
|
673
|
+
);
|
|
674
|
+
return void 0;
|
|
675
|
+
};
|
|
619
676
|
var isWebContainerRuntime = () => {
|
|
620
677
|
const g = globalThis;
|
|
621
678
|
return typeof g !== "undefined" && (Boolean(g.process?.versions?.webcontainer) || Boolean(g.process?.env?.SHELL?.includes?.("jsh")) || Boolean(g.process?.env?.STACKBLITZ));
|
|
@@ -639,7 +696,37 @@ var loadNobleGcm = () => {
|
|
|
639
696
|
};
|
|
640
697
|
var InMemoryCryptoProvider = class {
|
|
641
698
|
constructor(opts = {}) {
|
|
642
|
-
|
|
699
|
+
if (opts.key) {
|
|
700
|
+
this.key = opts.key;
|
|
701
|
+
} else {
|
|
702
|
+
const fromEnv = parseDevKey(
|
|
703
|
+
globalThis?.process?.env?.[DEV_KEY_ENV]
|
|
704
|
+
);
|
|
705
|
+
if (fromEnv) {
|
|
706
|
+
this.key = fromEnv;
|
|
707
|
+
} else {
|
|
708
|
+
const isTest = Boolean(
|
|
709
|
+
globalThis?.process?.env?.VITEST || globalThis?.process?.env?.NODE_ENV === "test"
|
|
710
|
+
);
|
|
711
|
+
const persisted = isTest ? void 0 : loadOrCreateDevKey();
|
|
712
|
+
if (persisted) {
|
|
713
|
+
this.key = persisted.key;
|
|
714
|
+
if (persisted.generated) {
|
|
715
|
+
console.warn(
|
|
716
|
+
`[InMemoryCryptoProvider] No ${DEV_KEY_ENV} set \u2014 generated a new AES-256-GCM key and persisted it to ${persisted.path} (mode 0600). Future restarts will reuse it automatically. For shared/CI environments, set ${DEV_KEY_ENV} explicitly in your environment.`
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
} else {
|
|
720
|
+
this.key = (0, import_node_crypto.randomBytes)(32);
|
|
721
|
+
if (!isTest) {
|
|
722
|
+
console.warn(
|
|
723
|
+
`[InMemoryCryptoProvider] No ${DEV_KEY_ENV} set and could not persist a fallback key \u2014 generated an ephemeral AES-256-GCM key. Existing encrypted settings (e.g. AI API keys) will fail to decrypt on next restart. To make the key survive restarts, add this to your .env:
|
|
724
|
+
${DEV_KEY_ENV}=${this.key.toString("base64")}`
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
643
730
|
this.useNoble = isWebContainerRuntime();
|
|
644
731
|
}
|
|
645
732
|
async encrypt(plain, ctx) {
|
|
@@ -1507,7 +1594,7 @@ var manifest3 = {
|
|
|
1507
1594
|
};
|
|
1508
1595
|
var aiSettingsManifest = manifest3;
|
|
1509
1596
|
var aiTestActionHandler = async ({ values, payload }) => {
|
|
1510
|
-
const overrides = payload
|
|
1597
|
+
const overrides = extractOverrides(payload);
|
|
1511
1598
|
const merged = { ...values, ...overrides };
|
|
1512
1599
|
const provider = String(merged.provider ?? "memory");
|
|
1513
1600
|
values = merged;
|
|
@@ -1540,6 +1627,14 @@ var aiTestActionHandler = async ({ values, payload }) => {
|
|
|
1540
1627
|
message: `${provider} configured (model=${model}). Mount @objectstack/service-ai to exercise live calls.`
|
|
1541
1628
|
};
|
|
1542
1629
|
};
|
|
1630
|
+
function extractOverrides(payload) {
|
|
1631
|
+
if (!payload || typeof payload !== "object") return {};
|
|
1632
|
+
const p = payload;
|
|
1633
|
+
if (p.values && typeof p.values === "object" && p.values !== null) {
|
|
1634
|
+
return p.values;
|
|
1635
|
+
}
|
|
1636
|
+
return p;
|
|
1637
|
+
}
|
|
1543
1638
|
|
|
1544
1639
|
// src/manifests/knowledge.manifest.ts
|
|
1545
1640
|
var manifest4 = {
|
|
@@ -2452,7 +2547,7 @@ var SettingsServicePlugin = class {
|
|
|
2452
2547
|
}
|
|
2453
2548
|
if (engine) {
|
|
2454
2549
|
this.service.bindEngine(
|
|
2455
|
-
engine,
|
|
2550
|
+
wrapEngineAsSettingsEngine(engine),
|
|
2456
2551
|
this.buildAuditSink(ctx, engine),
|
|
2457
2552
|
{
|
|
2458
2553
|
secretStore: this.buildSecretStore(engine),
|
|
@@ -2528,11 +2623,11 @@ var SettingsServicePlugin = class {
|
|
|
2528
2623
|
return row ?? null;
|
|
2529
2624
|
},
|
|
2530
2625
|
async update(id, patch) {
|
|
2531
|
-
await eng.update(
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
bypassTenantAudit: true
|
|
2535
|
-
|
|
2626
|
+
await eng.update(
|
|
2627
|
+
"sys_secret",
|
|
2628
|
+
{ id, ...patch },
|
|
2629
|
+
{ bypassTenantAudit: true }
|
|
2630
|
+
);
|
|
2536
2631
|
}
|
|
2537
2632
|
};
|
|
2538
2633
|
}
|
|
@@ -2567,6 +2662,30 @@ var SettingsServicePlugin = class {
|
|
|
2567
2662
|
};
|
|
2568
2663
|
}
|
|
2569
2664
|
};
|
|
2665
|
+
function wrapEngineAsSettingsEngine(engine) {
|
|
2666
|
+
const eng = engine;
|
|
2667
|
+
return {
|
|
2668
|
+
async find(objectName, opts) {
|
|
2669
|
+
return eng.find(objectName, opts);
|
|
2670
|
+
},
|
|
2671
|
+
async insert(objectName, data, opts) {
|
|
2672
|
+
return eng.insert(objectName, data, opts);
|
|
2673
|
+
},
|
|
2674
|
+
async update(objectName, opts) {
|
|
2675
|
+
const { where, data, bypassTenantAudit } = opts;
|
|
2676
|
+
const driverOpts = bypassTenantAudit ? { bypassTenantAudit: true } : void 0;
|
|
2677
|
+
const id = where?.id;
|
|
2678
|
+
if (id !== void 0 && id !== null) {
|
|
2679
|
+
return eng.update(objectName, { id, ...data }, driverOpts);
|
|
2680
|
+
}
|
|
2681
|
+
return eng.update(objectName, data, {
|
|
2682
|
+
where,
|
|
2683
|
+
multi: true,
|
|
2684
|
+
...driverOpts ?? {}
|
|
2685
|
+
});
|
|
2686
|
+
}
|
|
2687
|
+
};
|
|
2688
|
+
}
|
|
2570
2689
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2571
2690
|
0 && (module.exports = {
|
|
2572
2691
|
NoopCryptoAdapter,
|