Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bindings/nodejs): Add generated index.d.ts #1664

Merged
merged 3 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ jobs:
working-directory: bindings/nodejs
run: yarn install

- name: Build
working-directory: bindings/nodejs
run: yarn build

- name: Build bindings/nodejs Docs
working-directory: bindings/nodejs
run: yarn docs
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ Cargo.lock

.pnp.*
.yarn
!.yarn/patches
*.node
docs/

generated*.*
index.d.ts
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

diff --git a/scripts/index.js b/scripts/index.js
index 8db6618cb0f730238369a92a54fa23ad7a7bf6b1..065decd83647df7f195f34f0c2815b253f3dc386 100755
--- a/scripts/index.js
+++ b/scripts/index.js
@@ -11683,7 +11683,26 @@ function processIntermediateTypeFile(source, target, noDtsHeader) {
}, '');
const dtsHeader = noDtsHeader
? ''
- : `/* tslint:disable */
+ : `/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* tslint:disable */
/* eslint-disable */

/* auto-generated by NAPI-RS */\n
102 changes: 102 additions & 0 deletions bindings/nodejs/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/* tslint:disable */
/* eslint-disable */

/* auto-generated by NAPI-RS */

export class Operator {
constructor(scheme: string, options?: Record<string, string> | undefined | null)
/** Get current path's metadata **without cache** directly. */
stat(path: string): Promise<Metadata>
/** Get current path's metadata **without cache** directly and synchronously. */
statSync(path: string): Metadata
/** Create dir with given path. */
createDir(path: string): Promise<void>
/** Create dir with given path synchronously. */
createDirSync(path: string): void
/** Write bytes into path. */
write(path: string, content: Buffer | string): Promise<void>
/** Write bytes into path synchronously. */
writeSync(path: string, content: Buffer | string): void
/** Read the whole path into a buffer. */
read(path: string): Promise<Buffer>
/** Read the whole path into a buffer synchronously. */
readSync(path: string): Buffer
/** List dir in flat way. */
scan(path: string): Promise<Lister>
/** List dir in flat way synchronously. */
scanSync(path: string): BlockingLister
/** Delete the given path. */
delete(path: string): Promise<void>
/** Delete the given path synchronously. */
deleteSync(path: string): void
/**
* List given path.
*
* This function will create a new handle to list entries.
*
* An error will be returned if given path doesn't end with `/`.
*/
list(path: string): Promise<Lister>
/**
* List given path synchronously.
*
* This function will create a new handle to list entries.
*
* An error will be returned if given path doesn't end with `/`.
*/
listSync(path: string): BlockingLister
}
export class Entry {
path(): string
}
export class Metadata {
/** Returns true if the <op.stat> object describes a file system directory. */
isDirectory(): boolean
/** Returns true if the <op.stat> object describes a regular file. */
isFile(): boolean
/** Content-Disposition of this object */
get contentDisposition(): string | null
/** Content Length of this object */
get contentLength(): bigint | null
/** Content MD5 of this object. */
get contentMd5(): string | null
/** Content Type of this object. */
get contentType(): string | null
/** ETag of this object. */
get etag(): string | null
/** Last Modified of this object.(UTC) */
get lastModified(): string | null
}
export class Lister {
/**
* # Safety
*
* > &mut self in async napi methods should be marked as unsafe
*
* napi will make sure the function is safe, and we didn't do unsafe
* thing internally.
*/
next(): Promise<Entry | null>
}
export class BlockingLister {
next(): Entry | null
}
5 changes: 4 additions & 1 deletion bindings/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,8 @@
"test": "cucumber-js",
"version": "napi version"
},
"packageManager": "yarn@3.4.1+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f"
"packageManager": "yarn@3.4.1+sha224.cca891d4a8671d4898aba3426674bb734dbbf88cef82dd4dacd71c9f",
"resolutions": {
"@napi-rs/cli@^2.14.8": "patch:@napi-rs/cli@npm%3A2.14.8#./.yarn/patches/@napi-rs-cli-npm-2.14.8-71492d0ade.patch"
}
}
11 changes: 10 additions & 1 deletion bindings/nodejs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ __metadata:
languageName: node
linkType: hard

"@napi-rs/cli@npm:^2.14.8":
"@napi-rs/cli@npm:2.14.8":
version: 2.14.8
resolution: "@napi-rs/cli@npm:2.14.8"
bin:
Expand All @@ -193,6 +193,15 @@ __metadata:
languageName: node
linkType: hard

"@napi-rs/cli@patch:@napi-rs/cli@npm%3A2.14.8#./.yarn/patches/@napi-rs-cli-npm-2.14.8-71492d0ade.patch::locator=opendal%40workspace%3A.":
version: 2.14.8
resolution: "@napi-rs/cli@patch:@napi-rs/cli@npm%3A2.14.8#./.yarn/patches/@napi-rs-cli-npm-2.14.8-71492d0ade.patch::version=2.14.8&hash=0747d9&locator=opendal%40workspace%3A."
bin:
napi: scripts/index.js
checksum: 6860e2241d8c03efb3f55c3e111784e845ef271185665f8f6b3beb3685bba0bb6cab473d56ff30212d486df4fe142240f5181e5637ed4fd7b8c05dd1683e7196
languageName: node
linkType: hard

"@swc-node/core@npm:^1.10.1":
version: 1.10.1
resolution: "@swc-node/core@npm:1.10.1"
Expand Down
1 change: 0 additions & 1 deletion licenserc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ excludes = [
"**/fixtures/**",
"tests/data/**",
"bindings/nodejs/.npmignore",
"bindings/nodejs/index.d.ts",
"bindings/nodejs/generated*.*",
"**/*.node",
"bindings/python/test_requirements.txt",
Expand Down