Conversation
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
…in-typescript-submodules
Signed-off-by: Alessandro Asoni <alessandro@clockworklabs.io>
JasonAtClockwork
left a comment
There was a problem hiding this comment.
It looks like there is a client-binding issue when submodule table/view canonical names differ from the accessor.
Server
// library.ts
const activity = table(
{ name: 'stored_events', public: true },
{
id: t.u64().primaryKey().autoInc(),
value: t.string(),
}
);
const library = schema({ activityLog: activity });
export default library;
export const visibleEvents = library.view(
{ name: 'stored_view', public: true },
t.array(activity.rowType),
ctx => ctx.from.activityLog
);// index.ts
import * as library from './library';
export default schema({ clientLib: library });After generating the TypeScript bindings you can subscribe to tables.clientLib.activityLog and tables.clientLib.visibleEvents but the client accessors seem to be missing at ctx.db.clientLib.activityLog.
It's possible my test was incorrect but after looking it's possible #makeDbView() need the accessor path?
| if map.contains_key(&namespace) { | ||
| errors.push(ValidationError::DuplicateName { | ||
| name: submodule.namespace.into(), | ||
| name: namespace.as_raw().clone(), | ||
| }); |
There was a problem hiding this comment.
If I'm reading the validation correctly for namespaces/submodules we're only checking the canonical name for duplication. I believe with the tables it's checking canonical and accessor name to avoid collisions.
There was a problem hiding this comment.
ah that's a very good point. Accessor names should also not be be duplicated, I hadn't thought of that
Description of Changes
Canonicalize namespace names. Requires a new field in module def to save the non canonical name.
API and ABI breaking changes
This breaks existing modules that were published with names that will now canonicalize to a different name.
E.g. if a database was published with a submodule under namespace
myAuth, then this database will no longer work properly because the module definition will bo loaded asmy_authbut the datastore will havemyAuth.There are ways around this but they make the change more complicated. My take is we ship this and announce that the
upgrade will break modules with submodules.
Rollback safety impact
n/a
Expected complexity level and risk
3
Testing