@xemahq/contracts 0.78.0 → 0.80.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/dist/.source-stamp.json +2 -2
- package/dist/authorization-facts/lib/facts-apply.d.ts +1 -0
- package/dist/authorization-facts/lib/facts-apply.d.ts.map +1 -1
- package/dist/authorization-facts/lib/facts-apply.js +1 -0
- package/dist/authorization-facts/lib/facts-apply.js.map +1 -1
- package/dist/authorization-facts/lib/facts-writer-authority.d.ts +12 -1
- package/dist/authorization-facts/lib/facts-writer-authority.d.ts.map +1 -1
- package/dist/authorization-facts/lib/facts-writer-authority.js +69 -5
- package/dist/authorization-facts/lib/facts-writer-authority.js.map +1 -1
- package/dist/authorization-module/lib/authorization-composition-error.d.ts +1 -0
- package/dist/authorization-module/lib/authorization-composition-error.d.ts.map +1 -1
- package/dist/authorization-module/lib/authorization-composition-error.js +1 -0
- package/dist/authorization-module/lib/authorization-composition-error.js.map +1 -1
- package/dist/authorization-module/lib/platform-authorization-modules.d.ts.map +1 -1
- package/dist/authorization-module/lib/platform-authorization-modules.js +1 -0
- package/dist/authorization-module/lib/platform-authorization-modules.js.map +1 -1
- package/dist/authorization-module/server/compose-authorization-base.d.ts.map +1 -1
- package/dist/authorization-module/server/compose-authorization-base.js +30 -0
- package/dist/authorization-module/server/compose-authorization-base.js.map +1 -1
- package/dist/biome/lib/biome-component.d.ts +18 -0
- package/dist/biome/lib/biome-component.d.ts.map +1 -1
- package/dist/biome/lib/biome-component.js +100 -5
- package/dist/biome/lib/biome-component.js.map +1 -1
- package/dist/biome/lib/biome-generated-index.d.ts +75 -1
- package/dist/biome/lib/biome-generated-index.d.ts.map +1 -1
- package/dist/biome/lib/biome-generated-index.js +14 -0
- package/dist/biome/lib/biome-generated-index.js.map +1 -1
- package/dist/biome/lib/biome-manifest.d.ts +36 -0
- package/dist/biome/lib/biome-manifest.d.ts.map +1 -1
- package/dist/biome/xema-biome.schema.json +104 -0
- package/dist/connector/index.d.ts +1 -0
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +1 -0
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/lib/connector-adapter-contribution.d.ts +1 -0
- package/dist/connector/lib/connector-adapter-contribution.d.ts.map +1 -1
- package/dist/connector/lib/connector-descriptor.d.ts +4 -0
- package/dist/connector/lib/connector-descriptor.d.ts.map +1 -1
- package/dist/connector/lib/connector-descriptor.js +2 -0
- package/dist/connector/lib/connector-descriptor.js.map +1 -1
- package/dist/connector/lib/connector-operation-exposure.d.ts +8 -0
- package/dist/connector/lib/connector-operation-exposure.d.ts.map +1 -0
- package/dist/connector/lib/connector-operation-exposure.js +12 -0
- package/dist/connector/lib/connector-operation-exposure.js.map +1 -0
- package/dist/contribution/lib/contribution-kind.d.ts +1 -0
- package/dist/contribution/lib/contribution-kind.d.ts.map +1 -1
- package/dist/contribution/lib/contribution-kind.js +1 -0
- package/dist/contribution/lib/contribution-kind.js.map +1 -1
- package/dist/deployment/index.d.ts +4 -0
- package/dist/deployment/index.d.ts.map +1 -1
- package/dist/deployment/index.js +4 -0
- package/dist/deployment/index.js.map +1 -1
- package/dist/deployment/lib/operation-grant.d.ts +22 -0
- package/dist/deployment/lib/operation-grant.d.ts.map +1 -0
- package/dist/deployment/lib/operation-grant.js +45 -0
- package/dist/deployment/lib/operation-grant.js.map +1 -0
- package/dist/deployment/lib/operation-id.d.ts +6 -0
- package/dist/deployment/lib/operation-id.d.ts.map +1 -0
- package/dist/deployment/lib/operation-id.js +12 -0
- package/dist/deployment/lib/operation-id.js.map +1 -0
- package/dist/deployment/lib/organization-sweep-grant.d.ts +18 -0
- package/dist/deployment/lib/organization-sweep-grant.d.ts.map +1 -0
- package/dist/deployment/lib/organization-sweep-grant.js +25 -0
- package/dist/deployment/lib/organization-sweep-grant.js.map +1 -0
- package/dist/deployment/lib/platform-sweep.d.ts +17 -0
- package/dist/deployment/lib/platform-sweep.d.ts.map +1 -0
- package/dist/deployment/lib/platform-sweep.js +21 -0
- package/dist/deployment/lib/platform-sweep.js.map +1 -0
- package/dist/deployment/lib/resolved-deployment.d.ts +24 -2
- package/dist/deployment/lib/resolved-deployment.d.ts.map +1 -1
- package/dist/deployment/lib/resolved-deployment.js +47 -1
- package/dist/deployment/lib/resolved-deployment.js.map +1 -1
- package/dist/distribution/index.d.ts +5 -0
- package/dist/distribution/index.d.ts.map +1 -1
- package/dist/distribution/index.js +12 -1
- package/dist/distribution/index.js.map +1 -1
- package/dist/distribution/lib/capability-domain-owner-duplicates.d.ts +10 -0
- package/dist/distribution/lib/capability-domain-owner-duplicates.d.ts.map +1 -0
- package/dist/distribution/lib/capability-domain-owner-duplicates.js +21 -0
- package/dist/distribution/lib/capability-domain-owner-duplicates.js.map +1 -0
- package/dist/distribution/lib/code-unit-order.d.ts +2 -0
- package/dist/distribution/lib/code-unit-order.d.ts.map +1 -0
- package/dist/distribution/lib/code-unit-order.js +7 -0
- package/dist/distribution/lib/code-unit-order.js.map +1 -0
- package/dist/distribution/lib/distribution-lock.d.ts +8 -0
- package/dist/distribution/lib/distribution-lock.d.ts.map +1 -1
- package/dist/distribution/lib/distribution-lock.js +92 -8
- package/dist/distribution/lib/distribution-lock.js.map +1 -1
- package/dist/distribution/lib/kernel-contract-source-paths.d.ts +1 -1
- package/dist/distribution/lib/kernel-contract-source-paths.d.ts.map +1 -1
- package/dist/distribution/lib/kernel-contract-source-paths.js +10 -1
- package/dist/distribution/lib/kernel-contract-source-paths.js.map +1 -1
- package/dist/distribution/lib/operation-grant-admission.d.ts +23 -0
- package/dist/distribution/lib/operation-grant-admission.d.ts.map +1 -0
- package/dist/distribution/lib/operation-grant-admission.js +72 -0
- package/dist/distribution/lib/operation-grant-admission.js.map +1 -0
- package/dist/distribution/lib/organization-sweep-admission.d.ts +20 -0
- package/dist/distribution/lib/organization-sweep-admission.d.ts.map +1 -0
- package/dist/distribution/lib/organization-sweep-admission.js +45 -0
- package/dist/distribution/lib/organization-sweep-admission.js.map +1 -0
- package/dist/distribution/lib/platform-service-source-index.d.ts +2 -0
- package/dist/distribution/lib/platform-service-source-index.d.ts.map +1 -1
- package/dist/distribution/lib/platform-service-source-index.js +17 -0
- package/dist/distribution/lib/platform-service-source-index.js.map +1 -1
- package/dist/distribution/lib/resolve-unsplit-deployment.d.ts.map +1 -1
- package/dist/distribution/lib/resolve-unsplit-deployment.js +20 -0
- package/dist/distribution/lib/resolve-unsplit-deployment.js.map +1 -1
- package/dist/distribution/lib/sorted-unique-non-empty.d.ts +3 -0
- package/dist/distribution/lib/sorted-unique-non-empty.d.ts.map +1 -0
- package/dist/distribution/lib/sorted-unique-non-empty.js +29 -0
- package/dist/distribution/lib/sorted-unique-non-empty.js.map +1 -0
- package/dist/distribution/lib/verify-resolved-deployment.d.ts +6 -1
- package/dist/distribution/lib/verify-resolved-deployment.d.ts.map +1 -1
- package/dist/distribution/lib/verify-resolved-deployment.js +87 -3
- package/dist/distribution/lib/verify-resolved-deployment.js.map +1 -1
- package/dist/edition-protocol/edition-contract.schema.json +1 -1
- package/dist/edition-protocol/edition-protocol.json +1 -1
- package/dist/edition-protocol/lib/edition-protocol.js +2 -2
- package/dist/resolved-deployment-fixture/lib/resolved-deployment-fixture.d.ts +5 -0
- package/dist/resolved-deployment-fixture/lib/resolved-deployment-fixture.d.ts.map +1 -1
- package/dist/resolved-deployment-fixture/lib/resolved-deployment-fixture.js +38 -4
- package/dist/resolved-deployment-fixture/lib/resolved-deployment-fixture.js.map +1 -1
- package/dist/resource/lib/resource-kind.d.ts +1 -0
- package/dist/resource/lib/resource-kind.d.ts.map +1 -1
- package/dist/resource/lib/resource-kind.js +1 -0
- package/dist/resource/lib/resource-kind.js.map +1 -1
- package/dist/setting/index.d.ts +10 -0
- package/dist/setting/index.d.ts.map +1 -0
- package/dist/setting/index.js +26 -0
- package/dist/setting/index.js.map +1 -0
- package/dist/setting/lib/setting-constraints.d.ts +32 -0
- package/dist/setting/lib/setting-constraints.d.ts.map +1 -0
- package/dist/setting/lib/setting-constraints.js +27 -0
- package/dist/setting/lib/setting-constraints.js.map +1 -0
- package/dist/setting/lib/setting-definition.d.ts +70 -0
- package/dist/setting/lib/setting-definition.d.ts.map +1 -0
- package/dist/setting/lib/setting-definition.js +144 -0
- package/dist/setting/lib/setting-definition.js.map +1 -0
- package/dist/setting/lib/setting-duration.d.ts +3 -0
- package/dist/setting/lib/setting-duration.d.ts.map +1 -0
- package/dist/setting/lib/setting-duration.js +39 -0
- package/dist/setting/lib/setting-duration.js.map +1 -0
- package/dist/setting/lib/setting-enums.d.ts +27 -0
- package/dist/setting/lib/setting-enums.d.ts.map +1 -0
- package/dist/setting/lib/setting-enums.js +34 -0
- package/dist/setting/lib/setting-enums.js.map +1 -0
- package/dist/setting/lib/setting-key.d.ts +19 -0
- package/dist/setting/lib/setting-key.d.ts.map +1 -0
- package/dist/setting/lib/setting-key.js +70 -0
- package/dist/setting/lib/setting-key.js.map +1 -0
- package/dist/setting/lib/setting-merge.d.ts +7 -0
- package/dist/setting/lib/setting-merge.d.ts.map +1 -0
- package/dist/setting/lib/setting-merge.js +36 -0
- package/dist/setting/lib/setting-merge.js.map +1 -0
- package/dist/setting/lib/setting-resolve.d.ts +11 -0
- package/dist/setting/lib/setting-resolve.d.ts.map +1 -0
- package/dist/setting/lib/setting-resolve.js +39 -0
- package/dist/setting/lib/setting-resolve.js.map +1 -0
- package/dist/setting/lib/setting-revision.d.ts +5 -0
- package/dist/setting/lib/setting-revision.d.ts.map +1 -0
- package/dist/setting/lib/setting-revision.js +68 -0
- package/dist/setting/lib/setting-revision.js.map +1 -0
- package/dist/setting/lib/setting-value.d.ts +5 -0
- package/dist/setting/lib/setting-value.d.ts.map +1 -0
- package/dist/setting/lib/setting-value.js +57 -0
- package/dist/setting/lib/setting-value.js.map +1 -0
- package/dist/space/index.d.ts +0 -1
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +0 -1
- package/dist/space/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/space/lib/scoped-setting.d.ts +0 -28
- package/dist/space/lib/scoped-setting.d.ts.map +0 -1
- package/dist/space/lib/scoped-setting.js +0 -60
- package/dist/space/lib/scoped-setting.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.settingValueSchema = settingValueSchema;
|
|
4
|
+
exports.settingAtRestValueSchema = settingAtRestValueSchema;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const setting_duration_1 = require("./setting-duration");
|
|
7
|
+
const setting_enums_1 = require("./setting-enums");
|
|
8
|
+
function atRestSchema(shape) {
|
|
9
|
+
switch (shape.valueType) {
|
|
10
|
+
case setting_enums_1.SettingValueType.Boolean:
|
|
11
|
+
return zod_1.z.boolean();
|
|
12
|
+
case setting_enums_1.SettingValueType.Integer:
|
|
13
|
+
return zod_1.z
|
|
14
|
+
.number()
|
|
15
|
+
.int()
|
|
16
|
+
.min(shape.constraints.min)
|
|
17
|
+
.max(shape.constraints.max);
|
|
18
|
+
case setting_enums_1.SettingValueType.Duration:
|
|
19
|
+
return zod_1.z
|
|
20
|
+
.number()
|
|
21
|
+
.int()
|
|
22
|
+
.min(shape.constraints.minSeconds)
|
|
23
|
+
.max(shape.constraints.maxSeconds);
|
|
24
|
+
case setting_enums_1.SettingValueType.Enum:
|
|
25
|
+
return zod_1.z.enum(shape.constraints.values);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function settingValueSchema(shape) {
|
|
29
|
+
const rest = atRestSchema(shape);
|
|
30
|
+
if (shape.valueType !== setting_enums_1.SettingValueType.Duration)
|
|
31
|
+
return rest;
|
|
32
|
+
return zod_1.z.string().transform((raw, ctx) => {
|
|
33
|
+
let seconds;
|
|
34
|
+
try {
|
|
35
|
+
seconds = (0, setting_duration_1.parseIsoDurationSeconds)(raw);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
ctx.addIssue({
|
|
39
|
+
code: "custom",
|
|
40
|
+
message: error instanceof Error ? error.message : String(error),
|
|
41
|
+
});
|
|
42
|
+
return zod_1.z.NEVER;
|
|
43
|
+
}
|
|
44
|
+
const checked = rest.safeParse(seconds);
|
|
45
|
+
if (!checked.success) {
|
|
46
|
+
for (const issue of checked.error.issues) {
|
|
47
|
+
ctx.addIssue({ code: "custom", message: issue.message });
|
|
48
|
+
}
|
|
49
|
+
return zod_1.z.NEVER;
|
|
50
|
+
}
|
|
51
|
+
return checked.data;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function settingAtRestValueSchema(shape) {
|
|
55
|
+
return atRestSchema(shape);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=setting-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setting-value.js","sourceRoot":"","sources":["../../../src/setting/lib/setting-value.ts"],"names":[],"mappings":";;AAgCA,gDAyBC;AAGD,4DAIC;AAhED,6BAAwB;AAGxB,yDAA6D;AAC7D,mDAAmD;AAEnD,SAAS,YAAY,CAAC,KAAwB;IAC5C,QAAQ,KAAK,CAAC,SAAS,EAAE,CAAC;QACxB,KAAK,gCAAgB,CAAC,OAAO;YAC3B,OAAO,OAAC,CAAC,OAAO,EAAE,CAAC;QACrB,KAAK,gCAAgB,CAAC,OAAO;YAC3B,OAAO,OAAC;iBACL,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;iBAC1B,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAChC,KAAK,gCAAgB,CAAC,QAAQ;YAC5B,OAAO,OAAC;iBACL,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC;iBACjC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QACvC,KAAK,gCAAgB,CAAC,IAAI;Y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AAC,CAAC;AAC7B,CAAC"}
|
package/dist/space/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './lib/space';
|
|
|
2
2
|
export * from './lib/space-classification';
|
|
3
3
|
export * from './lib/space-kind-rank';
|
|
4
4
|
export * from './lib/scoped-resolution';
|
|
5
|
-
export * from './lib/scoped-setting';
|
|
6
5
|
export * from './lib/space-promotion';
|
|
7
6
|
export * from './lib/space-ref-parser';
|
|
8
7
|
export * from './lib/space-traversal';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC"}
|
package/dist/space/index.js
CHANGED
|
@@ -18,7 +18,6 @@ __exportStar(require("./lib/space"), exports);
|
|
|
18
18
|
__exportStar(require("./lib/space-classification"), exports);
|
|
19
19
|
__exportStar(require("./lib/space-kind-rank"), exports);
|
|
20
20
|
__exportStar(require("./lib/scoped-resolution"), exports);
|
|
21
|
-
__exportStar(require("./lib/scoped-setting"), exports);
|
|
22
21
|
__exportStar(require("./lib/space-promotion"), exports);
|
|
23
22
|
__exportStar(require("./lib/space-ref-parser"), exports);
|
|
24
23
|
__exportStar(require("./lib/space-traversal"), exports);
|
package/dist/space/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6DAA2C;AAC3C,wDAAsC;AACtC,0DAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6DAA2C;AAC3C,wDAAsC;AACtC,0DAAwC;AACxC,wDAAsC;AACtC,yDAAuC;AACvC,wDAAsC;AACtC,wDAAsC;AACtC,+DAA6C;AAC7C,+DAA6C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework deps; the one runtime dependency beside zod is the OpenFGA syntax transformer the authorization-module composer runs.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"test:authorization-models": "node scripts/run-authorization-model-tests.mjs"
|
|
58
58
|
},
|
|
59
59
|
"xemaRelease": {
|
|
60
|
-
"sourceDigest": "sha256:
|
|
60
|
+
"sourceDigest": "sha256:ebee17c030a9827de65387fb09c0a263f2a8f0f15db517501c8bd6bcbc88807c"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { type ScopedResolution } from './scoped-resolution';
|
|
3
|
-
import { SpaceKind } from './space';
|
|
4
|
-
export declare const SCOPED_SETTING_KEY_PATTERN: RegExp;
|
|
5
|
-
export declare const ScopedSettingKeySchema: z.ZodString;
|
|
6
|
-
export declare enum ScopedSettingOwnership {
|
|
7
|
-
OrgOnly = "org-only",
|
|
8
|
-
ProjectOverridable = "project-overridable",
|
|
9
|
-
ProjectOnly = "project-only",
|
|
10
|
-
Other = "other"
|
|
11
|
-
}
|
|
12
|
-
export interface ScopedSettingDefinition<TValue = unknown> {
|
|
13
|
-
readonly key: string;
|
|
14
|
-
readonly schema: z.ZodType<TValue>;
|
|
15
|
-
readonly declarableAt: readonly SpaceKind[];
|
|
16
|
-
}
|
|
17
|
-
export declare const ScopedSettingDefinitionSchema: z.ZodObject<{
|
|
18
|
-
key: z.ZodString;
|
|
19
|
-
declarableAt: z.ZodArray<z.ZodEnum<typeof SpaceKind>>;
|
|
20
|
-
}, z.core.$strict>;
|
|
21
|
-
export declare function mayDeclareAt(definition: Pick<ScopedSettingDefinition, 'declarableAt'>, tier: SpaceKind): boolean;
|
|
22
|
-
export declare function scopedSettingOwnership(definition: Pick<ScopedSettingDefinition, 'declarableAt'>): ScopedSettingOwnership;
|
|
23
|
-
export interface ScopedSettingDeclaration<TValue = unknown> {
|
|
24
|
-
readonly ownerSpaceKind: SpaceKind;
|
|
25
|
-
readonly value: TValue;
|
|
26
|
-
}
|
|
27
|
-
export declare function resolveScopedSetting<TValue>(definition: Pick<ScopedSettingDefinition<TValue>, 'declarableAt'>, declarations: readonly ScopedSettingDeclaration<TValue>[]): ScopedResolution<TValue> | undefined;
|
|
28
|
-
//# sourceMappingURL=scoped-setting.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-setting.d.ts","sourceRoot":"","sources":["../../../src/space/lib/scoped-setting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,SAAS,EAAmB,MAAM,SAAS,CAAC;AA8DrD,eAAO,MAAM,0BAA0B,QACK,CAAC;AAE7C,eAAO,MAAM,sBAAsB,aAKhC,CAAC;AAGJ,oBAAY,sBAAsB;IAChC,OAAO,aAAa;IACpB,kBAAkB,wBAAwB;IAC1C,WAAW,iBAAiB;IAE5B,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,uBAAuB,CAAC,MAAM,GAAG,OAAO;IACvD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAKnC,QAAQ,CAAC,YAAY,EAAE,SAAS,SAAS,EAAE,CAAC;CAC7C;AAED,eAAO,MAAM,6BAA6B;;;kBAW/B,CAAC;AASZ,wBAAgB,YAAY,CAC1B,UAAU,EAAE,IAAI,CAAC,uBAAuB,EAAE,cAAc,CAAC,EACzD,IAAI,EAAE,SAAS,GACd,OAAO,CAET;AASD,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,IAAI,CAAC,uBAAuB,EAAE,cAAc,CAAC,GACxD,sBAAsB,CAUxB;AAGD,MAAM,WAAW,wBAAwB,CAAC,MAAM,GAAG,OAAO;IACxD,QAAQ,CAAC,cAAc,EAAE,SAAS,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAWD,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,UAAU,EAAE,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,EACjE,YAAY,EAAE,SAAS,wBAAwB,CAAC,MAAM,CAAC,EAAE,GACxD,gBAAgB,CAAC,MAAM,CAAC,GAAG,SAAS,CAuBtC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ScopedSettingDefinitionSchema = exports.ScopedSettingOwnership = exports.ScopedSettingKeySchema = exports.SCOPED_SETTING_KEY_PATTERN = void 0;
|
|
4
|
-
exports.mayDeclareAt = mayDeclareAt;
|
|
5
|
-
exports.scopedSettingOwnership = scopedSettingOwnership;
|
|
6
|
-
exports.resolveScopedSetting = resolveScopedSetting;
|
|
7
|
-
const zod_1 = require("zod");
|
|
8
|
-
const scoped_resolution_1 = require("./scoped-resolution");
|
|
9
|
-
const space_1 = require("./space");
|
|
10
|
-
const space_kind_rank_1 = require("./space-kind-rank");
|
|
11
|
-
exports.SCOPED_SETTING_KEY_PATTERN = /^[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)+$/u;
|
|
12
|
-
exports.ScopedSettingKeySchema = zod_1.z
|
|
13
|
-
.string()
|
|
14
|
-
.regex(exports.SCOPED_SETTING_KEY_PATTERN, 'A setting key is dotted lower-kebab, e.g. "xema.llm.default-strategy".');
|
|
15
|
-
var ScopedSettingOwnership;
|
|
16
|
-
(function (ScopedSettingOwnership) {
|
|
17
|
-
ScopedSettingOwnership["OrgOnly"] = "org-only";
|
|
18
|
-
ScopedSettingOwnership["ProjectOverridable"] = "project-overridable";
|
|
19
|
-
ScopedSettingOwnership["ProjectOnly"] = "project-only";
|
|
20
|
-
ScopedSettingOwnership["Other"] = "other";
|
|
21
|
-
})(ScopedSettingOwnership || (exports.ScopedSettingOwnership = ScopedSettingOwnership = {}));
|
|
22
|
-
exports.ScopedSettingDefinitionSchema = zod_1.z
|
|
23
|
-
.object({
|
|
24
|
-
key: exports.ScopedSettingKeySchema,
|
|
25
|
-
declarableAt: zod_1.z
|
|
26
|
-
.array(space_1.SpaceKindSchema)
|
|
27
|
-
.min(1, 'A scoped setting must be declarable somewhere.')
|
|
28
|
-
.refine((kinds) => new Set(kinds).size === kinds.length, 'A tier may appear at most once in `declarableAt`.'),
|
|
29
|
-
})
|
|
30
|
-
.strict();
|
|
31
|
-
function mayDeclareAt(definition, tier) {
|
|
32
|
-
return definition.declarableAt.includes(tier);
|
|
33
|
-
}
|
|
34
|
-
function scopedSettingOwnership(definition) {
|
|
35
|
-
const tiers = new Set(definition.declarableAt);
|
|
36
|
-
const org = tiers.has(space_1.SpaceKind.Org);
|
|
37
|
-
const project = tiers.has(space_1.SpaceKind.Project);
|
|
38
|
-
if (tiers.size === 1 && org)
|
|
39
|
-
return ScopedSettingOwnership.OrgOnly;
|
|
40
|
-
if (tiers.size === 1 && project)
|
|
41
|
-
return ScopedSettingOwnership.ProjectOnly;
|
|
42
|
-
if (tiers.size === 2 && org && project) {
|
|
43
|
-
return ScopedSettingOwnership.ProjectOverridable;
|
|
44
|
-
}
|
|
45
|
-
return ScopedSettingOwnership.Other;
|
|
46
|
-
}
|
|
47
|
-
function resolveScopedSetting(definition, declarations) {
|
|
48
|
-
for (const declaration of declarations) {
|
|
49
|
-
if (!mayDeclareAt(definition, declaration.ownerSpaceKind)) {
|
|
50
|
-
throw new Error(`A value was declared at "${declaration.ownerSpaceKind}", which this ` +
|
|
51
|
-
`setting does not admit (declarable at: ${definition.declarableAt.join(', ')}).`);
|
|
52
|
-
}
|
|
53
|
-
(0, space_kind_rank_1.spaceKindRank)(declaration.ownerSpaceKind);
|
|
54
|
-
}
|
|
55
|
-
return (0, scoped_resolution_1.resolveScopedCandidate)(declarations.map((declaration) => ({
|
|
56
|
-
ownerSpaceKind: declaration.ownerSpaceKind,
|
|
57
|
-
value: declaration.value,
|
|
58
|
-
})), () => 0);
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=scoped-setting.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scoped-setting.js","sourceRoot":"","sources":["../../../src/space/lib/scoped-setting.ts"],"names":[],"mappings":";;;AAmHA,oCAKC;AASD,wDAYC;AAiBD,oDA0BC;AAxLD,6BAAwB;AAExB,2DAAoF;AACpF,mCAAqD;AACrD,uDAAkD;AA6DrC,QAAA,0BAA0B,GACrC,0CAA0C,CAAC;AAEhC,QAAA,sBAAsB,GAAG,OAAC;KACpC,MAAM,EAAE;KACR,KAAK,CACJ,kCAA0B,EAC1B,wEAAwE,CACzE,CAAC;AAGJ,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