repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.addSuperTriangle | addSuperTriangle(): void {
// Add new points to the end of the points array
this.points[this.N] = new TriangulationPoint(
this.N,
new Vector2(-100, -100),
);
this.points[this.N + 1] = new TriangulationPoint(
this.N + 1,
new Vector2(0, 100),
);
this.points[this.N + 2] = ne... | /**
* Initializes the triangulation by inserting the super triangle
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L251-L275 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.insertPointIntoTriangle | insertPointIntoTriangle(
p: TriangulationPoint,
t: number,
triangleCount: number,
) {
// V1
// *
// /|\
// /3|2\
// / | \
// / | \
// ... | /**
* Inserts the point `p` into triangle `t`, replacing it with three new triangles
*
* @param p The index of the point to insert
* @param t The index of the triangle
* @param triangleCount Total number of triangles created so far
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L284-L345 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.restoreDelauneyTriangulation | restoreDelauneyTriangulation(
p: TriangulationPoint,
t1: number,
t2: number,
t3: number,
): void {
const s: [t1: number, t2: number][] = [];
s.push([t1, this.triangulation[t1][E23]]);
s.push([t2, this.triangulation[t2][E23]]);
s.push([t3, this.triangulation[t3][E23]]);
while (s.l... | /**
* Restores the triangulation to a Delauney triangulation after new triangles have been added.
*
* @param p Index of the inserted point
* @param t1 Index of first triangle to check
* @param t2 Index of second triangle to check
* @param t3 Index of third triangle to check
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L355-L388 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.swapQuadDiagonalIfNeeded | swapQuadDiagonalIfNeeded(
p: number,
t1: number,
t2: number,
): { t3: number; t4: number } | null {
// 1) Form quadrilateral from t1 + t2 (q0->q1->q2->q3)
// 2) Swap diagonal between q1->q3 to q0->q2
//
// BEFORE AFTER
//
// ... | /**
* Swaps the diagonal of the quadrilateral formed by triangle `t` and the
* triangle adjacent to the edge that is opposite of the newly added point
*
* @param p The index of the inserted point
* @param t1 Index of the triangle containing p
* @param t2 Index of the triangle opposite t1 that shares e... | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L401-L501 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.discardTrianglesWithSuperTriangleVertices | discardTrianglesWithSuperTriangleVertices(): void {
for (let i = 0; i < this.triangleCount; i++) {
// Add all triangles that don't contain a super-triangle vertex
if (
this.triangleContainsVertex(i, this.N) ||
this.triangleContainsVertex(i, this.N + 1) ||
this.triangleContainsVer... | /**
* Marks any triangles that contain super-triangle vertices as discarded
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L506-L517 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.swapTest | swapTest(v1: Vector2, v2: Vector2, v3: Vector2, v4: Vector2): boolean {
const x13 = v1.x - v3.x;
const x23 = v2.x - v3.x;
const y13 = v1.y - v3.y;
const y23 = v2.y - v3.y;
const x14 = v1.x - v4.x;
const x24 = v2.x - v4.x;
const y14 = v1.y - v4.y;
const y24 = v2.y - v4.y;
const cosA ... | /**
* Checks to see if the triangle formed by points v1->v2->v3 circumscribes point v4.
*
* @param {Vector3} v1 - Coordinates of 1st vertex of triangle.
* @param {Vector3} v2 - Coordinates of 2nd vertex of triangle.
* @param {Vector3} v3 - Coordinates of 3rd vertex of triangle.
* @param {Vector3} v4 -... | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L528-L551 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.triangleContainsVertex | triangleContainsVertex(t: number, v: number): boolean {
return (
this.triangulation[t][V1] === v ||
this.triangulation[t][V2] === v ||
this.triangulation[t][V3] === v
);
} | /**
* Checks if the triangle `t` contains the specified vertex `v`.
*
* @param {number} t - The index of the triangle.
* @param {number} v - The index of the vertex.
* @returns {boolean} Returns true if the triangle `t` contains the vertex `v`.
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L560-L566 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.updateAdjacency | updateAdjacency(t: number, tOld: number, tNew: number) {
// Boundary edge, no triangle exists
if (t === OUT_OF_BOUNDS) {
return;
}
const sharedEdge = this.findSharedEdge(t, tOld);
if (sharedEdge) {
this.triangulation[t][sharedEdge] = tNew;
}
} | /**
* Updates the adjacency information in triangle `t`. Any references to `tOld` are
* replaced with `tNew`.
*
* @param {number} t - The index of the triangle to update.
* @param {number} tOld - The index to be replaced.
* @param {number} tNew - The new index to replace with.
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L576-L586 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | Triangulator.findSharedEdge | findSharedEdge(tOrigin: number, tAdjacent: number): number | null {
if (tOrigin === OUT_OF_BOUNDS) {
return null;
} else if (this.triangulation[tOrigin][E12] === tAdjacent) {
return E12;
} else if (this.triangulation[tOrigin][E23] === tAdjacent) {
return E23;
} else if (this.triangulat... | /**
* Finds the edge index for triangle `tOrigin` that is adjacent to triangle `tAdjacent`.
*
* @param {number} tOrigin - The origin triangle to search.
* @param {number} tAdjacent - The triangle index to search for.
* @param {number} edgeIndex - Edge index returned as an out parameter (by reference).
... | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/triangulators/Triangulator.ts#L598-L610 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | BinSort.getBinNumber | static getBinNumber(i: number, j: number, n: number): number {
return i % 2 === 0 ? i * n + j : (i + 1) * n - j - 1;
} | /**
* Computes the bin number for the set of grid coordinates.
*
* @param i - Grid row
* @param j - Grid column
* @param n - Grid size
* @returns The computed bin number based on row and column indices.
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/utils/BinSort.ts#L23-L25 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | BinSort.sort | static sort<T extends IBinSortable>(
input: T[],
lastIndex: number,
binCount: number,
): T[] {
if (binCount <= 1) {
return input; // Need at least two bins to sort
}
if (lastIndex > input.length) {
lastIndex = input.length; // If lastIndex is out of range, sort the entire array
... | /**
* Performs a counting sort of the input points based on their bin number. Only
* sorts the elements in the index range [0, count]. If binCount is <= 1, no sorting
* is performed. If lastIndex > input.length, the entire input array is sorted.
*
* @param input - The input array to sort
* @param last... | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/utils/BinSort.ts#L38-L74 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | linesIntersectInternal | function linesIntersectInternal(
a1: Vector2,
a2: Vector2,
b1: Vector2,
b2: Vector2,
includeSharedEndpoints: boolean,
): boolean {
let a12 = { x: a2.x - a1.x, y: a2.y - a1.y };
let b12 = { x: b2.x - b1.x, y: b2.y - b1.y };
// If any of the vertices are shared between the two diagonals,
// the quad co... | /**
* Returns true lines a1->a2 and b1->b2 is intersect
* @param a1 Start point of line A
* @param a2 End point of line A
* @param b1 Start point of line B
* @param b2 End point of line B
* @param includeSharedEndpoints If set to true, intersection test returns true if lines share endpoints
* @returns True if th... | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/utils/MathUtils.ts#L48-L90 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | hash2 | function hash2(v: Vector2, tolerance: number = 1e6): number {
// Multiply by the inverse of the tolerance to avoid division
const x = Math.floor(v.x * tolerance);
const y = Math.floor(v.y * tolerance);
return 0.5 * ((x + y) * (x + y + 1)) + y; // Pairing x and y
} | /**
* Calculates hash value of Vector2 using Cantor pairing
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/utils/MathUtils.ts#L153-L158 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | hash3 | function hash3(v: Vector3, tolerance: number = 1e6): number {
// Multiply by the inverse of the tolerance to avoid division
const x = Math.floor(v.x * tolerance);
const y = Math.floor(v.y * tolerance);
const z = Math.floor(v.z * tolerance);
const xy = 0.5 * ((x + y) * (x + y + 1)) + y;
return 0.5 * ((xy + z... | /**
* Returns true if p1 and p2 are effectively equal.
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/fracture/utils/MathUtils.ts#L163-L170 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | BreakableObject.fracture | fracture(
RAPIER: RAPIER_API,
world: RAPIER.World,
options: FractureOptions,
): PhysicsObject[] {
// Call the fracture function to split the mesh into fragments
return fracture(this.geometry, options).map((fragment) => {
const obj = new PhysicsObject();
// Use the original object as a... | /**
* Fractures this mesh into smaller pieces
* @param RAPIER The RAPIER physics API
* @param world The physics world object
* @param options Options controlling how to fracture this object
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/physics/BreakableObject.ts#L20-L52 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | PhysicsManager.addObject | addObject(obj: PhysicsObject, colliderDesc: RAPIER.ColliderDesc) {
if (obj.rigidBody) {
this.world.createCollider(colliderDesc, obj.rigidBody);
this.worldObjects.set(obj.rigidBody.handle, obj);
}
} | /**
* Adds an object to the world
* @param obj The physics object
* @param colliderDesc Collider description for the object
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/physics/PhysicsManager.ts#L45-L50 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | PhysicsManager.removeObject | removeObject(obj: PhysicsObject) {
if (obj.rigidBody) {
this.world.removeRigidBody(obj.rigidBody);
this.worldObjects.delete(obj.rigidBody.handle);
}
} | /**
* Removes an object from the world
* @param obj
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/physics/PhysicsManager.ts#L56-L61 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | PhysicsManager.handleFracture | async handleFracture(obj: BreakableObject, scene: THREE.Scene) {
const fragments = obj.fracture(
this.RAPIER,
this.world,
this.fractureOptions,
);
// Add the fragments to the scene and the physics world
scene.add(...fragments);
// Map the handle for each rigid body to the physics... | /**
* Handles fracturing `obj` into fragments and adding those to the scene
* @param obj The object to fracture
* @param scene The scene to add the resultant fragments to
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/physics/PhysicsManager.ts#L68-L99 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
three-pinata | github_2023 | dgreenheck | typescript | PhysicsManager.update | update(scene: THREE.Scene) {
// Step the physics world
this.world.step(this.eventQueue);
// Handle collisions
this.eventQueue.drainCollisionEvents((handle1, handle2, started) => {
if (!started) return;
// Using the handles from the collision event, find the object that needs to be updated
... | /**
* Updates the physics state and handles any collisions
* @param scene
*/ | https://github.com/dgreenheck/three-pinata/blob/3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0/src/physics/PhysicsManager.ts#L105-L129 | 3d2f3acbfb4d237a2cee93f4118711aa7c5fa0b0 |
screenshot-to-code | github_2023 | abi | typescript | fileToDataURL | function fileToDataURL(file: File) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
reader.readAsDataURL(file);
});
} | // TODO: Move to a separate file | https://github.com/abi/screenshot-to-code/blob/a240914b93d35ce17bc2263e2f9924b473e8bfa5/frontend/src/components/ImageUpload.tsx#L41-L48 | a240914b93d35ce17bc2263e2f9924b473e8bfa5 |
screenshot-to-code | github_2023 | abi | typescript | App.uploadImage | async uploadImage(screenshotPath: string) {
// Upload file
const fileInput = (await this.page.$(
".file-input"
)) as ElementHandle<HTMLInputElement>;
if (!fileInput) {
throw new Error("File input element not found");
}
await fileInput.uploadFile(screenshotPath);
await this._scree... | // Uploads a screenshot and generates the image | https://github.com/abi/screenshot-to-code/blob/a240914b93d35ce17bc2263e2f9924b473e8bfa5/frontend/src/tests/qa.test.ts#L215-L229 | a240914b93d35ce17bc2263e2f9924b473e8bfa5 |
screenshot-to-code | github_2023 | abi | typescript | App.edit | async edit(edit: string, version: string) {
// Type in the edit
await this.page.type(
'textarea[placeholder="Tell the AI what to change..."]',
edit
);
await this._screenshot(`typed_${version}`);
// Click the update button and wait for the code to be generated
await this.page.click("... | // Makes a text edit and waits for a new version | https://github.com/abi/screenshot-to-code/blob/a240914b93d35ce17bc2263e2f9924b473e8bfa5/frontend/src/tests/qa.test.ts#L232-L244 | a240914b93d35ce17bc2263e2f9924b473e8bfa5 |
screenshot-to-code | github_2023 | abi | typescript | App.importFromCode | async importFromCode() {
await this.page.click(".import-from-code-btn");
await this.page.type("textarea", "<html>hello world</html>");
await this.page.select("#output-settings-js", "HTML + Tailwind");
await this._screenshot("typed_code");
await this.page.click(".import-btn");
await this._wa... | // Work in progress | https://github.com/abi/screenshot-to-code/blob/a240914b93d35ce17bc2263e2f9924b473e8bfa5/frontend/src/tests/qa.test.ts#L263-L275 | a240914b93d35ce17bc2263e2f9924b473e8bfa5 |
ion | github_2023 | sst | typescript | createContext | const createContext = async (req: NextRequest) => {
return createTRPCContext({
headers: req.headers,
});
}; | /**
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
* handling a HTTP request (e.g. when you make requests from Client Components).
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/examples/aws-t3/src/app/api/trpc/[trpc]/route.ts#L12-L16 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Linkable.getSSTLink | public getSSTLink() {
return this._definition;
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/linkable.ts#L197-L199 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Linkable.wrap | public static wrap<Resource>(
cls: { new(...args: any[]): Resource },
cb: (resource: Resource) => Definition,
) {
// @ts-expect-error
this.wrappedResources.add(cls.__pulumiType);
cls.prototype.getSSTLink = function() {
return cb(this);
};
} | /**
* Wrap any resource class to make it linkable. Behind the scenes this modifies the
* prototype of the given class.
*
* :::tip
* Use `Linkable.wrap` to make any resource linkable.
* :::
*
* @param cls The resource class to wrap.
* @param cb A callback that returns the definition for the li... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/linkable.ts#L270-L280 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Resource.getSSTLink | public getSSTLink() {
return {
properties: this._properties,
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/linkable.ts#L314-L318 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Secret.constructor | constructor(name: string, placeholder?: string) {
super(
"sst:sst:Secret",
name,
{
placeholder,
},
{},
);
this._name = name;
this._placeholder = placeholder;
const value = process.env["SST_SECRET_" + this._name] ?? this._placeholder;
if (typeof value !== "st... | /**
* @param placeholder A placeholder value of the secret. This can be useful for cases where you might not be storing sensitive values.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/secret.ts#L107-L123 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Secret.name | public get name() {
return output(this._name);
} | /**
* The name of the secret.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/secret.ts#L128-L130 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Secret.value | public get value() {
return secret(this._value);
} | /**
* The value of the secret. It'll be `undefined` if the secret has not been set through the CLI or if the `placeholder` hasn't been set.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/secret.ts#L135-L137 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Secret.placeholder | public get placeholder() {
return output(this._placeholder);
} | /**
* The placeholder value of the secret.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/secret.ts#L142-L144 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Secret.getSSTLink | public getSSTLink() {
return {
properties: {
value: this.value,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/secret.ts#L147-L153 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Analog.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the Analog app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/analog.ts#L527-L531 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Analog.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the site.
*... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/analog.ts#L536-L551 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Analog.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/analog.ts#L554-L560 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayWebSocketRoute.nodes | public get nodes() {
return {
/**
* The Lambda function.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda permission.
*/
permission: this.permission,
/**
* The API Gateway HTTP API route.
*/
route: this.apiRoute,
... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigateway-websocket-route.ts#L145-L164 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayWebSocket.url | public get url() {
// Note: If mapping key is set, the URL needs a trailing slash. Without the
// trailing slash, the API fails with the error {"message":"Not Found"}
return this.apigDomain && this.apiMapping
? all([this.apigDomain.domainName, this.apiMapping.apiMappingKey]).apply(
([d... | /**
* The URL of the API.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated API Gateway URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigateway-websocket.ts#L446-L455 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayWebSocket.managementEndpoint | public get managementEndpoint() {
// ie. https://v1lmfez2nj.execute-api.us-east-1.amazonaws.com/$default
return this.api.apiEndpoint.apply(
(endpoint) =>
interpolate`${endpoint.replace("wss", "https")}/${this.stage.name}`,
);
} | /**
* The management endpoint for the API used by the API Gateway Management API client.
* This is useful for sending messages to connected clients.
*
* @example
* ```js
* import { Resource } from "sst";
* import { ApiGatewayManagementApiClient } from "@aws-sdk/client-apigatewaymanagementapi";
*... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigateway-websocket.ts#L471-L477 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayWebSocket.nodes | public get nodes() {
const self = this;
return {
/**
* The Amazon API Gateway V2 API.
*/
api: this.api,
/**
* The API Gateway HTTP API domain name.
*/
get domainName() {
if (!self.apigDomain)
throw new VisibleError(
`"nodes.domain... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigateway-websocket.ts#L482-L504 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayWebSocket.route | public route(
route: string,
handler: Input<string | FunctionArgs | FunctionArn>,
args: ApiGatewayWebSocketRouteArgs = {},
) {
const prefix = this.constructorName;
const suffix = logicalName(
["$connect", "$disconnect", "$default"].includes(route)
? route
: hashStringToPretty... | /**
* Add a route to the API Gateway WebSocket API.
*
* There are three predefined routes:
* - `$connect`: When the client connects to the API.
* - `$disconnect`: When the client or the server disconnects from the API.
* - `$default`: The default or catch-all route.
*
* In addition, you can crea... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigateway-websocket.ts#L560-L594 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayWebSocket.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
managementEndpoint: this.managementEndpoint,
},
include: [
permission({
actions: ["execute-api:ManageConnections"],
resources: [interpolate`${this.api.executionArn}/*/*/@connections/*`],
... | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigateway-websocket.ts#L597-L610 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1Authorizer.id | public get id() {
return this.authorizer.id;
} | /**
* The ID of the authorizer.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1-authorizer.ts#L143-L145 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1Authorizer.nodes | public get nodes() {
const self = this;
return {
/**
* The API Gateway Authorizer.
*/
authorizer: this.authorizer,
/**
* The Lambda function used by the authorizer.
*/
get function() {
if (!self.fn)
throw new VisibleError(
"Cannot... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1-authorizer.ts#L150-L168 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1IntegrationRoute.nodes | public get nodes() {
return {
/**
* The API Gateway REST API integration.
*/
integration: this.integration,
/**
* The API Gateway REST API method.
*/
method: this.method,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1-integration-route.ts#L76-L87 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1LambdaRoute.nodes | public get nodes() {
return {
/**
* The Lambda function.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda permission.
*/
permission: this.permission,
/**
* The API Gateway REST API integration.
*/
integration: this.i... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1-lambda-route.ts#L109-L128 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1.url | public get url() {
return this.apigDomain && this.apiMapping
? all([this.apigDomain.domainName, this.apiMapping.basePath]).apply(
([domain, key]) =>
key ? `https://${domain}/${key}/` : `https://${domain}`,
)
: interpolate`https://${this.api.id}.execute-api.${this.region}.am... | /**
* The URL of the API.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1.ts#L719-L726 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1.nodes | public get nodes() {
return {
/**
* The Amazon API Gateway REST API
*/
api: this.api,
/**
* The Amazon API Gateway REST API stage
*/
stage: this.stage,
/**
* The CloudWatch LogGroup for the access logs.
*/
logGroup: this.logGroup,
};
... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1.ts#L731-L746 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1.route | public route(
route: string,
handler: Input<string | FunctionArgs | FunctionArn>,
args: ApiGatewayV1RouteArgs = {},
) {
const { method, path } = this.parseRoute(route);
this.createResource(path);
const transformed = transform(
this.constructorArgs.transform?.route?.args,
this.buil... | /**
* Add a route to the API Gateway REST API. The route is a combination of an HTTP method and a path, `{METHOD} /{path}`.
*
* A method could be one of `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS`, or `ANY`. Here `ANY` matches any HTTP method.
*
* The path can be a combination of
* - Li... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1.ts#L830-L866 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1.routeIntegration | public routeIntegration(
route: string,
integration: ApiGatewayV1IntegrationArgs,
args: ApiGatewayV1RouteArgs = {},
) {
const { method, path } = this.parseRoute(route);
this.createResource(path);
const transformed = transform(
this.constructorArgs.transform?.route?.args,
this.buil... | /**
* Add a custom integration to the API Gateway REST API.
*
* Learn more about [integrations for REST APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-integration-settings.html).
*
* @param route The path for the route.
* @param integration The integration configuration.
... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1.ts#L896-L931 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1.addAuthorizer | public addAuthorizer(args: ApiGatewayV1AuthorizerArgs) {
const self = this;
const selfName = this.constructorName;
const nameSuffix = logicalName(args.name);
return new ApiGatewayV1Authorizer(
`${selfName}Authorizer${nameSuffix}`,
{
api: {
id: self.api.id,
name: ... | /**
* Add an authorizer to the API Gateway REST API.
*
* @param args Configure the authorizer.
* @example
* Add a Lambda token authorizer.
*
* ```js title="sst.config.ts"
* api.addAuthorizer({
* name: "myAuthorizer",
* tokenFunction: "src/authorizer.index"
* });
* ```
*
* A... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1.ts#L1042-L1059 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1.deploy | public deploy() {
const name = this.constructorName;
const args = this.constructorArgs;
const parent = this;
const api = this.api;
const routes = this.routes;
const endpointType = this.endpointType;
const accessLog = normalizeAccessLog();
const domain = normalizeDomain();
const corsR... | /**
* Create a deployment for the API Gateway REST API.
*
* :::note
* You need to call this after you've added all your routes.
* :::
*
* Due to the way API Gateway V1 is created internally, you'll need to call this method after
* you've added all your routes.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1.ts#L1071-L1417 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV1.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv1.ts#L1420-L1426 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2Authorizer.id | public get id() {
return this.authorizer.id;
} | /**
* The ID of the authorizer.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2-authorizer.ts#L152-L154 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2Authorizer.nodes | public get nodes() {
return {
/**
* The API Gateway V2 authorizer.
*/
authorizer: this.authorizer,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2-authorizer.ts#L159-L166 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2LambdaRoute.nodes | public get nodes() {
return {
/**
* The Lambda function.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda permission.
*/
permission: this.permission,
/**
* The API Gateway HTTP API route.
*/
route: this.apiRoute,
... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2-lambda-route.ts#L113-L132 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2PrivateRoute.nodes | public get nodes() {
return {
/**
* The API Gateway HTTP API route.
*/
route: this.apiRoute,
/**
* The API Gateway HTTP API integration.
*/
integration: this.integration,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2-private-route.ts#L85-L96 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2UrlRoute.nodes | public get nodes() {
return {
/**
* The API Gateway HTTP API route.
*/
route: this.apiRoute,
/**
* The API Gateway HTTP API integration.
*/
integration: this.integration,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2-url-route.ts#L74-L85 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2.url | public get url() {
// Note: If mapping key is set, the URL needs a trailing slash. Without the
// trailing slash, the API fails with the error {"message":"Not Found"}
return this.apigDomain && this.apiMapping
? all([this.apigDomain.domainName, this.apiMapping.apiMappingKey]).apply(
([d... | /**
* The URL of the API.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated API Gateway URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2.ts#L926-L935 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2.nodes | public get nodes() {
const self = this;
return {
/**
* The Amazon API Gateway HTTP API.
*/
api: this.api,
/**
* The API Gateway HTTP API domain name.
*/
get domainName() {
if (!self.apigDomain)
throw new VisibleError(
`"nodes.doma... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2.ts#L940-L966 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2.route | public route(
rawRoute: string,
handler: Input<string | FunctionArgs | FunctionArn>,
args: ApiGatewayV2RouteArgs = {},
) {
const route = this.parseRoute(rawRoute);
const transformed = transform(
this.constructorArgs.transform?.route?.args,
this.buildRouteId(route),
args,
{ ... | /**
* Add a route to the API Gateway HTTP API. The route is a combination of
* - An HTTP method and a path, `{METHOD} /{path}`.
* - Or a `$default` route.
*
* :::tip
* The `$default` route is a default or catch-all route. It'll match if no other route matches.
* :::
*
* A method could be one ... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2.ts#L1058-L1086 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2.routeUrl | public routeUrl(
rawRoute: string,
url: string,
args: ApiGatewayV2RouteArgs = {},
) {
const route = this.parseRoute(rawRoute);
const transformed = transform(
this.constructorArgs.transform?.route?.args,
this.buildRouteId(route),
args,
{ provider: this.constructorOpts.provid... | /**
* Add a URL route to the API Gateway HTTP API.
*
* @param rawRoute The path for the route.
* @param url The URL to forward to.
* @param args Configure the route.
*
* @example
* Add a simple route.
*
* ```js title="sst.config.ts"
* api.routeUrl("GET /", "https://google.com");
* ``... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2.ts#L1112-L1138 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2.routePrivate | public routePrivate(
rawRoute: string,
arn: string,
args: ApiGatewayV2RouteArgs = {},
) {
if (!this.vpcLink)
throw new VisibleError(
`To add private routes, you need to have a VPC link. Configure "vpc" for the "${this.constructorName}" API to create a VPC link.`,
);
const rout... | /**
* Adds a private route to the API Gateway HTTP API.
*
* To add private routes, you need to have a VPC link. Make sure to pass in a `vpc`.
* Learn more about [adding private routes](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-private.html).
*
* :::tip
... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2.ts#L1179-L1211 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2.addAuthorizer | public addAuthorizer(args: ApiGatewayV2AuthorizerArgs) {
const self = this;
const selfName = this.constructorName;
const nameSuffix = logicalName(args.name);
return new ApiGatewayV2Authorizer(
`${selfName}Authorizer${nameSuffix}`,
{
api: {
id: self.api.id,
name: ... | /**
* Add an authorizer to the API Gateway HTTP API.
*
* @param args Configure the authorizer.
* @example
* Add a Lambda authorizer.
*
* ```js title="sst.config.ts"
* api.addAuthorizer({
* name: "myAuthorizer",
* lambda: {
* function: "src/authorizer.index"
* }
* });
... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2.ts#L1311-L1328 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | ApiGatewayV2.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/apigatewayv2.ts#L1331-L1337 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSyncDataSource.name | public get name() {
return this.dataSource.name;
} | /**
* The name of the data source.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync-data-source.ts#L224-L226 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSyncDataSource.nodes | public get nodes() {
const self = this;
return {
/**
* The Amazon AppSync DataSource.
*/
dataSource: this.dataSource,
/**
* The Lambda function used by the data source.
*/
get function() {
if (!self.lambda)
throw new VisibleError(
... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync-data-source.ts#L231-L259 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSyncFunction.nodes | public get nodes() {
return {
/**
* The Amazon AppSync Function.
*/
function: this.fn,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync-function.ts#L67-L74 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSyncResolver.nodes | public get nodes() {
return {
/**
* The Amazon AppSync Resolver.
*/
resolver: this.resolver,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync-resolver.ts#L98-L105 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSync.id | public get id() {
return this.api.id;
} | /**
* The GraphQL API ID.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync.ts#L630-L632 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSync.url | public get url() {
return this.domainName
? interpolate`https://${this.domainName.domainName}/graphql`
: this.api.uris["GRAPHQL"];
} | /**
* The URL of the GraphQL API.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync.ts#L637-L641 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSync.nodes | public get nodes() {
return {
/**
* The Amazon AppSync GraphQL API.
*/
api: this.api,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync.ts#L646-L653 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSync.addDataSource | public addDataSource(args: AppSyncDataSourceArgs) {
const self = this;
const selfName = this.constructorName;
const nameSuffix = logicalName(args.name);
return new AppSyncDataSource(
`${selfName}DataSource${nameSuffix}`,
{
apiId: self.api.id,
apiComponentName: selfName,
... | /**
* Add a data source to this AppSync API.
*
* @param args Configure the data source.
*
* @example
*
* Add a Lambda function as a data source.
*
* ```js title="sst.config.ts"
* api.addDataSource({
* name: "lambdaDS",
* lambda: "src/lambda.handler"
* });
* ```
*
* Cu... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync.ts#L701-L715 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSync.addFunction | public addFunction(args: AppSyncFunctionArgs) {
const self = this;
const selfName = this.constructorName;
const nameSuffix = logicalName(args.name);
return new AppSyncFunction(
`${selfName}Function${nameSuffix}`,
{
apiId: self.api.id,
...args,
},
{ provider: this... | /**
* Add a function to this AppSync API.
*
* @param args Configure the function.
*
* @example
*
* Add a function using a Lambda data source.
*
* ```js title="sst.config.ts"
* api.addFunction({
* name: "myFunction",
* dataSource: "lambdaDS",
* });
* ```
*
* Add a func... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync.ts#L749-L762 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSync.addResolver | public addResolver(operation: string, args: AppSyncResolverArgs) {
const self = this;
const selfName = this.constructorName;
// Parse field and type
const parts = operation.trim().split(/\s+/);
if (parts.length !== 2)
throw new VisibleError(`Invalid resolver ${operation}`);
const [type, f... | /**
* Add a resolver to this AppSync API.
*
* @param operation The type and name of the operation.
* @param args Configure the resolver.
*
* @example
*
* Add a resolver using a Lambda data source.
*
* ```js title="sst.config.ts"
* api.addResolver("Query user", {
* dataSource: "lamb... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync.ts#L814-L835 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | AppSync.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/app-sync.ts#L838-L844 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Astro.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the Astro site.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/astro.ts#L616-L620 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Astro.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the site.
*... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/astro.ts#L625-L640 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Astro.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/astro.ts#L643-L649 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Auth.getSSTLink | public getSSTLink() {
return {
properties: {
publicKey: secret(this.key.publicKeyPem),
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/auth.ts#L57-L63 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | BucketLambdaSubscriber.nodes | public get nodes() {
return {
/**
* The Lambda function that'll be notified.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda permission.
*/
permission: this.permission,
/**
* The S3 bucket notification.
*/
notificat... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket-lambda-subscriber.ts#L138-L153 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | BucketQueueSubscriber.nodes | public get nodes() {
return {
/**
* The SQS Queue policy.
*/
policy: this.policy,
/**
* The S3 Bucket notification.
*/
notification: this.notification,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket-queue-subscriber.ts#L129-L140 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | BucketTopicSubscriber.nodes | public get nodes() {
return {
/**
* The SNS Topic policy.
*/
policy: this.policy,
/**
* The S3 Bucket notification.
*/
notification: this.notification,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket-topic-subscriber.ts#L128-L139 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.name | public get name() {
return this.bucket.bucket;
} | /**
* The generated name of the S3 Bucket.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L531-L533 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.domain | public get domain() {
return this.bucket.bucketDomainName;
} | /**
* The domain name of the bucket. Has the format `${bucketName}.s3.amazonaws.com`.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L538-L540 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.arn | public get arn() {
return this.bucket.arn;
} | /**
* The ARN of the S3 Bucket.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L545-L547 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.nodes | public get nodes() {
return {
/**
* The Amazon S3 bucket.
*/
bucket: this.bucket,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L552-L559 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.get | public static get(name: string, bucketName: string) {
return new Bucket(name, {
ref: true,
bucket: s3.BucketV2.get(`${name}Bucket`, bucketName),
} as BucketArgs);
} | /**
* Reference an existing bucket with the given bucket name. This is useful when you
* create a bucket in one stage and want to share it in another stage. It avoids having to
* create a new bucket in the other stage.
*
* :::tip
* You can use the `static get` method to share buckets across stages.
... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L592-L597 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.subscribe | public subscribe(
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: BucketSubscriberArgs,
) {
this.ensureNotSubscribed();
return Bucket._subscribeFunction(
this.constructorName,
this.bucket.bucket,
this.bucket.arn,
subscriber,
args,
{ provider: this.con... | /**
* Subscribe to events from this bucket.
*
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* ```js title="sst.config.ts"
* bucket.subscribe("src/subscriber.handler");
* ```
*
* Subscribe to specific S3 events. The `lin... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L646-L659 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.subscribe | public static subscribe(
bucketArn: Input<string>,
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: BucketSubscriberArgs,
) {
return output(bucketArn).apply((bucketArn) => {
const bucketName = parseBucketArn(bucketArn).bucketName;
return this._subscribeFunction(
bucke... | /**
* Subscribe to events of an S3 bucket that was not created in your app.
*
* @param bucketArn The ARN of the S3 bucket to subscribe to.
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have an existi... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L708-L723 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.subscribeQueue | public subscribeQueue(
queueArn: Input<string>,
args: BucketSubscriberArgs = {},
) {
this.ensureNotSubscribed();
return Bucket._subscribeQueue(
this.constructorName,
this.bucket.bucket,
this.arn,
queueArn,
args,
{ provider: this.constructorOpts.provider },
);
... | /**
* Subscribe to events from this bucket with an SQS Queue.
*
* @param queueArn The ARN of the queue that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have a queue.
*
* ```js title="sst.config.ts"
* const queue = sst.aws.Queue("... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L791-L804 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.subscribeQueue | public static subscribeQueue(
bucketArn: Input<string>,
queueArn: Input<string>,
args?: BucketSubscriberArgs,
) {
return output(bucketArn).apply((bucketArn) => {
const bucketName = parseBucketArn(bucketArn).bucketName;
return this._subscribeQueue(
bucketName,
bucketName,
... | /**
* Subscribe to events of an S3 bucket that was not created in your app with an SQS Queue.
*
* @param bucketArn The ARN of the S3 bucket to subscribe to.
* @param queueArn The ARN of the queue that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let'... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L845-L860 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.subscribeTopic | public subscribeTopic(
topicArn: Input<string>,
args: BucketSubscriberArgs = {},
) {
this.ensureNotSubscribed();
return Bucket._subscribeTopic(
this.constructorName,
this.bucket.bucket,
this.arn,
topicArn,
args,
{ provider: this.constructorOpts.provider },
);
... | /**
* Subscribe to events from this bucket with an SNS Topic.
*
* @param topicArn The ARN of the topic that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have a topic.
*
* ```js title="sst.config.ts"
* const topic = sst.aws.SnsTopi... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L925-L938 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.subscribeTopic | public static subscribeTopic(
bucketArn: Input<string>,
topicArn: Input<string>,
args?: BucketSubscriberArgs,
) {
return output(bucketArn).apply((bucketArn) => {
const bucketName = parseBucketArn(bucketArn).bucketName;
return this._subscribeTopic(
bucketName,
bucketName,
... | /**
* Subscribe to events of an S3 bucket that was not created in your app with an SNS Topic.
*
* @param bucketArn The ARN of the S3 bucket to subscribe to.
* @param topicArn The ARN of the topic that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let'... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L979-L994 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.getSSTLink | public getSSTLink() {
return {
properties: {
name: this.name,
},
include: [
permission({
actions: ["s3:*"],
resources: [this.arn, interpolate`${this.arn}/*`],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bucket.ts#L1061-L1073 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | BusLambdaSubscriber.nodes | public get nodes() {
return {
/**
* The Lambda function that'll be notified.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda permission.
*/
permission: this.permission,
/**
* The EventBus rule.
*/
rule: this.rule,
... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bus-lambda-subscriber.ts#L133-L152 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bus.name | public get name() {
return this.bus.name;
} | /**
* The name of the EventBus.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bus.ts#L202-L204 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bus.nodes | public get nodes() {
return {
/**
* The Amazon EventBus resource.
*/
bus: this.bus,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bus.ts#L209-L216 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bus.subscribe | public subscribe(
subscriber: Input<string | FunctionArgs | FunctionArn>,
args: BusSubscriberArgs = {},
) {
return Bus._subscribeFunction(
this.constructorName,
this.nodes.bus.name,
this.nodes.bus.arn,
subscriber,
args,
{ provider: this.constructorOpts.provider },
)... | /**
* Subscribe to this EventBus.
*
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* ```js
* bus.subscribe("src/subscriber.handler");
* ```
*
* Add a pattern to the subscription.
*
* ```js
* bus.subscribe("src/s... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bus.ts#L256-L268 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bus.subscribe | public static subscribe(
busArn: Input<string>,
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: BusSubscriberArgs,
) {
return output(busArn).apply((busArn) => {
const busName = parseEventBusArn(busArn).busName;
return this._subscribeFunction(
logicalName(busName),
... | /**
* Subscribe to an EventBus that was not created in your app.
*
* @param busArn The ARN of the EventBus to subscribe to.
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have an existing EventBus wit... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bus.ts#L310-L325 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bus.getSSTLink | public getSSTLink() {
return {
properties: {
name: this.name,
arn: this.nodes.bus.arn,
},
include: [
permission({
actions: ["events:*"],
resources: [this.nodes.bus.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/bus.ts#L360-L373 | d5c4855b2618198f5e9af315c5e67d4163df165a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.