Skip to content

Commit 12f0a6e

Browse files
feat(dir-sdk-javascript): initial commit
Signed-off-by: Bendegúz Csirmaz <csirmazbendeguz@gmail.com>
1 parent 65054f2 commit 12f0a6e

79 files changed

Lines changed: 12857 additions & 199 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
####################################################
22
#
3-
# List of approvers for <project-name> project
3+
# List of approvers for the Directory JavaScript SDK project
44
#
55
#####################################################
66
#
@@ -12,8 +12,8 @@
1212
# the repository. Unless a later match takes precedence,
1313
# the following users/teams will be requested for
1414
# review when someone opens a pull request.
15-
* @agntcy/<maintainer-team-name>
15+
* @agntcy/dir-maintainers
1616

1717
# Enforces admin protections for repo configuration via probot settings app.
1818
# ref: https://github.com/probot/settings#security-implications
19-
.github/settings.yml @agntcy/<admin-team-name>
19+
.github/settings.yml @agntcy/dir-maintainers

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ body:
3030
If applicable, provide the version number or release tag where this
3131
issue was encountered
3232
options:
33-
- v1.0.0
34-
- v1.0.1
35-
- v1.0.2
36-
- v1.0.3
33+
- v1.1.0
3734
default: 0
3835
validations:
3936
required: false
@@ -55,7 +52,7 @@ body:
5552
label: Checklist
5653
description: By submitting this issue, you agree to the following
5754
options:
58-
- label: I have read the [contributing guidelines](/agntcy/repo-template/blob/main/CONTRIBUTING.md)
55+
- label: I have read the [contributing guidelines](/agntcy/dir-sdk-javascript/blob/main/CONTRIBUTING.md)
5956
required: true
6057
- label: I have verified this does not duplicate an existing issue
6158
required: true

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ body:
4848
label: Checklist
4949
description: By submitting this request, you agree to the following
5050
options:
51-
- label: I have read the [contributing guidelines](/agntcy/repo-template/blob/main/CONTRIBUTING.md)
51+
- label: I have read the [contributing guidelines](/agntcy/dir-sdk-javascript/blob/main/CONTRIBUTING.md)
5252
required: true
5353
- label: |
5454
I have verified this does not duplicate an existing feature request

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ much longer to review, or result in it not being reviewed at all.
1919

2020
## Checklist
2121

22-
- [ ] I have read the [contributing guidelines](/agntcy/repo-template/blob/main/CONTRIBUTING.md)
22+
- [ ] I have read the [contributing guidelines](/agntcy/dir-sdk-javascript/blob/main/CONTRIBUTING.md)
2323
- [ ] Existing issues have been referenced (where applicable)
2424
- [ ] I have verified this change is not present in other open pull requests
2525
- [ ] Functionality is documented

.github/settings.yml

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ repository:
55
# See https://developer.github.com/v3/repos/#edit for all available settings.
66

77
# The name of the repository. Changing this will rename the repository
8-
name: repo-template
8+
name: dir-sdk-javascript
99

1010
# A short description of the repository that will show up on GitHub
11-
description: Agntcy Project Repo Template
11+
description: Directory JavaScript SDK
1212

1313
# A URL with more information about the repository
14-
homepage: https://www.example.com
14+
homepage: https://docs.agntcy.org/dir/directory-sdk/#javascript-sdk
1515

1616
# A comma-separated list of topics to set on the repository
1717
topics: github, probot
@@ -60,60 +60,56 @@ repository:
6060

6161
# TODO: Enable this section once GitHub teams have been created & granted access to this repository
6262
# See https://developer.github.com/v3/teams/#add-or-update-team-repository for options
63-
# teams:
64-
# # The permission to grant the team. Can be one of:
65-
# # * `pull` - can pull, but not push to or administer this repository.
66-
# # * `push` - can pull and push, but not administer this repository.
67-
# # * `admin` - can pull, push and administer this repository.
68-
# # * `maintain` - Recommended for project managers who need to manage the
69-
# # repository without access to sensitive or destructive actions.
70-
# # * `triage` - Recommended for contributors who need to proactively manage
71-
# # issues and pull requests without write access.
72-
# - name: <project-name-admins>
73-
# permission: admin
74-
# - name: <project-name-maintainers>
75-
# permission: maintain
76-
# - name: <project-name>
77-
# permission: triage
63+
teams:
64+
# The permission to grant the team. Can be one of:
65+
# * `pull` - can pull, but not push to or administer this repository.
66+
# * `push` - can pull and push, but not administer this repository.
67+
# * `admin` - can pull, push and administer this repository.
68+
# * `maintain` - Recommended for project managers who need to manage the
69+
# repository without access to sensitive or destructive actions.
70+
# * `triage` - Recommended for contributors who need to proactively manage
71+
# issues and pull requests without write access.
72+
- name: dir-maintainers
73+
permission: admin
7874

7975
# TODO: Enable this section once repository has been created & no further modifications are needed
80-
# branches:
81-
# - name: main
82-
# # https://developer.github.com/v3/repos/branches/#update-branch-protection
83-
# # Branch Protection settings. Set to null to disable
84-
# protection:
85-
# # Required. Require at least one approving review on a pull request,
86-
# # before merging. Set to null to disable.
87-
# required_pull_request_reviews:
88-
# # The number of approvals required. (1-6)
89-
# required_approving_review_count: 1
90-
# # Dismiss approved reviews automatically when a new commit is pushed.
91-
# dismiss_stale_reviews: true
92-
# # Blocks merge until code owners have reviewed.
93-
# require_code_owner_reviews: true
94-
# # Specify which users and teams can dismiss pull request reviews. Pass
95-
# # an empty dismissal_restrictions object to disable. User and team
96-
# # dismissal_restrictions are only available for organization-owned
97-
# # repositories. Omit this parameter for personal repositories.
98-
# dismissal_restrictions:
99-
# users: []
100-
# teams: []
101-
# # Required. Require status checks to pass before merging. Set to null to disable
102-
# required_status_checks:
103-
# # Required. Require branches to be up to date before merging.
104-
# strict: true
105-
# # Required. The list of required status checks in order to merge into this branch
106-
# contexts: []
107-
# # Required. Enforce all configured restrictions for administrators. Set to
108-
# # true to enforce required status checks for repository administrators.
109-
# # Set to null to disable.
110-
# enforce_admins: true
111-
# # Prevent merge commits from being pushed to matching branches
112-
# required_linear_history: true
113-
# # Required. Restrict who can push to this branch. Team and user
114-
# # restrictions are only available for organization-owned repositories. Set
115-
# # to null to disable.
116-
# restrictions:
117-
# apps: []
118-
# users: []
119-
# teams: []
76+
branches:
77+
- name: main
78+
# https://developer.github.com/v3/repos/branches/#update-branch-protection
79+
# Branch Protection settings. Set to null to disable
80+
protection:
81+
# Required. Require at least one approving review on a pull request,
82+
# before merging. Set to null to disable.
83+
required_pull_request_reviews:
84+
# The number of approvals required. (1-6)
85+
required_approving_review_count: 1
86+
# Dismiss approved reviews automatically when a new commit is pushed.
87+
dismiss_stale_reviews: true
88+
# Blocks merge until code owners have reviewed.
89+
require_code_owner_reviews: true
90+
# Specify which users and teams can dismiss pull request reviews. Pass
91+
# an empty dismissal_restrictions object to disable. User and team
92+
# dismissal_restrictions are only available for organization-owned
93+
# repositories. Omit this parameter for personal repositories.
94+
dismissal_restrictions:
95+
users: []
96+
teams: []
97+
# Required. Require status checks to pass before merging. Set to null to disable
98+
required_status_checks:
99+
# Required. Require branches to be up to date before merging.
100+
strict: true
101+
# Required. The list of required status checks in order to merge into this branch
102+
contexts: []
103+
# Required. Enforce all configured restrictions for administrators. Set to
104+
# true to enforce required status checks for repository administrators.
105+
# Set to null to disable.
106+
enforce_admins: true
107+
# Prevent merge commits from being pushed to matching branches
108+
required_linear_history: true
109+
# Required. Restrict who can push to this branch. Team and user
110+
# restrictions are only available for organization-owned repositories. Set
111+
# to null to disable.
112+
restrictions:
113+
apps: []
114+
users: []
115+
teams: []

.github/workflows/ci.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
tags:
11+
- "v*.*.*"
12+
pull_request:
13+
14+
permissions:
15+
contents: write
16+
packages: write
17+
id-token: write
18+
pull-requests: write
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
changes:
26+
name: Detect Changes
27+
runs-on: ubuntu-latest
28+
outputs:
29+
code: ${{ steps.result.outputs.code }}
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
34+
- name: Check for code changes
35+
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
36+
id: filter
37+
with:
38+
filters: |
39+
code:
40+
- '!docs/**'
41+
- '!README.md'
42+
- '!CHANGELOG.md'
43+
- '!CONTRIBUTING.md'
44+
- '!CODE_OF_CONDUCT.md'
45+
- '!SECURITY.md'
46+
- '!LICENSE.md'
47+
- '!MAINTAINERS.md'
48+
- '!CONTRIBUTORS.md'
49+
- '!AUTHZ.md'
50+
- '!API_SPEC.md'
51+
- '!RELEASE.md'
52+
- '!.gitignore'
53+
54+
- name: Determine result
55+
id: result
56+
run: |
57+
# Always run for tag pushes (releases), otherwise use paths-filter result
58+
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
59+
echo "code=true" >> $GITHUB_OUTPUT
60+
else
61+
echo "code=${{ steps.filter.outputs.code }}" >> $GITHUB_OUTPUT
62+
fi
63+
64+
test:
65+
name: Test
66+
needs:
67+
- changes
68+
uses: ./.github/workflows/reusable-test-sdk.yaml
69+
with:
70+
image_repo: ghcr.io/agntcy
71+
image_tag: ${{ github.sha }}
72+
73+
success:
74+
name: Success
75+
if: ${{ !cancelled() && !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }}
76+
needs:
77+
- changes
78+
- test
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: Echo Success
82+
run: |
83+
if [[ "${{ needs.changes.outputs.code }}" == "true" ]]; then
84+
echo "::notice Success! All code checks passed."
85+
else
86+
echo "::notice Success! No code changes detected, skipped builds and tests."
87+
fi

.github/workflows/dependency.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
name: dependency
33

4-
on:
5-
# Review dependencies on pull requests to the default branch
6-
pull_request:
7-
branches: ["main"]
4+
# TODO: enable dependency review after migration
5+
# on:
6+
# Review dependencies on pull requests to the default branch
7+
# pull_request:
8+
# branches: ["main"]
89

910
# Declare default permissions as read-only
1011
permissions: read-all

.github/workflows/lint.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
name: lint
33

4-
on:
5-
push:
6-
# Run superlinter on pushes to default branch
7-
branches:
8-
- main
9-
# Run superlinter on pull request events
10-
pull_request:
4+
# TODO: enable linter after migration
5+
# on:
6+
# push:
7+
# # Run superlinter on pushes to default branch
8+
# branches:
9+
# - main
10+
# # Run superlinter on pull request events
11+
# pull_request:
1112

1213
# Declare default permissions as read-only
1314
permissions: read-all
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Test SDK
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
image_repo:
10+
required: true
11+
type: string
12+
description: "Image repo to use."
13+
image_tag:
14+
required: true
15+
type: string
16+
description: "Image tag to use."
17+
18+
permissions:
19+
id-token: write
20+
contents: read
21+
22+
jobs:
23+
javascript:
24+
name: JavaScript
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Login to ghcr.io
33+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
34+
with:
35+
registry: ghcr.io
36+
username: notused
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Install Task
40+
uses: go-task/setup-task@3be4020d41929789a01026e0e427a4321ce0ad44 #v2.0.0
41+
42+
- name: Setup Node env
43+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
44+
with:
45+
node-version: "24.x"
46+
registry-url: https://registry.npmjs.org/
47+
scope: "@agntcy"
48+
49+
- name: Download artifacts
50+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
51+
with:
52+
path: tmp/artifacts
53+
merge-multiple: true
54+
55+
- name: Cache npm dependencies
56+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
57+
with:
58+
path: "~/.npm"
59+
key: node-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
60+
restore-keys: |
61+
node-${{ runner.os }}-
62+
63+
- name: Add dependencies for SDKs testing
64+
env:
65+
CLIENT_ID: "https://github.com/${{ github.repository }}/.github/workflows/reusable-test-sdk.yaml@${{ github.ref }}"
66+
run: |
67+
task sdk:deps:cicd:iodc-token-generation >> $GITHUB_ENV
68+
69+
- name: Test JavaScript SDK
70+
env:
71+
IMAGE_REPO: ${{ inputs.image_repo }}
72+
IMAGE_TAG: ${{ inputs.image_tag }}
73+
run: |
74+
task sdk:test:javascript

0 commit comments

Comments
 (0)