@supabase/pg-delta 1.0.0-alpha.22 → 1.0.0-alpha.23
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/core/catalog.model.js +1 -0
- package/dist/core/integrations/filter/flatten.js +13 -0
- package/dist/core/objects/aggregate/aggregate.diff.js +16 -0
- package/dist/core/objects/aggregate/aggregate.model.d.ts +10 -0
- package/dist/core/objects/aggregate/aggregate.model.js +19 -1
- package/dist/core/objects/aggregate/changes/aggregate.base.d.ts +1 -1
- package/dist/core/objects/aggregate/changes/aggregate.security-label.d.ts +28 -0
- package/dist/core/objects/aggregate/changes/aggregate.security-label.js +64 -0
- package/dist/core/objects/aggregate/changes/aggregate.types.d.ts +2 -1
- package/dist/core/objects/base.model.d.ts +8 -0
- package/dist/core/objects/base.model.js +2 -0
- package/dist/core/objects/domain/changes/domain.base.d.ts +1 -1
- package/dist/core/objects/domain/changes/domain.security-label.d.ts +28 -0
- package/dist/core/objects/domain/changes/domain.security-label.js +61 -0
- package/dist/core/objects/domain/changes/domain.types.d.ts +2 -1
- package/dist/core/objects/domain/domain.diff.js +16 -0
- package/dist/core/objects/domain/domain.model.d.ts +10 -0
- package/dist/core/objects/domain/domain.model.js +19 -1
- package/dist/core/objects/event-trigger/changes/event-trigger.base.d.ts +1 -1
- package/dist/core/objects/event-trigger/changes/event-trigger.security-label.d.ts +28 -0
- package/dist/core/objects/event-trigger/changes/event-trigger.security-label.js +61 -0
- package/dist/core/objects/event-trigger/changes/event-trigger.types.d.ts +2 -1
- package/dist/core/objects/event-trigger/event-trigger.diff.js +16 -0
- package/dist/core/objects/event-trigger/event-trigger.model.d.ts +10 -0
- package/dist/core/objects/event-trigger/event-trigger.model.js +19 -1
- package/dist/core/objects/foreign-data-wrapper/foreign-table/changes/foreign-table.base.d.ts +1 -1
- package/dist/core/objects/foreign-data-wrapper/foreign-table/changes/foreign-table.security-label.d.ts +28 -0
- package/dist/core/objects/foreign-data-wrapper/foreign-table/changes/foreign-table.security-label.js +61 -0
- package/dist/core/objects/foreign-data-wrapper/foreign-table/changes/foreign-table.types.d.ts +2 -1
- package/dist/core/objects/foreign-data-wrapper/foreign-table/foreign-table.diff.js +16 -0
- package/dist/core/objects/foreign-data-wrapper/foreign-table/foreign-table.model.d.ts +22 -0
- package/dist/core/objects/foreign-data-wrapper/foreign-table/foreign-table.model.js +20 -1
- package/dist/core/objects/materialized-view/changes/materialized-view.base.d.ts +1 -1
- package/dist/core/objects/materialized-view/changes/materialized-view.security-label.d.ts +28 -0
- package/dist/core/objects/materialized-view/changes/materialized-view.security-label.js +61 -0
- package/dist/core/objects/materialized-view/changes/materialized-view.types.d.ts +2 -1
- package/dist/core/objects/materialized-view/materialized-view.diff.js +18 -0
- package/dist/core/objects/materialized-view/materialized-view.model.d.ts +22 -0
- package/dist/core/objects/materialized-view/materialized-view.model.js +20 -1
- package/dist/core/objects/procedure/changes/procedure.base.d.ts +1 -1
- package/dist/core/objects/procedure/changes/procedure.security-label.d.ts +28 -0
- package/dist/core/objects/procedure/changes/procedure.security-label.js +69 -0
- package/dist/core/objects/procedure/changes/procedure.types.d.ts +2 -1
- package/dist/core/objects/procedure/procedure.diff.js +16 -0
- package/dist/core/objects/procedure/procedure.model.d.ts +10 -0
- package/dist/core/objects/procedure/procedure.model.js +19 -1
- package/dist/core/objects/publication/changes/publication.base.d.ts +1 -1
- package/dist/core/objects/publication/changes/publication.security-label.d.ts +28 -0
- package/dist/core/objects/publication/changes/publication.security-label.js +61 -0
- package/dist/core/objects/publication/changes/publication.types.d.ts +2 -1
- package/dist/core/objects/publication/publication.diff.js +16 -0
- package/dist/core/objects/publication/publication.model.d.ts +14 -0
- package/dist/core/objects/publication/publication.model.js +20 -1
- package/dist/core/objects/role/changes/role.base.d.ts +1 -1
- package/dist/core/objects/role/changes/role.security-label.d.ts +28 -0
- package/dist/core/objects/role/changes/role.security-label.js +61 -0
- package/dist/core/objects/role/changes/role.types.d.ts +2 -1
- package/dist/core/objects/role/role.diff.js +16 -0
- package/dist/core/objects/role/role.model.d.ts +10 -0
- package/dist/core/objects/role/role.model.js +29 -0
- package/dist/core/objects/schema/changes/schema.base.d.ts +1 -1
- package/dist/core/objects/schema/changes/schema.security-label.d.ts +28 -0
- package/dist/core/objects/schema/changes/schema.security-label.js +61 -0
- package/dist/core/objects/schema/changes/schema.types.d.ts +2 -1
- package/dist/core/objects/schema/schema.diff.js +24 -1
- package/dist/core/objects/schema/schema.model.d.ts +10 -0
- package/dist/core/objects/schema/schema.model.js +18 -1
- package/dist/core/objects/security-label.types.d.ts +20 -0
- package/dist/core/objects/security-label.types.js +46 -0
- package/dist/core/objects/sequence/changes/sequence.base.d.ts +1 -1
- package/dist/core/objects/sequence/changes/sequence.security-label.d.ts +28 -0
- package/dist/core/objects/sequence/changes/sequence.security-label.js +61 -0
- package/dist/core/objects/sequence/changes/sequence.types.d.ts +2 -1
- package/dist/core/objects/sequence/sequence.diff.js +16 -0
- package/dist/core/objects/sequence/sequence.model.d.ts +10 -0
- package/dist/core/objects/sequence/sequence.model.js +19 -1
- package/dist/core/objects/subscription/changes/subscription.base.d.ts +1 -1
- package/dist/core/objects/subscription/changes/subscription.security-label.d.ts +28 -0
- package/dist/core/objects/subscription/changes/subscription.security-label.js +61 -0
- package/dist/core/objects/subscription/changes/subscription.types.d.ts +2 -1
- package/dist/core/objects/subscription/subscription.diff.js +16 -0
- package/dist/core/objects/subscription/subscription.model.d.ts +10 -0
- package/dist/core/objects/subscription/subscription.model.js +19 -1
- package/dist/core/objects/table/changes/table.base.d.ts +1 -1
- package/dist/core/objects/table/changes/table.security-label.d.ts +63 -0
- package/dist/core/objects/table/changes/table.security-label.js +134 -0
- package/dist/core/objects/table/changes/table.types.d.ts +2 -1
- package/dist/core/objects/table/table.diff.js +49 -0
- package/dist/core/objects/table/table.model.d.ts +30 -0
- package/dist/core/objects/table/table.model.js +34 -2
- package/dist/core/objects/type/composite-type/changes/composite-type.base.d.ts +1 -1
- package/dist/core/objects/type/composite-type/changes/composite-type.security-label.d.ts +28 -0
- package/dist/core/objects/type/composite-type/changes/composite-type.security-label.js +61 -0
- package/dist/core/objects/type/composite-type/changes/composite-type.types.d.ts +2 -1
- package/dist/core/objects/type/composite-type/composite-type.diff.js +16 -0
- package/dist/core/objects/type/composite-type/composite-type.model.d.ts +22 -0
- package/dist/core/objects/type/composite-type/composite-type.model.js +22 -2
- package/dist/core/objects/type/enum/changes/enum.base.d.ts +1 -1
- package/dist/core/objects/type/enum/changes/enum.security-label.d.ts +28 -0
- package/dist/core/objects/type/enum/changes/enum.security-label.js +61 -0
- package/dist/core/objects/type/enum/changes/enum.types.d.ts +2 -1
- package/dist/core/objects/type/enum/enum.diff.js +16 -0
- package/dist/core/objects/type/enum/enum.model.d.ts +10 -0
- package/dist/core/objects/type/enum/enum.model.js +20 -1
- package/dist/core/objects/type/range/changes/range.base.d.ts +1 -1
- package/dist/core/objects/type/range/changes/range.security-label.d.ts +28 -0
- package/dist/core/objects/type/range/changes/range.security-label.js +61 -0
- package/dist/core/objects/type/range/changes/range.types.d.ts +2 -1
- package/dist/core/objects/type/range/range.diff.js +16 -0
- package/dist/core/objects/type/range/range.model.d.ts +10 -0
- package/dist/core/objects/type/range/range.model.js +19 -1
- package/dist/core/objects/utils.d.ts +1 -0
- package/dist/core/objects/utils.js +3 -0
- package/dist/core/objects/view/changes/view.base.d.ts +1 -1
- package/dist/core/objects/view/changes/view.security-label.d.ts +28 -0
- package/dist/core/objects/view/changes/view.security-label.js +61 -0
- package/dist/core/objects/view/changes/view.types.d.ts +2 -1
- package/dist/core/objects/view/view.diff.js +13 -0
- package/dist/core/objects/view/view.model.d.ts +26 -0
- package/dist/core/objects/view/view.model.js +20 -1
- package/dist/core/plan/sql-format/fixtures.js +1 -0
- package/package.json +1 -1
- package/src/core/catalog.model.ts +1 -0
- package/src/core/integrations/filter/dsl.test.ts +27 -0
- package/src/core/integrations/filter/flatten.ts +16 -0
- package/src/core/objects/aggregate/aggregate.diff.ts +33 -0
- package/src/core/objects/aggregate/aggregate.model.ts +22 -1
- package/src/core/objects/aggregate/changes/aggregate.base.ts +5 -1
- package/src/core/objects/aggregate/changes/aggregate.security-label.ts +99 -0
- package/src/core/objects/aggregate/changes/aggregate.types.ts +3 -1
- package/src/core/objects/base.model.ts +2 -0
- package/src/core/objects/domain/changes/domain.base.ts +5 -1
- package/src/core/objects/domain/changes/domain.security-label.test.ts +56 -0
- package/src/core/objects/domain/changes/domain.security-label.ts +77 -0
- package/src/core/objects/domain/changes/domain.types.ts +3 -1
- package/src/core/objects/domain/domain.diff.ts +33 -0
- package/src/core/objects/domain/domain.model.ts +22 -1
- package/src/core/objects/event-trigger/changes/event-trigger.base.ts +1 -1
- package/src/core/objects/event-trigger/changes/event-trigger.security-label.ts +95 -0
- package/src/core/objects/event-trigger/changes/event-trigger.types.ts +3 -1
- package/src/core/objects/event-trigger/event-trigger.diff.ts +33 -0
- package/src/core/objects/event-trigger/event-trigger.model.ts +22 -1
- package/src/core/objects/foreign-data-wrapper/foreign-table/changes/foreign-table.base.ts +5 -1
- package/src/core/objects/foreign-data-wrapper/foreign-table/changes/foreign-table.security-label.ts +95 -0
- package/src/core/objects/foreign-data-wrapper/foreign-table/changes/foreign-table.types.ts +3 -1
- package/src/core/objects/foreign-data-wrapper/foreign-table/foreign-table.diff.ts +33 -0
- package/src/core/objects/foreign-data-wrapper/foreign-table/foreign-table.model.ts +24 -1
- package/src/core/objects/materialized-view/changes/materialized-view.base.ts +5 -1
- package/src/core/objects/materialized-view/changes/materialized-view.security-label.test.ts +63 -0
- package/src/core/objects/materialized-view/changes/materialized-view.security-label.ts +95 -0
- package/src/core/objects/materialized-view/changes/materialized-view.types.ts +3 -1
- package/src/core/objects/materialized-view/materialized-view.diff.ts +37 -0
- package/src/core/objects/materialized-view/materialized-view.model.ts +25 -4
- package/src/core/objects/procedure/changes/procedure.base.ts +5 -1
- package/src/core/objects/procedure/changes/procedure.security-label.ts +105 -0
- package/src/core/objects/procedure/changes/procedure.types.ts +3 -1
- package/src/core/objects/procedure/procedure.diff.ts +33 -0
- package/src/core/objects/procedure/procedure.model.ts +23 -2
- package/src/core/objects/publication/changes/publication.base.ts +1 -1
- package/src/core/objects/publication/changes/publication.security-label.ts +95 -0
- package/src/core/objects/publication/changes/publication.types.ts +3 -1
- package/src/core/objects/publication/publication.diff.ts +33 -0
- package/src/core/objects/publication/publication.model.ts +24 -1
- package/src/core/objects/role/changes/role.base.ts +2 -1
- package/src/core/objects/role/changes/role.security-label.ts +77 -0
- package/src/core/objects/role/changes/role.types.ts +3 -1
- package/src/core/objects/role/role.diff.ts +33 -0
- package/src/core/objects/role/role.model.ts +32 -0
- package/src/core/objects/schema/changes/schema.alter.test.ts +1 -0
- package/src/core/objects/schema/changes/schema.base.ts +5 -1
- package/src/core/objects/schema/changes/schema.create.test.ts +1 -0
- package/src/core/objects/schema/changes/schema.drop.test.ts +1 -0
- package/src/core/objects/schema/changes/schema.security-label.test.ts +76 -0
- package/src/core/objects/schema/changes/schema.security-label.ts +77 -0
- package/src/core/objects/schema/changes/schema.types.ts +3 -1
- package/src/core/objects/schema/schema.diff.test.ts +1 -0
- package/src/core/objects/schema/schema.diff.ts +43 -1
- package/src/core/objects/schema/schema.model.ts +21 -1
- package/src/core/objects/security-label.types.test.ts +106 -0
- package/src/core/objects/security-label.types.ts +61 -0
- package/src/core/objects/sequence/changes/sequence.base.ts +5 -1
- package/src/core/objects/sequence/changes/sequence.security-label.test.ts +58 -0
- package/src/core/objects/sequence/changes/sequence.security-label.ts +92 -0
- package/src/core/objects/sequence/changes/sequence.types.ts +3 -1
- package/src/core/objects/sequence/sequence.diff.ts +33 -0
- package/src/core/objects/sequence/sequence.model.ts +22 -1
- package/src/core/objects/subscription/changes/subscription.base.ts +1 -1
- package/src/core/objects/subscription/changes/subscription.security-label.ts +95 -0
- package/src/core/objects/subscription/changes/subscription.types.ts +3 -1
- package/src/core/objects/subscription/subscription.diff.ts +33 -0
- package/src/core/objects/subscription/subscription.model.ts +22 -1
- package/src/core/objects/table/changes/table.base.ts +5 -1
- package/src/core/objects/table/changes/table.security-label.test.ts +140 -0
- package/src/core/objects/table/changes/table.security-label.ts +183 -0
- package/src/core/objects/table/changes/table.types.ts +3 -1
- package/src/core/objects/table/table.diff.ts +87 -0
- package/src/core/objects/table/table.model.ts +42 -2
- package/src/core/objects/type/composite-type/changes/composite-type.base.ts +5 -1
- package/src/core/objects/type/composite-type/changes/composite-type.security-label.ts +95 -0
- package/src/core/objects/type/composite-type/changes/composite-type.types.ts +3 -1
- package/src/core/objects/type/composite-type/composite-type.diff.ts +33 -0
- package/src/core/objects/type/composite-type/composite-type.model.ts +26 -2
- package/src/core/objects/type/enum/changes/enum.base.ts +5 -1
- package/src/core/objects/type/enum/changes/enum.security-label.ts +77 -0
- package/src/core/objects/type/enum/changes/enum.types.ts +3 -1
- package/src/core/objects/type/enum/enum.diff.ts +33 -0
- package/src/core/objects/type/enum/enum.model.ts +25 -1
- package/src/core/objects/type/range/changes/range.base.ts +5 -1
- package/src/core/objects/type/range/changes/range.security-label.ts +77 -0
- package/src/core/objects/type/range/changes/range.types.ts +3 -1
- package/src/core/objects/type/range/range.diff.ts +33 -0
- package/src/core/objects/type/range/range.model.ts +22 -1
- package/src/core/objects/utils.ts +3 -0
- package/src/core/objects/view/changes/view.base.ts +5 -1
- package/src/core/objects/view/changes/view.security-label.test.ts +64 -0
- package/src/core/objects/view/changes/view.security-label.ts +77 -0
- package/src/core/objects/view/changes/view.types.ts +3 -1
- package/src/core/objects/view/view.diff.ts +31 -0
- package/src/core/objects/view/view.model.ts +25 -2
- package/src/core/plan/sql-format/fixtures.ts +1 -0
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
type PrivilegeProps,
|
|
7
7
|
privilegePropsSchema,
|
|
8
8
|
} from "../base.privilege-diff.ts";
|
|
9
|
+
import {
|
|
10
|
+
type SecurityLabelProps,
|
|
11
|
+
securityLabelPropsSchema,
|
|
12
|
+
} from "../security-label.types.ts";
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* All properties exposed by CREATE SCHEMA statement are included in diff output.
|
|
@@ -19,6 +23,7 @@ const schemaPropsSchema = z.object({
|
|
|
19
23
|
owner: z.string(),
|
|
20
24
|
comment: z.string().nullable(),
|
|
21
25
|
privileges: z.array(privilegePropsSchema),
|
|
26
|
+
security_labels: z.array(securityLabelPropsSchema).default([]).optional(),
|
|
22
27
|
});
|
|
23
28
|
|
|
24
29
|
type SchemaPrivilegeProps = PrivilegeProps;
|
|
@@ -29,6 +34,7 @@ export class Schema extends BasePgModel {
|
|
|
29
34
|
public readonly owner: SchemaProps["owner"];
|
|
30
35
|
public readonly comment: SchemaProps["comment"];
|
|
31
36
|
public readonly privileges: SchemaPrivilegeProps[];
|
|
37
|
+
public readonly security_labels: SecurityLabelProps[];
|
|
32
38
|
|
|
33
39
|
constructor(props: SchemaProps) {
|
|
34
40
|
super();
|
|
@@ -40,6 +46,7 @@ export class Schema extends BasePgModel {
|
|
|
40
46
|
this.owner = props.owner;
|
|
41
47
|
this.comment = props.comment;
|
|
42
48
|
this.privileges = props.privileges;
|
|
49
|
+
this.security_labels = props.security_labels ?? [];
|
|
43
50
|
}
|
|
44
51
|
|
|
45
52
|
get stableId(): `schema:${string}` {
|
|
@@ -57,6 +64,7 @@ export class Schema extends BasePgModel {
|
|
|
57
64
|
owner: this.owner,
|
|
58
65
|
comment: this.comment,
|
|
59
66
|
privileges: this.privileges,
|
|
67
|
+
security_labels: this.security_labels,
|
|
60
68
|
};
|
|
61
69
|
}
|
|
62
70
|
}
|
|
@@ -88,7 +96,19 @@ export async function extractSchemas(pool: Pool): Promise<Schema[]> {
|
|
|
88
96
|
)
|
|
89
97
|
from lateral aclexplode(COALESCE(nspacl, acldefault('n', nspowner))) as x(grantor, grantee, privilege_type, is_grantable)
|
|
90
98
|
), '[]'
|
|
91
|
-
) as privileges
|
|
99
|
+
) as privileges,
|
|
100
|
+
coalesce(
|
|
101
|
+
(
|
|
102
|
+
select json_agg(
|
|
103
|
+
json_build_object('provider', sl.provider, 'label', sl.label)
|
|
104
|
+
order by sl.provider
|
|
105
|
+
)
|
|
106
|
+
from pg_catalog.pg_seclabel sl
|
|
107
|
+
where sl.objoid = pg_namespace.oid
|
|
108
|
+
and sl.classoid = 'pg_namespace'::regclass
|
|
109
|
+
and sl.objsubid = 0
|
|
110
|
+
), '[]'
|
|
111
|
+
) as security_labels
|
|
92
112
|
from
|
|
93
113
|
pg_catalog.pg_namespace
|
|
94
114
|
left outer join extension_oids e on e.objid = oid
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
diffSecurityLabels,
|
|
4
|
+
type SecurityLabelProps,
|
|
5
|
+
securityLabelPropsSchema,
|
|
6
|
+
} from "./security-label.types.ts";
|
|
7
|
+
|
|
8
|
+
describe("securityLabelPropsSchema", () => {
|
|
9
|
+
test("parses valid props", () => {
|
|
10
|
+
const parsed = securityLabelPropsSchema.parse({
|
|
11
|
+
provider: "p",
|
|
12
|
+
label: "l",
|
|
13
|
+
});
|
|
14
|
+
expect(parsed).toEqual({ provider: "p", label: "l" });
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("rejects null provider", () => {
|
|
18
|
+
expect(() =>
|
|
19
|
+
securityLabelPropsSchema.parse({ provider: null, label: "l" }),
|
|
20
|
+
).toThrow();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("rejects null label", () => {
|
|
24
|
+
expect(() =>
|
|
25
|
+
securityLabelPropsSchema.parse({ provider: "p", label: null }),
|
|
26
|
+
).toThrow();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("diffSecurityLabels", () => {
|
|
31
|
+
type Change = { kind: "create" | "drop" } & SecurityLabelProps;
|
|
32
|
+
const makeCreate = (p: SecurityLabelProps): Change => ({
|
|
33
|
+
kind: "create",
|
|
34
|
+
...p,
|
|
35
|
+
});
|
|
36
|
+
const makeDrop = (p: SecurityLabelProps): Change => ({
|
|
37
|
+
kind: "drop",
|
|
38
|
+
...p,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("both empty → no changes", () => {
|
|
42
|
+
expect(diffSecurityLabels([], [], makeCreate, makeDrop)).toEqual([]);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("added providers emit create", () => {
|
|
46
|
+
expect(
|
|
47
|
+
diffSecurityLabels(
|
|
48
|
+
[],
|
|
49
|
+
[{ provider: "a", label: "x" }],
|
|
50
|
+
makeCreate,
|
|
51
|
+
makeDrop,
|
|
52
|
+
),
|
|
53
|
+
).toEqual([{ kind: "create", provider: "a", label: "x" }]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("removed providers emit drop", () => {
|
|
57
|
+
expect(
|
|
58
|
+
diffSecurityLabels(
|
|
59
|
+
[{ provider: "a", label: "x" }],
|
|
60
|
+
[],
|
|
61
|
+
makeCreate,
|
|
62
|
+
makeDrop,
|
|
63
|
+
),
|
|
64
|
+
).toEqual([{ kind: "drop", provider: "a", label: "x" }]);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("changed label emits create (overwrite semantics)", () => {
|
|
68
|
+
expect(
|
|
69
|
+
diffSecurityLabels(
|
|
70
|
+
[{ provider: "a", label: "old" }],
|
|
71
|
+
[{ provider: "a", label: "new" }],
|
|
72
|
+
makeCreate,
|
|
73
|
+
makeDrop,
|
|
74
|
+
),
|
|
75
|
+
).toEqual([{ kind: "create", provider: "a", label: "new" }]);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("unchanged label emits nothing", () => {
|
|
79
|
+
expect(
|
|
80
|
+
diffSecurityLabels(
|
|
81
|
+
[{ provider: "a", label: "x" }],
|
|
82
|
+
[{ provider: "a", label: "x" }],
|
|
83
|
+
makeCreate,
|
|
84
|
+
makeDrop,
|
|
85
|
+
),
|
|
86
|
+
).toEqual([]);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("mixed add/remove/change/unchanged across providers, sorted by provider", () => {
|
|
90
|
+
const main = [
|
|
91
|
+
{ provider: "a", label: "stay" },
|
|
92
|
+
{ provider: "b", label: "old" },
|
|
93
|
+
{ provider: "c", label: "remove" },
|
|
94
|
+
];
|
|
95
|
+
const branch = [
|
|
96
|
+
{ provider: "a", label: "stay" },
|
|
97
|
+
{ provider: "b", label: "new" },
|
|
98
|
+
{ provider: "d", label: "add" },
|
|
99
|
+
];
|
|
100
|
+
expect(diffSecurityLabels(main, branch, makeCreate, makeDrop)).toEqual([
|
|
101
|
+
{ kind: "create", provider: "b", label: "new" },
|
|
102
|
+
{ kind: "drop", provider: "c", label: "remove" },
|
|
103
|
+
{ kind: "create", provider: "d", label: "add" },
|
|
104
|
+
]);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const securityLabelPropsSchema = z.object({
|
|
4
|
+
provider: z.string(),
|
|
5
|
+
label: z.string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type SecurityLabelProps = z.infer<typeof securityLabelPropsSchema>;
|
|
9
|
+
|
|
10
|
+
export function normalizeSecurityLabels(
|
|
11
|
+
labels: readonly SecurityLabelProps[],
|
|
12
|
+
): SecurityLabelProps[] {
|
|
13
|
+
return [...labels].sort((a, b) => a.provider.localeCompare(b.provider));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Pure helper: compares two arrays of security labels keyed by provider and
|
|
18
|
+
* returns a deterministic list of create/drop changes.
|
|
19
|
+
*
|
|
20
|
+
* - Labels present only on `branch` → emit create (via makeCreate).
|
|
21
|
+
* - Labels present only on `main` → emit drop (via makeDrop).
|
|
22
|
+
* - Labels with differing `label` under the same provider → emit create
|
|
23
|
+
* (PostgreSQL's SECURITY LABEL … IS '…' overwrites, so no separate alter).
|
|
24
|
+
* - Unchanged labels → nothing.
|
|
25
|
+
*
|
|
26
|
+
* Output order: by provider ascending.
|
|
27
|
+
*/
|
|
28
|
+
export function diffSecurityLabels<C>(
|
|
29
|
+
main: readonly SecurityLabelProps[],
|
|
30
|
+
branch: readonly SecurityLabelProps[],
|
|
31
|
+
makeCreate: (props: SecurityLabelProps) => C,
|
|
32
|
+
makeDrop: (props: SecurityLabelProps) => C,
|
|
33
|
+
): C[] {
|
|
34
|
+
const mainByProvider = new Map(main.map((l) => [l.provider, l.label]));
|
|
35
|
+
const branchByProvider = new Map(branch.map((l) => [l.provider, l.label]));
|
|
36
|
+
|
|
37
|
+
const providers = new Set<string>([
|
|
38
|
+
...mainByProvider.keys(),
|
|
39
|
+
...branchByProvider.keys(),
|
|
40
|
+
]);
|
|
41
|
+
const sortedProviders = [...providers].sort();
|
|
42
|
+
|
|
43
|
+
const out: C[] = [];
|
|
44
|
+
for (const provider of sortedProviders) {
|
|
45
|
+
const mainLabel = mainByProvider.get(provider);
|
|
46
|
+
const branchLabel = branchByProvider.get(provider);
|
|
47
|
+
|
|
48
|
+
if (mainLabel === undefined && branchLabel !== undefined) {
|
|
49
|
+
out.push(makeCreate({ provider, label: branchLabel }));
|
|
50
|
+
} else if (mainLabel !== undefined && branchLabel === undefined) {
|
|
51
|
+
out.push(makeDrop({ provider, label: mainLabel }));
|
|
52
|
+
} else if (
|
|
53
|
+
mainLabel !== undefined &&
|
|
54
|
+
branchLabel !== undefined &&
|
|
55
|
+
mainLabel !== branchLabel
|
|
56
|
+
) {
|
|
57
|
+
out.push(makeCreate({ provider, label: branchLabel }));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
@@ -3,7 +3,11 @@ import type { Sequence } from "../sequence.model.ts";
|
|
|
3
3
|
|
|
4
4
|
abstract class BaseSequenceChange extends BaseChange {
|
|
5
5
|
abstract readonly sequence: Sequence;
|
|
6
|
-
abstract readonly scope:
|
|
6
|
+
abstract readonly scope:
|
|
7
|
+
| "object"
|
|
8
|
+
| "comment"
|
|
9
|
+
| "privilege"
|
|
10
|
+
| "security_label";
|
|
7
11
|
readonly objectType: "sequence" = "sequence";
|
|
8
12
|
}
|
|
9
13
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { assertValidSql } from "../../../test-utils/assert-valid-sql.ts";
|
|
3
|
+
import { stableId } from "../../utils.ts";
|
|
4
|
+
import { Sequence, type SequenceProps } from "../sequence.model.ts";
|
|
5
|
+
import {
|
|
6
|
+
CreateSecurityLabelOnSequence,
|
|
7
|
+
DropSecurityLabelOnSequence,
|
|
8
|
+
} from "./sequence.security-label.ts";
|
|
9
|
+
|
|
10
|
+
const makeSequence = (): Sequence =>
|
|
11
|
+
new Sequence({
|
|
12
|
+
schema: "public",
|
|
13
|
+
name: "s1",
|
|
14
|
+
data_type: "bigint",
|
|
15
|
+
start_value: 1,
|
|
16
|
+
minimum_value: BigInt(1),
|
|
17
|
+
maximum_value: BigInt("9223372036854775807"),
|
|
18
|
+
increment: 1,
|
|
19
|
+
cycle_option: false,
|
|
20
|
+
cache_size: 1,
|
|
21
|
+
persistence: "p",
|
|
22
|
+
owned_by_schema: null,
|
|
23
|
+
owned_by_table: null,
|
|
24
|
+
owned_by_column: null,
|
|
25
|
+
comment: null,
|
|
26
|
+
privileges: [],
|
|
27
|
+
owner: "postgres",
|
|
28
|
+
} as SequenceProps);
|
|
29
|
+
|
|
30
|
+
describe("sequence.security-label", () => {
|
|
31
|
+
test("create serializes", async () => {
|
|
32
|
+
const sequence = makeSequence();
|
|
33
|
+
const change = new CreateSecurityLabelOnSequence({
|
|
34
|
+
sequence,
|
|
35
|
+
securityLabel: { provider: "dummy", label: "classified" },
|
|
36
|
+
});
|
|
37
|
+
expect(change.scope).toBe("security_label");
|
|
38
|
+
expect(change.creates).toEqual([
|
|
39
|
+
stableId.securityLabel(sequence.stableId, "dummy"),
|
|
40
|
+
]);
|
|
41
|
+
await assertValidSql(change.serialize());
|
|
42
|
+
expect(change.serialize()).toBe(
|
|
43
|
+
"SECURITY LABEL FOR dummy ON SEQUENCE public.s1 IS 'classified'",
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("drop serializes to IS NULL", async () => {
|
|
48
|
+
const sequence = makeSequence();
|
|
49
|
+
const change = new DropSecurityLabelOnSequence({
|
|
50
|
+
sequence,
|
|
51
|
+
securityLabel: { provider: "dummy", label: "x" },
|
|
52
|
+
});
|
|
53
|
+
await assertValidSql(change.serialize());
|
|
54
|
+
expect(change.serialize()).toBe(
|
|
55
|
+
"SECURITY LABEL FOR dummy ON SEQUENCE public.s1 IS NULL",
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { quoteLiteral } from "../../base.change.ts";
|
|
2
|
+
import type { SecurityLabelProps } from "../../security-label.types.ts";
|
|
3
|
+
import { stableId } from "../../utils.ts";
|
|
4
|
+
import type { Sequence } from "../sequence.model.ts";
|
|
5
|
+
import { CreateSequenceChange, DropSequenceChange } from "./sequence.base.ts";
|
|
6
|
+
|
|
7
|
+
export type SecurityLabelSequence =
|
|
8
|
+
| CreateSecurityLabelOnSequence
|
|
9
|
+
| DropSecurityLabelOnSequence;
|
|
10
|
+
|
|
11
|
+
export class CreateSecurityLabelOnSequence extends CreateSequenceChange {
|
|
12
|
+
public readonly sequence: Sequence;
|
|
13
|
+
public readonly securityLabel: SecurityLabelProps;
|
|
14
|
+
public readonly scope = "security_label" as const;
|
|
15
|
+
|
|
16
|
+
constructor(props: {
|
|
17
|
+
sequence: Sequence;
|
|
18
|
+
securityLabel: SecurityLabelProps;
|
|
19
|
+
}) {
|
|
20
|
+
super();
|
|
21
|
+
this.sequence = props.sequence;
|
|
22
|
+
this.securityLabel = props.securityLabel;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get creates() {
|
|
26
|
+
return [
|
|
27
|
+
stableId.securityLabel(
|
|
28
|
+
this.sequence.stableId,
|
|
29
|
+
this.securityLabel.provider,
|
|
30
|
+
),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get requires() {
|
|
35
|
+
return [this.sequence.stableId];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
serialize(): string {
|
|
39
|
+
return [
|
|
40
|
+
"SECURITY LABEL FOR",
|
|
41
|
+
this.securityLabel.provider,
|
|
42
|
+
"ON SEQUENCE",
|
|
43
|
+
`${this.sequence.schema}.${this.sequence.name}`,
|
|
44
|
+
"IS",
|
|
45
|
+
quoteLiteral(this.securityLabel.label),
|
|
46
|
+
].join(" ");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class DropSecurityLabelOnSequence extends DropSequenceChange {
|
|
51
|
+
public readonly sequence: Sequence;
|
|
52
|
+
public readonly securityLabel: SecurityLabelProps;
|
|
53
|
+
public readonly scope = "security_label" as const;
|
|
54
|
+
|
|
55
|
+
constructor(props: {
|
|
56
|
+
sequence: Sequence;
|
|
57
|
+
securityLabel: SecurityLabelProps;
|
|
58
|
+
}) {
|
|
59
|
+
super();
|
|
60
|
+
this.sequence = props.sequence;
|
|
61
|
+
this.securityLabel = props.securityLabel;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get drops() {
|
|
65
|
+
return [
|
|
66
|
+
stableId.securityLabel(
|
|
67
|
+
this.sequence.stableId,
|
|
68
|
+
this.securityLabel.provider,
|
|
69
|
+
),
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get requires() {
|
|
74
|
+
return [
|
|
75
|
+
stableId.securityLabel(
|
|
76
|
+
this.sequence.stableId,
|
|
77
|
+
this.securityLabel.provider,
|
|
78
|
+
),
|
|
79
|
+
this.sequence.stableId,
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
serialize(): string {
|
|
84
|
+
return [
|
|
85
|
+
"SECURITY LABEL FOR",
|
|
86
|
+
this.securityLabel.provider,
|
|
87
|
+
"ON SEQUENCE",
|
|
88
|
+
`${this.sequence.schema}.${this.sequence.name}`,
|
|
89
|
+
"IS NULL",
|
|
90
|
+
].join(" ");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { CommentSequence } from "./sequence.comment.ts";
|
|
|
3
3
|
import type { CreateSequence } from "./sequence.create.ts";
|
|
4
4
|
import type { DropSequence } from "./sequence.drop.ts";
|
|
5
5
|
import type { SequencePrivilege } from "./sequence.privilege.ts";
|
|
6
|
+
import type { SecurityLabelSequence } from "./sequence.security-label.ts";
|
|
6
7
|
|
|
7
8
|
/** Union of all sequence-related change variants (`objectType: "sequence"`). @category Change Types */
|
|
8
9
|
export type SequenceChange =
|
|
@@ -10,4 +11,5 @@ export type SequenceChange =
|
|
|
10
11
|
| CommentSequence
|
|
11
12
|
| CreateSequence
|
|
12
13
|
| DropSequence
|
|
13
|
-
| SequencePrivilege
|
|
14
|
+
| SequencePrivilege
|
|
15
|
+
| SecurityLabelSequence;
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
emitObjectPrivilegeChanges,
|
|
5
5
|
} from "../base.privilege-diff.ts";
|
|
6
6
|
import type { ObjectDiffContext } from "../diff-context.ts";
|
|
7
|
+
import { diffSecurityLabels } from "../security-label.types.ts";
|
|
7
8
|
import { AlterTableAlterColumnSetDefault } from "../table/changes/table.alter.ts";
|
|
8
9
|
import type { Table } from "../table/table.model.ts";
|
|
9
10
|
import { hasNonAlterableChanges } from "../utils.ts";
|
|
@@ -22,6 +23,10 @@ import {
|
|
|
22
23
|
RevokeGrantOptionSequencePrivileges,
|
|
23
24
|
RevokeSequencePrivileges,
|
|
24
25
|
} from "./changes/sequence.privilege.ts";
|
|
26
|
+
import {
|
|
27
|
+
CreateSecurityLabelOnSequence,
|
|
28
|
+
DropSecurityLabelOnSequence,
|
|
29
|
+
} from "./changes/sequence.security-label.ts";
|
|
25
30
|
import type { SequenceChange } from "./changes/sequence.types.ts";
|
|
26
31
|
import type { Sequence } from "./sequence.model.ts";
|
|
27
32
|
|
|
@@ -59,6 +64,14 @@ export function diffSequences(
|
|
|
59
64
|
if (createdSeq.comment !== null) {
|
|
60
65
|
changes.push(new CreateCommentOnSequence({ sequence: createdSeq }));
|
|
61
66
|
}
|
|
67
|
+
for (const label of createdSeq.security_labels) {
|
|
68
|
+
changes.push(
|
|
69
|
+
new CreateSecurityLabelOnSequence({
|
|
70
|
+
sequence: createdSeq,
|
|
71
|
+
securityLabel: label,
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
62
75
|
// If the created sequence is OWNED BY a column, emit an ALTER to set it
|
|
63
76
|
if (
|
|
64
77
|
createdSeq.owned_by_schema !== null &&
|
|
@@ -325,6 +338,26 @@ export function diffSequences(
|
|
|
325
338
|
}
|
|
326
339
|
}
|
|
327
340
|
|
|
341
|
+
// SECURITY LABELS
|
|
342
|
+
changes.push(
|
|
343
|
+
...diffSecurityLabels<
|
|
344
|
+
CreateSecurityLabelOnSequence | DropSecurityLabelOnSequence
|
|
345
|
+
>(
|
|
346
|
+
mainSequence.security_labels,
|
|
347
|
+
branchSequence.security_labels,
|
|
348
|
+
(securityLabel) =>
|
|
349
|
+
new CreateSecurityLabelOnSequence({
|
|
350
|
+
sequence: branchSequence,
|
|
351
|
+
securityLabel,
|
|
352
|
+
}),
|
|
353
|
+
(securityLabel) =>
|
|
354
|
+
new DropSecurityLabelOnSequence({
|
|
355
|
+
sequence: mainSequence,
|
|
356
|
+
securityLabel,
|
|
357
|
+
}),
|
|
358
|
+
),
|
|
359
|
+
);
|
|
360
|
+
|
|
328
361
|
// PRIVILEGES
|
|
329
362
|
// Filter out owner privileges - owner always has ALL privileges implicitly
|
|
330
363
|
// and shouldn't be compared. Use branch owner as the reference.
|
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
type PrivilegeProps,
|
|
7
7
|
privilegePropsSchema,
|
|
8
8
|
} from "../base.privilege-diff.ts";
|
|
9
|
+
import {
|
|
10
|
+
type SecurityLabelProps,
|
|
11
|
+
securityLabelPropsSchema,
|
|
12
|
+
} from "../security-label.types.ts";
|
|
9
13
|
|
|
10
14
|
const sequencePropsSchema = z.object({
|
|
11
15
|
schema: z.string(),
|
|
@@ -24,6 +28,7 @@ const sequencePropsSchema = z.object({
|
|
|
24
28
|
comment: z.string().nullable(),
|
|
25
29
|
privileges: z.array(privilegePropsSchema),
|
|
26
30
|
owner: z.string(),
|
|
31
|
+
security_labels: z.array(securityLabelPropsSchema).default([]).optional(),
|
|
27
32
|
});
|
|
28
33
|
|
|
29
34
|
type SequencePrivilegeProps = PrivilegeProps;
|
|
@@ -46,6 +51,7 @@ export class Sequence extends BasePgModel {
|
|
|
46
51
|
public readonly comment: SequenceProps["comment"];
|
|
47
52
|
public readonly privileges: SequencePrivilegeProps[];
|
|
48
53
|
public readonly owner: SequenceProps["owner"];
|
|
54
|
+
public readonly security_labels: SecurityLabelProps[];
|
|
49
55
|
|
|
50
56
|
constructor(props: SequenceProps) {
|
|
51
57
|
super();
|
|
@@ -69,6 +75,7 @@ export class Sequence extends BasePgModel {
|
|
|
69
75
|
this.comment = props.comment;
|
|
70
76
|
this.privileges = props.privileges;
|
|
71
77
|
this.owner = props.owner;
|
|
78
|
+
this.security_labels = props.security_labels ?? [];
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
get stableId(): `sequence:${string}` {
|
|
@@ -98,6 +105,7 @@ export class Sequence extends BasePgModel {
|
|
|
98
105
|
comment: this.comment,
|
|
99
106
|
privileges: this.privileges,
|
|
100
107
|
owner: this.owner,
|
|
108
|
+
security_labels: this.security_labels,
|
|
101
109
|
};
|
|
102
110
|
}
|
|
103
111
|
}
|
|
@@ -151,7 +159,20 @@ select
|
|
|
151
159
|
from lateral aclexplode(COALESCE(c.relacl, acldefault('S', c.relowner))) as x(grantor, grantee, privilege_type, is_grantable)
|
|
152
160
|
), '[]'
|
|
153
161
|
) as privileges,
|
|
154
|
-
c.relowner::regrole::text as owner
|
|
162
|
+
c.relowner::regrole::text as owner,
|
|
163
|
+
coalesce(
|
|
164
|
+
(
|
|
165
|
+
select json_agg(
|
|
166
|
+
json_build_object('provider', sl.provider, 'label', sl.label)
|
|
167
|
+
order by sl.provider
|
|
168
|
+
)
|
|
169
|
+
from pg_catalog.pg_seclabel sl
|
|
170
|
+
where sl.objoid = c.oid
|
|
171
|
+
and sl.classoid = 'pg_class'::regclass
|
|
172
|
+
and sl.objsubid = 0
|
|
173
|
+
),
|
|
174
|
+
'[]'::json
|
|
175
|
+
) as security_labels
|
|
155
176
|
from
|
|
156
177
|
pg_catalog.pg_class c
|
|
157
178
|
inner join pg_catalog.pg_sequence s on s.seqrelid = c.oid
|
|
@@ -3,7 +3,7 @@ import type { Subscription } from "../subscription.model.ts";
|
|
|
3
3
|
|
|
4
4
|
abstract class BaseSubscriptionChange extends BaseChange {
|
|
5
5
|
abstract readonly subscription: Subscription;
|
|
6
|
-
abstract readonly scope: "object" | "comment";
|
|
6
|
+
abstract readonly scope: "object" | "comment" | "security_label";
|
|
7
7
|
readonly objectType = "subscription" as const;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { quoteLiteral } from "../../base.change.ts";
|
|
2
|
+
import type { SecurityLabelProps } from "../../security-label.types.ts";
|
|
3
|
+
import { stableId } from "../../utils.ts";
|
|
4
|
+
import type { Subscription } from "../subscription.model.ts";
|
|
5
|
+
import {
|
|
6
|
+
CreateSubscriptionChange,
|
|
7
|
+
DropSubscriptionChange,
|
|
8
|
+
} from "./subscription.base.ts";
|
|
9
|
+
|
|
10
|
+
export type SecurityLabelSubscription =
|
|
11
|
+
| CreateSecurityLabelOnSubscription
|
|
12
|
+
| DropSecurityLabelOnSubscription;
|
|
13
|
+
|
|
14
|
+
export class CreateSecurityLabelOnSubscription extends CreateSubscriptionChange {
|
|
15
|
+
public readonly subscription: Subscription;
|
|
16
|
+
public readonly securityLabel: SecurityLabelProps;
|
|
17
|
+
public readonly scope = "security_label" as const;
|
|
18
|
+
|
|
19
|
+
constructor(props: {
|
|
20
|
+
subscription: Subscription;
|
|
21
|
+
securityLabel: SecurityLabelProps;
|
|
22
|
+
}) {
|
|
23
|
+
super();
|
|
24
|
+
this.subscription = props.subscription;
|
|
25
|
+
this.securityLabel = props.securityLabel;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get creates() {
|
|
29
|
+
return [
|
|
30
|
+
stableId.securityLabel(
|
|
31
|
+
this.subscription.stableId,
|
|
32
|
+
this.securityLabel.provider,
|
|
33
|
+
),
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get requires() {
|
|
38
|
+
return [this.subscription.stableId];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
serialize(): string {
|
|
42
|
+
return [
|
|
43
|
+
"SECURITY LABEL FOR",
|
|
44
|
+
this.securityLabel.provider,
|
|
45
|
+
"ON SUBSCRIPTION",
|
|
46
|
+
this.subscription.name,
|
|
47
|
+
"IS",
|
|
48
|
+
quoteLiteral(this.securityLabel.label),
|
|
49
|
+
].join(" ");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export class DropSecurityLabelOnSubscription extends DropSubscriptionChange {
|
|
54
|
+
public readonly subscription: Subscription;
|
|
55
|
+
public readonly securityLabel: SecurityLabelProps;
|
|
56
|
+
public readonly scope = "security_label" as const;
|
|
57
|
+
|
|
58
|
+
constructor(props: {
|
|
59
|
+
subscription: Subscription;
|
|
60
|
+
securityLabel: SecurityLabelProps;
|
|
61
|
+
}) {
|
|
62
|
+
super();
|
|
63
|
+
this.subscription = props.subscription;
|
|
64
|
+
this.securityLabel = props.securityLabel;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get drops() {
|
|
68
|
+
return [
|
|
69
|
+
stableId.securityLabel(
|
|
70
|
+
this.subscription.stableId,
|
|
71
|
+
this.securityLabel.provider,
|
|
72
|
+
),
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get requires() {
|
|
77
|
+
return [
|
|
78
|
+
stableId.securityLabel(
|
|
79
|
+
this.subscription.stableId,
|
|
80
|
+
this.securityLabel.provider,
|
|
81
|
+
),
|
|
82
|
+
this.subscription.stableId,
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
serialize(): string {
|
|
87
|
+
return [
|
|
88
|
+
"SECURITY LABEL FOR",
|
|
89
|
+
this.securityLabel.provider,
|
|
90
|
+
"ON SUBSCRIPTION",
|
|
91
|
+
this.subscription.name,
|
|
92
|
+
"IS NULL",
|
|
93
|
+
].join(" ");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
import type { CommentSubscription } from "./subscription.comment.ts";
|
|
10
10
|
import type { CreateSubscription } from "./subscription.create.ts";
|
|
11
11
|
import type { DropSubscription } from "./subscription.drop.ts";
|
|
12
|
+
import type { SecurityLabelSubscription } from "./subscription.security-label.ts";
|
|
12
13
|
|
|
13
14
|
/** Union of all subscription-related change variants (`objectType: "subscription"`). @category Change Types */
|
|
14
15
|
export type SubscriptionChange =
|
|
@@ -20,4 +21,5 @@ export type SubscriptionChange =
|
|
|
20
21
|
| AlterSubscriptionDisable
|
|
21
22
|
| AlterSubscriptionSetOptions
|
|
22
23
|
| AlterSubscriptionSetOwner
|
|
23
|
-
| CommentSubscription
|
|
24
|
+
| CommentSubscription
|
|
25
|
+
| SecurityLabelSubscription;
|