@wirechunk/cli 0.0.3 → 0.0.4
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/build/main.js
CHANGED
|
@@ -24956,18 +24956,12 @@ const bootstrap = async (opts, env2) => {
|
|
|
24956
24956
|
} else {
|
|
24957
24957
|
emailSendFrom = `site@${adminSiteDomain}`;
|
|
24958
24958
|
}
|
|
24959
|
-
const adminSiteName = `${name} Admin`;
|
|
24960
24959
|
await db.transaction(async (db2) => {
|
|
24961
24960
|
await db2.query(
|
|
24962
24961
|
distExports$1.sql.type(
|
|
24963
24962
|
voidSelectSchema
|
|
24964
24963
|
)`insert into "Platforms" ("id", "handle", "name", "defaultFormFormattedDataTemplate", "defaultFormNotificationEmailBodyTemplate", "emailSendFromAddress") values (${platformId}, ${handle}, ${name}, ${defaultFormattedDataTemplate}, ${defaultNotificationEmailBodyTemplate}, ${emailSendFrom})`
|
|
24965
24964
|
);
|
|
24966
|
-
await db2.query(
|
|
24967
|
-
distExports$1.sql.type(
|
|
24968
|
-
voidSelectSchema
|
|
24969
|
-
)`insert into "Sites" ("platformId", "domain", "name") values (${platformId}, ${adminSiteDomain}, ${adminSiteName})`
|
|
24970
|
-
);
|
|
24971
24965
|
});
|
|
24972
24966
|
console.log(`Created platform ${name} with handle ${handle} (ID ${platformId})`);
|
|
24973
24967
|
};
|
|
@@ -25255,8 +25249,8 @@ const numberExpressionSchema = {
|
|
|
25255
25249
|
const $schema$8 = "https://json-schema.org/draft/2020-12/schema";
|
|
25256
25250
|
const $id$9 = "/expressions/string-expression.json";
|
|
25257
25251
|
const title$8 = "StringExpression";
|
|
25258
|
-
const oneOf$1 = [{ "$ref": "#/$defs/eventSourceComponentName" }, { "$ref": "#/$defs/eventSourceComponentType" }, { "$ref": "#/$defs/featureTag" }, { "$ref": "#/$defs/inputChangeEventStringValue" }, { "$ref": "#/$defs/inputDataString" }, { "$ref": "#/$defs/propsString" }, { "$ref": "#/$defs/stringLiteral" }, { "$ref": "#/$defs/userEmail" }, { "$ref": "#/$defs/userRole" }];
|
|
25259
|
-
const $defs$3 = { "eventSourceComponentName": { "type": "object", "properties": { "operator": { "const": "eventSourceComponentName" } }, "required": ["operator"] }, "eventSourceComponentType": { "type": "object", "properties": { "operator": { "const": "eventSourceComponentType" } }, "required": ["operator"] }, "featureTag": { "type": "object", "properties": { "operator": { "const": "featureTag" }, "tag": { "type": "string" } }, "required": ["operator", "tag"] }, "inputChangeEventStringValue": { "type": "object", "properties": { "operator": { "const": "inputChangeEventStringValue" } }, "required": ["operator"] }, "inputDataString": { "type": "object", "properties": { "operator": { "const": "inputDataString" }, "fieldKey": { "type": "string" } }, "required": ["operator", "fieldKey"] }, "propsString": { "type": "object", "properties": { "operator": { "const": "propsString" }, "prop": { "type": "string" } }, "required": ["operator", "prop"] }, "stringLiteral": { "type": "object", "properties": { "operator": { "const": "stringLiteral" }, "value": { "type": "string" } }, "required": ["operator", "value"] }, "userEmail": { "type": "object", "properties": { "operator": { "const": "userEmail" } }, "required": ["operator"] }, "userRole": { "type": "object", "properties": { "operator": { "const": "userRole" } }, "required": ["operator"] } };
|
|
25252
|
+
const oneOf$1 = [{ "$ref": "#/$defs/eventSourceComponentName" }, { "$ref": "#/$defs/eventSourceComponentType" }, { "$ref": "#/$defs/featureTag" }, { "$ref": "#/$defs/inputChangeEventStringValue" }, { "$ref": "#/$defs/inputDataString" }, { "$ref": "#/$defs/propsString" }, { "$ref": "#/$defs/stringLiteral" }, { "$ref": "#/$defs/userEmail" }, { "$ref": "#/$defs/userOrgId" }, { "$ref": "#/$defs/userRole" }];
|
|
25253
|
+
const $defs$3 = { "eventSourceComponentName": { "type": "object", "properties": { "operator": { "const": "eventSourceComponentName" } }, "required": ["operator"] }, "eventSourceComponentType": { "type": "object", "properties": { "operator": { "const": "eventSourceComponentType" } }, "required": ["operator"] }, "featureTag": { "type": "object", "properties": { "operator": { "const": "featureTag" }, "tag": { "type": "string" } }, "required": ["operator", "tag"] }, "inputChangeEventStringValue": { "type": "object", "properties": { "operator": { "const": "inputChangeEventStringValue" } }, "required": ["operator"] }, "inputDataString": { "type": "object", "properties": { "operator": { "const": "inputDataString" }, "fieldKey": { "type": "string" } }, "required": ["operator", "fieldKey"] }, "propsString": { "type": "object", "properties": { "operator": { "const": "propsString" }, "prop": { "type": "string" } }, "required": ["operator", "prop"] }, "stringLiteral": { "type": "object", "properties": { "operator": { "const": "stringLiteral" }, "value": { "type": "string" } }, "required": ["operator", "value"] }, "userEmail": { "type": "object", "properties": { "operator": { "const": "userEmail" } }, "required": ["operator"] }, "userOrgId": { "type": "object", "properties": { "operator": { "const": "userOrgId" } }, "required": ["operator"] }, "userRole": { "type": "object", "properties": { "operator": { "const": "userRole" } }, "required": ["operator"] } };
|
|
25260
25254
|
const stringExpressionSchema = {
|
|
25261
25255
|
$schema: $schema$8,
|
|
25262
25256
|
$id: $id$9,
|
|
@@ -60991,82 +60985,180 @@ const createUser = async (opts, env2) => {
|
|
|
60991
60985
|
process.exit(1);
|
|
60992
60986
|
}
|
|
60993
60987
|
};
|
|
60994
|
-
const
|
|
60995
|
-
|
|
60996
|
-
|
|
60997
|
-
|
|
60998
|
-
|
|
60999
|
-
|
|
61000
|
-
|
|
61001
|
-
|
|
61002
|
-
|
|
61003
|
-
|
|
61004
|
-
|
|
61005
|
-
|
|
61006
|
-
|
|
61007
|
-
|
|
61008
|
-
|
|
61009
|
-
|
|
61010
|
-
|
|
61011
|
-
|
|
61012
|
-
|
|
61013
|
-
|
|
61014
|
-
|
|
61015
|
-
|
|
61016
|
-
|
|
61017
|
-
|
|
61018
|
-
|
|
61019
|
-
|
|
61020
|
-
|
|
61021
|
-
|
|
61022
|
-
|
|
61023
|
-
|
|
61024
|
-
|
|
61025
|
-
|
|
61026
|
-
|
|
61027
|
-
|
|
61028
|
-
|
|
61029
|
-
|
|
61030
|
-
|
|
61031
|
-
|
|
61032
|
-
|
|
61033
|
-
|
|
61034
|
-
|
|
61035
|
-
|
|
61036
|
-
|
|
61037
|
-
|
|
61038
|
-
|
|
61039
|
-
|
|
61040
|
-
|
|
61041
|
-
|
|
61042
|
-
|
|
61043
|
-
|
|
61044
|
-
|
|
61045
|
-
|
|
61046
|
-
|
|
61047
|
-
|
|
61048
|
-
|
|
61049
|
-
|
|
61050
|
-
|
|
61051
|
-
|
|
61052
|
-
|
|
61053
|
-
|
|
61054
|
-
|
|
61055
|
-
|
|
61056
|
-
|
|
61057
|
-
|
|
61058
|
-
|
|
61059
|
-
|
|
61060
|
-
|
|
60988
|
+
const permissionExtensionCreate = {
|
|
60989
|
+
object: "Extension",
|
|
60990
|
+
action: "create"
|
|
60991
|
+
};
|
|
60992
|
+
const permissionExtensionCreateVersion = {
|
|
60993
|
+
object: "Extension",
|
|
60994
|
+
action: "createVersion"
|
|
60995
|
+
};
|
|
60996
|
+
const permissionSiteCreate = {
|
|
60997
|
+
object: "Site",
|
|
60998
|
+
action: "create"
|
|
60999
|
+
};
|
|
61000
|
+
const permissionTemplateCreate = {
|
|
61001
|
+
object: "Template",
|
|
61002
|
+
action: "create"
|
|
61003
|
+
};
|
|
61004
|
+
const permissionUserCreate = {
|
|
61005
|
+
object: "User",
|
|
61006
|
+
action: "create"
|
|
61007
|
+
};
|
|
61008
|
+
const permissionPlatformEdit = {
|
|
61009
|
+
object: "Platform",
|
|
61010
|
+
action: "edit"
|
|
61011
|
+
};
|
|
61012
|
+
const permissionComponentEdit = {
|
|
61013
|
+
object: "Component",
|
|
61014
|
+
action: "edit"
|
|
61015
|
+
};
|
|
61016
|
+
const permissionCourseEdit = {
|
|
61017
|
+
object: "Course",
|
|
61018
|
+
action: "edit"
|
|
61019
|
+
};
|
|
61020
|
+
const permissionCustomComponentEdit = {
|
|
61021
|
+
object: "CustomComponent",
|
|
61022
|
+
action: "edit"
|
|
61023
|
+
};
|
|
61024
|
+
const permissionCustomFieldEdit = {
|
|
61025
|
+
object: "CustomField",
|
|
61026
|
+
action: "edit"
|
|
61027
|
+
};
|
|
61028
|
+
const permissionCustomerSiteEdit = {
|
|
61029
|
+
object: "CustomerSite",
|
|
61030
|
+
action: "edit"
|
|
61031
|
+
};
|
|
61032
|
+
const permissionExtensionEdit = {
|
|
61033
|
+
object: "Extension",
|
|
61034
|
+
action: "edit"
|
|
61035
|
+
};
|
|
61036
|
+
const permissionHelpTicketEditStatus = {
|
|
61037
|
+
object: "HelpTicket",
|
|
61038
|
+
action: "editStatus"
|
|
61039
|
+
};
|
|
61040
|
+
const permissionPlatformSiteEdit = {
|
|
61041
|
+
object: "PlatformSite",
|
|
61042
|
+
action: "edit"
|
|
61043
|
+
};
|
|
61044
|
+
const permissionSequenceEdit = {
|
|
61045
|
+
object: "Sequence",
|
|
61046
|
+
action: "edit"
|
|
61047
|
+
};
|
|
61048
|
+
const permissionSequenceUserEdit = {
|
|
61049
|
+
object: "SequenceUser",
|
|
61050
|
+
action: "edit"
|
|
61051
|
+
};
|
|
61052
|
+
const permissionSiteEdit = {
|
|
61053
|
+
object: "Site",
|
|
61054
|
+
action: "edit"
|
|
61055
|
+
};
|
|
61056
|
+
const permissionSiteEditDomain = {
|
|
61057
|
+
object: "Site",
|
|
61058
|
+
action: "editDomain"
|
|
61059
|
+
};
|
|
61060
|
+
const permissionSiteEditTls = {
|
|
61061
|
+
object: "Site",
|
|
61062
|
+
action: "editTls"
|
|
61061
61063
|
};
|
|
61062
|
-
const
|
|
61064
|
+
const permissionSubscriptionEdit = {
|
|
61065
|
+
object: "Subscription",
|
|
61066
|
+
action: "edit"
|
|
61067
|
+
};
|
|
61068
|
+
const permissionTemplateEdit = {
|
|
61069
|
+
object: "Template",
|
|
61070
|
+
action: "edit"
|
|
61071
|
+
};
|
|
61072
|
+
const permissionUserEditEmail = {
|
|
61073
|
+
object: "User",
|
|
61074
|
+
action: "editEmail"
|
|
61075
|
+
};
|
|
61076
|
+
const permissionUserEditOrg = {
|
|
61077
|
+
object: "User",
|
|
61078
|
+
action: "editOrg"
|
|
61079
|
+
};
|
|
61080
|
+
const permissionUserEditStatus = {
|
|
61081
|
+
object: "User",
|
|
61082
|
+
action: "editStatus"
|
|
61083
|
+
};
|
|
61084
|
+
const permissionUserEditRole = {
|
|
61085
|
+
object: "User",
|
|
61086
|
+
action: "editRole"
|
|
61087
|
+
};
|
|
61088
|
+
const permissionUserEditProfile = {
|
|
61089
|
+
object: "User",
|
|
61090
|
+
action: "editProfile"
|
|
61091
|
+
};
|
|
61092
|
+
const permissionFormTemplateSync = {
|
|
61093
|
+
object: "FormTemplate",
|
|
61094
|
+
action: "sync"
|
|
61095
|
+
};
|
|
61096
|
+
const permissionPageTemplateSync = {
|
|
61097
|
+
object: "PageTemplate",
|
|
61098
|
+
action: "sync"
|
|
61099
|
+
};
|
|
61100
|
+
const permissionPlatformView = {
|
|
61101
|
+
object: "Platform",
|
|
61102
|
+
action: "view"
|
|
61103
|
+
};
|
|
61104
|
+
const permissionCourseView = {
|
|
61105
|
+
object: "Course",
|
|
61106
|
+
action: "view"
|
|
61107
|
+
};
|
|
61108
|
+
const permissionExtensionView = {
|
|
61109
|
+
object: "Extension",
|
|
61110
|
+
action: "view"
|
|
61111
|
+
};
|
|
61112
|
+
const permissionSiteView = {
|
|
61113
|
+
object: "Site",
|
|
61114
|
+
action: "view"
|
|
61115
|
+
};
|
|
61116
|
+
const permissionTemplateView = {
|
|
61117
|
+
object: "Template",
|
|
61118
|
+
action: "view"
|
|
61119
|
+
};
|
|
61120
|
+
const allPermissions = [
|
|
61121
|
+
permissionExtensionCreate,
|
|
61122
|
+
permissionExtensionCreateVersion,
|
|
61123
|
+
permissionSiteCreate,
|
|
61124
|
+
permissionTemplateCreate,
|
|
61125
|
+
permissionUserCreate,
|
|
61126
|
+
permissionPlatformEdit,
|
|
61127
|
+
permissionComponentEdit,
|
|
61128
|
+
permissionCourseEdit,
|
|
61129
|
+
permissionCustomComponentEdit,
|
|
61130
|
+
permissionCustomFieldEdit,
|
|
61131
|
+
permissionCustomerSiteEdit,
|
|
61132
|
+
permissionExtensionEdit,
|
|
61133
|
+
permissionHelpTicketEditStatus,
|
|
61134
|
+
permissionPlatformSiteEdit,
|
|
61135
|
+
permissionSequenceEdit,
|
|
61136
|
+
permissionSequenceUserEdit,
|
|
61137
|
+
permissionSiteEdit,
|
|
61138
|
+
permissionSiteEditDomain,
|
|
61139
|
+
permissionSiteEditTls,
|
|
61140
|
+
permissionSubscriptionEdit,
|
|
61141
|
+
permissionTemplateEdit,
|
|
61142
|
+
permissionUserEditEmail,
|
|
61143
|
+
permissionUserEditOrg,
|
|
61144
|
+
permissionUserEditStatus,
|
|
61145
|
+
permissionUserEditRole,
|
|
61146
|
+
permissionUserEditProfile,
|
|
61147
|
+
permissionFormTemplateSync,
|
|
61148
|
+
permissionPageTemplateSync,
|
|
61149
|
+
permissionPlatformView,
|
|
61150
|
+
permissionCourseView,
|
|
61151
|
+
permissionExtensionView,
|
|
61152
|
+
permissionSiteView,
|
|
61153
|
+
permissionTemplateView
|
|
61154
|
+
];
|
|
61063
61155
|
const revokeAllUserPlatformPermissions = async ({
|
|
61064
61156
|
platformAdminId
|
|
61065
61157
|
}, db) => {
|
|
61066
61158
|
await db.query(
|
|
61067
61159
|
distExports$1.sql.type(
|
|
61068
61160
|
voidSelectSchema
|
|
61069
|
-
)`delete from "
|
|
61161
|
+
)`delete from "Permissions" where "platformAdminId" = ${platformAdminId}`
|
|
61070
61162
|
);
|
|
61071
61163
|
};
|
|
61072
61164
|
const grantAllUserPlatformPermissions = async ({
|
|
@@ -61075,12 +61167,12 @@ const grantAllUserPlatformPermissions = async ({
|
|
|
61075
61167
|
await db.query(
|
|
61076
61168
|
distExports$1.sql.type(
|
|
61077
61169
|
voidSelectSchema
|
|
61078
|
-
)`insert into "
|
|
61170
|
+
)`insert into "Permissions" ("id", "platformAdminId", "object", "action") values ${distExports$1.sql.join(
|
|
61079
61171
|
allPermissions.map(
|
|
61080
|
-
(permission) => distExports$1.sql.fragment`(${cleanSmallId()}, ${platformAdminId}, ${permission})`
|
|
61172
|
+
(permission) => distExports$1.sql.fragment`(${cleanSmallId()}, ${platformAdminId}, ${permission.object}, ${permission.action})`
|
|
61081
61173
|
),
|
|
61082
61174
|
distExports$1.sql.fragment`,`
|
|
61083
|
-
)} on conflict ("platformAdminId", "
|
|
61175
|
+
)} on conflict ("platformAdminId", "object", "action") do nothing`
|
|
61084
61176
|
);
|
|
61085
61177
|
};
|
|
61086
61178
|
const findPlatformAdminSchema = z.object({
|
|
@@ -61120,10 +61212,18 @@ const editAdmin = async (opts, env2) => {
|
|
|
61120
61212
|
platformAdmin = await db2.one(
|
|
61121
61213
|
distExports$1.sql.type(findPlatformAdminSchema)`
|
|
61122
61214
|
insert into "PlatformAdmins" ("id", "platformId", "userId", "owner", "active")
|
|
61123
|
-
values (${cleanSmallId()}, ${platformId}, ${userId}, ${active ?? true}
|
|
61215
|
+
values (${cleanSmallId()}, ${platformId}, ${userId}, true, ${active ?? true})
|
|
61124
61216
|
returning "id", "platformId", "active"
|
|
61125
61217
|
`
|
|
61126
61218
|
);
|
|
61219
|
+
} else {
|
|
61220
|
+
await db2.query(
|
|
61221
|
+
distExports$1.sql.type(voidSelectSchema)`
|
|
61222
|
+
update "PlatformAdmins"
|
|
61223
|
+
set "owner" = true
|
|
61224
|
+
where "id" = ${platformAdmin.id}
|
|
61225
|
+
`
|
|
61226
|
+
);
|
|
61127
61227
|
}
|
|
61128
61228
|
await grantAllUserPlatformPermissions({ platformAdminId: platformAdmin.id }, db2);
|
|
61129
61229
|
if (opts.verbose) {
|
package/package.json
CHANGED
|
@@ -23,6 +23,7 @@ const randomString = () => randomUUID().replaceAll('-', '').slice(0, 10);
|
|
|
23
23
|
type BootstrapOptions = {
|
|
24
24
|
name: string;
|
|
25
25
|
handle?: string;
|
|
26
|
+
// TODO: Require this be set in the environment instead.
|
|
26
27
|
adminSiteDomain: string;
|
|
27
28
|
emailSendFrom?: string;
|
|
28
29
|
};
|
|
@@ -61,7 +62,6 @@ export const bootstrap = async (
|
|
|
61
62
|
} else {
|
|
62
63
|
emailSendFrom = `site@${adminSiteDomain}`;
|
|
63
64
|
}
|
|
64
|
-
const adminSiteName = `${name} Admin`;
|
|
65
65
|
|
|
66
66
|
await db.transaction(async (db) => {
|
|
67
67
|
await db.query(
|
|
@@ -69,12 +69,6 @@ export const bootstrap = async (
|
|
|
69
69
|
voidSelectSchema,
|
|
70
70
|
)`insert into "Platforms" ("id", "handle", "name", "defaultFormFormattedDataTemplate", "defaultFormNotificationEmailBodyTemplate", "emailSendFromAddress") values (${platformId}, ${handle}, ${name}, ${defaultFormattedDataTemplate}, ${defaultNotificationEmailBodyTemplate}, ${emailSendFrom})`,
|
|
71
71
|
);
|
|
72
|
-
|
|
73
|
-
await db.query(
|
|
74
|
-
sql.type(
|
|
75
|
-
voidSelectSchema,
|
|
76
|
-
)`insert into "Sites" ("platformId", "domain", "name") values (${platformId}, ${adminSiteDomain}, ${adminSiteName})`,
|
|
77
|
-
);
|
|
78
72
|
});
|
|
79
73
|
|
|
80
74
|
console.log(`Created platform ${name} with handle ${handle} (ID ${platformId})`);
|
|
@@ -63,10 +63,18 @@ export const editAdmin = async (
|
|
|
63
63
|
platformAdmin = await db.one(
|
|
64
64
|
sql.type(findPlatformAdminSchema)`
|
|
65
65
|
insert into "PlatformAdmins" ("id", "platformId", "userId", "owner", "active")
|
|
66
|
-
values (${cleanSmallId()}, ${platformId}, ${userId}, ${active ?? true}
|
|
66
|
+
values (${cleanSmallId()}, ${platformId}, ${userId}, true, ${active ?? true})
|
|
67
67
|
returning "id", "platformId", "active"
|
|
68
68
|
`,
|
|
69
69
|
);
|
|
70
|
+
} else {
|
|
71
|
+
await db.query(
|
|
72
|
+
sql.type(voidSelectSchema)`
|
|
73
|
+
update "PlatformAdmins"
|
|
74
|
+
set "owner" = true
|
|
75
|
+
where "id" = ${platformAdmin.id}
|
|
76
|
+
`,
|
|
77
|
+
);
|
|
70
78
|
}
|
|
71
79
|
await grantAllUserPlatformPermissions({ platformAdminId: platformAdmin.id }, db);
|
|
72
80
|
if (opts.verbose) {
|