@engenty/wizards-runtime 0.19.1 → 0.20.1
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/apps/runtime/dist/agents/architect.js +4 -4
- package/apps/runtime/dist/agents/studio-assistant.js +2 -31
- package/apps/runtime/dist/app.js +4 -4
- package/apps/runtime/dist/assistant/knows.js +2 -2
- package/apps/runtime/dist/auth/index.js +1 -1
- package/apps/runtime/dist/authoring/example.js +1 -1
- package/apps/runtime/dist/authoring/guide.js +35 -6
- package/apps/runtime/dist/broker/account.js +85 -16
- package/apps/runtime/dist/broker/call.js +137 -37
- package/apps/runtime/dist/broker/log.js +19 -5
- package/apps/runtime/dist/broker/rwx.js +12 -9
- package/apps/runtime/dist/cli/main.js +2 -0
- package/apps/runtime/dist/connectors/index.js +52 -11
- package/apps/runtime/dist/connectors/person-connections.js +279 -0
- package/apps/runtime/dist/connectors/person-sign-ins.js +74 -3
- package/apps/runtime/dist/connectors/same-service.js +14 -0
- package/apps/runtime/dist/connectors/space-choice.js +116 -0
- package/apps/runtime/dist/connectors/space-connections.js +40 -2
- package/apps/runtime/dist/db/client.js +8 -0
- package/apps/runtime/dist/db/kept-accounts.js +88 -0
- package/apps/runtime/dist/db/migrations/tenant/0075_person_connection.sql +25 -0
- package/apps/runtime/dist/db/migrations/tenant/0076_clients_in_spaces.sql +28 -0
- package/apps/runtime/dist/db/migrations/tenant/0077_client_spaces_at_root.sql +21 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0075_snapshot.json +7859 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0076_snapshot.json +7859 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0077_snapshot.json +7859 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +21 -0
- package/apps/runtime/dist/db/schema.js +67 -16
- package/apps/runtime/dist/docs/dev/api.md +8 -8
- package/apps/runtime/dist/docs/dev/wizard-format/index.md +3 -1
- package/apps/runtime/dist/docs/user-guide/command-line.md +2 -1
- package/apps/runtime/dist/elements/caller.js +1 -1
- package/apps/runtime/dist/elements/knowledge.js +5 -5
- package/apps/runtime/dist/elements/wizards.js +7 -11
- package/apps/runtime/dist/engine/notices.js +13 -1
- package/apps/runtime/dist/engine/requirements.js +116 -3
- package/apps/runtime/dist/engine/run-needs.js +58 -0
- package/apps/runtime/dist/engine/runner.js +209 -16
- package/apps/runtime/dist/engine/starts.js +9 -0
- package/apps/runtime/dist/engine/types.js +5 -1
- package/apps/runtime/dist/harness/claude.js +3 -1
- package/apps/runtime/dist/manage.js +1 -1
- package/apps/runtime/dist/mcp/tools.js +3 -3
- package/apps/runtime/dist/plugins/runs.js +2 -1
- package/apps/runtime/dist/prompts/authoring.md +13 -3
- package/apps/runtime/dist/prompts/goose.md +0 -5
- package/apps/runtime/dist/routes/api.js +9 -4
- package/apps/runtime/dist/routes/client-contract.js +2 -2
- package/apps/runtime/dist/routes/client-spaces.js +1 -16
- package/apps/runtime/dist/routes/connections.js +6 -1
- package/apps/runtime/dist/routes/marketplace.js +27 -7
- package/apps/runtime/dist/routes/plugins.js +1 -1
- package/apps/runtime/dist/routes/runs.js +157 -11
- package/apps/runtime/dist/routes/studio.js +42 -5
- package/apps/runtime/dist/services/client-portal.js +58 -49
- package/apps/runtime/dist/services/client-spaces.js +57 -125
- package/apps/runtime/dist/services/links.js +3 -3
- package/apps/runtime/dist/services/marketplace.js +6 -2
- package/apps/runtime/dist/services/members-studio.js +1 -1
- package/apps/runtime/dist/services/query-vectors.js +1 -1
- package/apps/runtime/dist/services/runs.js +19 -20
- package/apps/runtime/dist/services/space-parent.js +4 -11
- package/apps/runtime/dist/services/spaces.js +56 -47
- package/apps/runtime/dist/services/work-ai.js +3 -3
- package/apps/runtime/dist/store/index.js +28 -8
- package/apps/runtime/dist/store/shared-lists.js +2 -2
- package/apps/runtime/dist/sync/hub.js +9 -5
- package/apps/runtime/dist/tools/connector.js +4 -2
- package/apps/web/dist/assets/{AboutDialog-BUWu36Mb.js → AboutDialog-BFi6vOyJ.js} +1 -1
- package/apps/web/dist/assets/{BlockEditor-1-EvUIta.js → BlockEditor-C44bI_ih.js} +1 -1
- package/apps/web/dist/assets/{Bundle-RNkjBwAL.js → Bundle-DZyQ1FP7.js} +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-DAX03vkY.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-C_ZZLRZT.js → ChangelogDialog-CdchxTO8.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BEJKIMd0.js → CodeEditor-BRufUwu0.js} +1 -1
- package/apps/web/dist/assets/ConnectorsSection-CNpieoyT.js +1 -0
- package/apps/web/dist/assets/EditorPage-CxABBMqo.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-ptI86Ogs.js → FlowPreview-aj58c-gH.js} +1 -1
- package/apps/web/dist/assets/{LangSwitch-BNa_H8AR.js → LangSwitch-BNkytlus.js} +1 -1
- package/apps/web/dist/assets/Marketplace-D3hdvrkz.js +2 -0
- package/apps/web/dist/assets/NewWizardChannels-0aZoziks.js +1 -0
- package/apps/web/dist/assets/NewWizardPage-Bn2BPaUB.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-DwF6KdQy.js +1 -0
- package/apps/web/dist/assets/ProtocolSection-Ce5LBBzL.js +1 -0
- package/apps/web/dist/assets/PublicRunner-Bp4DxTrD.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-YF0RkR7P.js → ReadOnly-BFVaKM3w.js} +1 -1
- package/apps/web/dist/assets/{Results-DJRLiVo0.js → Results--mJFsNH2.js} +1 -1
- package/apps/web/dist/assets/{RunDrawer-CSpTNJp-.js → RunDrawer-DtbxGBIm.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-Cytcl_9w.js +2 -0
- package/apps/web/dist/assets/SetupPage-B5zCrIKT.js +1 -0
- package/apps/web/dist/assets/{SharePage-OiKEnmL1.js → SharePage-CgQp_PT6.js} +1 -1
- package/apps/web/dist/assets/SkillEditor-ARx8QPGp.js +1 -0
- package/apps/web/dist/assets/Skills-frfXXEcF.js +9 -0
- package/apps/web/dist/assets/SpacePage-Bd5-wBUc.js +2 -0
- package/apps/web/dist/assets/StudioHome-DzVpWMrD.js +1 -0
- package/apps/web/dist/assets/TableEditor-CRhc6jI6.js +7 -0
- package/apps/web/dist/assets/{UpdateCheck-BpdsLIOc.js → UpdateCheck-BEruHgs0.js} +2 -2
- package/apps/web/dist/assets/{brand-ByQY-UcL.js → brand-DKuVyYhH.js} +1 -1
- package/apps/web/dist/assets/changelog-BgFhbmMa.js +1 -0
- package/apps/web/dist/assets/{code-editor-B8zG80PA.js → code-editor-BLwDuQLI.js} +2 -2
- package/apps/web/dist/assets/host-B2ZzDrkc.js +69 -0
- package/apps/web/dist/assets/i18n-Dyi0kvaA.js +55 -0
- package/apps/web/dist/assets/index-C1m_S1ls.js +102 -0
- package/apps/web/dist/assets/{index-D18zQ05f.css → index-CduFlFCp.css} +1 -1
- package/apps/web/dist/assets/{read-aloud-spC7eEBp.js → read-aloud-DGS8mWgC.js} +1 -1
- package/apps/web/dist/assets/session-EIDP3Wzc.js +1 -0
- package/apps/web/dist/assets/theme-B46aPLtX.js +14 -0
- package/apps/web/dist/assets/ui-DSgksc1H.js +16 -0
- package/apps/web/dist/assets/{useMutation-CoEdB_9_.js → useMutation-fT44ij_b.js} +1 -1
- package/apps/web/dist/assets/{viewers-BmcrgvXX.js → viewers-DvA5VsXw.js} +2 -2
- package/apps/web/dist/index.html +18 -13
- package/apps/web/dist/mcp/flow.html +62 -62
- package/bin/bot.mjs +1120 -0
- package/bin/wizards.mjs +6 -0
- package/node_modules/@engenty/wizards-shared/dist/catalog-prompt.js +2 -2
- package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +67 -0
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +10324 -7
- package/node_modules/@engenty/wizards-shared/dist/definition.js +32 -6
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +17 -23
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +17 -23
- package/node_modules/@engenty/wizards-shared/dist/json-schema.js +3 -3
- package/node_modules/@engenty/wizards-shared/dist/marketplace-search.js +7 -1
- package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +9 -2
- package/node_modules/@engenty/wizards-shared/dist/page-data.d.ts +72 -0
- package/node_modules/@engenty/wizards-shared/dist/page-data.js +5 -0
- package/node_modules/@engenty/wizards-shared/dist/page-look.d.ts +17 -0
- package/node_modules/@engenty/wizards-shared/dist/page-look.js +118 -0
- package/node_modules/@engenty/wizards-shared/dist/page-styles.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/page-styles.js +98 -0
- package/node_modules/@engenty/wizards-shared/dist/page-texts.d.ts +36 -0
- package/node_modules/@engenty/wizards-shared/dist/page-texts.js +119 -0
- package/node_modules/@engenty/wizards-shared/dist/requires.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +54 -1
- package/node_modules/@engenty/wizards-shared/dist/run.js +23 -0
- package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +27 -1
- package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +26 -0
- package/node_modules/@engenty/wizards-shared/dist/store.d.ts +24 -1
- package/node_modules/@engenty/wizards-shared/dist/transition.d.ts +2 -1
- package/node_modules/@engenty/wizards-shared/dist/transition.js +5 -1
- package/node_modules/@engenty/wizards-shared/dist/wizard-text.js +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-fgTP28Mn.js +0 -2
- package/apps/web/dist/assets/ConnectorsSection-iLrduYak.js +0 -1
- package/apps/web/dist/assets/EditorPage-CRZte0O1.js +0 -3
- package/apps/web/dist/assets/Marketplace-9aGWG2pJ.js +0 -2
- package/apps/web/dist/assets/NewWizardChannels-BFDm9vCT.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-ueGFlLDo.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-DtDd7k_O.js +0 -1
- package/apps/web/dist/assets/PreviewPane-CEltrf_-.js +0 -7
- package/apps/web/dist/assets/ProtocolSection-Bb3c44Te.js +0 -1
- package/apps/web/dist/assets/PublicRunner-BaTg24s3.js +0 -1
- package/apps/web/dist/assets/SettingsPage--_ap3omw.js +0 -2
- package/apps/web/dist/assets/SetupPage-ELKHbmnE.js +0 -1
- package/apps/web/dist/assets/SkillEditor-C1_zwNOQ.js +0 -1
- package/apps/web/dist/assets/Skills-_pLGtOjH.js +0 -9
- package/apps/web/dist/assets/SpacePage-r4EbxEJe.js +0 -2
- package/apps/web/dist/assets/StudioHome-CwvxI29m.js +0 -1
- package/apps/web/dist/assets/changelog-Dt-V-BKp.js +0 -1
- package/apps/web/dist/assets/host-Ckjz94Ea.js +0 -69
- package/apps/web/dist/assets/i18n-ClCOlfx2.js +0 -55
- package/apps/web/dist/assets/index-BHKh0A9F.js +0 -10
- package/apps/web/dist/assets/runners-DNqzwMQ0.js +0 -1
- package/apps/web/dist/assets/session-Dd9duhPc.js +0 -1
- package/apps/web/dist/assets/theme-DumM6FI_.js +0 -14
- package/apps/web/dist/assets/ui-BjhZhw8x.js +0 -16
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { and, eq, inArray, like } from "drizzle-orm";
|
|
2
|
+
import { nanoid } from "nanoid";
|
|
3
|
+
import { sameService } from "../connectors/same-service.js";
|
|
4
|
+
import * as schema from "./schema.js";
|
|
5
|
+
/*
|
|
6
|
+
* The accounts wizards kept in their store (`store_secret`, slot `connection:<need>`) become
|
|
7
|
+
* connections of their holder (docs/plans/run-connections.md, step 1): one per holder, service
|
|
8
|
+
* and address, and the wizard remembers it as its choice for that need. The store's rows go. The
|
|
9
|
+
* sealed secret moves as it is: nothing is unsealed.
|
|
10
|
+
*
|
|
11
|
+
* Runs while a tenant's database opens, right after its migrations (`db/client.ts`), so a tenant
|
|
12
|
+
* converts when its schema moves. One write transaction: a second process opening the same
|
|
13
|
+
* tenant waits for it and then finds nothing left. A tenant with nothing kept costs one query.
|
|
14
|
+
*/
|
|
15
|
+
const PREFIX = "connection:";
|
|
16
|
+
export async function moveKeptAccounts(db) {
|
|
17
|
+
const any = await db
|
|
18
|
+
.select({ id: schema.storeSecret.id })
|
|
19
|
+
.from(schema.storeSecret)
|
|
20
|
+
.where(like(schema.storeSecret.slot, `${PREFIX}%`))
|
|
21
|
+
.limit(1);
|
|
22
|
+
if (!any.length) {
|
|
23
|
+
return { accounts: 0, reused: 0, choices: 0 };
|
|
24
|
+
}
|
|
25
|
+
return db.transaction(move);
|
|
26
|
+
}
|
|
27
|
+
async function move(tx) {
|
|
28
|
+
const counts = { accounts: 0, reused: 0, choices: 0 };
|
|
29
|
+
// Read again inside the transaction: another process may have moved them meanwhile.
|
|
30
|
+
const rows = await tx.query.storeSecret.findMany({
|
|
31
|
+
where: like(schema.storeSecret.slot, `${PREFIX}%`),
|
|
32
|
+
orderBy: (s, { desc }) => [desc(s.updatedAt)],
|
|
33
|
+
});
|
|
34
|
+
/** The connection each holder, service and address became; the newest secret makes it. */
|
|
35
|
+
const made = new Map();
|
|
36
|
+
for (const row of rows) {
|
|
37
|
+
const key = `${row.holder}\n${[...sameService(row.provider)].sort().join("|")}\n${row.label}`;
|
|
38
|
+
let id = made.get(key);
|
|
39
|
+
if (!id) {
|
|
40
|
+
id = await existing(tx, row.holder, row.provider, row.label);
|
|
41
|
+
if (id) {
|
|
42
|
+
counts.reused++;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const [inserted] = await tx
|
|
46
|
+
.insert(schema.personConnection)
|
|
47
|
+
.values({
|
|
48
|
+
id: nanoid(14),
|
|
49
|
+
holder: row.holder,
|
|
50
|
+
connectorId: row.provider,
|
|
51
|
+
label: row.label,
|
|
52
|
+
// Sealed as the store sealed it: the same key opens it.
|
|
53
|
+
secret: row.data,
|
|
54
|
+
createdAt: row.createdAt,
|
|
55
|
+
updatedAt: row.updatedAt,
|
|
56
|
+
})
|
|
57
|
+
.onConflictDoNothing()
|
|
58
|
+
.returning({ id: schema.personConnection.id });
|
|
59
|
+
id = inserted?.id ?? (await existing(tx, row.holder, row.provider, row.label));
|
|
60
|
+
if (!id) {
|
|
61
|
+
throw new Error(`No connection for ${row.holder}'s ${row.provider} account.`);
|
|
62
|
+
}
|
|
63
|
+
counts.accounts++;
|
|
64
|
+
}
|
|
65
|
+
made.set(key, id);
|
|
66
|
+
}
|
|
67
|
+
await tx
|
|
68
|
+
.insert(schema.connectionChoice)
|
|
69
|
+
.values({
|
|
70
|
+
wizardId: row.wizardId,
|
|
71
|
+
need: row.slot.slice(PREFIX.length),
|
|
72
|
+
holder: row.holder,
|
|
73
|
+
personConnectionId: id,
|
|
74
|
+
chosenAt: row.updatedAt,
|
|
75
|
+
})
|
|
76
|
+
.onConflictDoNothing();
|
|
77
|
+
await tx.delete(schema.storeSecret).where(eq(schema.storeSecret.id, row.id));
|
|
78
|
+
counts.choices++;
|
|
79
|
+
}
|
|
80
|
+
return counts;
|
|
81
|
+
}
|
|
82
|
+
async function existing(tx, holder, connectorId, label) {
|
|
83
|
+
const found = await tx.query.personConnection.findFirst({
|
|
84
|
+
where: and(eq(schema.personConnection.holder, holder), inArray(schema.personConnection.connectorId, sameService(connectorId)), eq(schema.personConnection.label, label)),
|
|
85
|
+
columns: { id: true },
|
|
86
|
+
});
|
|
87
|
+
return found?.id;
|
|
88
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
CREATE TABLE `connection_choice` (
|
|
2
|
+
`wizard_id` text NOT NULL,
|
|
3
|
+
`need` text NOT NULL,
|
|
4
|
+
`holder` text NOT NULL,
|
|
5
|
+
`person_connection_id` text,
|
|
6
|
+
`space_connection_id` text,
|
|
7
|
+
`chosen_at` integer DEFAULT (unixepoch() * 1000) NOT NULL,
|
|
8
|
+
PRIMARY KEY(`wizard_id`, `need`, `holder`),
|
|
9
|
+
FOREIGN KEY (`wizard_id`) REFERENCES `wizard`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
10
|
+
FOREIGN KEY (`person_connection_id`) REFERENCES `person_connection`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
11
|
+
FOREIGN KEY (`space_connection_id`) REFERENCES `space_connection`(`id`) ON UPDATE no action ON DELETE cascade
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE INDEX `connection_choice_person` ON `connection_choice` (`person_connection_id`);--> statement-breakpoint
|
|
15
|
+
CREATE TABLE `person_connection` (
|
|
16
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
17
|
+
`holder` text NOT NULL,
|
|
18
|
+
`connector_id` text NOT NULL,
|
|
19
|
+
`label` text NOT NULL,
|
|
20
|
+
`secret` text NOT NULL,
|
|
21
|
+
`created_at` integer DEFAULT (unixepoch() * 1000) NOT NULL,
|
|
22
|
+
`updated_at` integer DEFAULT (unixepoch() * 1000) NOT NULL
|
|
23
|
+
);
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
CREATE UNIQUE INDEX `person_connection_account` ON `person_connection` (`holder`,`connector_id`,`label`);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
-- A client space stands beside the team spaces (docs/plans/org-spaces.md): a client space of
|
|
2
|
+
-- before, under a team space, moves under the organization's own space, its root (the oldest space
|
|
3
|
+
-- made here with no parent), with its clients still in it. It wears the organization's brand and
|
|
4
|
+
-- Info, as it did.
|
|
5
|
+
UPDATE `space` SET
|
|
6
|
+
`access` = 'all',
|
|
7
|
+
`brand_from` = 'root',
|
|
8
|
+
`parent_id` = coalesce((
|
|
9
|
+
SELECT r.`id` FROM `space` AS r
|
|
10
|
+
WHERE r.`tenant_id` = `space`.`tenant_id` AND r.`parent_id` IS NULL AND r.`kind` = 'space' AND r.`origin` IS NULL
|
|
11
|
+
ORDER BY r.`created_at` LIMIT 1
|
|
12
|
+
), `parent_id`),
|
|
13
|
+
`brand` = coalesce((
|
|
14
|
+
SELECT r.`brand` FROM `space` AS r
|
|
15
|
+
WHERE r.`tenant_id` = `space`.`tenant_id` AND r.`parent_id` IS NULL AND r.`kind` = 'space' AND r.`origin` IS NULL
|
|
16
|
+
ORDER BY r.`created_at` LIMIT 1
|
|
17
|
+
), `brand`),
|
|
18
|
+
`facts` = coalesce((
|
|
19
|
+
SELECT r.`facts` FROM `space` AS r
|
|
20
|
+
WHERE r.`tenant_id` = `space`.`tenant_id` AND r.`parent_id` IS NULL AND r.`kind` = 'space' AND r.`origin` IS NULL
|
|
21
|
+
ORDER BY r.`created_at` LIMIT 1
|
|
22
|
+
), `facts`),
|
|
23
|
+
`themes` = coalesce((
|
|
24
|
+
SELECT r.`themes` FROM `space` AS r
|
|
25
|
+
WHERE r.`tenant_id` = `space`.`tenant_id` AND r.`parent_id` IS NULL AND r.`kind` = 'space' AND r.`origin` IS NULL
|
|
26
|
+
ORDER BY r.`created_at` LIMIT 1
|
|
27
|
+
), `themes`)
|
|
28
|
+
WHERE `kind` = 'client';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- A client is a client space (docs/plans/org-spaces.md): a space under the organization's root
|
|
2
|
+
-- with clients in it is one, its own kind again. Its clients work with its data, run its wizards
|
|
3
|
+
-- and skills, as in a client space before; what of the root they reach, the root opens item by
|
|
4
|
+
-- item.
|
|
5
|
+
UPDATE `space` SET `kind` = 'client', `access` = 'all'
|
|
6
|
+
WHERE `kind` = 'space' AND `parent_id` IS NOT NULL AND EXISTS (
|
|
7
|
+
SELECT 1 FROM `space_member` AS m WHERE m.`space_id` = `space`.`id` AND m.`role` = 'client'
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
INSERT OR IGNORE INTO `rwx_rule` (`id`, `tenant_id`, `space_id`, `subject_kind`, `subject_id`, `resource_kind`, `resource_id`, `r`, `w`, `x`, `created_by`)
|
|
11
|
+
SELECT lower(hex(randomblob(6))), s.`tenant_id`, s.`id`, 'role', 'client', v.kind, '*', v.r, v.w, v.x, 'seed'
|
|
12
|
+
FROM `space` AS s
|
|
13
|
+
CROSS JOIN (
|
|
14
|
+
SELECT 'document' AS kind, 'allow' AS r, 'allow' AS w, NULL AS x
|
|
15
|
+
UNION ALL SELECT 'table', 'allow', 'allow', NULL
|
|
16
|
+
UNION ALL SELECT 'page', 'allow', 'allow', NULL
|
|
17
|
+
UNION ALL SELECT 'wizard', 'allow', NULL, 'allow'
|
|
18
|
+
) AS v
|
|
19
|
+
WHERE s.`kind` = 'client' AND EXISTS (
|
|
20
|
+
SELECT 1 FROM `rwx_rule` AS e WHERE e.`space_id` = s.`id`
|
|
21
|
+
);
|