Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
d05a3316c5 | |||
50a6b99b9b | |||
27af4bc41f | |||
8b586640a1 | |||
bdc93b01b6 | |||
fa99ed778d | |||
182a264f65 | |||
1566d06a7d | |||
4f25f2d6e6 | |||
6468aa902e | |||
357c77d572 | |||
542f99261c | |||
f539144cb1 | |||
8c717516d4 |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm publish
|
||||
|
||||
metadata:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
run: |
|
||||
npmci command npm install -g typescript
|
||||
npmci npm install
|
||||
|
||||
- name: Trigger
|
||||
run: npmci trigger
|
||||
|
||||
- name: Build docs and upload artifacts
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @git.zone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,7 +3,6 @@
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
@ -17,4 +16,4 @@ node_modules/
|
||||
dist/
|
||||
dist_*/
|
||||
|
||||
# custom
|
||||
#------# custom
|
137
.gitlab-ci.yml
137
.gitlab-ci.yml
@ -1,137 +0,0 @@
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
tags:
|
||||
- docker
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
allow_failure: true
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "current file",
|
||||
"type": "node",
|
||||
"command": "npm test",
|
||||
"name": "Run npm test",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"${relativeFile}"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": "test.ts",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"test/test.ts"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
32
changelog.md
Normal file
32
changelog.md
Normal file
@ -0,0 +1,32 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-12-27 - 1.2.1 - fix(documentation)
|
||||
Updated package description and keywords
|
||||
|
||||
- Standardized and expanded the package description for better clarity.
|
||||
- Added relevant keywords to enhance discoverability.
|
||||
|
||||
## 2024-12-27 - 1.2.0 - feat(ci)
|
||||
Add GitHub Actions workflows for CI/CD
|
||||
|
||||
- Implemented workflows for handling pushes and tags separately.
|
||||
- Added job steps for security audits, testing, releasing, and metadata handling.
|
||||
- Updated .vscode launch configuration to run tests with npm command.
|
||||
|
||||
## 2024-12-27 - 1.1.0 - feat(core)
|
||||
Add TypeScript configuration and update package dependencies and scripts
|
||||
|
||||
- Added 'tsconfig.json' for TypeScript configuration, setting target to ES2022 and module to NodeNext.
|
||||
- Updated the package name and author in 'package.json'.
|
||||
- Fixed module paths for imports in 'test/test.ts'.
|
||||
- Removed '.gitlab-ci.yml'.
|
||||
|
||||
## 2023-06-09 - 1.0.5 to 1.0.6 - core updates
|
||||
Routine core updates and version bump
|
||||
|
||||
- Core update implemented in version 1.0.5
|
||||
|
||||
## 2020-09-14 - 1.0.1 to 1.0.5 - core updates
|
||||
Routine core updates and version bump
|
||||
|
||||
- Sequential core updates from version 1.0.1 to 1.0.5
|
2
license
2
license
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2020 Lossless GmbH (hello@lossless.com)
|
||||
Copyright (c) 2020 Task Venture Capital GmbH (hello@task.vc)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -5,10 +5,24 @@
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "social.io/private",
|
||||
"gitrepo": "interfaces",
|
||||
"shortDescription": "an interface package for social.io",
|
||||
"npmPackagename": "@social.io_private/interfaces",
|
||||
"license": "UNLICENSED",
|
||||
"projectDomain": "social.io"
|
||||
"projectDomain": "social.io",
|
||||
"description": "A TypeScript-based package providing standardized interfaces for data exchange and operations within the social.io application ecosystem.",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"interfaces",
|
||||
"social media",
|
||||
"data exchange",
|
||||
"session management",
|
||||
"profile management",
|
||||
"conversations",
|
||||
"node.js",
|
||||
"typed requests",
|
||||
"standardization",
|
||||
"module",
|
||||
"npm package"
|
||||
]
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
|
11210
package-lock.json
generated
11210
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
51
package.json
51
package.json
@ -1,27 +1,28 @@
|
||||
{
|
||||
"name": "@social.io_private/interfaces",
|
||||
"version": "1.0.2",
|
||||
"name": "@social.io/interfaces",
|
||||
"version": "1.2.1",
|
||||
"private": false,
|
||||
"description": "an interface package for social.io",
|
||||
"description": "A TypeScript-based package providing standardized interfaces for data exchange and operations within the social.io application ecosystem.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "UNLICENSED",
|
||||
"type": "module",
|
||||
"author": "Task Venture Capital GmbH",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild)",
|
||||
"format": "(gitzone format)"
|
||||
"build": "(tsbuild --web)",
|
||||
"format": "(gitzone format)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.11.7",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
"@git.zone/tsbuild": "^2.1.66",
|
||||
"@git.zone/tsrun": "^1.3.3",
|
||||
"@git.zone/tstest": "^1.0.74",
|
||||
"@push.rocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^20.2.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15"
|
||||
"@apiglobal/typedrequest-interfaces": "^2.0.1"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
@ -37,5 +38,27 @@
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitlab.com/social.io/private/interfaces.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/social.io/private/interfaces/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/social.io/private/interfaces#readme",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"interfaces",
|
||||
"social media",
|
||||
"data exchange",
|
||||
"session management",
|
||||
"profile management",
|
||||
"conversations",
|
||||
"node.js",
|
||||
"typed requests",
|
||||
"standardization",
|
||||
"module",
|
||||
"npm package"
|
||||
]
|
||||
}
|
||||
|
9639
pnpm-lock.yaml
generated
Normal file
9639
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
0
readme.hints.md
Normal file
0
readme.hints.md
Normal file
180
readme.md
180
readme.md
@ -1,34 +1,162 @@
|
||||
# @social.io/private/interfaces
|
||||
an interface package for social.io
|
||||
# @social.io/interfaces
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@social.io_private/interfaces)
|
||||
* [gitlab.com (source)](https://gitlab.com/social.io/private/interfaces)
|
||||
* [github.com (source mirror)](https://github.com/social.io/private/interfaces)
|
||||
* [docs (typedoc)](https://social.io/private.gitlab.io/interfaces/)
|
||||
An interface package for social.io.
|
||||
|
||||
## Status for master
|
||||
## Install
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
TypeScript Support | [](https://lossless.cloud)
|
||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
To install the `@social.io/interfaces` package, you can use npm. Make sure you have Node.js installed, then run the following command in your terminal:
|
||||
|
||||
```bash
|
||||
npm install @social.io/interfaces
|
||||
```
|
||||
|
||||
This will fetch the latest package from the npm registry and add it to your project's dependencies.
|
||||
|
||||
## Usage
|
||||
|
||||
Use TypeScript for best in class intellisense
|
||||
For further information read the linked docs at the top of this readme.
|
||||
The `@social.io/interfaces` package provides a set of interfaces to be used with the social.io application, designed to standardize the communication and data exchange within the application. To effectively use this package, it's recommended to employ TypeScript, which provides advanced features like intellisense and type safety, promoting a better development experience.
|
||||
|
||||
> UNLICENSED licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
### Setting Up Your Project
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
Firstly, ensure that you set up your project to work with ES Modules and optionally TypeScript. If you are working with JavaScript, ensure your `package.json` file contains the line `"type": "module"`. For TypeScript, you might want to add configuration in `tsconfig.json` as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"target": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Importing Interfaces
|
||||
|
||||
The package exports various interfaces for managing social.io data and operations. You can import them using:
|
||||
|
||||
```typescript
|
||||
import {
|
||||
ISioConversation,
|
||||
ISioSession,
|
||||
IRequest_GetSocialSession,
|
||||
IRequest_AttachProfileId,
|
||||
IRequest_GetConversations
|
||||
} from '@social.io/interfaces';
|
||||
```
|
||||
|
||||
### Managing Sessions
|
||||
|
||||
The package provides an interface `IRequest_GetSocialSession` which models a request to get a social session. This can be useful when you need to manage user sessions:
|
||||
|
||||
```typescript
|
||||
const getSessionRequest: IRequest_GetSocialSession = {
|
||||
method: 'getSocialSession',
|
||||
request: {
|
||||
existingSessionId: 'currentSessionId123'
|
||||
},
|
||||
response: {
|
||||
newSessionId: 'newSessionId456'
|
||||
}
|
||||
};
|
||||
|
||||
// Utilize getSessionRequest in your session management logic
|
||||
```
|
||||
|
||||
This follows a pattern of detailing a request/response structure, allowing you to handle sessions more seamlessly.
|
||||
|
||||
### Attaching Profile IDs
|
||||
|
||||
The interaction with user profiles is essential in most social applications. Use `IRequest_AttachProfileId` to attach a profile to a session:
|
||||
|
||||
```typescript
|
||||
const attachProfileRequest: IRequest_AttachProfileId = {
|
||||
method: 'attachProfileId',
|
||||
request: {
|
||||
sessionId: 'newSessionId456',
|
||||
profileId: 'userProfileId789'
|
||||
},
|
||||
response: {
|
||||
newSessionId: 'updatedSessionId012'
|
||||
}
|
||||
};
|
||||
|
||||
// Implement logic to leverage attachProfileRequest for profile operations
|
||||
```
|
||||
|
||||
These types ensure strict adherence to your backend contract, reducing runtime errors and improving code quality.
|
||||
|
||||
### Handling Conversations
|
||||
|
||||
Conversations are a critical part of any social platform. The package defines various interfaces to accommodate complex conversation structures:
|
||||
|
||||
```typescript
|
||||
const conversation: ISioConversation = {
|
||||
subject: 'Chat about TypeScript best practices',
|
||||
parties: [
|
||||
{ id: 'user1', name: 'Alice', description: 'TypeScript enthusiast' },
|
||||
{ id: 'user2', name: 'Bob', description: 'Node.js guru' }
|
||||
],
|
||||
conversationBlocks: [
|
||||
{ partyId: 'user1', text: 'I love using TypeScript with Node.js!' },
|
||||
{ partyId: 'user2', text: 'Same here! It makes development so much safer and robust.' }
|
||||
]
|
||||
};
|
||||
|
||||
// These conversations can be leveraged in your business logic to create engaging user experiences
|
||||
```
|
||||
|
||||
This interface allows for a detailed conversational structure including multiple participants and conversation blocks.
|
||||
|
||||
### Extending Sessions and Conversations
|
||||
|
||||
For further extensions, the `ISioSession` interface is key, providing session-level information like tenant IDs, activity status, and user profiles:
|
||||
|
||||
```typescript
|
||||
const session: ISioSession = {
|
||||
tenantId: 'socialTenant123',
|
||||
active: true,
|
||||
abandoned: false,
|
||||
markedForDeletion: false,
|
||||
profileInfo: {
|
||||
profileId: 'profileId1234',
|
||||
name: 'Alice Johnson',
|
||||
email: 'alice@example.com',
|
||||
mobilePhone: '+1234567890'
|
||||
},
|
||||
conversations: [conversation]
|
||||
};
|
||||
|
||||
// Handle session operations and data management through this detailed session structure
|
||||
```
|
||||
|
||||
This level of detail in interfaces encourages robust software design by promoting thorough type usage and better communication through shared types.
|
||||
|
||||
### Requests Pattern
|
||||
|
||||
The package uses a consistent pattern by inheriting from a base typed request interface, promoting consistency and reusability:
|
||||
|
||||
```typescript
|
||||
import * as plugins from '@social.io/interfaces';
|
||||
|
||||
export interface IRequest_GetArrayExample
|
||||
extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_GetArrayExample
|
||||
> {
|
||||
method: 'getArrayExample';
|
||||
request: {
|
||||
itemCount: number;
|
||||
};
|
||||
response: {
|
||||
items: Array<string>;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Such patterns simplify request and response management due to their predictability and standardization across different modules.
|
||||
|
||||
By following these patterns, you can build scalable, maintainable, and highly reliable applications centered around the social.io interfaces. Always remember to check the comprehensive module documentation and integrate the above interfaces into your TypeScript-first, node-based projects.
|
||||
undefined
|
@ -1,5 +1,5 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as interfaces from '../ts/index';
|
||||
import { expect, tap } from '@push.rocks/tapbundle';
|
||||
import * as interfaces from '../ts/index.js';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
interfaces;
|
||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@social.io/interfaces',
|
||||
version: '1.2.1',
|
||||
description: 'A TypeScript-based package providing standardized interfaces for data exchange and operations within the social.io application ecosystem.'
|
||||
}
|
@ -1,2 +1,2 @@
|
||||
export * from './sio-interfaces.data';
|
||||
export * from './sio-interfaces.requests';
|
||||
export * from './sio-interfaces.data.js';
|
||||
export * from './sio-interfaces.requests.js';
|
||||
|
@ -1,5 +1,3 @@
|
||||
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
|
||||
|
||||
export {
|
||||
typedrequestInterfaces
|
||||
}
|
||||
export { typedrequestInterfaces };
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as plugins from './interfaces.plugins';
|
||||
import * as plugins from './interfaces.plugins.js';
|
||||
|
||||
// Basic Conversation
|
||||
export interface ISioConversationParty {
|
||||
@ -13,6 +13,7 @@ export interface ISioConversationBlock {
|
||||
}
|
||||
|
||||
export interface ISioConversation {
|
||||
subject: string;
|
||||
parties: ISioConversationParty[];
|
||||
conversationBlocks: ISioConversationBlock[];
|
||||
}
|
||||
@ -28,10 +29,9 @@ export interface ISioSession {
|
||||
name: string;
|
||||
email: string;
|
||||
mobilePhone: string;
|
||||
|
||||
};
|
||||
conversations: ISioConversation[];
|
||||
}
|
||||
|
||||
// tenant
|
||||
export interface ISioTenant {}
|
||||
export interface ISioTenant {}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import * as plugins from './interfaces.plugins';
|
||||
import * as plugins from './interfaces.plugins.js';
|
||||
|
||||
export interface IRequest_GetSocialSession extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_GetSocialSession
|
||||
> {
|
||||
export interface IRequest_GetSocialSession
|
||||
extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_GetSocialSession
|
||||
> {
|
||||
method: 'getSocialSession';
|
||||
request: {
|
||||
existingSessionId?: string;
|
||||
@ -13,24 +14,26 @@ export interface IRequest_GetSocialSession extends plugins.typedrequestInterface
|
||||
};
|
||||
}
|
||||
|
||||
export interface IRequest_AttachProfileId extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_AttachProfileId
|
||||
> {
|
||||
method: 'attachProfileId';
|
||||
request: {
|
||||
sessionId: string;
|
||||
profileId: string;
|
||||
};
|
||||
response: {
|
||||
newSessionId: string;
|
||||
};
|
||||
export interface IRequest_AttachProfileId
|
||||
extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_AttachProfileId
|
||||
> {
|
||||
method: 'attachProfileId';
|
||||
request: {
|
||||
sessionId: string;
|
||||
profileId: string;
|
||||
};
|
||||
response: {
|
||||
newSessionId: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IRequest_GetConversations extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_GetConversations
|
||||
> {
|
||||
export interface IRequest_GetConversations
|
||||
extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IRequest_GetConversations
|
||||
> {
|
||||
method: 'getConversations';
|
||||
request: {
|
||||
sessionId: string;
|
||||
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {}
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user