mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 13:54:20 +03:00
interface: updated npm packages
This commit is contained in:
parent
2b30227f0f
commit
8362f22cd7
@ -1,186 +1,3 @@
|
||||
const env = {
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
};
|
||||
|
||||
const rules = {
|
||||
"array-bracket-spacing": ["error", "never"],
|
||||
"arrow-parens": [
|
||||
"error",
|
||||
"as-needed",
|
||||
{
|
||||
"requireForBlockBody": true
|
||||
}
|
||||
],
|
||||
"arrow-spacing": "error",
|
||||
"block-spacing": ["error", "always"],
|
||||
"brace-style": ["error", "1tbs"],
|
||||
"camelcase": [
|
||||
"error",
|
||||
{
|
||||
"properties": "never"
|
||||
}
|
||||
],
|
||||
"comma-dangle": ["error", "never"],
|
||||
"eol-last": ["error", "always"],
|
||||
"func-name-matching": "error",
|
||||
"indent": [
|
||||
"off",
|
||||
2,
|
||||
{
|
||||
"ArrayExpression": "off",
|
||||
"SwitchCase": 1,
|
||||
"CallExpression": {
|
||||
"arguments": "off"
|
||||
},
|
||||
"FunctionDeclaration": {
|
||||
"parameters": "off"
|
||||
},
|
||||
"FunctionExpression": {
|
||||
"parameters": "off"
|
||||
},
|
||||
"MemberExpression": "off",
|
||||
"ObjectExpression": "off",
|
||||
"ImportDeclaration": "off"
|
||||
}
|
||||
],
|
||||
"handle-callback-err": "off",
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"max-lines": [
|
||||
"error",
|
||||
{
|
||||
"max": 300,
|
||||
"skipBlankLines": true,
|
||||
"skipComments": true
|
||||
}
|
||||
],
|
||||
"max-lines-per-function": [
|
||||
"warn",
|
||||
{
|
||||
"skipBlankLines": true,
|
||||
"skipComments": true
|
||||
}
|
||||
],
|
||||
"max-statements-per-line": [
|
||||
"error",
|
||||
{
|
||||
"max": 1
|
||||
}
|
||||
],
|
||||
"new-cap": [
|
||||
"error",
|
||||
{
|
||||
"newIsCap": true,
|
||||
"capIsNew": false
|
||||
}
|
||||
],
|
||||
"new-parens": "error",
|
||||
"no-buffer-constructor": "error",
|
||||
"no-console": "off",
|
||||
"no-extra-semi": "off",
|
||||
"no-fallthrough": "off",
|
||||
"no-func-assign": "off",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-multi-assign": "error",
|
||||
"no-multiple-empty-lines": [
|
||||
"error",
|
||||
{
|
||||
"max": 1
|
||||
}
|
||||
],
|
||||
"no-nested-ternary": "error",
|
||||
"no-param-reassign": "off",
|
||||
"no-return-assign": "error",
|
||||
"no-return-await": "off",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-tabs": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "none",
|
||||
"ignoreRestSiblings": false
|
||||
}
|
||||
],
|
||||
"no-use-before-define": [
|
||||
"error",
|
||||
{
|
||||
"functions": false,
|
||||
"classes": false
|
||||
}
|
||||
],
|
||||
"no-useless-escape": "off",
|
||||
"no-var": "error",
|
||||
"nonblock-statement-body-position": ["error", "below"],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"padded-blocks": ["error", "never"],
|
||||
"prefer-arrow-callback": "error",
|
||||
"prefer-const": [
|
||||
"error",
|
||||
{
|
||||
"destructuring": "all",
|
||||
"ignoreReadBeforeAssign": true
|
||||
}
|
||||
],
|
||||
"prefer-template": "off",
|
||||
"quotes": ["error", "single"],
|
||||
"semi": ["error", "always"],
|
||||
"spaced-comment": [
|
||||
"error",
|
||||
"always",
|
||||
{
|
||||
"exceptions": ["!"]
|
||||
}
|
||||
],
|
||||
"space-before-blocks": "error",
|
||||
"unicode-bom": ["error", "never"],
|
||||
"valid-jsdoc": "error",
|
||||
"wrap-iife": ["error", "inside"],
|
||||
"react/jsx-closing-bracket-location": 1,
|
||||
"react/jsx-tag-spacing": 1,
|
||||
"react/jsx-max-props-per-line": ["error", { "maximum": 2, "when": "multiline" }],
|
||||
"react/prop-types": 0
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
"env": env,
|
||||
"extends": [
|
||||
"plugin:react/recommended",
|
||||
"eslint:recommended",
|
||||
],
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "^16.5.2"
|
||||
}
|
||||
},
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 10,
|
||||
"requireConfigFile": false,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"root": true,
|
||||
"rules": rules,
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.ts", "**/*.tsx"],
|
||||
"env": env,
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": { "jsx": true },
|
||||
"ecmaVersion": 10,
|
||||
"requireConfigFile": false,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"rules": rules
|
||||
}
|
||||
]
|
||||
};
|
||||
extends: "@urbit"
|
||||
};
|
916
pkg/interface/package-lock.json
generated
916
pkg/interface/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@
|
||||
"@tlon/indigo-light": "^1.0.6",
|
||||
"@tlon/indigo-react": "1.2.17",
|
||||
"@tlon/sigil-js": "^1.4.3",
|
||||
"@urbit/api": "file:../npm/api",
|
||||
"aws-sdk": "^2.830.0",
|
||||
"big-integer": "^1.6.48",
|
||||
"classnames": "^2.2.6",
|
||||
@ -63,15 +64,15 @@
|
||||
"@types/styled-components": "^5.1.7",
|
||||
"@types/styled-system": "^5.1.10",
|
||||
"@types/yup": "^0.29.11",
|
||||
"@typescript-eslint/eslint-plugin": "^3.10.1",
|
||||
"@typescript-eslint/parser": "^3.10.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.15.0",
|
||||
"@urbit/eslint-config": "file:../npm/eslint-config",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-lodash": "^3.3.4",
|
||||
"babel-plugin-root-import": "^6.6.0",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint": "^7.19.0",
|
||||
"eslint-plugin-react": "^7.22.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"html-webpack-plugin": "^4.5.1",
|
||||
|
@ -80,25 +80,31 @@ function moduleToMark(mod: string): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export const storeAction = <T>(data: T): Poke<T> => ({
|
||||
const storeAction = <T>(data: T): Poke<T> => ({
|
||||
app: 'graph-store',
|
||||
mark: 'graph-update',
|
||||
json: data
|
||||
});
|
||||
|
||||
export const viewAction = <T>(threadName: string, action: T): Thread<T> => ({
|
||||
export { storeAction as graphStoreAction };
|
||||
|
||||
const viewAction = <T>(threadName: string, action: T): Thread<T> => ({
|
||||
inputMark: 'graph-view-action',
|
||||
outputMark: 'json',
|
||||
threadName,
|
||||
body: action
|
||||
});
|
||||
|
||||
export const hookAction = <T>(data: T): Poke<T> => ({
|
||||
export { viewAction as graphViewAction };
|
||||
|
||||
const hookAction = <T>(data: T): Poke<T> => ({
|
||||
app: 'graph-push-hook',
|
||||
mark: 'graph-update',
|
||||
json: data
|
||||
});
|
||||
|
||||
export { hookAction as graphHookAction };
|
||||
|
||||
|
||||
export const createManagedGraph = (
|
||||
ship: PatpNoSig,
|
||||
|
179
pkg/npm/api/groups/index.d.ts
vendored
179
pkg/npm/api/groups/index.d.ts
vendored
@ -1,177 +1,2 @@
|
||||
import { PatpNoSig, Path, Jug, ShipRank, Enc } from '..';
|
||||
|
||||
export interface RoleTag {
|
||||
tag: 'admin' | 'moderator' | 'janitor';
|
||||
}
|
||||
|
||||
export interface AppTag {
|
||||
app: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
export type Tag = AppTag | RoleTag;
|
||||
|
||||
export interface InvitePolicy {
|
||||
invite: {
|
||||
pending: Set<PatpNoSig>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface OpenPolicy {
|
||||
open: {
|
||||
banned: Set<PatpNoSig>;
|
||||
banRanks: Set<ShipRank>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Resource {
|
||||
name: string;
|
||||
ship: PatpNoSig; // TODO different declaration than in metadata?
|
||||
}
|
||||
|
||||
export type OpenPolicyDiff =
|
||||
| AllowRanksDiff
|
||||
| BanRanksDiff
|
||||
| AllowShipsDiff
|
||||
| BanShipsDiff;
|
||||
|
||||
export interface AllowRanksDiff {
|
||||
allowRanks: ShipRank[];
|
||||
}
|
||||
|
||||
export interface BanRanksDiff {
|
||||
banRanks: ShipRank[];
|
||||
}
|
||||
|
||||
export interface AllowShipsDiff {
|
||||
allowShips: PatpNoSig[];
|
||||
}
|
||||
|
||||
export interface BanShipsDiff {
|
||||
banShips: PatpNoSig[];
|
||||
}
|
||||
|
||||
export type InvitePolicyDiff = AddInvitesDiff | RemoveInvitesDiff;
|
||||
|
||||
export interface AddInvitesDiff {
|
||||
addInvites: PatpNoSig[];
|
||||
}
|
||||
|
||||
export interface RemoveInvitesDiff {
|
||||
removeInvites: PatpNoSig[];
|
||||
}
|
||||
|
||||
export interface ReplacePolicyDiff {
|
||||
replace: GroupPolicy;
|
||||
}
|
||||
|
||||
export type GroupPolicyDiff =
|
||||
| { open: OpenPolicyDiff }
|
||||
| { invite: InvitePolicyDiff }
|
||||
| ReplacePolicyDiff;
|
||||
|
||||
export type GroupPolicy = OpenPolicy | InvitePolicy;
|
||||
|
||||
export interface TaggedShips {
|
||||
[tag: string]: Set<PatpNoSig>;
|
||||
}
|
||||
|
||||
export interface Tags {
|
||||
role: TaggedShips;
|
||||
[app: string]: TaggedShips;
|
||||
}
|
||||
|
||||
export interface Group {
|
||||
members: Set<PatpNoSig>;
|
||||
tags: Tags;
|
||||
policy: GroupPolicy;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
export type Groups = {
|
||||
[p in Path]: Group;
|
||||
};
|
||||
|
||||
export interface GroupUpdateInitial {
|
||||
initial: Enc<Groups>;
|
||||
}
|
||||
|
||||
export interface GroupUpdateAddGroup {
|
||||
addGroup: {
|
||||
resource: Resource;
|
||||
policy: Enc<GroupPolicy>;
|
||||
hidden: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupUpdateAddMembers {
|
||||
addMembers: {
|
||||
ships: PatpNoSig[];
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupUpdateRemoveMembers {
|
||||
removeMembers: {
|
||||
ships: PatpNoSig[];
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupUpdateAddTag {
|
||||
addTag: {
|
||||
tag: Tag;
|
||||
resource: Resource;
|
||||
ships: PatpNoSig[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupUpdateRemoveTag {
|
||||
removeTag: {
|
||||
tag: Tag;
|
||||
resource: Resource;
|
||||
ships: PatpNoSig[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupUpdateChangePolicy {
|
||||
changePolicy: { resource: Resource; diff: GroupPolicyDiff };
|
||||
}
|
||||
|
||||
export interface GroupUpdateRemoveGroup {
|
||||
removeGroup: {
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupUpdateExpose {
|
||||
expose: {
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
export interface GroupUpdateInitialGroup {
|
||||
initialGroup: {
|
||||
resource: Resource;
|
||||
group: Enc<Group>;
|
||||
};
|
||||
}
|
||||
|
||||
export type GroupUpdate =
|
||||
| GroupUpdateInitial
|
||||
| GroupUpdateAddGroup
|
||||
| GroupUpdateAddMembers
|
||||
| GroupUpdateRemoveMembers
|
||||
| GroupUpdateAddTag
|
||||
| GroupUpdateRemoveTag
|
||||
| GroupUpdateChangePolicy
|
||||
| GroupUpdateRemoveGroup
|
||||
| GroupUpdateExpose
|
||||
| GroupUpdateInitialGroup;
|
||||
|
||||
export type GroupAction = Omit<GroupUpdate, 'initialGroup' | 'initial'>;
|
||||
|
||||
export const groupBunts = {
|
||||
group: (): Group => ({ members: new Set(), tags: { role: {} }, hidden: false, policy: groupBunts.policy() }),
|
||||
policy: (): GroupPolicy => ({ open: { banned: new Set(), banRanks: new Set() } })
|
||||
};
|
||||
export * from './update.d';
|
||||
export * from './view.d';
|
@ -87,7 +87,7 @@ export const changePolicy = (
|
||||
}
|
||||
});
|
||||
|
||||
const roleTags = ['janitor', 'moderator', 'admin'];
|
||||
export const roleTags = ['janitor', 'moderator', 'admin'];
|
||||
// TODO make this type better?
|
||||
|
||||
export function roleForShip(group: Group, ship: PatpNoSig): string | undefined {
|
||||
@ -106,3 +106,6 @@ export function makeResource(ship: string, name:string) {
|
||||
return { ship, name };
|
||||
}
|
||||
|
||||
export const joinError = ['no-perms', 'strange'] as const;
|
||||
export const joinResult = ['done', ...joinError] as const;
|
||||
export const joinProgress = ['start', 'added', ...joinResult] as const;
|
180
pkg/npm/api/groups/update.d.ts
vendored
Normal file
180
pkg/npm/api/groups/update.d.ts
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
import { PatpNoSig, Path, Jug, ShipRank, Enc } from '..';
|
||||
import { roleTags } from './index';
|
||||
|
||||
export type RoleTags = typeof roleTags[number];
|
||||
interface RoleTag {
|
||||
tag: 'admin' | 'moderator' | 'janitor';
|
||||
}
|
||||
|
||||
interface AppTag {
|
||||
app: string;
|
||||
resource: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
export type Tag = AppTag | RoleTag;
|
||||
|
||||
export interface InvitePolicy {
|
||||
invite: {
|
||||
pending: Set<PatpNoSig>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface OpenPolicy {
|
||||
open: {
|
||||
banned: Set<PatpNoSig>;
|
||||
banRanks: Set<ShipRank>;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Resource {
|
||||
name: string;
|
||||
ship: PatpNoSig;
|
||||
}
|
||||
|
||||
export type OpenPolicyDiff =
|
||||
| AllowRanksDiff
|
||||
| BanRanksDiff
|
||||
| AllowShipsDiff
|
||||
| BanShipsDiff;
|
||||
|
||||
interface AllowRanksDiff {
|
||||
allowRanks: ShipRank[];
|
||||
}
|
||||
|
||||
interface BanRanksDiff {
|
||||
banRanks: ShipRank[];
|
||||
}
|
||||
|
||||
interface AllowShipsDiff {
|
||||
allowShips: PatpNoSig[];
|
||||
}
|
||||
|
||||
interface BanShipsDiff {
|
||||
banShips: PatpNoSig[];
|
||||
}
|
||||
|
||||
export type InvitePolicyDiff = AddInvitesDiff | RemoveInvitesDiff;
|
||||
|
||||
interface AddInvitesDiff {
|
||||
addInvites: PatpNoSig[];
|
||||
}
|
||||
|
||||
interface RemoveInvitesDiff {
|
||||
removeInvites: PatpNoSig[];
|
||||
}
|
||||
|
||||
interface ReplacePolicyDiff {
|
||||
replace: GroupPolicy;
|
||||
}
|
||||
|
||||
export type GroupPolicyDiff =
|
||||
| { open: OpenPolicyDiff }
|
||||
| { invite: InvitePolicyDiff }
|
||||
| ReplacePolicyDiff;
|
||||
|
||||
export type GroupPolicy = OpenPolicy | InvitePolicy;
|
||||
|
||||
interface TaggedShips {
|
||||
[tag: string]: Set<PatpNoSig>;
|
||||
}
|
||||
|
||||
export interface Tags {
|
||||
role: TaggedShips;
|
||||
[app: string]: TaggedShips;
|
||||
}
|
||||
|
||||
export interface Group {
|
||||
members: Set<PatpNoSig>;
|
||||
tags: Tags;
|
||||
policy: GroupPolicy;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
export type Groups = {
|
||||
[p in Path]: Group;
|
||||
};
|
||||
|
||||
interface GroupUpdateInitial {
|
||||
initial: Enc<Groups>;
|
||||
}
|
||||
|
||||
interface GroupUpdateAddGroup {
|
||||
addGroup: {
|
||||
resource: Resource;
|
||||
policy: Enc<GroupPolicy>;
|
||||
hidden: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface GroupUpdateAddMembers {
|
||||
addMembers: {
|
||||
ships: PatpNoSig[];
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
interface GroupUpdateRemoveMembers {
|
||||
removeMembers: {
|
||||
ships: PatpNoSig[];
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
interface GroupUpdateAddTag {
|
||||
addTag: {
|
||||
tag: Tag;
|
||||
resource: Resource;
|
||||
ships: PatpNoSig[];
|
||||
};
|
||||
}
|
||||
|
||||
interface GroupUpdateRemoveTag {
|
||||
removeTag: {
|
||||
tag: Tag;
|
||||
resource: Resource;
|
||||
ships: PatpNoSig;
|
||||
};
|
||||
}
|
||||
|
||||
interface GroupUpdateChangePolicy {
|
||||
changePolicy: { resource: Resource; diff: GroupPolicyDiff };
|
||||
}
|
||||
|
||||
interface GroupUpdateRemoveGroup {
|
||||
removeGroup: {
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
interface GroupUpdateExpose {
|
||||
expose: {
|
||||
resource: Resource;
|
||||
};
|
||||
}
|
||||
|
||||
interface GroupUpdateInitialGroup {
|
||||
initialGroup: {
|
||||
resource: Resource;
|
||||
group: Enc<Group>;
|
||||
};
|
||||
}
|
||||
|
||||
export type GroupUpdate =
|
||||
| GroupUpdateInitial
|
||||
| GroupUpdateAddGroup
|
||||
| GroupUpdateAddMembers
|
||||
| GroupUpdateRemoveMembers
|
||||
| GroupUpdateAddTag
|
||||
| GroupUpdateRemoveTag
|
||||
| GroupUpdateChangePolicy
|
||||
| GroupUpdateRemoveGroup
|
||||
| GroupUpdateExpose
|
||||
| GroupUpdateInitialGroup;
|
||||
|
||||
export type GroupAction = Omit<GroupUpdate, 'initialGroup' | 'initial'>;
|
||||
|
||||
export const groupBunts = {
|
||||
group: (): Group => ({ members: new Set(), tags: { role: {} }, hidden: false, policy: groupBunts.policy() }),
|
||||
policy: (): GroupPolicy => ({ open: { banned: new Set(), banRanks: new Set() } })
|
||||
};
|
12
pkg/npm/api/groups/view.d.ts
vendored
Normal file
12
pkg/npm/api/groups/view.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { joinError, joinProgress, joinResult } from ".";
|
||||
|
||||
export type JoinError = typeof joinError[number];
|
||||
|
||||
export type JoinResult = typeof joinResult[number];
|
||||
|
||||
|
||||
export type JoinProgress = typeof joinProgress[number];
|
||||
|
||||
export interface JoinRequests {
|
||||
[rid: string]: JoinProgress;
|
||||
}
|
19
pkg/npm/api/hark/index.d.ts
vendored
19
pkg/npm/api/hark/index.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
import { Content, Post } from "../graph/index.d";
|
||||
import { Post } from "../graph/index.d";
|
||||
import { GroupUpdate } from "../groups/index.d";
|
||||
import BigIntOrderedMap from "../lib/BigIntOrderedMap";
|
||||
import { BigIntOrderedMap } from "~/logic/lib/BigIntOrderedMap";
|
||||
|
||||
export type GraphNotifDescription = "link" | "comment" | "note" | "mention";
|
||||
|
||||
@ -23,27 +23,17 @@ export interface GroupNotifIndex {
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface ChatNotifIndex {
|
||||
chat: string;
|
||||
mention: boolean;
|
||||
}
|
||||
|
||||
export type NotifIndex =
|
||||
| { graph: GraphNotifIndex }
|
||||
| { group: GroupNotifIndex }
|
||||
| { chat: ChatNotifIndex };
|
||||
| { group: GroupNotifIndex };
|
||||
|
||||
export type GraphNotificationContents = Post[];
|
||||
|
||||
export type GroupNotificationContents = GroupUpdate[];
|
||||
|
||||
export type ChatNotificationContents = Content[];
|
||||
|
||||
export type NotificationContents =
|
||||
| { graph: GraphNotificationContents }
|
||||
| { group: GroupNotificationContents }
|
||||
| { chat: ChatNotificationContents };
|
||||
|
||||
| { group: GroupNotificationContents };
|
||||
export interface Notification {
|
||||
read: boolean;
|
||||
time: number;
|
||||
@ -66,7 +56,6 @@ export interface NotificationGraphConfig {
|
||||
}
|
||||
|
||||
export interface Unreads {
|
||||
chat: Record<string, UnreadStats>;
|
||||
graph: Record<string, Record<string, UnreadStats>>;
|
||||
group: Record<string, UnreadStats>;
|
||||
}
|
||||
|
74
pkg/npm/api/index.d.ts
vendored
74
pkg/npm/api/index.d.ts
vendored
@ -1,67 +1,7 @@
|
||||
/**
|
||||
* Martian embassy
|
||||
*/
|
||||
|
||||
// an urbit style path rendered as string
|
||||
export type Path = string;
|
||||
|
||||
// patp including leading sig
|
||||
export type Patp = string;
|
||||
|
||||
// patp excluding leading sig
|
||||
export type PatpNoSig = string;
|
||||
|
||||
// @uvH encoded string
|
||||
export type Serial = string;
|
||||
|
||||
// jug from hoon
|
||||
export type Jug<K,V> = Map<K,Set<V>>;
|
||||
|
||||
// name of app
|
||||
export type AppName = 'chat' | 'link' | 'contacts' | 'publish' | 'graph';
|
||||
|
||||
export function getTagFromFrond<O>(frond: O): keyof O {
|
||||
const tags = Object.keys(frond) as Array<keyof O>;
|
||||
const tag = tags[0];
|
||||
if(!tag) {
|
||||
throw new Error("bad frond");
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
export type ShipRank = 'czar' | 'king' | 'duke' | 'earl' | 'pawn';
|
||||
|
||||
export type Action = 'poke' | 'subscribe' | 'ack' | 'unsubscribe' | 'delete';
|
||||
|
||||
|
||||
export type SetElement<S> = S extends Set<(infer T)> ? T : never;
|
||||
export type MapKey<M> = M extends Map<(infer K), any> ? K : never;
|
||||
export type MapValue<M> = M extends Map<any, (infer V)> ? V : never;
|
||||
|
||||
/**
|
||||
* Turns sets into arrays and maps into objects so we can send them over the wire
|
||||
*/
|
||||
export type Enc<S> =
|
||||
S extends Set<any> ?
|
||||
Enc<SetElement<S>>[] :
|
||||
S extends Map<string, any> ?
|
||||
{ [s: string]: Enc<MapValue<S>> } :
|
||||
S extends object ?
|
||||
{ [K in keyof S]: Enc<S[K]> } :
|
||||
S;
|
||||
|
||||
export type Mark = string;
|
||||
|
||||
export interface Poke<Action> {
|
||||
ship?: string; // This should be handled by the http library, but is part of the spec
|
||||
app: string;
|
||||
mark: Mark;
|
||||
json: Action;
|
||||
}
|
||||
|
||||
export interface Thread<Action> {
|
||||
inputMark: string;
|
||||
outputMark: string;
|
||||
threadName: string;
|
||||
body: Action;
|
||||
}
|
||||
export * from './contacts/index.d'
|
||||
export * from './graph/index.d';
|
||||
export * from './groups/index.d';
|
||||
export * from './hark/index.d';
|
||||
export * from './invite/index.d';
|
||||
export * from './lib/index.d';
|
||||
export * from './metadata/index.d';
|
@ -2,4 +2,13 @@ import BigIntOrderedMap from './lib/BigIntOrderedMap';
|
||||
|
||||
export {
|
||||
BigIntOrderedMap
|
||||
};
|
||||
};
|
||||
|
||||
export * from './contacts';
|
||||
export * from './graph';
|
||||
export * from './groups';
|
||||
export * from './hark';
|
||||
export * from './invite';
|
||||
export * from './metadata';
|
||||
export * from './settings';
|
||||
export * from './index.d';
|
35
pkg/npm/api/invite/index.d.ts
vendored
35
pkg/npm/api/invite/index.d.ts
vendored
@ -1,4 +1,5 @@
|
||||
import { Serial, PatpNoSig, Path } from '..';
|
||||
import { Resource } from '../groups';
|
||||
|
||||
export type InviteUpdate =
|
||||
InviteUpdateInitial
|
||||
@ -8,23 +9,24 @@ export type InviteUpdate =
|
||||
| InviteUpdateAccepted
|
||||
| InviteUpdateDecline;
|
||||
|
||||
export interface InviteUpdateInitial {
|
||||
|
||||
interface InviteUpdateInitial {
|
||||
initial: Invites;
|
||||
}
|
||||
|
||||
export interface InviteUpdateCreate {
|
||||
interface InviteUpdateCreate {
|
||||
create: {
|
||||
path: Path;
|
||||
};
|
||||
}
|
||||
|
||||
export interface InviteUpdateDelete {
|
||||
interface InviteUpdateDelete {
|
||||
delete: {
|
||||
path: Path;
|
||||
};
|
||||
}
|
||||
|
||||
export interface InviteUpdateInvite {
|
||||
interface InviteUpdateInvite {
|
||||
invite: {
|
||||
path: Path;
|
||||
uid: Serial;
|
||||
@ -32,39 +34,20 @@ export interface InviteUpdateInvite {
|
||||
};
|
||||
}
|
||||
|
||||
export interface InviteUpdateAccepted {
|
||||
interface InviteUpdateAccepted {
|
||||
accepted: {
|
||||
path: Path;
|
||||
uid: Serial;
|
||||
};
|
||||
}
|
||||
|
||||
export interface InviteUpdateDecline {
|
||||
interface InviteUpdateDecline {
|
||||
decline: {
|
||||
path: Path;
|
||||
uid: Serial;
|
||||
};
|
||||
}
|
||||
|
||||
export type InviteAction =
|
||||
InviteActionAccept
|
||||
| InviteActionDecline;
|
||||
|
||||
export interface InviteActionAccept {
|
||||
accept: {
|
||||
term: string,
|
||||
uid: Serial
|
||||
}
|
||||
}
|
||||
|
||||
export interface InviteActionDecline {
|
||||
decline: {
|
||||
term: string,
|
||||
uid: Serial
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// actual datastructures
|
||||
|
||||
|
||||
@ -78,8 +61,8 @@ export type AppInvites = {
|
||||
|
||||
export interface Invite {
|
||||
app: string;
|
||||
path: Path;
|
||||
recipient: PatpNoSig;
|
||||
resource: Resource;
|
||||
ship: PatpNoSig;
|
||||
text: string;
|
||||
}
|
||||
|
67
pkg/npm/api/lib/index.d.ts
vendored
Normal file
67
pkg/npm/api/lib/index.d.ts
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* Martian embassy
|
||||
*/
|
||||
|
||||
// an urbit style path rendered as string
|
||||
export type Path = string;
|
||||
|
||||
// patp including leading sig
|
||||
export type Patp = string;
|
||||
|
||||
// patp excluding leading sig
|
||||
export type PatpNoSig = string;
|
||||
|
||||
// @uvH encoded string
|
||||
export type Serial = string;
|
||||
|
||||
// jug from hoon
|
||||
export type Jug<K,V> = Map<K,Set<V>>;
|
||||
|
||||
// name of app
|
||||
export type AppName = 'chat' | 'link' | 'contacts' | 'publish' | 'graph';
|
||||
|
||||
export function getTagFromFrond<O>(frond: O): keyof O {
|
||||
const tags = Object.keys(frond) as Array<keyof O>;
|
||||
const tag = tags[0];
|
||||
if(!tag) {
|
||||
throw new Error("bad frond");
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
export type ShipRank = 'czar' | 'king' | 'duke' | 'earl' | 'pawn';
|
||||
|
||||
export type Action = 'poke' | 'subscribe' | 'ack' | 'unsubscribe' | 'delete';
|
||||
|
||||
|
||||
export type SetElement<S> = S extends Set<(infer T)> ? T : never;
|
||||
export type MapKey<M> = M extends Map<(infer K), any> ? K : never;
|
||||
export type MapValue<M> = M extends Map<any, (infer V)> ? V : never;
|
||||
|
||||
/**
|
||||
* Turns sets into arrays and maps into objects so we can send them over the wire
|
||||
*/
|
||||
export type Enc<S> =
|
||||
S extends Set<any> ?
|
||||
Enc<SetElement<S>>[] :
|
||||
S extends Map<string, any> ?
|
||||
{ [s: string]: Enc<MapValue<S>> } :
|
||||
S extends object ?
|
||||
{ [K in keyof S]: Enc<S[K]> } :
|
||||
S;
|
||||
|
||||
export type Mark = string;
|
||||
|
||||
export interface Poke<Action> {
|
||||
ship?: string; // This should be handled by the http library, but is part of the spec
|
||||
app: string;
|
||||
mark: Mark;
|
||||
json: Action;
|
||||
}
|
||||
|
||||
export interface Thread<Action> {
|
||||
inputMark: string;
|
||||
outputMark: string;
|
||||
threadName: string;
|
||||
body: Action;
|
||||
}
|
32
pkg/npm/api/metadata/index.d.ts
vendored
32
pkg/npm/api/metadata/index.d.ts
vendored
@ -1,47 +1,54 @@
|
||||
import { AppName, Path, Patp } from '..';
|
||||
|
||||
|
||||
export type MetadataUpdate =
|
||||
MetadataUpdateInitial
|
||||
| MetadataUpdateAdd
|
||||
| MetadataUpdateUpdate
|
||||
| MetadataUpdateRemove;
|
||||
|
||||
export interface MetadataUpdateInitial {
|
||||
interface MetadataUpdateInitial {
|
||||
associations: ResourceAssociations;
|
||||
}
|
||||
|
||||
export type ResourceAssociations = {
|
||||
type ResourceAssociations = {
|
||||
[p in Path]: Association;
|
||||
}
|
||||
|
||||
export type MetadataUpdateAdd = {
|
||||
type MetadataUpdateAdd = {
|
||||
add: Association;
|
||||
}
|
||||
|
||||
export type MetadataUpdateUpdate = {
|
||||
type MetadataUpdateUpdate = {
|
||||
update: Association;
|
||||
}
|
||||
|
||||
export type MetadataUpdateRemove = {
|
||||
type MetadataUpdateRemove = {
|
||||
remove: Resource & {
|
||||
'group-path': Path;
|
||||
group: Path;
|
||||
}
|
||||
}
|
||||
|
||||
export interface MetadataUpdatePreview {
|
||||
group: string;
|
||||
channels: Associations;
|
||||
"channel-count": number;
|
||||
members: number;
|
||||
metadata: Metadata;
|
||||
}
|
||||
|
||||
export type Associations = Record<AppName, AppAssociations>;
|
||||
|
||||
export type AppAssociations = {
|
||||
[p in Path]: Association;
|
||||
}
|
||||
|
||||
export interface Resource {
|
||||
'app-path': Path;
|
||||
interface Resource {
|
||||
resource: Path;
|
||||
'app-name': AppName;
|
||||
}
|
||||
|
||||
export type Association = Resource & {
|
||||
'group-path': Path;
|
||||
group: Path;
|
||||
metadata: Metadata;
|
||||
};
|
||||
|
||||
@ -52,4 +59,9 @@ export interface Metadata {
|
||||
description: string;
|
||||
title: string;
|
||||
module: string;
|
||||
picture: string;
|
||||
preview: boolean;
|
||||
vip: PermVariation;
|
||||
}
|
||||
|
||||
export type PermVariation = '' | 'reader-comments' | 'member-metadata';
|
||||
|
@ -2,12 +2,17 @@
|
||||
"name": "@urbit/api",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"repository" : {
|
||||
"type" : "git",
|
||||
"url": "ssh://git@github.com/urbit/urbit.git",
|
||||
"directory": "pkg/npm/api"
|
||||
},
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Tyler Brown Cifu Shuster",
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
|
55
pkg/npm/api/settings/index.d.ts
vendored
Normal file
55
pkg/npm/api/settings/index.d.ts
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
export type Key = string;
|
||||
export type Value = string | boolean | number;
|
||||
export type Bucket = Map<string, Value>;
|
||||
export type Settings = Map<string, Bucket>;
|
||||
|
||||
interface PutBucket {
|
||||
"put-bucket": {
|
||||
"bucket-key": Key;
|
||||
"bucket": Bucket;
|
||||
};
|
||||
}
|
||||
|
||||
interface DelBucket {
|
||||
"del-bucket": {
|
||||
"bucket-key": Key;
|
||||
};
|
||||
}
|
||||
|
||||
interface PutEntry {
|
||||
"put-entry": {
|
||||
"bucket-key": Key;
|
||||
"entry-key": Key;
|
||||
"value": Value;
|
||||
};
|
||||
}
|
||||
|
||||
interface DelEntry {
|
||||
"del-entry": {
|
||||
"bucket-key": Key;
|
||||
"entry-key": Key;
|
||||
};
|
||||
}
|
||||
|
||||
interface AllData {
|
||||
"all": Settings;
|
||||
}
|
||||
|
||||
interface BucketData {
|
||||
"bucket": Bucket;
|
||||
}
|
||||
|
||||
interface EntryData {
|
||||
"entry": Value;
|
||||
}
|
||||
|
||||
export type SettingsUpdate =
|
||||
| PutBucket
|
||||
| DelBucket
|
||||
| PutEntry
|
||||
| DelEntry;
|
||||
|
||||
export type SettingsData =
|
||||
| AllData
|
||||
| BucketData
|
||||
| EntryData;
|
0
pkg/npm/api/settings/index.ts
Normal file
0
pkg/npm/api/settings/index.ts
Normal file
@ -96,7 +96,8 @@ const rules = {
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-tabs": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-unused-vars": [
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"vars": "all",
|
||||
@ -104,7 +105,8 @@ const rules = {
|
||||
"ignoreRestSiblings": false
|
||||
}
|
||||
],
|
||||
"no-use-before-define": [
|
||||
"no-use-before-define": "off",
|
||||
"@typescript-eslint/no-use-before-define": [
|
||||
"error",
|
||||
{
|
||||
"functions": false,
|
||||
|
1015
pkg/npm/eslint-config/package-lock.json
generated
1015
pkg/npm/eslint-config/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -2,13 +2,25 @@
|
||||
"name": "@urbit/eslint-config",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@github.com/urbit/urbit.git",
|
||||
"directory": "pkg/npm/eslint-config"
|
||||
},
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "Tyler Brown Cifu Shuster",
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"eslint": ">= 3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^4.15.0",
|
||||
"@typescript-eslint/parser": "^4.15.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint-plugin-react": "^7.22.0",
|
||||
"typescript": "^4.1.5"
|
||||
}
|
||||
}
|
||||
|
42
pkg/npm/http-api/.github/workflows/main.yml
vendored
42
pkg/npm/http-api/.github/workflows/main.yml
vendored
@ -1,42 +0,0 @@
|
||||
name: CI
|
||||
on: [push]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Begin CI...
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node 12
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
|
||||
- name: Use cached node_modules
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: node_modules
|
||||
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
nodeModules-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Lint
|
||||
run: yarn lint
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Test
|
||||
run: yarn test --ci --coverage --maxWorkers=2
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Build
|
||||
run: yarn build
|
||||
env:
|
||||
CI: true
|
5
pkg/npm/http-api/.vscode/settings.json
vendored
5
pkg/npm/http-api/.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"files.watcherExclude": {
|
||||
"**/node_modules/**": false
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Tyler Brown Cifu Shuster
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -3,7 +3,11 @@
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"description": "Library to interact with an Urbit ship over HTTP",
|
||||
"repository": "github:tylershuster/urbit",
|
||||
"repository" : {
|
||||
"type" : "git",
|
||||
"url": "ssh://git@github.com/urbit/urbit.git",
|
||||
"directory": "pkg/npm/http-api"
|
||||
},
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
"browser": "dist/esm/index.js",
|
||||
@ -27,7 +31,7 @@
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
},
|
||||
"author": "Tyler Brown Cifu Shuster",
|
||||
"author": "",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
||||
|
Loading…
Reference in New Issue
Block a user