@weave-kit/engine 1.8.0 → 2.0.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/CHANGELOG.md +24 -0
- package/dist/adapters/auth/index.d.ts +1 -1
- package/dist/adapters/auth/index.d.ts.map +1 -1
- package/dist/adapters/auth/index.js +1 -1
- package/dist/adapters/auth/index.js.map +1 -1
- package/dist/adapters/auth/oidc.d.ts +2 -2
- package/dist/adapters/auth/oidc.d.ts.map +1 -1
- package/dist/adapters/auth/oidc.js +4 -4
- package/dist/adapters/auth/oidc.js.map +1 -1
- package/dist/adapters/auth/subject.d.ts +3 -9
- package/dist/adapters/auth/subject.d.ts.map +1 -1
- package/dist/adapters/auth/subject.js +4 -19
- package/dist/adapters/auth/subject.js.map +1 -1
- package/dist/adapters/events/index.js +2 -2
- package/dist/adapters/events/index.js.map +1 -1
- package/dist/adapters/mcp/http.js +1 -1
- package/dist/adapters/mcp/http.js.map +1 -1
- package/dist/adapters/mcp/tools.js +1 -1
- package/dist/adapters/mcp/tools.js.map +1 -1
- package/dist/adapters/rest/audit.js +3 -3
- package/dist/adapters/rest/audit.js.map +1 -1
- package/dist/adapters/rest/index.d.ts +0 -1
- package/dist/adapters/rest/index.d.ts.map +1 -1
- package/dist/adapters/rest/index.js +0 -1
- package/dist/adapters/rest/index.js.map +1 -1
- package/dist/cli/commands/deploy.js +4 -4
- package/dist/cli/commands/deploy.js.map +1 -1
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +0 -13
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +0 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +0 -1
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/object-create.d.ts.map +1 -1
- package/dist/cli/commands/object-create.js +1 -127
- package/dist/cli/commands/object-create.js.map +1 -1
- package/dist/cli/index.js +0 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/project-types/manifest.d.ts +3 -7
- package/dist/cli/project-types/manifest.d.ts.map +1 -1
- package/dist/cli/project-types/manifest.js +0 -14
- package/dist/cli/project-types/manifest.js.map +1 -1
- package/dist/cli/types/values.d.ts +0 -2
- package/dist/cli/types/values.d.ts.map +1 -1
- package/dist/cli/types/values.js +0 -2
- package/dist/cli/types/values.js.map +1 -1
- package/dist/core/api/types.d.ts +3 -40
- package/dist/core/api/types.d.ts.map +1 -1
- package/dist/core/api/types.js +0 -5
- package/dist/core/api/types.js.map +1 -1
- package/dist/core/audit/types.d.ts +7 -124
- package/dist/core/audit/types.d.ts.map +1 -1
- package/dist/core/audit/types.js +4 -44
- package/dist/core/audit/types.js.map +1 -1
- package/dist/core/i18n/ar.js +1 -1
- package/dist/core/i18n/ar.js.map +1 -1
- package/dist/core/i18n/de.js +1 -1
- package/dist/core/i18n/de.js.map +1 -1
- package/dist/core/i18n/en.d.ts +1 -1
- package/dist/core/i18n/en.js +1 -1
- package/dist/core/i18n/en.js.map +1 -1
- package/dist/core/i18n/es.js +1 -1
- package/dist/core/i18n/es.js.map +1 -1
- package/dist/core/i18n/fr.js +1 -1
- package/dist/core/i18n/fr.js.map +1 -1
- package/dist/core/i18n/hi.js +1 -1
- package/dist/core/i18n/hi.js.map +1 -1
- package/dist/core/i18n/id.js +1 -1
- package/dist/core/i18n/id.js.map +1 -1
- package/dist/core/i18n/ja.js +1 -1
- package/dist/core/i18n/ja.js.map +1 -1
- package/dist/core/i18n/ko.js +1 -1
- package/dist/core/i18n/ko.js.map +1 -1
- package/dist/core/i18n/pt.js +1 -1
- package/dist/core/i18n/pt.js.map +1 -1
- package/dist/core/i18n/ru.js +1 -1
- package/dist/core/i18n/ru.js.map +1 -1
- package/dist/core/i18n/vi.js +1 -1
- package/dist/core/i18n/vi.js.map +1 -1
- package/dist/core/i18n/zh-hant.js +1 -1
- package/dist/core/i18n/zh-hant.js.map +1 -1
- package/dist/core/i18n/zh.js +1 -1
- package/dist/core/i18n/zh.js.map +1 -1
- package/dist/core/limiter/quota.d.ts +1 -1
- package/dist/core/limiter/quota.js +1 -1
- package/dist/core/object/describe.d.ts +2 -124
- package/dist/core/object/describe.d.ts.map +1 -1
- package/dist/core/object/describe.js.map +1 -1
- package/dist/core/object/system-objects.js +2 -2
- package/dist/core/object/system-objects.js.map +1 -1
- package/dist/core/object/validate/field.d.ts.map +1 -1
- package/dist/core/object/validate/field.js +2 -4
- package/dist/core/object/validate/field.js.map +1 -1
- package/dist/core/provider/identity/types.d.ts +2 -5
- package/dist/core/provider/identity/types.d.ts.map +1 -1
- package/dist/core/rbac/index.d.ts +1 -1
- package/dist/core/rbac/index.d.ts.map +1 -1
- package/dist/core/rbac/index.js +1 -1
- package/dist/core/rbac/index.js.map +1 -1
- package/dist/core/rbac/rls.d.ts +1 -1
- package/dist/core/rbac/rls.d.ts.map +1 -1
- package/dist/core/rbac/rls.js +7 -10
- package/dist/core/rbac/rls.js.map +1 -1
- package/dist/core/rbac/rowScope.js +2 -2
- package/dist/core/rbac/rowScope.js.map +1 -1
- package/dist/core/rbac/scopeMarker.d.ts +2 -5
- package/dist/core/rbac/scopeMarker.d.ts.map +1 -1
- package/dist/core/rbac/scopeMarker.js +3 -18
- package/dist/core/rbac/scopeMarker.js.map +1 -1
- package/dist/core/script/types.d.ts +1 -3
- package/dist/core/script/types.d.ts.map +1 -1
- package/dist/core/script/types.js.map +1 -1
- package/dist/core/script/values.d.ts +3 -7
- package/dist/core/script/values.d.ts.map +1 -1
- package/dist/core/script/values.js +2 -6
- package/dist/core/script/values.js.map +1 -1
- package/dist/core/storage/impact.d.ts +2 -2
- package/dist/core/storage/impact.d.ts.map +1 -1
- package/dist/core/storage/impact.js +6 -6
- package/dist/core/storage/impact.js.map +1 -1
- package/dist/core/storage/system-tables.js +2 -2
- package/dist/core/storage/system-tables.js.map +1 -1
- package/dist/core/tools/types.d.ts +2 -28
- package/dist/core/tools/types.d.ts.map +1 -1
- package/dist/core/tools/values.d.ts +2 -6
- package/dist/core/tools/values.d.ts.map +1 -1
- package/dist/core/tools/values.js +2 -5
- package/dist/core/tools/values.js.map +1 -1
- package/dist/core/types/field-type.d.ts +3 -10
- package/dist/core/types/field-type.d.ts.map +1 -1
- package/dist/core/types/field-type.js +2 -9
- package/dist/core/types/field-type.js.map +1 -1
- package/dist/core/types/fields.d.ts +1 -3
- package/dist/core/types/fields.d.ts.map +1 -1
- package/dist/core/types/principal.d.ts +3 -6
- package/dist/core/types/principal.d.ts.map +1 -1
- package/dist/core/types/principal.js +5 -11
- package/dist/core/types/principal.js.map +1 -1
- package/dist/core/types/values.d.ts +4 -194
- package/dist/core/types/values.d.ts.map +1 -1
- package/dist/core/types/values.js +3 -144
- package/dist/core/types/values.js.map +1 -1
- package/dist/core/types/workflow.d.ts +6 -78
- package/dist/core/types/workflow.d.ts.map +1 -1
- package/dist/core/types/workflow.js +5 -27
- package/dist/core/types/workflow.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/data-access/index.d.ts +1 -1
- package/dist/runtime/data-access/index.d.ts.map +1 -1
- package/dist/runtime/data-access/index.js +1 -1
- package/dist/runtime/data-access/index.js.map +1 -1
- package/dist/runtime/data-access/query.js +15 -15
- package/dist/runtime/data-access/query.js.map +1 -1
- package/dist/runtime/data-access/rbac.js +1 -1
- package/dist/runtime/data-access/rbac.js.map +1 -1
- package/dist/runtime/data-access/rls-session.d.ts +1 -2
- package/dist/runtime/data-access/rls-session.d.ts.map +1 -1
- package/dist/runtime/data-access/rls-session.js +2 -3
- package/dist/runtime/data-access/rls-session.js.map +1 -1
- package/dist/runtime/data-access/sql-executor.d.ts +1 -2
- package/dist/runtime/data-access/sql-executor.d.ts.map +1 -1
- package/dist/runtime/data-access/sql-executor.js.map +1 -1
- package/dist/runtime/data-access/types.d.ts +5 -63
- package/dist/runtime/data-access/types.d.ts.map +1 -1
- package/dist/runtime/data-access/types.js +3 -7
- package/dist/runtime/data-access/types.js.map +1 -1
- package/dist/runtime/data-access/values.d.ts +4 -46
- package/dist/runtime/data-access/values.d.ts.map +1 -1
- package/dist/runtime/data-access/values.js +3 -42
- package/dist/runtime/data-access/values.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -15
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +3 -14
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/git/index.d.ts +0 -4
- package/dist/runtime/git/index.d.ts.map +1 -1
- package/dist/runtime/git/index.js +0 -2
- package/dist/runtime/git/index.js.map +1 -1
- package/dist/runtime/tools/executor.js +2 -2
- package/dist/runtime/tools/executor.js.map +1 -1
- package/dist/subsystems/audit/store.d.ts.map +1 -1
- package/dist/subsystems/audit/store.js +9 -10
- package/dist/subsystems/audit/store.js.map +1 -1
- package/dist/subsystems/script/backend/types.d.ts +0 -1
- package/dist/subsystems/script/backend/types.d.ts.map +1 -1
- package/dist/subsystems/script/bridge.js +2 -2
- package/dist/subsystems/script/bridge.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../src/core/types/values.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../src/core/types/values.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,GACf,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,cAAc,EACd,WAAW,EACX,SAAS,EACT,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,147 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Every const below is `as const` and drives its union type via
|
|
5
|
-
* `typeof X[keyof typeof X]`, so the value set lives in exactly one place.
|
|
6
|
-
* Consumers import the const (runtime) or the derived type (compile-time).
|
|
2
|
+
* Schema vocabulary — re-exported from `@weave-kit/contract/values` (single
|
|
3
|
+
* source of truth; the engine no longer owns these literals).
|
|
7
4
|
*/
|
|
8
|
-
|
|
9
|
-
* PG-native field types: near 1:1 with a native PostgreSQL column type
|
|
10
|
-
* (aliases allowed, e.g. `string`→varchar, `number`→numeric, `double`→double
|
|
11
|
-
* precision). No engine-specific rules beyond the column mapping.
|
|
12
|
-
*/
|
|
13
|
-
export const PG_FIELD_TYPES = {
|
|
14
|
-
STRING: 'string',
|
|
15
|
-
TEXT: 'text',
|
|
16
|
-
CHAR: 'char',
|
|
17
|
-
SMALLINT: 'smallint',
|
|
18
|
-
INTEGER: 'integer',
|
|
19
|
-
BIGINT: 'bigint',
|
|
20
|
-
NUMBER: 'number',
|
|
21
|
-
REAL: 'real',
|
|
22
|
-
DOUBLE: 'double',
|
|
23
|
-
BOOLEAN: 'boolean',
|
|
24
|
-
DATE: 'date',
|
|
25
|
-
TIME: 'time',
|
|
26
|
-
TIMETZ: 'timetz',
|
|
27
|
-
TIMESTAMP: 'timestamp',
|
|
28
|
-
TIMESTAMPTZ: 'timestamptz',
|
|
29
|
-
INTERVAL: 'interval',
|
|
30
|
-
UUID: 'uuid',
|
|
31
|
-
JSON: 'json',
|
|
32
|
-
JSONB: 'jsonb',
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Engine-shipped custom field types (each may carry its own rules: enum options,
|
|
36
|
-
* relation target, currency code, identity target, …). External user/plugin
|
|
37
|
-
* registrations join this same category at runtime through the
|
|
38
|
-
* `FieldTypeRegistry` (namespaced), so only the engine-provided ones are
|
|
39
|
-
* enumerated statically here.
|
|
40
|
-
*/
|
|
41
|
-
export const BUILTIN_CUSTOM_FIELD_TYPES = {
|
|
42
|
-
ENUM: 'enum',
|
|
43
|
-
RELATION: 'relation',
|
|
44
|
-
DETAILS: 'details',
|
|
45
|
-
MULTI_RELATION: 'multiRelation',
|
|
46
|
-
SEQ_NO: 'seq_no',
|
|
47
|
-
FIRST_NAME: 'firstName',
|
|
48
|
-
LAST_NAME: 'lastName',
|
|
49
|
-
EMAIL: 'email',
|
|
50
|
-
PHONE: 'phone',
|
|
51
|
-
IMAGE: 'image',
|
|
52
|
-
CURRENCY: 'currency',
|
|
53
|
-
USER: 'user',
|
|
54
|
-
DEPARTMENT: 'department',
|
|
55
|
-
};
|
|
56
|
-
/** every field type: PG-native columns + engine-shipped custom types */
|
|
57
|
-
export const FIELD_TYPES = {
|
|
58
|
-
...PG_FIELD_TYPES,
|
|
59
|
-
...BUILTIN_CUSTOM_FIELD_TYPES,
|
|
60
|
-
};
|
|
61
|
-
/** the engine identity objects targeted by the `user`/`department` field types */
|
|
62
|
-
export const IDENTITY_OBJECT_NAMES = {
|
|
63
|
-
USER: 'weavekit_user',
|
|
64
|
-
DEPARTMENT: 'weavekit_department',
|
|
65
|
-
};
|
|
66
|
-
/** FK delete behavior for `relation` fields (default restrict) */
|
|
67
|
-
export const ON_DELETE_ACTIONS = {
|
|
68
|
-
CASCADE: 'cascade',
|
|
69
|
-
RESTRICT: 'restrict',
|
|
70
|
-
SET_NULL: 'set_null',
|
|
71
|
-
};
|
|
72
|
-
/** row-level read/manage scope for RBAC */
|
|
73
|
-
export const READ_SCOPES = {
|
|
74
|
-
OWN: 'own',
|
|
75
|
-
DEPARTMENT: 'department',
|
|
76
|
-
ALL: 'all',
|
|
77
|
-
};
|
|
78
|
-
/** field markers that declare row-level scope columns (ownership/department/tenant/scope) */
|
|
79
|
-
export const ROW_SCOPE_MARKERS = {
|
|
80
|
-
OWNERSHIP: 'ownership',
|
|
81
|
-
DEPARTMENT: 'department',
|
|
82
|
-
/** tenant column: every read/write is implicitly scoped to the subject's tenant */
|
|
83
|
-
TENANT: 'tenant',
|
|
84
|
-
/**
|
|
85
|
-
* generic row-scope column: same semantics as `tenant` (a single column scopes
|
|
86
|
-
* every read/write to the subject's scope value). `scope` is the canonical
|
|
87
|
-
* name; `tenant` is the retained alias. An object may declare at most one.
|
|
88
|
-
*/
|
|
89
|
-
SCOPE: 'scope',
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* where a scope column's values come from:
|
|
93
|
-
* - `internal` — ids of the engine identity directory (`weavekit_*` uuids)
|
|
94
|
-
* - `external` — ids from the identity source (translated via `external_id`)
|
|
95
|
-
*/
|
|
96
|
-
export const SCOPE_SOURCES = {
|
|
97
|
-
INTERNAL: 'internal',
|
|
98
|
-
EXTERNAL: 'external',
|
|
99
|
-
};
|
|
100
|
-
/** object names reserved by the engine (system objects + engine-managed tables) */
|
|
101
|
-
export const RESERVED_OBJECT_PREFIX = 'weavekit_';
|
|
102
|
-
/** index access method */
|
|
103
|
-
export const INDEX_TYPES = {
|
|
104
|
-
BTREE: 'btree',
|
|
105
|
-
GIN: 'gin',
|
|
106
|
-
GIST: 'gist',
|
|
107
|
-
};
|
|
108
|
-
/** declarative table-level constraint kinds */
|
|
109
|
-
export const CONSTRAINT_TYPES = {
|
|
110
|
-
UNIQUE: 'unique',
|
|
111
|
-
};
|
|
112
|
-
/** seq_no counter restart strategy */
|
|
113
|
-
export const SEQUENCE_CYCLES = {
|
|
114
|
-
NONE: 'none',
|
|
115
|
-
YEAR: 'year',
|
|
116
|
-
};
|
|
117
|
-
/** placeholders allowed inside a seq_no `format` template */
|
|
118
|
-
export const SEQUENCE_TOKENS = {
|
|
119
|
-
SEQ: 'seq',
|
|
120
|
-
YEAR: 'year',
|
|
121
|
-
MONTH: 'month',
|
|
122
|
-
DAY: 'day',
|
|
123
|
-
};
|
|
124
|
-
/** engine-managed columns auto-added to a details child table */
|
|
125
|
-
export const DETAILS_COLUMNS = {
|
|
126
|
-
PARENT_ID: 'parent_id',
|
|
127
|
-
PARENT_TYPE: 'parent_type',
|
|
128
|
-
PARENT_IDX: 'parent_idx',
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Engine-managed record instance status (`weave_status`). The workflow runtime
|
|
132
|
-
* drives transitions between these; a record with no engine metadata defaults
|
|
133
|
-
* to `draft`.
|
|
134
|
-
*/
|
|
135
|
-
export const WEAVE_STATUS = {
|
|
136
|
-
DRAFT: 'draft',
|
|
137
|
-
RUNNING: 'running',
|
|
138
|
-
EFFECTIVE: 'effective',
|
|
139
|
-
CANCELED: 'canceled',
|
|
140
|
-
};
|
|
141
|
-
/** relation edge kinds in the normalized RelationGraph */
|
|
142
|
-
export const RELATION_KINDS = {
|
|
143
|
-
BELONGS_TO: 'belongsTo',
|
|
144
|
-
HAS_MANY: 'hasMany',
|
|
145
|
-
MULTI_RELATION: 'multiRelation',
|
|
146
|
-
};
|
|
5
|
+
export { PG_FIELD_TYPES, BUILTIN_CUSTOM_FIELD_TYPES, FIELD_TYPES, IDENTITY_OBJECT_NAMES, ON_DELETE_ACTIONS, READ_SCOPES, ROW_SCOPE_MARKERS, SCOPE_SOURCES, RESERVED_OBJECT_PREFIX, INDEX_TYPES, CONSTRAINT_TYPES, SEQUENCE_CYCLES, SEQUENCE_TOKENS, DETAILS_COLUMNS, WEAVE_STATUS, RELATION_KINDS, } from '@weave-kit/contract/values';
|
|
147
6
|
//# sourceMappingURL=values.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/core/types/values.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../src/core/types/values.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,GACf,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,84 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Pure types — zero runtime dependencies (core contract layer).
|
|
2
|
+
* Workflow schema + durable timer contract.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* customer's columns (see the C-phase plan).
|
|
4
|
+
* The `workflow.json` schema vocabulary (format version, node kinds, and the
|
|
5
|
+
* node/assign/timeout/definition shapes) lives in `@weave-kit/contract` and is
|
|
6
|
+
* re-exported here; this module keeps the engine-side timer/backend seams.
|
|
9
7
|
*/
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
/** synthetic node id of the implicit start (发起) node — never authored */
|
|
13
|
-
export declare const WORKFLOW_START_NODE = "__start__";
|
|
14
|
-
/** node kinds (single source of truth) */
|
|
15
|
-
export declare const WORKFLOW_NODE_KINDS: {
|
|
16
|
-
readonly APPROVE: "approve";
|
|
17
|
-
readonly NOTIFY: "notify";
|
|
18
|
-
};
|
|
19
|
-
export type WorkflowNodeKind = (typeof WORKFLOW_NODE_KINDS)[keyof typeof WORKFLOW_NODE_KINDS];
|
|
20
|
-
/** how a node's assignees complete it (single source of truth) */
|
|
21
|
-
export declare const WORKFLOW_ASSIGN_MODES: {
|
|
22
|
-
/** 或签: the first decision settles the node */
|
|
23
|
-
readonly ANY: "any";
|
|
24
|
-
/** 会签: every assignee must approve */
|
|
25
|
-
readonly ALL: "all";
|
|
26
|
-
};
|
|
27
|
-
export type WorkflowAssignMode = (typeof WORKFLOW_ASSIGN_MODES)[keyof typeof WORKFLOW_ASSIGN_MODES];
|
|
28
|
-
/** the actions a node timeout may auto-fire (single source of truth) */
|
|
29
|
-
export declare const WORKFLOW_TIMEOUT_ACTIONS: {
|
|
30
|
-
readonly APPROVE: "approve";
|
|
31
|
-
readonly REJECT: "reject";
|
|
32
|
-
};
|
|
33
|
-
export type WorkflowTimeoutAction = (typeof WORKFLOW_TIMEOUT_ACTIONS)[keyof typeof WORKFLOW_TIMEOUT_ACTIONS];
|
|
34
|
-
/** how long a node may be held before its timeout fires, and what to do then */
|
|
35
|
-
export interface WorkflowTimeout {
|
|
36
|
-
/** duration string: `<n>` with optional unit `ms|s|m|h|d|w` (bare number = ms) */
|
|
37
|
-
after: string;
|
|
38
|
-
/** action auto-fired on expiry; absent = only dispatch the `onTimeout` hook */
|
|
39
|
-
action?: WorkflowTimeoutAction;
|
|
40
|
-
}
|
|
41
|
-
/** who acts at a node and how the node completes */
|
|
42
|
-
export interface WorkflowAssign {
|
|
43
|
-
/** roles whose members resolve to the node's assignees (required, non-empty) */
|
|
44
|
-
roles: string[];
|
|
45
|
-
/** 或签 (`any`, default) | 会签 (`all`); `notify` nodes keep `any` */
|
|
46
|
-
mode?: WorkflowAssignMode;
|
|
47
|
-
}
|
|
48
|
-
/** one node in the single-line chain */
|
|
49
|
-
export interface WorkflowNode {
|
|
50
|
-
/** snake_case node id, unique within the chain */
|
|
51
|
-
id: string;
|
|
52
|
-
/** `approve` (default) | `notify` (抄送: no quorum, advances immediately) */
|
|
53
|
-
kind?: WorkflowNodeKind;
|
|
54
|
-
/** display names keyed by locale, e.g. { en: 'Finance', zh: '财务审批' } */
|
|
55
|
-
name?: Record<string, string>;
|
|
56
|
-
description?: string;
|
|
57
|
-
/** roles that resolve to the node's assignees (required) */
|
|
58
|
-
assign: WorkflowAssign;
|
|
59
|
-
/** on reject, roll back to this earlier node id; absent = the start node */
|
|
60
|
-
onReject?: string;
|
|
61
|
-
/** on withdraw, roll back to this earlier node id; absent = the start node */
|
|
62
|
-
onWithdraw?: string;
|
|
63
|
-
/** when true, the action at this node must be approved through the approval queue before it fires */
|
|
64
|
-
requiresApproval?: boolean;
|
|
65
|
-
/** node-level timeout (approve nodes only) */
|
|
66
|
-
onTimeout?: WorkflowTimeout;
|
|
67
|
-
}
|
|
68
|
-
/** validated workflow definition attached to an object */
|
|
69
|
-
export interface WorkflowDefinition {
|
|
70
|
-
/** on-disk `workflow.json` format version */
|
|
71
|
-
schemaVersion?: number;
|
|
72
|
-
/**
|
|
73
|
-
* author-managed definition revision (an arbitrary positive integer, distinct
|
|
74
|
-
* from the on-disk `schemaVersion`). Surfaced in the descriptor / transition
|
|
75
|
-
* events + audit so history stays interpretable after a definition changes.
|
|
76
|
-
* See `workflowHash` for the exact content identity (instance pinning).
|
|
77
|
-
*/
|
|
78
|
-
version?: number;
|
|
79
|
-
/** the ordered single-line node chain (the start node is implicit) */
|
|
80
|
-
nodes: WorkflowNode[];
|
|
81
|
-
}
|
|
8
|
+
export { WORKFLOW_FORMAT_VERSION, WORKFLOW_START_NODE, WORKFLOW_NODE_KINDS, WORKFLOW_ASSIGN_MODES, WORKFLOW_TIMEOUT_ACTIONS, } from '@weave-kit/contract/values';
|
|
9
|
+
export type { WorkflowNodeKind, WorkflowAssignMode, WorkflowTimeoutAction, WorkflowTimeout, WorkflowAssign, WorkflowNode, WorkflowDefinition, } from '@weave-kit/contract';
|
|
82
10
|
/** `weavekit.config.ts -> subsystems.workflow` */
|
|
83
11
|
export interface EngineWorkflowConfig {
|
|
84
12
|
enabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../src/core/types/workflow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../src/core/types/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,4B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MAAM,WAAW,iBAAiB;IAChC,8FAA8F;IAC9F,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,sCAAsC;IACtC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAKD,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO/D"}
|
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Pure types — zero runtime dependencies (core contract layer).
|
|
2
|
+
* Workflow schema + durable timer contract.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* customer's columns (see the C-phase plan).
|
|
4
|
+
* The `workflow.json` schema vocabulary (format version, node kinds, and the
|
|
5
|
+
* node/assign/timeout/definition shapes) lives in `@weave-kit/contract` and is
|
|
6
|
+
* re-exported here; this module keeps the engine-side timer/backend seams.
|
|
9
7
|
*/
|
|
10
|
-
|
|
11
|
-
export const WORKFLOW_FORMAT_VERSION = 2;
|
|
12
|
-
/** synthetic node id of the implicit start (发起) node — never authored */
|
|
13
|
-
export const WORKFLOW_START_NODE = '__start__';
|
|
14
|
-
/** node kinds (single source of truth) */
|
|
15
|
-
export const WORKFLOW_NODE_KINDS = {
|
|
16
|
-
APPROVE: 'approve',
|
|
17
|
-
NOTIFY: 'notify',
|
|
18
|
-
};
|
|
19
|
-
/** how a node's assignees complete it (single source of truth) */
|
|
20
|
-
export const WORKFLOW_ASSIGN_MODES = {
|
|
21
|
-
/** 或签: the first decision settles the node */
|
|
22
|
-
ANY: 'any',
|
|
23
|
-
/** 会签: every assignee must approve */
|
|
24
|
-
ALL: 'all',
|
|
25
|
-
};
|
|
26
|
-
/** the actions a node timeout may auto-fire (single source of truth) */
|
|
27
|
-
export const WORKFLOW_TIMEOUT_ACTIONS = {
|
|
28
|
-
APPROVE: 'approve',
|
|
29
|
-
REJECT: 'reject',
|
|
30
|
-
};
|
|
8
|
+
export { WORKFLOW_FORMAT_VERSION, WORKFLOW_START_NODE, WORKFLOW_NODE_KINDS, WORKFLOW_ASSIGN_MODES, WORKFLOW_TIMEOUT_ACTIONS, } from '@weave-kit/contract/values';
|
|
31
9
|
/** scheduler defaults — single source of truth (as const, see AGENTS.md) */
|
|
32
10
|
export const WORKFLOW_TIMER_DEFAULTS = {
|
|
33
11
|
pollMs: 30000,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../src/core/types/workflow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../../src/core/types/workflow.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAsBpC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,EAAE;CACL,CAAC;AAqDX,8DAA8D;AAC9D,MAAM,cAAc,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,WAAW,EAAW,CAAC;AAE3G,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1D,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAgC,CAAC;IAC/D,OAAO,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type { ScaffoldProjectOptions, ScaffoldProjectResult } from './cli/scaffo
|
|
|
23
23
|
export { loadFieldTypesDir, normalizeFieldTypeRegistration, resolveFieldTypeRegistry } from './runtime/fieldtypes/index.js';
|
|
24
24
|
export type { LoadedFieldType } from './runtime/fieldtypes/index.js';
|
|
25
25
|
export { PROJECT_TYPES } from './cli/types/values.js';
|
|
26
|
-
export { PROJECT_TYPE_DEFINITIONS, projectTypeDef
|
|
26
|
+
export { PROJECT_TYPE_DEFINITIONS, projectTypeDef } from './cli/project-types/manifest.js';
|
|
27
27
|
export type { ProjectType } from './cli/types/values.js';
|
|
28
28
|
export { CONTRACT_VERSION, version } from './version.js';
|
|
29
29
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKxE,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,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{ buildOpenApiDocument, capabilitiesFromConfig } from './adapters/openapi
|
|
|
24
24
|
export { scaffoldProject } from './cli/scaffold.js';
|
|
25
25
|
export { loadFieldTypesDir, normalizeFieldTypeRegistration, resolveFieldTypeRegistry } from './runtime/fieldtypes/index.js';
|
|
26
26
|
export { PROJECT_TYPES } from './cli/types/values.js';
|
|
27
|
-
export { PROJECT_TYPE_DEFINITIONS, projectTypeDef
|
|
27
|
+
export { PROJECT_TYPE_DEFINITIONS, projectTypeDef } from './cli/project-types/manifest.js';
|
|
28
28
|
export { CONTRACT_VERSION, version } from './version.js';
|
|
29
29
|
/**
|
|
30
30
|
* Assemble an engine from a config: load the schema from `schemaDir`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEnG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,gFAAgF;AAChF,6GAA6G;AAC7G,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,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CAAC,SAAS,CAAC,OAAO;qBAChC,CAAC,CAAC;gBACL,CAAC;wBAAS,CAAC;oBACT,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;gBACnB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,GAAG,EAAE;YACpD,MAAM;YACN,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,UAAU;YAC9C,UAAU;SACX,CAAC,CAAC;QACH,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC9B,QAAQ,GAAG,MAAM,CAAC;IACpB,CAAC;IAED,OAAO,uBAAuB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -2,7 +2,7 @@ export { FILTER_OPS, SORT_DIRS, PAGINATION, WRITE_MODES, TOTAL_MODES } from "./v
|
|
|
2
2
|
export type { FilterOp, SortDir, WriteMode, TotalMode } from "./values.js";
|
|
3
3
|
export type { Filter, FilterGroup, FilterValue, Sort, FindOptions, FindResult, DataAccessContext, ObjectDataAccess, Queryable, } from "./types.js";
|
|
4
4
|
export { buildWhere, buildOrderBy, buildColumns, resolvePagination, buildFindSql, buildCountSql, buildEstimateSql, } from "./builder.js";
|
|
5
|
-
export { isSystemCtx, subjectOf,
|
|
5
|
+
export { isSystemCtx, subjectOf, scopeOf } from "./types.js";
|
|
6
6
|
export { CURSOR_VERSION, decodeCursor, encodeCursor } from "./cursor.js";
|
|
7
7
|
export { QUERY_BUDGET_DEFAULTS, assertQueryBudget, countFilterConditions, resolveQueryBudget, } from "./query-budget.js";
|
|
8
8
|
export type { QueryBudget } from "./query-budget.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/data-access/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1F,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EACV,MAAM,EACN,WAAW,EACX,WAAW,EACX,IAAI,EACJ,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/data-access/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1F,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EACV,MAAM,EACN,WAAW,EACX,WAAW,EACX,IAAI,EACJ,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { FILTER_OPS, SORT_DIRS, PAGINATION, WRITE_MODES, TOTAL_MODES } from "./values.js";
|
|
2
2
|
export { buildWhere, buildOrderBy, buildColumns, resolvePagination, buildFindSql, buildCountSql, buildEstimateSql, } from "./builder.js";
|
|
3
|
-
export { isSystemCtx, subjectOf,
|
|
3
|
+
export { isSystemCtx, subjectOf, scopeOf } from "./types.js";
|
|
4
4
|
export { CURSOR_VERSION, decodeCursor, encodeCursor } from "./cursor.js";
|
|
5
5
|
export { QUERY_BUDGET_DEFAULTS, assertQueryBudget, countFilterConditions, resolveQueryBudget, } from "./query-budget.js";
|
|
6
6
|
export { validateRecord } from "./validate.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/data-access/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAa1F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/data-access/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAa1F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EACL,SAAS,EACT,SAAS,EACT,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAKzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -77,7 +77,7 @@ async function auditWrite(sink, ctx, action, objectName, objectId, changes, erro
|
|
|
77
77
|
if (sink === undefined)
|
|
78
78
|
return;
|
|
79
79
|
const principal = ctx.principal;
|
|
80
|
-
const
|
|
80
|
+
const scopeValue = scopeOf(ctx);
|
|
81
81
|
const event = {
|
|
82
82
|
actorType: principal.kind === 'user' ? AUDIT_ACTOR_TYPES.USER : AUDIT_ACTOR_TYPES.SYSTEM,
|
|
83
83
|
actorId: principalActorId(principal),
|
|
@@ -90,7 +90,7 @@ async function auditWrite(sink, ctx, action, objectName, objectId, changes, erro
|
|
|
90
90
|
...(principal.kind === 'system' ? { meta: { capability: principal.capability } } : {}),
|
|
91
91
|
...(ctx.requestId === undefined ? {} : { requestId: ctx.requestId }),
|
|
92
92
|
...(ctx.traceId === undefined ? {} : { traceId: ctx.traceId }),
|
|
93
|
-
...(
|
|
93
|
+
...(scopeValue === undefined ? {} : { scopeId: scopeValue }),
|
|
94
94
|
timestamp: new Date(),
|
|
95
95
|
};
|
|
96
96
|
if (before !== undefined)
|
|
@@ -112,7 +112,7 @@ function scriptUserOf(ctx) {
|
|
|
112
112
|
id: subject?.id ?? 'system',
|
|
113
113
|
roles: subject?.roles ?? [],
|
|
114
114
|
departmentId: subject?.departmentId,
|
|
115
|
-
...(subject?.
|
|
115
|
+
...(subject?.scopeId === undefined ? {} : { scopeId: subject.scopeId }),
|
|
116
116
|
...(subject?.scopeId === undefined ? {} : { scopeId: subject.scopeId }),
|
|
117
117
|
};
|
|
118
118
|
}
|
|
@@ -628,10 +628,10 @@ export class DefaultObjectDataAccess {
|
|
|
628
628
|
Object.assign(record, payload);
|
|
629
629
|
// row-scope: force the scope column to the subject's scope — a scoped
|
|
630
630
|
// subject must not create rows attributed to another scope
|
|
631
|
-
const
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
634
|
-
record[
|
|
631
|
+
const scopeField = scopeFieldName(def);
|
|
632
|
+
const scopeValue = scopeOf(ctx);
|
|
633
|
+
if (scopeField !== undefined && scopeValue !== undefined)
|
|
634
|
+
record[scopeField] = scopeValue;
|
|
635
635
|
const seqFields = def.fields.filter((f) => f.type === FIELD_TYPES.SEQ_NO);
|
|
636
636
|
if (seqFields.length > 0) {
|
|
637
637
|
for (const f of seqFields)
|
|
@@ -742,14 +742,14 @@ export class DefaultObjectDataAccess {
|
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
744
|
// row-scope: the scope column is immutable — a scoped subject must not move
|
|
745
|
-
// a row into another scope (error code kept as `object.
|
|
746
|
-
const
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
749
|
-
|
|
750
|
-
payload[
|
|
751
|
-
payload[
|
|
752
|
-
throw new SchemaError('object.
|
|
745
|
+
// a row into another scope (error code kept as `object.scope.immutable` for compat)
|
|
746
|
+
const scopeField = scopeFieldName(def);
|
|
747
|
+
const scopeValue = scopeOf(ctx);
|
|
748
|
+
if (scopeField !== undefined &&
|
|
749
|
+
scopeValue !== undefined &&
|
|
750
|
+
payload[scopeField] !== undefined &&
|
|
751
|
+
payload[scopeField] !== scopeValue) {
|
|
752
|
+
throw new SchemaError('object.scope.immutable', { object: objectName, field: scopeField }, ctx.locale);
|
|
753
753
|
}
|
|
754
754
|
const now = new Date();
|
|
755
755
|
const record = { ...existing, ...payload };
|